videodecoder: Small cleanups

Remove extra deref using a local var, and add/change some doc comments
and debug statements
This commit is contained in:
Jan Schmidt 2012-06-19 23:43:27 +10:00
parent 2d770ac406
commit 487e5348e0

View File

@ -1431,6 +1431,9 @@ static void
gst_video_decoder_get_timestamp_at_offset (GstVideoDecoder * gst_video_decoder_get_timestamp_at_offset (GstVideoDecoder *
decoder, guint64 offset, GstClockTime * timestamp, GstClockTime * duration) decoder, guint64 offset, GstClockTime * timestamp, GstClockTime * duration)
{ {
#ifndef GST_DISABLE_GST_DEBUG
guint64 got_offset = 0;
#endif
Timestamp *ts; Timestamp *ts;
GList *g; GList *g;
@ -1441,6 +1444,9 @@ gst_video_decoder_get_timestamp_at_offset (GstVideoDecoder *
while (g) { while (g) {
ts = g->data; ts = g->data;
if (ts->offset <= offset) { if (ts->offset <= offset) {
#ifndef GST_DISABLE_GST_DEBUG
got_offset = ts->offset;
#endif
*timestamp = ts->timestamp; *timestamp = ts->timestamp;
*duration = ts->duration; *duration = ts->duration;
g_free (ts); g_free (ts);
@ -1452,8 +1458,9 @@ gst_video_decoder_get_timestamp_at_offset (GstVideoDecoder *
} }
GST_LOG_OBJECT (decoder, GST_LOG_OBJECT (decoder,
"got timestamp %" GST_TIME_FORMAT " (offset:%" G_GUINT64_FORMAT ")", "got timestamp %" GST_TIME_FORMAT " @ offs %" G_GUINT64_FORMAT
GST_TIME_ARGS (*timestamp), offset); " (wanted offset:%" G_GUINT64_FORMAT ")", GST_TIME_ARGS (*timestamp),
got_offset, offset);
} }
static void static void
@ -1620,8 +1627,8 @@ gst_video_decoder_flush_decode (GstVideoDecoder * dec)
GstVideoCodecFrame *frame = (GstVideoCodecFrame *) (walk->data); GstVideoCodecFrame *frame = (GstVideoCodecFrame *) (walk->data);
GstBuffer *buf = frame->input_buffer; GstBuffer *buf = frame->input_buffer;
GST_DEBUG_OBJECT (dec, "decoding frame %p, ts %" GST_TIME_FORMAT, GST_DEBUG_OBJECT (dec, "decoding frame %p buffer %p, ts %" GST_TIME_FORMAT,
buf, GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf))); frame, buf, GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)));
next = walk->next; next = walk->next;
@ -2322,18 +2329,17 @@ gst_video_decoder_have_frame (GstVideoDecoder * decoder)
GST_VIDEO_DECODER_STREAM_LOCK (decoder); GST_VIDEO_DECODER_STREAM_LOCK (decoder);
n_available = gst_adapter_available (decoder->priv->output_adapter); n_available = gst_adapter_available (priv->output_adapter);
if (n_available) { if (n_available) {
buffer = buffer = gst_adapter_take_buffer (priv->output_adapter, n_available);
gst_adapter_take_buffer (decoder->priv->output_adapter, n_available);
} else { } else {
buffer = gst_buffer_new_and_alloc (0); buffer = gst_buffer_new_and_alloc (0);
} }
decoder->priv->current_frame->input_buffer = buffer; priv->current_frame->input_buffer = buffer;
gst_video_decoder_get_timestamp_at_offset (decoder, gst_video_decoder_get_timestamp_at_offset (decoder,
decoder->priv->frame_offset, &timestamp, &duration); priv->frame_offset, &timestamp, &duration);
GST_BUFFER_TIMESTAMP (buffer) = timestamp; GST_BUFFER_TIMESTAMP (buffer) = timestamp;
GST_BUFFER_DURATION (buffer) = duration; GST_BUFFER_DURATION (buffer) = duration;