diff options
author | Christian Pointner <equinox@spreadspace.org> | 2014-09-04 02:20:34 +0200 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2014-09-04 02:20:34 +0200 |
commit | 72aad834774598a50cbaf4bedc22e8101b02cef5 (patch) | |
tree | 081d07f3e41a757e2aaa15bb388196a9181b5ead /src/options.c | |
parent | removed useless sysexec (diff) |
added send stream pipeline with options
Diffstat (limited to 'src/options.c')
-rw-r--r-- | src/options.c | 102 |
1 files changed, 84 insertions, 18 deletions
diff --git a/src/options.c b/src/options.c index afe9a37..260438b 100644 --- a/src/options.c +++ b/src/options.c @@ -199,12 +199,25 @@ int options_parse(options_t* opt, int argc, char* argv[]) PARSE_STRING_LIST("-L","--log", opt->log_targets_) PARSE_BOOL_PARAM("-U", "--debug", opt->debug_) PARSE_STRING_PARAM("-n","--appname", opt->appname_) - PARSE_STRING_PARAM("-R","--rec-dir", opt->rec_dir_) + PARSE_STRING_PARAM("-vs","--video-source", opt->video_src_) + PARSE_STRING_PARAM("-ve","--video-encoder", opt->video_enc_) + PARSE_STRING_PARAM("-vp","--video-payloader", opt->video_payloader_) + PARSE_STRING_PARAM("-V","--videosink", opt->videosink_) + PARSE_STRING_PARAM("-as","--audio-source", opt->audio_src_) + PARSE_STRING_PARAM("-ae","--audio-encoder-stream", opt->audio_enc_stream_) + PARSE_STRING_PARAM("-ap","--audio-payloader", opt->audio_payloader_) + PARSE_STRING_PARAM("-o","--rtp-host", opt->rtp_host_) + PARSE_INT_PARAM("-O","--rtp-port-base", opt->rtp_port_base_, 10) + PARSE_STRING_PARAM("-ar","--audio-encoder-rec", opt->audio_enc_rec_) + PARSE_STRING_PARAM("-m","--rec-mux", opt->rec_mux_) PARSE_STRING_PARAM("-r","--rec-name-format", opt->rec_name_format_) else return i; } + if(opt->rtp_port_base_ < 1 || opt->rtp_port_base_ > 65535) + return -4; + if(opt->debug_) { string_list_add(&opt->log_targets_, "stdout:5"); opt->daemonize_ = 0; @@ -239,8 +252,23 @@ void options_default(options_t* opt) string_list_init(&opt->log_targets_); opt->debug_ = 0; opt->appname_ = NULL; - opt->rec_dir_ = strdup("./recordings/"); - opt->rec_name_format_ = strdup("%Y-%m-%d_%H-%M-$S"); + + opt->video_src_ = strdup("v4l2src ! videoconvert ! videoscale ! video/x-raw,format=I420,width=864,height=480,framerate=25/1,pixel-aspect-ratio=1/1"); + opt->video_enc_ = strdup("vp8enc keyframe-max-dist=25 error-resilient=2 end-usage=1 target-bitrate=1800000 cpu-used=4 deadline=1000000 threads=2"); + opt->video_payloader_ = strdup("rtpvp8pay"); + opt->videosink_ = strdup("xvimagesink"); + + opt->audio_src_ = strdup("autoaudiosrc ! audio/x-raw,format=S16LE,channels=1,rate=48000"); + opt->audio_enc_stream_ = strdup("opusenc bitrate=64000 cbr=true packet-loss-percentage=0 inband-fec=false"); + opt->audio_payloader_ = strdup("rtpopuspay"); + + opt->rtp_host_ = strdup("127.0.0.1"); + opt->rtp_port_base_ = 5100; + + opt->audio_enc_rec_ = strdup("audioconvert ! vorbisenc bitrate=96000"); + opt->rec_mux_ = strdup("matroskamux"); + + opt->rec_name_format_ = strdup("./recordings/%Y-%m-%d_%H-%M-%S.mkv"); } void options_clear(options_t* opt) @@ -261,8 +289,26 @@ void options_clear(options_t* opt) string_list_clear(&opt->log_targets_); if(opt->appname_) free(opt->appname_); - if(opt->rec_dir_) - free(opt->rec_dir_); + if(opt->video_src_) + free(opt->video_src_); + if(opt->video_enc_) + free(opt->video_enc_); + if(opt->video_payloader_) + free(opt->video_payloader_); + if(opt->videosink_) + free(opt->videosink_); + if(opt->audio_src_) + free(opt->audio_src_); + if(opt->audio_enc_stream_) + free(opt->audio_enc_stream_); + if(opt->audio_payloader_) + free(opt->audio_payloader_); + if(opt->rtp_host_) + free(opt->rtp_host_); + if(opt->audio_enc_rec_) + free(opt->audio_enc_rec_); + if(opt->rec_mux_) + free(opt->rec_mux_); if(opt->rec_name_format_) free(opt->rec_name_format_); } @@ -281,7 +327,17 @@ void options_print_usage() printf(" add a log target, can be invoked several times\n"); printf(" [-U|--debug] don't daemonize and log to stdout with maximum log level\n"); printf(" [-n|--appname] <name> set the application name (will be used by xvimagesink for window title\n"); - printf(" [-R|--rec-dir] <path> path to the recording directory\n"); + printf(" [-vs|--video-source pipeline for raw video (i.e. videotestsrc)\n"); + printf(" [-ve|--video-encoder pipeline for video encoder (stream and recording)\n"); + printf(" [-vp|--video-payloader video payloader element (i.e. rtpvp8pay\n"); + printf(" [-V|--videosink video sink element (i.e. xvimagesink\n"); + printf(" [-as|--audio-source pipeline for raw audio (audiotestsrc)\n"); + printf(" [-ae|--audio-encoder-stream pipeline for audio encoder (stream only)\n"); + printf(" [-ap|--audio-payloader audio payloader element (i.e. rptopuspay)\n"); + printf(" [-o|--rtp-host remote host for RTP packets\n"); + printf(" [-O|--rtp-port-base base number for remote ports\n"); + printf(" [-ar|--audio-encoder-rec pipeline for audio encoder (recording only)\n"); + printf(" [-m|--rec-mux muxer elemenent (i.e. matroskamux)\n"); printf(" [-r|--rec-name-format] <format> the recording file name format, see manpage of strftime for the syntax\n"); } @@ -296,16 +352,26 @@ void options_print(options_t* opt) if(!opt) return; - printf("progname: '%s'\n", opt->progname_); - printf("daemonize: %d\n", opt->daemonize_); - printf("username: '%s'\n", opt->username_); - printf("groupname: '%s'\n", opt->groupname_); - printf("chroot_dir: '%s'\n", opt->chroot_dir_); - printf("pid_file: '%s'\n", opt->pid_file_); - printf("log_targets: \n"); - string_list_print(&opt->log_targets_, " '", "'\n"); - printf("debug: %s\n", !opt->debug_ ? "false" : "true"); - printf("appname: >>%s<<\n", opt->appname_); - printf("rec_output_dir: '%s'\n", opt->rec_dir_); - printf("rec_name_format: '%s'\n", opt->rec_name_format_); + printf(" progname: '%s'\n", opt->progname_); + printf(" daemonize: %d\n", opt->daemonize_); + printf(" username: '%s'\n", opt->username_); + printf(" groupname: '%s'\n", opt->groupname_); + printf(" chroot_dir: '%s'\n", opt->chroot_dir_); + printf(" pid_file: '%s'\n", opt->pid_file_); + printf(" log_targets: \n"); + string_list_print(&opt->log_targets_, " '", "'\n"); + printf(" debug: %s\n", !opt->debug_ ? "false" : "true"); + printf(" appname: >>%s<<\n", opt->appname_); + printf(" video_src: >>%s<<\n", opt->video_src_); + printf(" video_enc: >>%s<<\n", opt->video_enc_); + printf(" video_payloader: >>%s<<\n", opt->video_payloader_); + printf(" video_sink: >>%s<<\n", opt->videosink_); + printf(" audio_src: >>%s<<\n", opt->audio_src_); + printf(" audio_enc_stream: >>%s<<\n", opt->audio_enc_stream_); + printf(" audio_payloader: >>%s<<\n", opt->audio_payloader_); + printf(" rtp_host: >>%s<<\n", opt->rtp_host_); + printf(" rtp_port_base: %d\n", opt->rtp_port_base_); + printf(" audio_enc_rec: >>%s<<\n", opt->audio_enc_rec_); + printf(" rec_mux: >>%s<<\n", opt->rec_mux_); + printf(" rec_name_format: '%s'\n", opt->rec_name_format_); } |