basevideo: Move deadline to frame structure

This commit is contained in:
David Schleef 2010-09-18 17:28:48 -07:00
parent 8dfcc11bcb
commit 7cd2e0dd3e
5 changed files with 28 additions and 17 deletions

View file

@ -93,7 +93,7 @@ static GstFlowReturn gst_schro_dec_parse_data (GstBaseVideoDecoder *
static int gst_schro_dec_scan_for_sync (GstBaseVideoDecoder *
base_video_decoder, gboolean at_eos, int offset, int n);
static GstFlowReturn gst_schro_dec_handle_frame (GstBaseVideoDecoder * decoder,
GstVideoFrame * frame, GstClockTimeDiff deadline);
GstVideoFrame * frame);
static gboolean gst_schro_dec_finish (GstBaseVideoDecoder * base_video_decoder);
static void gst_schrodec_send_tags (GstSchroDec * schro_dec);
@ -681,7 +681,7 @@ gst_schro_dec_process (GstSchroDec * schro_dec, gboolean eos)
GstFlowReturn
gst_schro_dec_handle_frame (GstBaseVideoDecoder * base_video_decoder,
GstVideoFrame * frame, GstClockTimeDiff deadline)
GstVideoFrame * frame)
{
GstSchroDec *schro_dec;
int schro_ret;

View file

@ -103,7 +103,7 @@ static gboolean gst_vp8_dec_reset (GstBaseVideoDecoder * decoder);
static GstFlowReturn gst_vp8_dec_parse_data (GstBaseVideoDecoder * decoder,
gboolean at_eos);
static GstFlowReturn gst_vp8_dec_handle_frame (GstBaseVideoDecoder * decoder,
GstVideoFrame * frame, GstClockTimeDiff deadline);
GstVideoFrame * frame);
static GstStaticPadTemplate gst_vp8_dec_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink",
@ -377,8 +377,7 @@ gst_vp8_dec_image_to_buffer (GstVP8Dec * dec, const vpx_image_t * img,
}
static GstFlowReturn
gst_vp8_dec_handle_frame (GstBaseVideoDecoder * decoder, GstVideoFrame * frame,
GstClockTimeDiff deadline)
gst_vp8_dec_handle_frame (GstBaseVideoDecoder * decoder, GstVideoFrame * frame)
{
GstVP8Dec *dec;
GstFlowReturn ret = GST_FLOW_OK;
@ -386,6 +385,7 @@ gst_vp8_dec_handle_frame (GstBaseVideoDecoder * decoder, GstVideoFrame * frame,
vpx_codec_iter_t iter = NULL;
vpx_image_t *img;
long decoder_deadline = 0;
GstClockTimeDiff deadline;
GST_DEBUG_OBJECT (decoder, "handle_frame");
@ -470,6 +470,7 @@ gst_vp8_dec_handle_frame (GstBaseVideoDecoder * decoder, GstVideoFrame * frame,
}
#endif
deadline = gst_base_video_decoder_get_max_decode_time (decoder, frame);
if (deadline < 0) {
decoder_deadline = 1;
} else if (deadline == G_MAXINT64) {

View file

@ -1341,8 +1341,6 @@ gst_base_video_decoder_have_frame_2 (GstBaseVideoDecoder * base_video_decoder)
GstVideoFrame *frame = base_video_decoder->current_frame;
GstBaseVideoDecoderClass *base_video_decoder_class;
GstFlowReturn ret = GST_FLOW_OK;
GstClockTime running_time;
GstClockTimeDiff deadline;
base_video_decoder_class =
GST_BASE_VIDEO_DECODER_GET_CLASS (base_video_decoder);
@ -1361,17 +1359,11 @@ gst_base_video_decoder_have_frame_2 (GstBaseVideoDecoder * base_video_decoder)
base_video_decoder->frames = g_list_append (base_video_decoder->frames,
frame);
running_time = gst_segment_to_running_time (&base_video_decoder->segment,
frame->deadline = gst_segment_to_running_time (&base_video_decoder->segment,
GST_FORMAT_TIME, frame->presentation_timestamp);
if (GST_CLOCK_TIME_IS_VALID (base_video_decoder->earliest_time))
deadline = GST_CLOCK_DIFF (base_video_decoder->earliest_time, running_time);
else
deadline = G_MAXINT64;
/* do something with frame */
ret = base_video_decoder_class->handle_frame (base_video_decoder, frame,
deadline);
ret = base_video_decoder_class->handle_frame (base_video_decoder, frame);
if (!GST_FLOW_IS_SUCCESS (ret)) {
GST_DEBUG ("flow error!");
}
@ -1498,3 +1490,18 @@ gst_base_video_decoder_alloc_src_frame (GstBaseVideoDecoder *
return flow_ret;
}
GstClockTimeDiff
gst_base_video_decoder_get_max_decode_time (GstBaseVideoDecoder *
base_video_decoder, GstVideoFrame * frame)
{
GstClockTimeDiff deadline;
if (GST_CLOCK_TIME_IS_VALID (base_video_decoder->earliest_time))
deadline = GST_CLOCK_DIFF (base_video_decoder->earliest_time,
frame->deadline);
else
deadline = G_MAXINT64;
return deadline;
}

View file

@ -133,8 +133,7 @@ struct _GstBaseVideoDecoderClass
int offset, int n);
GstFlowReturn (*parse_data) (GstBaseVideoDecoder *decoder, gboolean at_eos);
GstFlowReturn (*finish) (GstBaseVideoDecoder *coder);
GstFlowReturn (*handle_frame) (GstBaseVideoDecoder *coder, GstVideoFrame *frame,
GstClockTimeDiff deadline);
GstFlowReturn (*handle_frame) (GstBaseVideoDecoder *coder, GstVideoFrame *frame);
GstFlowReturn (*shape_output) (GstBaseVideoDecoder *coder, GstVideoFrame *frame);
GstCaps *(*get_caps) (GstBaseVideoDecoder *coder);
@ -171,6 +170,9 @@ void gst_base_video_decoder_set_src_caps (GstBaseVideoDecoder *base_video_decode
GstFlowReturn gst_base_video_decoder_alloc_src_frame (GstBaseVideoDecoder *base_video_decoder,
GstVideoFrame *frame);
GstClockTimeDiff gst_base_video_decoder_get_max_decode_time (
GstBaseVideoDecoder *base_video_decoder, GstVideoFrame *frame);
G_END_DECLS
#endif

View file

@ -78,6 +78,7 @@ struct _GstVideoFrame
int n_fields;
void *coder_hook;
GstClockTime deadline;
};
gboolean gst_base_video_rawvideo_convert (GstVideoState *state,