return TRUE;
}
+static void
+push_back_buffer(GstVaapiDecoder *decoder, GstBuffer *buffer)
+{
+ GstVaapiDecoderPrivate * const priv = decoder->priv;
+
+ GST_DEBUG("requeue encoded data buffer %p (%d bytes)",
+ buffer, GST_BUFFER_SIZE(buffer));
+
+ g_queue_push_head(priv->buffers, buffer);
+}
+
static GstBuffer *
pop_buffer(GstVaapiDecoder *decoder)
{
}
gboolean
+gst_vaapi_decoder_push_buffer_sub(
+ GstVaapiDecoder *decoder,
+ GstBuffer *buffer,
+ guint offset,
+ guint size
+)
+{
+ GstBuffer *subbuffer;
+
+ subbuffer = gst_buffer_create_sub(buffer, offset, size);
+ if (!subbuffer)
+ return FALSE;
+
+ push_back_buffer(decoder, subbuffer);
+ return TRUE;
+}
+
+gboolean
gst_vaapi_decoder_push_surface(
GstVaapiDecoder *decoder,
GstVaapiSurface *surface,
GstVaapiDecoderFfmpeg * const ffdecoder = GST_VAAPI_DECODER_FFMPEG(decoder);
GstVaapiDecoderFfmpegPrivate * const priv = ffdecoder->priv;
GstClockTime inbuf_ts;
- guchar *inbuf, *outbuf;
- gint inbuf_size, outbuf_size;
+ guchar *outbuf;
+ gint inbuf_ofs, inbuf_size, outbuf_size;
gboolean got_frame;
g_return_val_if_fail(priv->is_constructed,
return GST_VAAPI_DECODER_STATUS_ERROR_UNSUPPORTED_CODEC;
}
- inbuf = GST_BUFFER_DATA(buffer);
+ inbuf_ofs = 0;
inbuf_size = GST_BUFFER_SIZE(buffer);
inbuf_ts = GST_BUFFER_TIMESTAMP(buffer);
priv->pctx,
priv->avctx,
&outbuf, &outbuf_size,
- inbuf, inbuf_size,
+ GST_BUFFER_DATA(buffer) + inbuf_ofs, inbuf_size,
inbuf_ts, inbuf_ts
);
got_frame = outbuf && outbuf_size > 0;
if (parsed_size > 0) {
- inbuf += parsed_size;
+ inbuf_ofs += parsed_size;
inbuf_size -= parsed_size;
}
} while (!got_frame && inbuf_size > 0);
inbuf_ts = priv->pctx->pts;
}
else {
- outbuf = inbuf;
+ outbuf = GST_BUFFER_DATA(buffer);
outbuf_size = inbuf_size;
- got_frame = inbuf && inbuf_size > 0;
+ got_frame = outbuf && outbuf_size > 0;
+ inbuf_ofs = inbuf_size;
+ inbuf_size = 0;
}
+ if (inbuf_size > 0 &&
+ !gst_vaapi_decoder_push_buffer_sub(decoder, buffer,
+ inbuf_ofs, inbuf_size))
+ return GST_VAAPI_DECODER_STATUS_ERROR_ALLOCATION_FAILED;
+
if (!got_frame && !GST_BUFFER_IS_EOS(buffer))
return GST_VAAPI_DECODER_STATUS_ERROR_NO_DATA;
) attribute_hidden;
gboolean
+gst_vaapi_decoder_push_buffer_sub(
+ GstVaapiDecoder *decoder,
+ GstBuffer *buffer,
+ guint offset,
+ guint size
+) attribute_hidden;
+
+gboolean
gst_vaapi_decoder_push_surface(
GstVaapiDecoder *decoder,
GstVaapiSurface *surface,