summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>2012-01-11 12:57:19 +0100
committerMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>2012-01-11 12:57:19 +0100
commit8bbefbe9cf379505bfd9de62410ed7187bb957bb (patch)
tree9cff83bd086cc386dc17c4d0a09b867d2c88b195
parent84c6fdd85efb6960a313348ae4a3ea6ebeebd54d (diff)
faac: base class audio info is not yet set during set_format
... since it will only be committed after it has been accepted by subclass. In particular, subclass should not rely on it during its setup.
-rw-r--r--ext/faac/gstfaac.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/ext/faac/gstfaac.c b/ext/faac/gstfaac.c
index 5a94bc502..ecae7da8a 100644
--- a/ext/faac/gstfaac.c
+++ b/ext/faac/gstfaac.c
@@ -122,7 +122,8 @@ static void gst_faac_set_property (GObject * object,
static void gst_faac_get_property (GObject * object,
guint prop_id, GValue * value, GParamSpec * pspec);
-static gboolean gst_faac_configure_source_pad (GstFaac * faac);
+static gboolean gst_faac_configure_source_pad (GstFaac * faac,
+ GstAudioInfo * info);
static GstCaps *gst_faac_getcaps (GstAudioEncoder * enc, GstCaps * filter);
static gboolean gst_faac_start (GstAudioEncoder * enc);
@@ -392,7 +393,7 @@ gst_faac_set_format (GstAudioEncoder * enc, GstAudioInfo * info)
faac->format = fmt;
/* finish up */
- result = gst_faac_configure_source_pad (faac);
+ result = gst_faac_configure_source_pad (faac, info);
if (!result)
goto done;
@@ -464,14 +465,12 @@ gst_faac_negotiate (GstFaac * faac)
}
static gboolean
-gst_faac_open_encoder (GstFaac * faac)
+gst_faac_open_encoder (GstFaac * faac, GstAudioInfo * info)
{
faacEncHandle *handle;
faacEncConfiguration *conf;
guint maxbitrate;
gulong samples, bytes;
- GstAudioInfo *info =
- gst_audio_encoder_get_audio_info (GST_AUDIO_ENCODER (faac));
g_return_val_if_fail (info->rate != 0 && info->channels != 0, FALSE);
@@ -546,17 +545,15 @@ setup_failed:
}
static gboolean
-gst_faac_configure_source_pad (GstFaac * faac)
+gst_faac_configure_source_pad (GstFaac * faac, GstAudioInfo * info)
{
GstCaps *srccaps;
gboolean ret;
- GstAudioInfo *info =
- gst_audio_encoder_get_audio_info (GST_AUDIO_ENCODER (faac));
/* negotiate stream format */
gst_faac_negotiate (faac);
- if (!gst_faac_open_encoder (faac))
+ if (!gst_faac_open_encoder (faac, info))
goto set_failed;
/* now create a caps for it all */
@@ -689,7 +686,7 @@ gst_faac_handle_frame (GstAudioEncoder * enc, GstBuffer * in_buf)
if (!in_buf) {
GST_DEBUG_OBJECT (faac, "flushed; recreating encoder");
gst_faac_close_encoder (faac);
- if (!gst_faac_open_encoder (faac))
+ if (!gst_faac_open_encoder (faac, gst_audio_encoder_get_audio_info (enc)))
ret = GST_FLOW_ERROR;
}
}