diff options
author | Christian Pointner <equinox@spreadspace.org> | 2014-09-27 20:13:56 +0200 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2014-09-27 20:13:56 +0200 |
commit | e7ca89be606fc88c740d48b6cbdeff520a8d9ece (patch) | |
tree | d76566dfff7eeaa6169b881a38a7ab8988a51373 /src/options.c | |
parent | idx vs. session (diff) |
creating udp sources works now
Diffstat (limited to 'src/options.c')
-rw-r--r-- | src/options.c | 79 |
1 files changed, 67 insertions, 12 deletions
diff --git a/src/options.c b/src/options.c index 48a0f20..532039b 100644 --- a/src/options.c +++ b/src/options.c @@ -64,10 +64,18 @@ static void options_defaults(options_t* opt) opt->video_src_ = g_strdup("v4l2src ! videoconvert ! videoscale ! video/x-raw,format=I420,width=864,height=480,framerate=25/1,pixel-aspect-ratio=1/1 ! identity"); opt->video_enc_ = g_strdup("vp8enc keyframe-max-dist=25 error-resilient=2 end-usage=1 target-bitrate=1200000 cpu-used=4 deadline=1000000 threads=2"); opt->video_payloader_ = g_strdup("rtpvp8pay"); + opt->video_caps_ = g_strdup("application/x-rtp,media=video,clock-rate=90000,encoding-name=VP8-DRAFT-IETF-01,caps=\"video/x-vp8\""); + opt->video_depayloader_ = g_strdup("rtpvp8depay"); + opt->video_dec_ = g_strdup("vp8dec"); + opt->video_sink_ = g_strdup("videoconvert ! videoscale add-borders=true ! xvimagesink"); opt->audio_src_ = g_strdup("autoaudiosrc ! audio/x-raw,format=S16LE,channels=1,rate=48000 ! identity"); opt->audio_enc_ = g_strdup("opusenc bitrate=64000 cbr=true packet-loss-percentage=0 inband-fec=false"); opt->audio_payloader_ = g_strdup("rtpopuspay"); + opt->audio_caps_ = g_strdup("application/x-rtp,media=audio,clock-rate=48000,payload=96,encoding-name=X-GST-OPUS-DRAFT-SPITTKA-00,caps=\"audio/x-opus\""); + opt->audio_depayloader_ = g_strdup("rtpopusdepay"); + opt->audio_dec_ = g_strdup("opusdec"); + opt->audio_sink_ = g_strdup("audioconvert ! autoaudiosink"); opt->rtp_host_ = NULL; opt->rtp_port_base_ = 5000; @@ -93,15 +101,17 @@ static GQuark options_error_quark() return quark; } -static GOptionGroup* options_get_av_group(options_t* opt) +static GOptionGroup* options_get_avsend_group(options_t* opt) { - GOptionEntry av_entries[] = { + GOptionEntry avsend_entries[] = { { "video-source", 0, 0, G_OPTION_ARG_STRING, &opt->video_src_, "pipeline for raw video (i.e. videotestsrc)", "BIN DESCRIPTION" }, { "video-encoder", 0, 0, G_OPTION_ARG_STRING, &opt->video_enc_, "pipeline for video encoder (i.e. videoconvert ! vp8enc)", "BIN DESCRIPTION" }, { "video-payloader", 0, 0, G_OPTION_ARG_STRING, &opt->video_payloader_, "video RTP payloader element (i.e. rtpvp8pay)", "ELEMENT" }, + { "previewsink", 0, 0, G_OPTION_ARG_STRING, &opt->preview_videosink_, + "video sink element for local preview (i.e. textoverlay text=\" preview \" ! xvimagesink) - leave empty to disable preview", "BIN DESCRIPTION" }, { "audio-source", 0, 0, G_OPTION_ARG_STRING, &opt->audio_src_, "pipeline for raw audio (i.e. audiotestsrc)", "BIN DESCRIPTION" }, { "audio-encoder", 0, 0, G_OPTION_ARG_STRING, &opt->audio_enc_, @@ -110,12 +120,41 @@ static GOptionGroup* options_get_av_group(options_t* opt) "audio RTP payloader element (i.e. rtpopuspay)", "ELEMENT" }, { NULL } }; - GOptionGroup* av_group = g_option_group_new ("av", "Audio/Video Options", - "Show Audio/Video Options", opt, NULL); - if(!av_group) return NULL; - g_option_group_add_entries(av_group, av_entries); + GOptionGroup* avsend_group = g_option_group_new ("avsend", "Audio/Video Sender Options", + "Show Audio/Video Sender Options", opt, NULL); + if(!avsend_group) return NULL; + g_option_group_add_entries(avsend_group, avsend_entries); + + return avsend_group; +} + +static GOptionGroup* options_get_avrecv_group(options_t* opt) +{ + GOptionEntry avrecv_entries[] = { + { "video-caps", 0, 0, G_OPTION_ARG_STRING, &opt->video_caps_, + "Caps for incoming Video RTP packets", "CAPS" }, + { "video-depayloader", 0, 0, G_OPTION_ARG_STRING, &opt->video_depayloader_, + "video RTP depayloader element (i.e. rtpvp8depay)", "ELEMENT" }, + { "video-decoder", 0, 0, G_OPTION_ARG_STRING, &opt->video_dec_, + "pipeline for video decoder (i.e. vp8dec)", "BIN DESCRIPTION" }, + { "video-sink", 0, 0, G_OPTION_ARG_STRING, &opt->video_sink_, + "video sink element (i.e. videoconvert ! xvimagesink)", "BIN DESCRIPTION" }, + { "audio-caps", 0, 0, G_OPTION_ARG_STRING, &opt->audio_caps_, + "Caps for incoming Audio RTP packets", "CAPS" }, + { "audio-depayloader", 0, 0, G_OPTION_ARG_STRING, &opt->audio_depayloader_, + "audio RTP depayloader element (i.e. rtpopusdepay)", "ELEMENT" }, + { "audio-decoder", 0, 0, G_OPTION_ARG_STRING, &opt->audio_dec_, + "pipeline for audio decoder (i.e. opusdnc)", "BIN DESCRIPTION" }, + { "audio-sink", 0, 0, G_OPTION_ARG_STRING, &opt->audio_sink_, + "audio sink element (i.e. audioconvert ! autoaudiosink)", "BIN DESCRIPTION" }, + { NULL } + }; + GOptionGroup* avrecv_group = g_option_group_new ("avrecv", "Audio/Video Receiver Options", + "Show Audio/Video Receiver Options", opt, NULL); + if(!avrecv_group) return NULL; + g_option_group_add_entries(avrecv_group, avrecv_entries); - return av_group; + return avrecv_group; } static GOptionGroup* options_get_rtp_group(options_t* opt) @@ -216,8 +255,6 @@ int options_parse(options_t* opt, int argc, char* argv[]) "set the application name (will be used by xvimagesink for window title)", "NAME" }, { "mode", 'm', 0, G_OPTION_ARG_CALLBACK, options_parse_mode, "the main operation mode", "(sender|receiver)" }, - { "videosink", 'V', 0, G_OPTION_ARG_STRING, &opt->preview_videosink_, - "video sink element for local preview (i.e. textoverlay text=\" preview \" ! xvimagesink) - leave empty to disable preview", "BIN DESCRIPTION" }, { NULL } }; GOptionContext *ctx = g_option_context_new("- spreadspace streaming hydra "); @@ -226,16 +263,18 @@ int options_parse(options_t* opt, int argc, char* argv[]) if(main_group) g_option_group_add_entries(main_group, main_entries); - GOptionGroup* av_group = options_get_av_group(opt); + GOptionGroup* avsend_group = options_get_avsend_group(opt); + GOptionGroup* avrecv_group = options_get_avrecv_group(opt); GOptionGroup* rtp_group = options_get_rtp_group(opt); GOptionGroup* rec_group = options_get_rec_group(opt); GOptionGroup* gst_group = gst_init_get_option_group(); - if(!main_group || !av_group || !rtp_group || !rec_group || !gst_group) { + if(!main_group || !avsend_group || !avrecv_group || !rtp_group || !rec_group || !gst_group) { printf("Failed to initialize: memory error\n"); return -127; } g_option_context_set_main_group(ctx, main_group); - g_option_context_add_group(ctx, av_group); + g_option_context_add_group(ctx, avsend_group); + g_option_context_add_group(ctx, avrecv_group); g_option_context_add_group(ctx, rtp_group); g_option_context_add_group(ctx, rec_group); g_option_context_add_group(ctx, gst_group); @@ -306,9 +345,17 @@ void options_clear(options_t* opt) g_free(opt->video_src_); g_free(opt->video_enc_); g_free(opt->video_payloader_); + g_free(opt->video_caps_); + g_free(opt->video_depayloader_); + g_free(opt->video_dec_); + g_free(opt->video_sink_); g_free(opt->audio_src_); g_free(opt->audio_enc_); g_free(opt->audio_payloader_); + g_free(opt->audio_caps_); + g_free(opt->audio_depayloader_); + g_free(opt->audio_dec_); + g_free(opt->audio_sink_); g_free(opt->rtp_host_); g_free(opt->rtp_addr_local_); g_free(opt->preview_videosink_); @@ -363,9 +410,17 @@ void options_print(options_t* opt) 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_caps: >>%s<<\n", opt->video_caps_); + printf(" video_depayloader: >>%s<<\n", opt->video_depayloader_); + printf(" video_dec: >>%s<<\n", opt->video_dec_); + printf(" video_sink: >>%s<<\n", opt->video_sink_); printf(" audio_src: >>%s<<\n", opt->audio_src_); printf(" audio_enc: >>%s<<\n", opt->audio_enc_); printf(" audio_payloader: >>%s<<\n", opt->audio_payloader_); + printf(" audio_caps: >>%s<<\n", opt->audio_caps_); + printf(" audio_depayloader: >>%s<<\n", opt->audio_depayloader_); + printf(" audio_dec: >>%s<<\n", opt->audio_dec_); + printf(" audio_sink: >>%s<<\n", opt->audio_sink_); printf(" rtp_host: >>%s<<\n", opt->rtp_host_); printf(" rtp_port_base: %d\n", opt->rtp_port_base_); printf(" rtp_addr_local: >>%s<<\n", opt->rtp_addr_local_); |