mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-10 03:19:40 +00:00
decoder: add {start,end}_frame() hooks.
The start_frame() hook is called prior to traversing all decode-units for decoding. The unit argument represents the first slice in the frame. Some codecs (e.g. H.264) need to wait for the first slice in order to determine the actual VA context parameters.
This commit is contained in:
parent
66cc8754fc
commit
ea9703362c
2 changed files with 22 additions and 2 deletions
|
@ -210,13 +210,24 @@ do_decode(GstVaapiDecoder *decoder, GstVideoCodecFrame *base_frame)
|
|||
{
|
||||
GstVaapiDecoderClass * const klass = GST_VAAPI_DECODER_GET_CLASS(decoder);
|
||||
GstVaapiParserState * const ps = &decoder->priv->parser_state;
|
||||
GstVaapiDecoderFrame *frame;
|
||||
GstVaapiDecoderFrame * const frame = base_frame->user_data;
|
||||
GstVaapiDecoderStatus status;
|
||||
GSList *l;
|
||||
|
||||
ps->current_frame = base_frame;
|
||||
|
||||
frame = base_frame->user_data;
|
||||
if (klass->start_frame) {
|
||||
for (l = frame->units; l != NULL; l = l->next) {
|
||||
GstVaapiDecoderUnit * const unit = l->data;
|
||||
if (GST_VAAPI_DECODER_UNIT_IS_SLICE(unit)) {
|
||||
status = klass->start_frame(decoder, unit);
|
||||
if (status != GST_VAAPI_DECODER_STATUS_SUCCESS)
|
||||
return status;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (l = frame->units; l != NULL; l = l->next) {
|
||||
GstVaapiDecoderUnit * const unit = l->data;
|
||||
if (GST_VAAPI_DECODER_UNIT_IS_SKIPPED(unit))
|
||||
|
@ -225,6 +236,12 @@ do_decode(GstVaapiDecoder *decoder, GstVideoCodecFrame *base_frame)
|
|||
if (status != GST_VAAPI_DECODER_STATUS_SUCCESS)
|
||||
return status;
|
||||
}
|
||||
|
||||
if (klass->end_frame) {
|
||||
status = klass->end_frame(decoder);
|
||||
if (status != GST_VAAPI_DECODER_STATUS_SUCCESS)
|
||||
return status;
|
||||
}
|
||||
return GST_VAAPI_DECODER_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -118,6 +118,9 @@ struct _GstVaapiDecoderClass {
|
|||
struct _GstVaapiDecoderUnit **unit_ptr);
|
||||
GstVaapiDecoderStatus (*decode)(GstVaapiDecoder *decoder,
|
||||
struct _GstVaapiDecoderUnit *unit);
|
||||
GstVaapiDecoderStatus (*start_frame)(GstVaapiDecoder *decoder,
|
||||
struct _GstVaapiDecoderUnit *unit);
|
||||
GstVaapiDecoderStatus (*end_frame)(GstVaapiDecoder *decoder);
|
||||
};
|
||||
|
||||
GType
|
||||
|
|
Loading…
Reference in a new issue