ext/ffmpeg/gstffmpegmux.c: ffmux_flv only accepts mpeg audio with a sample rate of 44100, 22050 or 11025. Fix up the ...

Original commit message from CVS:
* ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_register):
ffmux_flv only accepts mpeg audio with a sample rate of 44100, 22050
or 11025. Fix up the caps in the sink pad template accordingly, so
that encoding piplines at least have a chance to automatically
negotiate to one of the allowed rates.
This commit is contained in:
Tim-Philipp Müller 2007-02-09 17:30:19 +00:00
parent a23114785a
commit b0d8e2f710
2 changed files with 40 additions and 0 deletions

View file

@ -1,3 +1,11 @@
2007-02-09 Tim-Philipp Müller <tim at centricular dot net>
* ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_register):
ffmux_flv only accepts mpeg audio with a sample rate of 44100, 22050
or 11025. Fix up the caps in the sink pad template accordingly, so
that encoding piplines at least have a chance to automatically
negotiate to one of the allowed rates.
2007-02-09 Tim-Philipp Müller <tim at centricular dot net>
* ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_request_new_pad),

View file

@ -627,6 +627,31 @@ gst_ffmpegmux_get_id_caps (enum CodecID * id_list)
return caps;
}
/* set a list of integer values on the caps, e.g. for sample rates */
static void
gst_ffmpeg_mux_simple_caps_set_int_list (GstCaps * caps, const gchar * field,
guint num, const gint * values)
{
GValue list = { 0, };
GValue val = { 0, };
gint i;
g_return_if_fail (GST_CAPS_IS_SIMPLE (caps));
g_value_init (&list, GST_TYPE_LIST);
g_value_init (&val, G_TYPE_INT);
for (i = 0; i < num; ++i) {
g_value_set_int (&val, values[i]);
gst_value_list_append_value (&list, &val);
}
gst_structure_set_value (gst_caps_get_structure (caps, 0), field, &list);
g_value_unset (&val);
g_value_unset (&list);
}
gboolean
gst_ffmpegmux_register (GstPlugin * plugin)
{
@ -693,6 +718,13 @@ gst_ffmpegmux_register (GstPlugin * plugin)
goto next;
}
/* fix up allowed caps for some muxers */
if (strcmp (in_plugin->name, "flv") == 0) {
const gint rates[] = { 44100, 22050, 11025 };
gst_ffmpeg_mux_simple_caps_set_int_list (audiosinkcaps, "rate", 3, rates);
}
/* create a cache for these properties */
params = g_new0 (GstFFMpegMuxClassParams, 1);
params->in_plugin = in_plugin;