mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
decoder: simplify output of decoded frames.
Drop obsolete gst_vaapi_decoder_push_surface() that was no longer used. Change gst_vaapi_decoder_push_surface_proxy() semantics to assume PTS is already set correctly and reference count increased, if necessary.
This commit is contained in:
parent
e5d12e8853
commit
7b19745141
4 changed files with 27 additions and 54 deletions
|
@ -122,21 +122,15 @@ decode_step(GstVaapiDecoder *decoder)
|
|||
return status;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
push_surface(
|
||||
GstVaapiDecoder *decoder,
|
||||
GstVaapiSurfaceProxy *proxy,
|
||||
GstClockTime timestamp
|
||||
)
|
||||
static inline void
|
||||
push_surface(GstVaapiDecoder *decoder, GstVaapiSurfaceProxy *proxy)
|
||||
{
|
||||
GstVaapiDecoderPrivate * const priv = decoder->priv;
|
||||
|
||||
GST_DEBUG("queue decoded surface %" GST_VAAPI_ID_FORMAT,
|
||||
GST_VAAPI_ID_ARGS(gst_vaapi_surface_proxy_get_surface_id(proxy)));
|
||||
|
||||
gst_vaapi_surface_proxy_set_timestamp(proxy, timestamp);
|
||||
g_queue_push_tail(priv->surfaces, proxy);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static inline GstVaapiSurfaceProxy *
|
||||
|
@ -559,28 +553,11 @@ gst_vaapi_decoder_push_buffer_sub(
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_vaapi_decoder_push_surface(
|
||||
GstVaapiDecoder *decoder,
|
||||
GstVaapiSurface *surface,
|
||||
GstClockTime timestamp
|
||||
)
|
||||
{
|
||||
GstVaapiDecoderPrivate * const priv = decoder->priv;
|
||||
GstVaapiSurfaceProxy *proxy;
|
||||
|
||||
proxy = gst_vaapi_surface_proxy_new(priv->context, surface);
|
||||
if (!proxy)
|
||||
return FALSE;
|
||||
return push_surface(decoder, proxy, timestamp);
|
||||
}
|
||||
|
||||
gboolean
|
||||
void
|
||||
gst_vaapi_decoder_push_surface_proxy(
|
||||
GstVaapiDecoder *decoder,
|
||||
GstVaapiSurfaceProxy *proxy,
|
||||
GstClockTime timestamp
|
||||
GstVaapiSurfaceProxy *proxy
|
||||
)
|
||||
{
|
||||
return push_surface(decoder, g_object_ref(proxy), timestamp);
|
||||
return push_surface(decoder, proxy);
|
||||
}
|
||||
|
|
|
@ -483,12 +483,26 @@ gst_vaapi_decoder_ffmpeg_create(GstVaapiDecoderFfmpeg *ffdecoder)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static GstVaapiDecoderStatus
|
||||
render_frame(GstVaapiDecoderFfmpeg *decoder, AVFrame *frame)
|
||||
{
|
||||
GstVaapiDecoder * const base_decoder = GST_VAAPI_DECODER(decoder);
|
||||
GstVaapiSurfaceProxy *proxy;
|
||||
|
||||
proxy = GST_VAAPI_SURFACE_PROXY(frame->data[0]);
|
||||
if (!proxy)
|
||||
return GST_VAAPI_DECODER_STATUS_ERROR_INVALID_SURFACE;
|
||||
|
||||
gst_vaapi_surface_proxy_set_timestamp(proxy, frame->pts);
|
||||
gst_vaapi_decoder_push_surface_proxy(base_decoder, g_object_ref(proxy));
|
||||
return GST_VAAPI_DECODER_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static GstVaapiDecoderStatus
|
||||
decode_frame(GstVaapiDecoderFfmpeg *ffdecoder, guchar *buf, guint buf_size)
|
||||
{
|
||||
GstVaapiDecoderFfmpegPrivate * const priv = ffdecoder->priv;
|
||||
GstVaapiDisplay * const display = GST_VAAPI_DECODER_DISPLAY(ffdecoder);
|
||||
GstVaapiSurfaceProxy *proxy;
|
||||
int bytes_read, got_picture = 0;
|
||||
AVPacket pkt;
|
||||
|
||||
|
@ -509,14 +523,7 @@ decode_frame(GstVaapiDecoderFfmpeg *ffdecoder, guchar *buf, guint buf_size)
|
|||
if (bytes_read < 0)
|
||||
return GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN;
|
||||
|
||||
proxy = GST_VAAPI_SURFACE_PROXY(priv->frame->data[0]);
|
||||
if (!proxy)
|
||||
return GST_VAAPI_DECODER_STATUS_ERROR_INVALID_SURFACE;
|
||||
|
||||
if (!gst_vaapi_decoder_push_surface_proxy(GST_VAAPI_DECODER_CAST(ffdecoder),
|
||||
proxy, priv->frame->pts))
|
||||
return GST_VAAPI_DECODER_STATUS_ERROR_ALLOCATION_FAILED;
|
||||
return GST_VAAPI_DECODER_STATUS_SUCCESS;
|
||||
return render_frame(ffdecoder, priv->frame);
|
||||
}
|
||||
|
||||
GstVaapiDecoderStatus
|
||||
|
|
|
@ -224,19 +224,16 @@ gboolean
|
|||
gst_vaapi_picture_output(GstVaapiPicture *picture)
|
||||
{
|
||||
GstVaapiSurfaceProxy *proxy;
|
||||
gboolean success;
|
||||
|
||||
g_return_val_if_fail(GST_VAAPI_IS_PICTURE(picture), FALSE);
|
||||
|
||||
proxy = gst_vaapi_surface_proxy_new(GET_CONTEXT(picture), picture->surface);
|
||||
if (!proxy)
|
||||
return FALSE;
|
||||
success = gst_vaapi_decoder_push_surface_proxy(
|
||||
GET_DECODER(picture),
|
||||
proxy, picture->pts
|
||||
);
|
||||
g_object_unref(proxy); // ref'ed in gst_vaapi_decoder_push_surface_proxy()
|
||||
return success;
|
||||
|
||||
gst_vaapi_surface_proxy_set_timestamp(proxy, picture->pts);
|
||||
gst_vaapi_decoder_push_surface_proxy(GET_DECODER(picture), proxy);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
|
|
@ -165,18 +165,10 @@ gst_vaapi_decoder_push_buffer_sub(
|
|||
guint size
|
||||
) attribute_hidden;
|
||||
|
||||
gboolean
|
||||
gst_vaapi_decoder_push_surface(
|
||||
GstVaapiDecoder *decoder,
|
||||
GstVaapiSurface *surface,
|
||||
GstClockTime timestamp
|
||||
) attribute_hidden;
|
||||
|
||||
gboolean
|
||||
void
|
||||
gst_vaapi_decoder_push_surface_proxy(
|
||||
GstVaapiDecoder *decoder,
|
||||
GstVaapiSurfaceProxy *proxy,
|
||||
GstClockTime timestamp
|
||||
GstVaapiSurfaceProxy *proxy
|
||||
) attribute_hidden;
|
||||
|
||||
G_END_DECLS
|
||||
|
|
Loading…
Reference in a new issue