summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.net>2007-02-09 17:30:19 +0000
committerTim-Philipp Müller <tim@centricular.net>2007-02-09 17:30:19 +0000
commitb0d8e2f710d6e47872600e6cec1f682597b76acb (patch)
tree2851b64f36312696e8773cdac4b1912066f09442
parenta23114785a5f36cf1c8966963051bc4e0a31ee79 (diff)
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.
-rw-r--r--ChangeLog8
-rw-r--r--ext/ffmpeg/gstffmpegmux.c32
2 files changed, 40 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index f3b5894..39c2133 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
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),
(gst_ffmpegmux_setcaps), (gst_ffmpegmux_collected):
Only set the mux->opened flag after we've successfully written the
diff --git a/ext/ffmpeg/gstffmpegmux.c b/ext/ffmpeg/gstffmpegmux.c
index 5eb7d21..7f6ea26 100644
--- a/ext/ffmpeg/gstffmpegmux.c
+++ b/ext/ffmpeg/gstffmpegmux.c
@@ -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;