mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 02:31:03 +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;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static inline void
|
||||||
push_surface(
|
push_surface(GstVaapiDecoder *decoder, GstVaapiSurfaceProxy *proxy)
|
||||||
GstVaapiDecoder *decoder,
|
|
||||||
GstVaapiSurfaceProxy *proxy,
|
|
||||||
GstClockTime timestamp
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
GstVaapiDecoderPrivate * const priv = decoder->priv;
|
GstVaapiDecoderPrivate * const priv = decoder->priv;
|
||||||
|
|
||||||
GST_DEBUG("queue decoded surface %" GST_VAAPI_ID_FORMAT,
|
GST_DEBUG("queue decoded surface %" GST_VAAPI_ID_FORMAT,
|
||||||
GST_VAAPI_ID_ARGS(gst_vaapi_surface_proxy_get_surface_id(proxy)));
|
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);
|
g_queue_push_tail(priv->surfaces, proxy);
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline GstVaapiSurfaceProxy *
|
static inline GstVaapiSurfaceProxy *
|
||||||
|
@ -559,28 +553,11 @@ gst_vaapi_decoder_push_buffer_sub(
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
void
|
||||||
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
|
|
||||||
gst_vaapi_decoder_push_surface_proxy(
|
gst_vaapi_decoder_push_surface_proxy(
|
||||||
GstVaapiDecoder *decoder,
|
GstVaapiDecoder *decoder,
|
||||||
GstVaapiSurfaceProxy *proxy,
|
GstVaapiSurfaceProxy *proxy
|
||||||
GstClockTime timestamp
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
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;
|
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
|
static GstVaapiDecoderStatus
|
||||||
decode_frame(GstVaapiDecoderFfmpeg *ffdecoder, guchar *buf, guint buf_size)
|
decode_frame(GstVaapiDecoderFfmpeg *ffdecoder, guchar *buf, guint buf_size)
|
||||||
{
|
{
|
||||||
GstVaapiDecoderFfmpegPrivate * const priv = ffdecoder->priv;
|
GstVaapiDecoderFfmpegPrivate * const priv = ffdecoder->priv;
|
||||||
GstVaapiDisplay * const display = GST_VAAPI_DECODER_DISPLAY(ffdecoder);
|
GstVaapiDisplay * const display = GST_VAAPI_DECODER_DISPLAY(ffdecoder);
|
||||||
GstVaapiSurfaceProxy *proxy;
|
|
||||||
int bytes_read, got_picture = 0;
|
int bytes_read, got_picture = 0;
|
||||||
AVPacket pkt;
|
AVPacket pkt;
|
||||||
|
|
||||||
|
@ -509,14 +523,7 @@ decode_frame(GstVaapiDecoderFfmpeg *ffdecoder, guchar *buf, guint buf_size)
|
||||||
if (bytes_read < 0)
|
if (bytes_read < 0)
|
||||||
return GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN;
|
return GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN;
|
||||||
|
|
||||||
proxy = GST_VAAPI_SURFACE_PROXY(priv->frame->data[0]);
|
return render_frame(ffdecoder, priv->frame);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GstVaapiDecoderStatus
|
GstVaapiDecoderStatus
|
||||||
|
|
|
@ -224,19 +224,16 @@ gboolean
|
||||||
gst_vaapi_picture_output(GstVaapiPicture *picture)
|
gst_vaapi_picture_output(GstVaapiPicture *picture)
|
||||||
{
|
{
|
||||||
GstVaapiSurfaceProxy *proxy;
|
GstVaapiSurfaceProxy *proxy;
|
||||||
gboolean success;
|
|
||||||
|
|
||||||
g_return_val_if_fail(GST_VAAPI_IS_PICTURE(picture), FALSE);
|
g_return_val_if_fail(GST_VAAPI_IS_PICTURE(picture), FALSE);
|
||||||
|
|
||||||
proxy = gst_vaapi_surface_proxy_new(GET_CONTEXT(picture), picture->surface);
|
proxy = gst_vaapi_surface_proxy_new(GET_CONTEXT(picture), picture->surface);
|
||||||
if (!proxy)
|
if (!proxy)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
success = gst_vaapi_decoder_push_surface_proxy(
|
|
||||||
GET_DECODER(picture),
|
gst_vaapi_surface_proxy_set_timestamp(proxy, picture->pts);
|
||||||
proxy, picture->pts
|
gst_vaapi_decoder_push_surface_proxy(GET_DECODER(picture), proxy);
|
||||||
);
|
return TRUE;
|
||||||
g_object_unref(proxy); // ref'ed in gst_vaapi_decoder_push_surface_proxy()
|
|
||||||
return success;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
|
|
|
@ -165,18 +165,10 @@ gst_vaapi_decoder_push_buffer_sub(
|
||||||
guint size
|
guint size
|
||||||
) attribute_hidden;
|
) attribute_hidden;
|
||||||
|
|
||||||
gboolean
|
void
|
||||||
gst_vaapi_decoder_push_surface(
|
|
||||||
GstVaapiDecoder *decoder,
|
|
||||||
GstVaapiSurface *surface,
|
|
||||||
GstClockTime timestamp
|
|
||||||
) attribute_hidden;
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
gst_vaapi_decoder_push_surface_proxy(
|
gst_vaapi_decoder_push_surface_proxy(
|
||||||
GstVaapiDecoder *decoder,
|
GstVaapiDecoder *decoder,
|
||||||
GstVaapiSurfaceProxy *proxy,
|
GstVaapiSurfaceProxy *proxy
|
||||||
GstClockTime timestamp
|
|
||||||
) attribute_hidden;
|
) attribute_hidden;
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
Loading…
Reference in a new issue