mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 14:56:36 +00:00
ext/ffmpeg/gstffmpegdec.c: Reduce the rank of the mpeg2 decoder back below mpeg2dec
Original commit message from CVS: * ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_frame), (gst_ffmpegdec_chain), (gst_ffmpegdec_register): Reduce the rank of the mpeg2 decoder back below mpeg2dec Use the parser to reorder pts times. Fixes mpeg playback without changing any other files I tested. Use the repeat_pict flag to correctly set durations
This commit is contained in:
parent
1b6e6aee2d
commit
363794a122
2 changed files with 31 additions and 4 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2005-02-04 Jan Schmidt <thaytan@mad.scientist.com>
|
||||||
|
|
||||||
|
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_frame),
|
||||||
|
(gst_ffmpegdec_chain), (gst_ffmpegdec_register):
|
||||||
|
Reduce the rank of the mpeg2 decoder back below mpeg2dec
|
||||||
|
Use the parser to reorder pts times. Fixes mpeg playback
|
||||||
|
without changing any other files I tested.
|
||||||
|
Use the repeat_pict flag to correctly set durations
|
||||||
|
|
||||||
2005-02-02 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
|
2005-02-02 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
|
||||||
|
|
||||||
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_codecid_to_caps),
|
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_codecid_to_caps),
|
||||||
|
|
|
@ -665,12 +665,18 @@ gst_ffmpegdec_frame (GstFFMpegDec * ffmpegdec,
|
||||||
GST_CLOCK_TIME_IS_VALID (*in_ts)) {
|
GST_CLOCK_TIME_IS_VALID (*in_ts)) {
|
||||||
ffmpegdec->next_ts = *in_ts;
|
ffmpegdec->next_ts = *in_ts;
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_BUFFER_TIMESTAMP (outbuf) = ffmpegdec->next_ts;
|
GST_BUFFER_TIMESTAMP (outbuf) = ffmpegdec->next_ts;
|
||||||
if (ffmpegdec->context->frame_rate_base != 0 &&
|
if (ffmpegdec->context->frame_rate_base != 0 &&
|
||||||
ffmpegdec->context->frame_rate != 0) {
|
ffmpegdec->context->frame_rate != 0) {
|
||||||
GST_BUFFER_DURATION (outbuf) = GST_SECOND *
|
GST_BUFFER_DURATION (outbuf) = GST_SECOND *
|
||||||
ffmpegdec->context->frame_rate_base /
|
ffmpegdec->context->frame_rate_base /
|
||||||
ffmpegdec->context->frame_rate;
|
ffmpegdec->context->frame_rate;
|
||||||
|
|
||||||
|
/* Take repeat_pict into account */
|
||||||
|
GST_BUFFER_DURATION (outbuf) += GST_BUFFER_DURATION (outbuf)
|
||||||
|
* ffmpegdec->picture->repeat_pict / 2;
|
||||||
|
|
||||||
ffmpegdec->next_ts += GST_BUFFER_DURATION (outbuf);
|
ffmpegdec->next_ts += GST_BUFFER_DURATION (outbuf);
|
||||||
} else {
|
} else {
|
||||||
ffmpegdec->next_ts = GST_CLOCK_TIME_NONE;
|
ffmpegdec->next_ts = GST_CLOCK_TIME_NONE;
|
||||||
|
@ -682,11 +688,17 @@ gst_ffmpegdec_frame (GstFFMpegDec * ffmpegdec,
|
||||||
GST_CLOCK_TIME_IS_VALID (*in_ts)) {
|
GST_CLOCK_TIME_IS_VALID (*in_ts)) {
|
||||||
ffmpegdec->next_ts = *in_ts;
|
ffmpegdec->next_ts = *in_ts;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ffmpegdec->context->frame_rate_base != 0 &&
|
if (ffmpegdec->context->frame_rate_base != 0 &&
|
||||||
ffmpegdec->context->frame_rate != 0) {
|
ffmpegdec->context->frame_rate != 0) {
|
||||||
ffmpegdec->next_ts += GST_SECOND *
|
guint64 dur = GST_SECOND *
|
||||||
ffmpegdec->context->frame_rate_base /
|
ffmpegdec->context->frame_rate_base /
|
||||||
ffmpegdec->context->frame_rate;
|
ffmpegdec->context->frame_rate;
|
||||||
|
|
||||||
|
/* Take repeat_pict into account */
|
||||||
|
dur += dur * ffmpegdec->picture->repeat_pict / 2;
|
||||||
|
|
||||||
|
ffmpegdec->next_ts += dur;
|
||||||
} else {
|
} else {
|
||||||
ffmpegdec->next_ts = GST_CLOCK_TIME_NONE;
|
ffmpegdec->next_ts = GST_CLOCK_TIME_NONE;
|
||||||
}
|
}
|
||||||
|
@ -866,14 +878,21 @@ gst_ffmpegdec_chain (GstPad * pad, GstData * _data)
|
||||||
/* parse, if at all possible */
|
/* parse, if at all possible */
|
||||||
if (ffmpegdec->pctx) {
|
if (ffmpegdec->pctx) {
|
||||||
gint res;
|
gint res;
|
||||||
|
gint64 ffpts = AV_NOPTS_VALUE;
|
||||||
|
|
||||||
|
if (GST_CLOCK_TIME_IS_VALID (in_ts))
|
||||||
|
ffpts = in_ts / (GST_SECOND / AV_TIME_BASE);
|
||||||
|
|
||||||
res = av_parser_parse (ffmpegdec->pctx, ffmpegdec->context,
|
res = av_parser_parse (ffmpegdec->pctx, ffmpegdec->context,
|
||||||
&data, &size, bdata, bsize,
|
&data, &size, bdata, bsize,
|
||||||
in_ts / (GST_SECOND / AV_TIME_BASE),
|
ffpts, ffpts);
|
||||||
in_ts / (GST_SECOND / AV_TIME_BASE));
|
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (ffmpegdec, "Parsed video frame, res=%d, size=%d",
|
GST_DEBUG_OBJECT (ffmpegdec, "Parsed video frame, res=%d, size=%d",
|
||||||
res, size);
|
res, size);
|
||||||
|
|
||||||
|
if (ffmpegdec->pctx->pts != AV_NOPTS_VALUE)
|
||||||
|
in_ts = ffmpegdec->pctx->pts * (GST_SECOND / AV_TIME_BASE);
|
||||||
|
|
||||||
if (res == 0 || size == 0)
|
if (res == 0 || size == 0)
|
||||||
break;
|
break;
|
||||||
else {
|
else {
|
||||||
|
@ -1050,7 +1069,6 @@ gst_ffmpegdec_register (GstPlugin * plugin)
|
||||||
* and use rank=none for H263I for now, until I know what the diff
|
* and use rank=none for H263I for now, until I know what the diff
|
||||||
* is. */
|
* is. */
|
||||||
switch (in_plugin->id) {
|
switch (in_plugin->id) {
|
||||||
case CODEC_ID_MPEG2VIDEO:
|
|
||||||
case CODEC_ID_MPEG4:
|
case CODEC_ID_MPEG4:
|
||||||
case CODEC_ID_MSMPEG4V3:
|
case CODEC_ID_MSMPEG4V3:
|
||||||
rank = GST_RANK_PRIMARY;
|
rank = GST_RANK_PRIMARY;
|
||||||
|
|
Loading…
Reference in a new issue