From: Edward Hervey Date: Fri, 27 Feb 2009 08:40:03 +0000 (+0100) Subject: ffmpegmux: Use information from AVOutputFormat to expose more muxers. X-Git-Tag: RELEASE-0_10_7~39 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=269698f02089d1ea3bfe4740256526e48be08574;p=platform%2Fupstream%2Fgst-libav.git ffmpegmux: Use information from AVOutputFormat to expose more muxers. AVOutputFormat does *NOT* contain the full list of codecs a muxer can handle, but does contain the recommended audio and video codecs. Therefore we use that information to expose more muxers, until AVOutputFormat contains a list of *ALL* compatible codecs. --- diff --git a/ext/ffmpeg/gstffmpegcodecmap.c b/ext/ffmpeg/gstffmpegcodecmap.c index 233702b..49c5209 100644 --- a/ext/ffmpeg/gstffmpegcodecmap.c +++ b/ext/ffmpeg/gstffmpegcodecmap.c @@ -2344,8 +2344,17 @@ gst_ffmpeg_formatid_to_caps (const gchar * format_name) gboolean gst_ffmpeg_formatid_get_codecids (const gchar * format_name, - enum CodecID ** video_codec_list, enum CodecID ** audio_codec_list) + enum CodecID ** video_codec_list, enum CodecID ** audio_codec_list, + AVOutputFormat * plugin) { + static enum CodecID tmp_vlist[] = { + CODEC_ID_NONE, + CODEC_ID_NONE + }; + static enum CodecID tmp_alist[] = { + CODEC_ID_NONE, + CODEC_ID_NONE + }; GST_LOG ("format_name : %s", format_name); @@ -2471,6 +2480,13 @@ gst_ffmpeg_formatid_get_codecids (const gchar * format_name, }; *video_codec_list = gif_image_list; *audio_codec_list = NULL; + } else if ((plugin->audio_codec != CODEC_ID_NONE) || + (plugin->video_codec != CODEC_ID_NONE)) { + tmp_vlist[0] = plugin->video_codec; + tmp_alist[0] = plugin->audio_codec; + + *video_codec_list = tmp_vlist; + *audio_codec_list = tmp_alist; } else { GST_LOG ("Format %s not found", format_name); return FALSE; diff --git a/ext/ffmpeg/gstffmpegcodecmap.h b/ext/ffmpeg/gstffmpegcodecmap.h index f72c6fa..940c6d5 100644 --- a/ext/ffmpeg/gstffmpegcodecmap.h +++ b/ext/ffmpeg/gstffmpegcodecmap.h @@ -110,7 +110,8 @@ gst_ffmpeg_formatid_to_caps (const gchar *format_name); gboolean gst_ffmpeg_formatid_get_codecids (const gchar *format_name, enum CodecID ** video_codec_list, - enum CodecID ** audio_codec_list); + enum CodecID ** audio_codec_list, + AVOutputFormat * plugin); /* * Since FFMpeg has such really cool and useful descriptions diff --git a/ext/ffmpeg/gstffmpegmux.c b/ext/ffmpeg/gstffmpegmux.c index b49507f..f68288c 100644 --- a/ext/ffmpeg/gstffmpegmux.c +++ b/ext/ffmpeg/gstffmpegmux.c @@ -703,6 +703,27 @@ gst_ffmpegmux_register (GstPlugin * plugin) GstCaps *srccaps, *audiosinkcaps, *videosinkcaps; enum CodecID *video_ids = NULL, *audio_ids = NULL; + if ((!strncmp (in_plugin->name, "u16", 3)) || + (!strncmp (in_plugin->name, "s16", 3)) || + (!strncmp (in_plugin->name, "u24", 3)) || + (!strncmp (in_plugin->name, "s24", 3)) || + (!strncmp (in_plugin->name, "u8", 2)) || + (!strncmp (in_plugin->name, "s8", 2)) || + (!strncmp (in_plugin->name, "u32", 3)) || + (!strncmp (in_plugin->name, "s32", 3)) || + (!strncmp (in_plugin->name, "f32", 3)) || + (!strncmp (in_plugin->name, "f64", 3)) || + (!strncmp (in_plugin->name, "raw", 3)) || + (!strncmp (in_plugin->name, "crc", 3)) || + (!strncmp (in_plugin->name, "null", 4)) || + (!strncmp (in_plugin->name, "gif", 3)) || + (!strncmp (in_plugin->name, "frame", 5)) || + (!strncmp (in_plugin->name, "image", 5)) + ) { + GST_LOG ("Ignoring muxer %s", in_plugin->name); + goto next; + } + /* Try to find the caps that belongs here */ srccaps = gst_ffmpeg_formatid_to_caps (in_plugin->name); if (!srccaps) { @@ -710,7 +731,7 @@ gst_ffmpegmux_register (GstPlugin * plugin) goto next; } if (!gst_ffmpeg_formatid_get_codecids (in_plugin->name, - &video_ids, &audio_ids)) { + &video_ids, &audio_ids, in_plugin)) { gst_caps_unref (srccaps); GST_WARNING ("Couldn't get sink caps for muxer %s. Most likely because no input format mapping exists.",