summaryrefslogtreecommitdiff
path: root/gst-libs/gst
diff options
context:
space:
mode:
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>2012-01-26 14:54:31 +0100
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>2012-01-27 13:28:12 +0100
commit7b19745141d3d653e84e3512b7235292e7c1e17a (patch)
tree170360e9ee1b3ba03e9850c51f2c059970b8979c /gst-libs/gst
parente5d12e885315fc2a5db806ec5a8d92f9ab3ea809 (diff)
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.
Diffstat (limited to 'gst-libs/gst')
-rw-r--r--gst-libs/gst/vaapi/gstvaapidecoder.c33
-rw-r--r--gst-libs/gst/vaapi/gstvaapidecoder_ffmpeg.c25
-rw-r--r--gst-libs/gst/vaapi/gstvaapidecoder_objects.c11
-rw-r--r--gst-libs/gst/vaapi/gstvaapidecoder_priv.h12
4 files changed, 27 insertions, 54 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapidecoder.c b/gst-libs/gst/vaapi/gstvaapidecoder.c
index e0d1b7b2..2f54e7a4 100644
--- a/gst-libs/gst/vaapi/gstvaapidecoder.c
+++ b/gst-libs/gst/vaapi/gstvaapidecoder.c
@@ -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);
}
diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_ffmpeg.c b/gst-libs/gst/vaapi/gstvaapidecoder_ffmpeg.c
index 8fb9099d..21425ac8 100644
--- a/gst-libs/gst/vaapi/gstvaapidecoder_ffmpeg.c
+++ b/gst-libs/gst/vaapi/gstvaapidecoder_ffmpeg.c
@@ -484,11 +484,25 @@ gst_vaapi_decoder_ffmpeg_create(GstVaapiDecoderFfmpeg *ffdecoder)
}
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
diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_objects.c b/gst-libs/gst/vaapi/gstvaapidecoder_objects.c
index 61ff4e6b..c25e86cf 100644
--- a/gst-libs/gst/vaapi/gstvaapidecoder_objects.c
+++ b/gst-libs/gst/vaapi/gstvaapidecoder_objects.c
@@ -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;
}
/* ------------------------------------------------------------------------- */
diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_priv.h b/gst-libs/gst/vaapi/gstvaapidecoder_priv.h
index 27efee11..87ce200b 100644
--- a/gst-libs/gst/vaapi/gstvaapidecoder_priv.h
+++ b/gst-libs/gst/vaapi/gstvaapidecoder_priv.h
@@ -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