summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Santos <thiago.sousa.santos@collabora.co.uk>2010-03-08 15:00:05 -0300
committerThiago Santos <thiago.sousa.santos@collabora.co.uk>2010-03-11 09:55:49 -0300
commitc300a0a9f24a0e6b5714ab4bfe1d8fd8a5f8bbfb (patch)
treea30f33590c86fefd1b3263e47eb01148660ecb21
parentd0ac5265fa4ed6017325f7611269e7710f34133c (diff)
ffdec_aac: Do not parse raw format
If the stream is 'raw' format, do not use parsers. Re-enables the aac decoder by putting it back to default ffdec rank. Fixes #566250
-rw-r--r--ext/ffmpeg/gstffmpegdec.c34
1 files changed, 23 insertions, 11 deletions
diff --git a/ext/ffmpeg/gstffmpegdec.c b/ext/ffmpeg/gstffmpegdec.c
index d1a868c..9023d09 100644
--- a/ext/ffmpeg/gstffmpegdec.c
+++ b/ext/ffmpeg/gstffmpegdec.c
@@ -126,6 +126,8 @@ struct _GstFFMpegDec
gboolean has_b_frames;
/* parsing */
+ gboolean turnoff_parser; /* used for turning off aac raw parsing
+ * See bug #566250 */
AVCodecParserContext *pctx;
GstBuffer *pcache;
guint8 *padded;
@@ -647,11 +649,15 @@ gst_ffmpegdec_open (GstFFMpegDec * ffmpegdec)
ffmpegdec->is_realvideo = TRUE;
break;
default:
- ffmpegdec->pctx = av_parser_init (oclass->in_plugin->id);
- if (ffmpegdec->pctx)
- GST_LOG_OBJECT (ffmpegdec, "Using parser %p", ffmpegdec->pctx);
- else
- GST_LOG_OBJECT (ffmpegdec, "No parser for codec");
+ if (!ffmpegdec->turnoff_parser) {
+ ffmpegdec->pctx = av_parser_init (oclass->in_plugin->id);
+ if (ffmpegdec->pctx)
+ GST_LOG_OBJECT (ffmpegdec, "Using parser %p", ffmpegdec->pctx);
+ else
+ GST_LOG_OBJECT (ffmpegdec, "No parser for codec");
+ } else {
+ GST_LOG_OBJECT (ffmpegdec, "Parser deactivated for format");
+ }
break;
}
@@ -729,6 +735,9 @@ gst_ffmpegdec_setcaps (GstPad * pad, GstCaps * caps)
ffmpegdec->context->release_buffer = gst_ffmpegdec_release_buffer;
ffmpegdec->context->draw_horiz_band = NULL;
+ /* default is to let format decide if it needs a parser */
+ ffmpegdec->turnoff_parser = FALSE;
+
/* assume PTS as input, we will adapt when we detect timestamp reordering
* in the output frames. */
ffmpegdec->ts_is_dts = FALSE;
@@ -813,6 +822,15 @@ gst_ffmpegdec_setcaps (GstPad * pad, GstCaps * caps)
ffmpegdec->context->flags |= CODEC_FLAG_EMU_EDGE;
}
+ /* for AAC we only use av_parse if not on raw caps */
+ if (oclass->in_plugin->id == CODEC_ID_AAC) {
+ const gchar *format = gst_structure_get_string (structure, "stream-format");
+
+ if (format == NULL || strcmp (format, "raw") == 0) {
+ ffmpegdec->turnoff_parser = TRUE;
+ }
+ }
+
/* workaround encoder bugs */
ffmpegdec->context->workaround_bugs |= FF_BUG_AUTODETECT;
ffmpegdec->context->error_recognition = 1;
@@ -2904,12 +2922,6 @@ gst_ffmpegdec_register (GstPlugin * plugin)
note: if you change this, see the code in gstdv.c in good/ext/dv. */
rank = GST_RANK_SECONDARY;
break;
- case CODEC_ID_AAC:
- /* The ffmpeg AAC decoder isn't complete, and there's no way to figure out
- * before decoding whether it will support the given stream or not.
- * We therefore set it to NONE until it can handle the full specs. */
- rank = GST_RANK_NONE;
- break;
default:
rank = GST_RANK_MARGINAL;
break;