mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 22:36:33 +00:00
ext/ffmpeg/gstffmpegdec.c: When H264 is presented without codec_data, use a parser to frame it by assuming that no co...
Original commit message from CVS: * ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_open), (gst_ffmpegdec_chain): When H264 is presented without codec_data, use a parser to frame it by assuming that no codec_data implies it is unpacketised. Always use the return value from the parser to advance the input buffer position.
This commit is contained in:
parent
38970e4d85
commit
1359d61313
2 changed files with 37 additions and 10 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2006-11-27 Jan Schmidt <thaytan@mad.scientist.com>
|
||||||
|
|
||||||
|
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_open),
|
||||||
|
(gst_ffmpegdec_chain):
|
||||||
|
When H264 is presented without codec_data, use a parser to frame it
|
||||||
|
by assuming that no codec_data implies it is unpacketised.
|
||||||
|
|
||||||
|
Always use the return value from the parser to advance the input
|
||||||
|
buffer position.
|
||||||
|
|
||||||
2006-11-17 Thomas Vander Stichele <thomas at apestaart dot org>
|
2006-11-17 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||||
|
|
||||||
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_register):
|
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_register):
|
||||||
|
|
|
@ -487,10 +487,22 @@ gst_ffmpegdec_open (GstFFMpegDec * ffmpegdec)
|
||||||
case CODEC_ID_MPEG4:
|
case CODEC_ID_MPEG4:
|
||||||
case CODEC_ID_MJPEG:
|
case CODEC_ID_MJPEG:
|
||||||
case CODEC_ID_MP3:
|
case CODEC_ID_MP3:
|
||||||
case CODEC_ID_H264:
|
|
||||||
GST_LOG_OBJECT (ffmpegdec, "not using parser, blacklisted codec");
|
GST_LOG_OBJECT (ffmpegdec, "not using parser, blacklisted codec");
|
||||||
ffmpegdec->pctx = NULL;
|
ffmpegdec->pctx = NULL;
|
||||||
break;
|
break;
|
||||||
|
case CODEC_ID_H264:
|
||||||
|
/* For H264, only use a parser if there is no context data, if there is,
|
||||||
|
* we're talking AVC */
|
||||||
|
if (ffmpegdec->context->extradata_size == 0) {
|
||||||
|
GST_LOG_OBJECT (ffmpegdec, "H264 with no extradata, creating parser");
|
||||||
|
ffmpegdec->pctx = av_parser_init (oclass->in_plugin->id);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
GST_LOG_OBJECT (ffmpegdec,
|
||||||
|
"H264 with extradata implies framed data - not using parser");
|
||||||
|
ffmpegdec->pctx = NULL;
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
GST_LOG_OBJECT (ffmpegdec, "Using parser");
|
GST_LOG_OBJECT (ffmpegdec, "Using parser");
|
||||||
ffmpegdec->pctx = av_parser_init (oclass->in_plugin->id);
|
ffmpegdec->pctx = av_parser_init (oclass->in_plugin->id);
|
||||||
|
@ -1871,17 +1883,22 @@ gst_ffmpegdec_chain (GstPad * pad, GstBuffer * inbuf)
|
||||||
GST_LOG_OBJECT (ffmpegdec,
|
GST_LOG_OBJECT (ffmpegdec,
|
||||||
"parser returned res %d and size %d", res, size);
|
"parser returned res %d and size %d", res, size);
|
||||||
|
|
||||||
/* if there is no output, we must break and wait for more data. also the
|
GST_LOG_OBJECT (ffmpegdec, "consuming %d bytes. Next ts at %d, ffpts:%"
|
||||||
* timestamp in the context is not updated. */
|
G_GINT64_FORMAT, size, left, ffmpegdec->pctx->pts);
|
||||||
if (size == 0)
|
|
||||||
break;
|
|
||||||
|
|
||||||
GST_LOG_OBJECT (ffmpegdec, "consuming %d bytes. Next ts at %d, ffpts:%"G_GINT64_FORMAT,
|
|
||||||
size, left, ffmpegdec->pctx->pts);
|
|
||||||
|
|
||||||
/* there is output, set pointers for next round. */
|
/* there is output, set pointers for next round. */
|
||||||
bsize -= size;
|
bsize -= res;
|
||||||
bdata += size;
|
bdata += res;
|
||||||
|
|
||||||
|
/* if there is no output, we must break and wait for more data. also the
|
||||||
|
* timestamp in the context is not updated. */
|
||||||
|
if (size == 0) {
|
||||||
|
if(bsize>0)
|
||||||
|
continue;
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (left <= size) {
|
if (left <= size) {
|
||||||
left = 0;
|
left = 0;
|
||||||
/* activate the pending timestamp/duration and mark it invalid */
|
/* activate the pending timestamp/duration and mark it invalid */
|
||||||
|
|
Loading…
Reference in a new issue