Commit 5627c7d3 authored by Wim Taymans's avatar Wim Taymans

ext/ffmpeg/gstffmpegdec.c: Remove some more overly clever code that does...

ext/ffmpeg/gstffmpegdec.c: Remove some more overly clever code that does nothing but mess up timestamps.

Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_chain):
Remove some more overly clever code that does nothing but mess up
timestamps.
parent c7d5be2b
2008-01-21 Wim Taymans <wim.taymans@collabora.co.uk>
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_chain):
Remove some more overly clever code that does nothing but mess up
timestamps.
2008-01-18 Wim Taymans <wim.taymans@collabora.co.uk> 2008-01-18 Wim Taymans <wim.taymans@collabora.co.uk>
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_drain), * ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_drain),
......
common @ 662f544d
Subproject commit b6bd1a35b641237d016496039e474dee4230de76 Subproject commit 662f544d56a6d6ef20b8ea5f56e975f9e139bc78
...@@ -1367,8 +1367,7 @@ gst_ffmpegdec_video_frame (GstFFMpegDec * ffmpegdec, ...@@ -1367,8 +1367,7 @@ gst_ffmpegdec_video_frame (GstFFMpegDec * ffmpegdec,
if (ffmpegdec->picture->pts != -1) { if (ffmpegdec->picture->pts != -1) {
GST_LOG_OBJECT (ffmpegdec, "using timestamp returned by ffmpeg"); GST_LOG_OBJECT (ffmpegdec, "using timestamp returned by ffmpeg");
/* Get (interpolated) timestamp from FFMPEG */ /* Get (interpolated) timestamp from FFMPEG */
in_timestamp = gst_ffmpeg_time_ff_to_gst ((guint64) ffmpegdec->picture->pts, in_timestamp = (GstClockTime)ffmpegdec->picture->pts;
ffmpegdec->context->time_base);
} }
if (!GST_CLOCK_TIME_IS_VALID (in_timestamp)) { if (!GST_CLOCK_TIME_IS_VALID (in_timestamp)) {
in_timestamp = ffmpegdec->next_ts; in_timestamp = ffmpegdec->next_ts;
...@@ -1995,20 +1994,16 @@ gst_ffmpegdec_chain (GstPad * pad, GstBuffer * inbuf) ...@@ -1995,20 +1994,16 @@ gst_ffmpegdec_chain (GstPad * pad, GstBuffer * inbuf)
/* parse, if at all possible */ /* parse, if at all possible */
if (ffmpegdec->pctx) { if (ffmpegdec->pctx) {
gint res; gint res;
gint64 ffpts;
/* convert timestamp to ffmpeg timestamp */
ffpts =
gst_ffmpeg_time_gst_to_ff (in_timestamp,
ffmpegdec->context->time_base);
GST_LOG_OBJECT (ffmpegdec, GST_LOG_OBJECT (ffmpegdec,
"Calling av_parser_parse with ts:%" GST_TIME_FORMAT ", ffpts:%" "Calling av_parser_parse with ts:%" GST_TIME_FORMAT,
G_GINT64_FORMAT, GST_TIME_ARGS (in_timestamp), ffpts); GST_TIME_ARGS (in_timestamp));
/* feed the parser */ /* feed the parser. We store the raw gstreamer timestamp because
* converting it to ffmpeg timestamps can corrupt it if the framerate is
* wrong. */
res = av_parser_parse (ffmpegdec->pctx, ffmpegdec->context, res = av_parser_parse (ffmpegdec->pctx, ffmpegdec->context,
&data, &size, bdata, bsize, ffpts, ffpts); &data, &size, bdata, bsize, in_timestamp, in_timestamp);
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);
...@@ -2016,8 +2011,8 @@ gst_ffmpegdec_chain (GstPad * pad, GstBuffer * inbuf) ...@@ -2016,8 +2011,8 @@ gst_ffmpegdec_chain (GstPad * pad, GstBuffer * inbuf)
/* store pts for get_buffer */ /* store pts for get_buffer */
ffmpegdec->in_ts = ffmpegdec->pctx->pts; ffmpegdec->in_ts = ffmpegdec->pctx->pts;
GST_LOG_OBJECT (ffmpegdec, "consuming %d bytes. ffpts:%" GST_LOG_OBJECT (ffmpegdec, "consuming %d bytes. ts:%"
G_GINT64_FORMAT, size, ffmpegdec->pctx->pts); GST_TIME_FORMAT, size, GST_TIME_ARGS (ffmpegdec->pctx->pts));
/* there is output, set pointers for next round. */ /* there is output, set pointers for next round. */
bsize -= res; bsize -= res;
...@@ -2035,8 +2030,7 @@ gst_ffmpegdec_chain (GstPad * pad, GstBuffer * inbuf) ...@@ -2035,8 +2030,7 @@ gst_ffmpegdec_chain (GstPad * pad, GstBuffer * inbuf)
data = bdata; data = bdata;
size = bsize; size = bsize;
ffmpegdec->in_ts = gst_ffmpeg_time_gst_to_ff (in_timestamp, ffmpegdec->in_ts = in_timestamp;
ffmpegdec->context->time_base);
} }
/* decode a frame of audio/video now */ /* decode a frame of audio/video now */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment