*/
#include <unistd.h>
#include <stdlib.h>
+#include <signal.h>
+#include <pthread.h>
#include <libavformat/avformat.h>
#include <libavdevice/avdevice.h>
#include <ul_logreg.h>
#endif
-#ifdef CONFIG_STREAMER_WITH_FRSH
+#ifdef CONFIG_FFMPEG_WITH_FRSH
#include <frsh.h>
-#endif
+/*temporrary solution to pass network parameters */
extern long int udp_budget, udp_period;
+#endif /*CONFIG_STREAMER_WITH_FRSH*/
static const char *sdp_file = "sdp.txt";
static const char *vdev = "/dev/video0";
printf(" -r <path> video device [%s]\n", vdev);
printf(" -m <addr> destination IP address\n");
printf(" -i <string> input video device format [%s]\n", impform);
+ #ifdef CONFIG_STREAMER_WITH_FRSH
+ printf(" -b <number> network budget\n");
+ printf(" -p <number> network period for given budget\n");
+ #endif /*CONFIG_STREAMER_WITH_FRSH*/
#ifdef CONFIG_OC_ULUT
printf(" -l <number>|<domain>=<number>,...\n");
#endif /*CONFIG_OC_ULUT*/
{
int v;
- while ((v = getopt(argc, argv, "w:h:r:d:m:i:l:")) >= 0) {
+ while ((v = getopt(argc, argv, "w:h:r:d:m:i:l:b:p:")) >= 0) {
switch (v) {
case 'w':
width = atoi(optarg);
else if(!strcmp(impform, "v4l2"))
impform = "video4linux2";
break;
+ #ifdef CONFIG_STREAMER_WITH_FRSH
+ case 'b':
+ udp_budget = atol(optarg);
+ break;
+ case 'p':
+ udp_period = atol(optarg);
+ break;
+ #endif /*CONFIG_STREAMER_WITH_FRSH*/
+
#ifdef CONFIG_OC_ULUT
case 'l':
ul_log_domain_arg2levels(optarg);
opkt = pkt_encode(os, f);
if (opkt) {
pkt_send(os, opkt);
+ printf("opkt size: %d\n", opkt->size);
}
}
//rt_job_end();
block_signals();
-#ifdef CONFIG_STREAMER_WITH_FRSH
+#ifdef CONFIG_FFMPEG_WITH_FRSH
ret = frsh_init();
if (ret) PERROR_AND_EXIT(ret, "frsh_init1");
-#endif /*CONFIG_STREAMER_WITH_FRSH*/
-
- /* fill contract params */
+
+ /* fill default network contract params */
udp_budget = 50000;
udp_period = 500;
-
+#endif /*CONFIG_FFMPEG_WITH_FRSH*/
+
avcodec_register_all();
av_register_all();
avdevice_register_all();
os->streams[0]->codec->width = s->streams[0]->codec->width;
os->streams[0]->codec->height = s->streams[0]->codec->height;
os->streams[0]->codec->time_base = s->streams[0]->codec->time_base;
+ os->streams[0]->codec->bit_rate = 300000;
codec_connect(s->streams[0]->codec, os->streams[0]->codec);
out_codec_open(os);
dump_format(os, 0, os->filename, 1);
sdp_print(os, sdp_file);
-#ifdef CONFIG_AQUOSA
+#if CONFIG_STREAMER_WITH_FRSH && CONFIG_AQUOSA
frsh_thread_attr_t frsh_attr;
frsh_thread_id_t thread;
frsh_vres_id_t cpu_vres;
printf("Finishing\n");
+ close_output_stream(os);
#else
pthread_attr_t attr;
pthread_t streamer_th;
pthread_join(streamer_th, (void**) NULL);
printf("Finishing\n");
+
+ close_output_stream(os);
#endif
return 0;