2010-04-23 16:05:58 +00:00
|
|
|
/*
|
|
|
|
* gstvaapidecoder.c - VA decoder abstraction
|
|
|
|
*
|
2012-01-16 09:41:10 +00:00
|
|
|
* Copyright (C) 2010-2011 Splitted-Desktop Systems
|
2013-11-22 04:57:18 +00:00
|
|
|
* Author: Gwenole Beauchesne <gwenole.beauchesne@splitted-desktop.com>
|
2014-01-22 17:54:14 +00:00
|
|
|
* Copyright (C) 2011-2014 Intel Corporation
|
2013-11-22 04:57:18 +00:00
|
|
|
* Author: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
|
2010-04-23 16:05:58 +00:00
|
|
|
*
|
2010-05-03 07:07:27 +00:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2.1
|
|
|
|
* of the License, or (at your option) any later version.
|
2010-04-23 16:05:58 +00:00
|
|
|
*
|
2010-05-03 07:07:27 +00:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
2010-04-23 16:05:58 +00:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2010-05-03 07:07:27 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2010-04-23 16:05:58 +00:00
|
|
|
*
|
2010-05-03 07:07:27 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free
|
|
|
|
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301 USA
|
2010-04-23 16:05:58 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* SECTION:gstvaapidecoder
|
|
|
|
* @short_description: VA decoder abstraction
|
|
|
|
*/
|
|
|
|
|
2012-01-30 17:12:59 +00:00
|
|
|
#include "sysdeps.h"
|
2010-04-23 16:05:58 +00:00
|
|
|
#include "gstvaapicompat.h"
|
|
|
|
#include "gstvaapidecoder.h"
|
|
|
|
#include "gstvaapidecoder_priv.h"
|
2013-04-16 11:23:41 +00:00
|
|
|
#include "gstvaapiparser_frame.h"
|
2013-04-16 16:56:24 +00:00
|
|
|
#include "gstvaapisurfaceproxy_priv.h"
|
2010-04-23 16:05:58 +00:00
|
|
|
#include "gstvaapiutils.h"
|
|
|
|
|
|
|
|
#define DEBUG 1
|
|
|
|
#include "gstvaapidebug.h"
|
|
|
|
|
2013-01-30 15:33:48 +00:00
|
|
|
static void
|
|
|
|
drop_frame(GstVaapiDecoder *decoder, GstVideoCodecFrame *frame);
|
|
|
|
|
2012-12-06 12:57:42 +00:00
|
|
|
static void
|
|
|
|
parser_state_finalize(GstVaapiParserState *ps)
|
|
|
|
{
|
|
|
|
if (ps->input_adapter) {
|
|
|
|
gst_adapter_clear(ps->input_adapter);
|
|
|
|
g_object_unref(ps->input_adapter);
|
|
|
|
ps->input_adapter = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps->output_adapter) {
|
|
|
|
gst_adapter_clear(ps->output_adapter);
|
|
|
|
g_object_unref(ps->output_adapter);
|
|
|
|
ps->output_adapter = NULL;
|
|
|
|
}
|
2013-01-07 12:41:59 +00:00
|
|
|
|
|
|
|
if (ps->next_unit_pending) {
|
|
|
|
gst_vaapi_decoder_unit_clear(&ps->next_unit);
|
|
|
|
ps->next_unit_pending = FALSE;
|
|
|
|
}
|
2012-12-06 12:57:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
parser_state_init(GstVaapiParserState *ps)
|
|
|
|
{
|
2013-05-06 12:07:17 +00:00
|
|
|
memset(ps, 0, sizeof(*ps));
|
|
|
|
|
2012-12-06 12:57:42 +00:00
|
|
|
ps->input_adapter = gst_adapter_new();
|
|
|
|
if (!ps->input_adapter)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
ps->output_adapter = gst_adapter_new();
|
|
|
|
if (!ps->output_adapter)
|
|
|
|
return FALSE;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
parser_state_prepare(GstVaapiParserState *ps, GstAdapter *adapter)
|
|
|
|
{
|
|
|
|
/* XXX: check we really have a continuity from the previous call */
|
|
|
|
if (ps->current_adapter != adapter)
|
|
|
|
goto reset;
|
|
|
|
return;
|
|
|
|
|
|
|
|
reset:
|
|
|
|
ps->current_adapter = adapter;
|
2013-09-20 08:12:08 +00:00
|
|
|
ps->input_offset1 = -1;
|
2012-12-06 12:57:42 +00:00
|
|
|
ps->input_offset2 = -1;
|
|
|
|
}
|
|
|
|
|
2010-04-23 16:05:58 +00:00
|
|
|
static gboolean
|
|
|
|
push_buffer(GstVaapiDecoder *decoder, GstBuffer *buffer)
|
|
|
|
{
|
2010-04-26 11:44:32 +00:00
|
|
|
if (!buffer) {
|
2010-05-03 21:25:46 +00:00
|
|
|
buffer = gst_buffer_new();
|
2010-04-27 15:26:19 +00:00
|
|
|
if (!buffer)
|
|
|
|
return FALSE;
|
2010-05-03 21:25:46 +00:00
|
|
|
GST_BUFFER_FLAG_SET(buffer, GST_BUFFER_FLAG_EOS);
|
2010-04-26 11:44:32 +00:00
|
|
|
}
|
2010-04-23 16:05:58 +00:00
|
|
|
|
2014-01-02 10:17:28 +00:00
|
|
|
GST_DEBUG("queue encoded data buffer %p (%zu bytes)",
|
2012-09-04 12:12:18 +00:00
|
|
|
buffer, gst_buffer_get_size(buffer));
|
2010-04-23 16:05:58 +00:00
|
|
|
|
2013-05-06 12:07:17 +00:00
|
|
|
g_async_queue_push(decoder->buffers, buffer);
|
2010-04-23 16:05:58 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2010-04-27 15:26:19 +00:00
|
|
|
static GstBuffer *
|
|
|
|
pop_buffer(GstVaapiDecoder *decoder)
|
|
|
|
{
|
|
|
|
GstBuffer *buffer;
|
|
|
|
|
2013-05-06 12:07:17 +00:00
|
|
|
buffer = g_async_queue_try_pop(decoder->buffers);
|
2010-04-29 17:11:32 +00:00
|
|
|
if (!buffer)
|
|
|
|
return NULL;
|
2010-04-27 15:26:19 +00:00
|
|
|
|
2014-01-02 10:17:28 +00:00
|
|
|
GST_DEBUG("dequeue buffer %p for decoding (%zu bytes)",
|
2012-09-04 12:12:18 +00:00
|
|
|
buffer, gst_buffer_get_size(buffer));
|
2010-04-29 14:28:43 +00:00
|
|
|
|
2010-04-27 15:26:19 +00:00
|
|
|
return buffer;
|
|
|
|
}
|
|
|
|
|
2012-12-06 12:57:42 +00:00
|
|
|
static GstVaapiDecoderStatus
|
|
|
|
do_parse(GstVaapiDecoder *decoder,
|
|
|
|
GstVideoCodecFrame *base_frame, GstAdapter *adapter, gboolean at_eos,
|
|
|
|
guint *got_unit_size_ptr, gboolean *got_frame_ptr)
|
|
|
|
{
|
2013-05-06 12:07:17 +00:00
|
|
|
GstVaapiParserState * const ps = &decoder->parser_state;
|
2013-04-16 11:23:41 +00:00
|
|
|
GstVaapiParserFrame *frame;
|
2012-12-06 12:57:42 +00:00
|
|
|
GstVaapiDecoderUnit *unit;
|
|
|
|
GstVaapiDecoderStatus status;
|
|
|
|
|
|
|
|
*got_unit_size_ptr = 0;
|
|
|
|
*got_frame_ptr = FALSE;
|
|
|
|
|
|
|
|
frame = gst_video_codec_frame_get_user_data(base_frame);
|
|
|
|
if (!frame) {
|
2013-05-06 12:07:17 +00:00
|
|
|
GstVideoCodecState * const codec_state = decoder->codec_state;
|
2013-04-16 11:23:41 +00:00
|
|
|
frame = gst_vaapi_parser_frame_new(codec_state->info.width,
|
2013-01-07 12:59:07 +00:00
|
|
|
codec_state->info.height);
|
2012-12-06 12:57:42 +00:00
|
|
|
if (!frame)
|
|
|
|
return GST_VAAPI_DECODER_STATUS_ERROR_ALLOCATION_FAILED;
|
|
|
|
gst_video_codec_frame_set_user_data(base_frame,
|
|
|
|
frame, (GDestroyNotify)gst_vaapi_mini_object_unref);
|
|
|
|
}
|
|
|
|
|
|
|
|
parser_state_prepare(ps, adapter);
|
|
|
|
|
2013-01-07 12:41:59 +00:00
|
|
|
unit = &ps->next_unit;
|
|
|
|
if (ps->next_unit_pending) {
|
|
|
|
ps->next_unit_pending = FALSE;
|
2012-12-06 12:57:42 +00:00
|
|
|
goto got_unit;
|
2013-01-07 12:41:59 +00:00
|
|
|
}
|
|
|
|
gst_vaapi_decoder_unit_init(unit);
|
2013-01-07 10:13:07 +00:00
|
|
|
|
2012-12-06 12:57:42 +00:00
|
|
|
ps->current_frame = base_frame;
|
|
|
|
status = GST_VAAPI_DECODER_GET_CLASS(decoder)->parse(decoder,
|
2013-01-07 10:13:07 +00:00
|
|
|
adapter, at_eos, unit);
|
2013-01-29 15:18:13 +00:00
|
|
|
if (status != GST_VAAPI_DECODER_STATUS_SUCCESS) {
|
|
|
|
if (at_eos && frame->units->len > 0 &&
|
|
|
|
status == GST_VAAPI_DECODER_STATUS_ERROR_NO_DATA) {
|
|
|
|
/* XXX: assume the frame is complete at <EOS> */
|
|
|
|
*got_frame_ptr = TRUE;
|
|
|
|
return GST_VAAPI_DECODER_STATUS_SUCCESS;
|
|
|
|
}
|
2012-12-06 12:57:42 +00:00
|
|
|
return status;
|
2013-01-29 15:18:13 +00:00
|
|
|
}
|
2012-12-06 12:57:42 +00:00
|
|
|
|
2013-01-07 12:41:59 +00:00
|
|
|
if (GST_VAAPI_DECODER_UNIT_IS_FRAME_START(unit) && frame->units->len > 0) {
|
|
|
|
ps->next_unit_pending = TRUE;
|
|
|
|
*got_frame_ptr = TRUE;
|
|
|
|
return GST_VAAPI_DECODER_STATUS_SUCCESS;
|
2012-12-06 12:57:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
got_unit:
|
2013-04-16 11:23:41 +00:00
|
|
|
gst_vaapi_parser_frame_append_unit(frame, unit);
|
2012-12-06 12:57:42 +00:00
|
|
|
*got_unit_size_ptr = unit->size;
|
2013-01-07 12:41:59 +00:00
|
|
|
*got_frame_ptr = GST_VAAPI_DECODER_UNIT_IS_FRAME_END(unit);
|
2012-12-27 17:52:43 +00:00
|
|
|
return GST_VAAPI_DECODER_STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstVaapiDecoderStatus
|
2013-01-07 12:41:59 +00:00
|
|
|
do_decode_units(GstVaapiDecoder *decoder, GArray *units)
|
2012-12-27 17:52:43 +00:00
|
|
|
{
|
|
|
|
GstVaapiDecoderClass * const klass = GST_VAAPI_DECODER_GET_CLASS(decoder);
|
|
|
|
GstVaapiDecoderStatus status;
|
2013-01-07 12:41:59 +00:00
|
|
|
guint i;
|
2012-12-27 17:52:43 +00:00
|
|
|
|
2013-01-07 12:41:59 +00:00
|
|
|
for (i = 0; i < units->len; i++) {
|
|
|
|
GstVaapiDecoderUnit * const unit =
|
|
|
|
&g_array_index(units, GstVaapiDecoderUnit, i);
|
2012-12-27 17:52:43 +00:00
|
|
|
if (GST_VAAPI_DECODER_UNIT_IS_SKIPPED(unit))
|
|
|
|
continue;
|
|
|
|
status = klass->decode(decoder, unit);
|
|
|
|
if (status != GST_VAAPI_DECODER_STATUS_SUCCESS)
|
|
|
|
return status;
|
2012-12-06 12:57:42 +00:00
|
|
|
}
|
|
|
|
return GST_VAAPI_DECODER_STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstVaapiDecoderStatus
|
2013-04-16 11:23:41 +00:00
|
|
|
do_decode_1(GstVaapiDecoder *decoder, GstVaapiParserFrame *frame)
|
2012-12-06 12:57:42 +00:00
|
|
|
{
|
|
|
|
GstVaapiDecoderClass * const klass = GST_VAAPI_DECODER_GET_CLASS(decoder);
|
|
|
|
GstVaapiDecoderStatus status;
|
|
|
|
|
2013-01-07 12:41:59 +00:00
|
|
|
if (frame->pre_units->len > 0) {
|
|
|
|
status = do_decode_units(decoder, frame->pre_units);
|
2012-12-27 17:52:43 +00:00
|
|
|
if (status != GST_VAAPI_DECODER_STATUS_SUCCESS)
|
|
|
|
return status;
|
2012-12-13 09:20:35 +00:00
|
|
|
}
|
|
|
|
|
2013-01-07 12:41:59 +00:00
|
|
|
if (frame->units->len > 0) {
|
2012-12-27 17:52:43 +00:00
|
|
|
if (klass->start_frame) {
|
2013-01-07 12:41:59 +00:00
|
|
|
GstVaapiDecoderUnit * const unit =
|
|
|
|
&g_array_index(frame->units, GstVaapiDecoderUnit, 0);
|
|
|
|
status = klass->start_frame(decoder, unit);
|
2012-12-27 17:52:43 +00:00
|
|
|
if (status != GST_VAAPI_DECODER_STATUS_SUCCESS)
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2013-01-07 12:41:59 +00:00
|
|
|
status = do_decode_units(decoder, frame->units);
|
2012-12-06 12:57:42 +00:00
|
|
|
if (status != GST_VAAPI_DECODER_STATUS_SUCCESS)
|
|
|
|
return status;
|
2012-12-27 17:52:43 +00:00
|
|
|
|
|
|
|
if (klass->end_frame) {
|
|
|
|
status = klass->end_frame(decoder);
|
|
|
|
if (status != GST_VAAPI_DECODER_STATUS_SUCCESS)
|
|
|
|
return status;
|
|
|
|
}
|
2012-12-06 12:57:42 +00:00
|
|
|
}
|
2012-12-13 09:20:35 +00:00
|
|
|
|
2013-01-07 12:41:59 +00:00
|
|
|
if (frame->post_units->len > 0) {
|
|
|
|
status = do_decode_units(decoder, frame->post_units);
|
2012-12-13 09:20:35 +00:00
|
|
|
if (status != GST_VAAPI_DECODER_STATUS_SUCCESS)
|
|
|
|
return status;
|
|
|
|
}
|
2013-01-30 15:33:48 +00:00
|
|
|
|
|
|
|
/* Drop frame if there is no slice data unit in there */
|
|
|
|
if (G_UNLIKELY(frame->units->len == 0))
|
|
|
|
return GST_VAAPI_DECODER_STATUS_DROP_FRAME;
|
2012-12-06 12:57:42 +00:00
|
|
|
return GST_VAAPI_DECODER_STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2013-01-07 12:41:59 +00:00
|
|
|
static inline GstVaapiDecoderStatus
|
|
|
|
do_decode(GstVaapiDecoder *decoder, GstVideoCodecFrame *base_frame)
|
|
|
|
{
|
2013-05-06 12:07:17 +00:00
|
|
|
GstVaapiParserState * const ps = &decoder->parser_state;
|
2013-04-16 11:23:41 +00:00
|
|
|
GstVaapiParserFrame * const frame = base_frame->user_data;
|
2013-01-07 12:41:59 +00:00
|
|
|
GstVaapiDecoderStatus status;
|
|
|
|
|
|
|
|
ps->current_frame = base_frame;
|
|
|
|
|
2013-04-16 11:23:41 +00:00
|
|
|
gst_vaapi_parser_frame_ref(frame);
|
2013-01-07 12:41:59 +00:00
|
|
|
status = do_decode_1(decoder, frame);
|
2013-04-16 11:23:41 +00:00
|
|
|
gst_vaapi_parser_frame_unref(frame);
|
2013-01-30 15:33:48 +00:00
|
|
|
|
|
|
|
switch ((guint)status) {
|
|
|
|
case GST_VAAPI_DECODER_STATUS_DROP_FRAME:
|
|
|
|
drop_frame(decoder, base_frame);
|
|
|
|
status = GST_VAAPI_DECODER_STATUS_SUCCESS;
|
|
|
|
break;
|
|
|
|
}
|
2013-01-07 12:41:59 +00:00
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2013-01-17 17:33:32 +00:00
|
|
|
static inline GstVaapiDecoderStatus
|
|
|
|
do_flush(GstVaapiDecoder *decoder)
|
|
|
|
{
|
|
|
|
GstVaapiDecoderClass * const klass = GST_VAAPI_DECODER_GET_CLASS(decoder);
|
|
|
|
|
|
|
|
if (klass->flush)
|
|
|
|
return klass->flush(decoder);
|
|
|
|
return GST_VAAPI_DECODER_STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2010-04-30 15:37:28 +00:00
|
|
|
static GstVaapiDecoderStatus
|
|
|
|
decode_step(GstVaapiDecoder *decoder)
|
|
|
|
{
|
2013-05-06 12:07:17 +00:00
|
|
|
GstVaapiParserState * const ps = &decoder->parser_state;
|
2010-04-30 15:37:28 +00:00
|
|
|
GstVaapiDecoderStatus status;
|
|
|
|
GstBuffer *buffer;
|
2013-01-15 16:21:50 +00:00
|
|
|
gboolean got_frame;
|
2013-01-18 15:56:15 +00:00
|
|
|
guint got_unit_size, input_size;
|
2013-01-15 16:21:50 +00:00
|
|
|
|
2012-02-06 14:54:09 +00:00
|
|
|
status = gst_vaapi_decoder_check_status(decoder);
|
|
|
|
if (status != GST_VAAPI_DECODER_STATUS_SUCCESS)
|
|
|
|
return status;
|
2010-05-15 05:36:15 +00:00
|
|
|
|
2013-01-18 15:56:15 +00:00
|
|
|
/* Fill adapter with all buffers we have in the queue */
|
|
|
|
for (;;) {
|
2010-04-30 15:37:28 +00:00
|
|
|
buffer = pop_buffer(decoder);
|
|
|
|
if (!buffer)
|
2013-01-18 15:56:15 +00:00
|
|
|
break;
|
2010-04-30 15:37:28 +00:00
|
|
|
|
2013-01-15 16:21:50 +00:00
|
|
|
ps->at_eos = GST_BUFFER_IS_EOS(buffer);
|
|
|
|
if (!ps->at_eos)
|
2012-12-06 12:57:42 +00:00
|
|
|
gst_adapter_push(ps->input_adapter, buffer);
|
2013-01-18 15:56:15 +00:00
|
|
|
}
|
2012-12-06 12:57:42 +00:00
|
|
|
|
2013-01-18 15:56:15 +00:00
|
|
|
/* Parse and decode all decode units */
|
|
|
|
input_size = gst_adapter_available(ps->input_adapter);
|
|
|
|
if (input_size == 0) {
|
|
|
|
if (ps->at_eos)
|
|
|
|
return GST_VAAPI_DECODER_STATUS_END_OF_STREAM;
|
|
|
|
return GST_VAAPI_DECODER_STATUS_ERROR_NO_DATA;
|
|
|
|
}
|
2012-12-06 12:57:42 +00:00
|
|
|
|
2013-01-18 15:56:15 +00:00
|
|
|
do {
|
|
|
|
if (!ps->current_frame) {
|
|
|
|
ps->current_frame = g_slice_new0(GstVideoCodecFrame);
|
|
|
|
if (!ps->current_frame)
|
|
|
|
return GST_VAAPI_DECODER_STATUS_ERROR_ALLOCATION_FAILED;
|
|
|
|
ps->current_frame->ref_count = 1;
|
2014-01-22 17:11:26 +00:00
|
|
|
ps->current_frame->system_frame_number = ps->current_frame_number++;
|
2013-01-18 15:56:15 +00:00
|
|
|
}
|
2012-12-06 12:57:42 +00:00
|
|
|
|
2013-01-18 15:56:15 +00:00
|
|
|
status = do_parse(decoder, ps->current_frame, ps->input_adapter,
|
|
|
|
ps->at_eos, &got_unit_size, &got_frame);
|
|
|
|
GST_DEBUG("parse frame (status = %d)", status);
|
|
|
|
if (status != GST_VAAPI_DECODER_STATUS_SUCCESS) {
|
|
|
|
if (status == GST_VAAPI_DECODER_STATUS_ERROR_NO_DATA && ps->at_eos)
|
|
|
|
status = GST_VAAPI_DECODER_STATUS_END_OF_STREAM;
|
|
|
|
break;
|
|
|
|
}
|
2012-12-06 12:57:42 +00:00
|
|
|
|
2013-01-18 15:56:15 +00:00
|
|
|
if (got_unit_size > 0) {
|
|
|
|
buffer = gst_adapter_take_buffer(ps->input_adapter, got_unit_size);
|
|
|
|
input_size -= got_unit_size;
|
2012-12-06 12:57:42 +00:00
|
|
|
|
2013-01-18 15:56:15 +00:00
|
|
|
if (gst_adapter_available(ps->output_adapter) == 0) {
|
|
|
|
ps->current_frame->pts =
|
|
|
|
gst_adapter_prev_timestamp(ps->input_adapter, NULL);
|
2012-12-06 12:57:42 +00:00
|
|
|
}
|
2013-01-18 15:56:15 +00:00
|
|
|
gst_adapter_push(ps->output_adapter, buffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (got_frame) {
|
|
|
|
ps->current_frame->input_buffer = gst_adapter_take_buffer(
|
|
|
|
ps->output_adapter,
|
|
|
|
gst_adapter_available(ps->output_adapter));
|
|
|
|
|
|
|
|
status = do_decode(decoder, ps->current_frame);
|
|
|
|
GST_DEBUG("decode frame (status = %d)", status);
|
|
|
|
|
|
|
|
gst_video_codec_frame_unref(ps->current_frame);
|
|
|
|
ps->current_frame = NULL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} while (input_size > 0);
|
2010-04-30 15:37:28 +00:00
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2013-01-30 15:33:48 +00:00
|
|
|
static void
|
|
|
|
drop_frame(GstVaapiDecoder *decoder, GstVideoCodecFrame *frame)
|
|
|
|
{
|
|
|
|
GST_DEBUG("drop frame %d", frame->system_frame_number);
|
|
|
|
|
|
|
|
/* no surface proxy */
|
|
|
|
gst_video_codec_frame_set_user_data(frame, NULL, NULL);
|
|
|
|
|
|
|
|
frame->pts = GST_CLOCK_TIME_NONE;
|
|
|
|
GST_VIDEO_CODEC_FRAME_FLAG_SET(frame,
|
|
|
|
GST_VIDEO_CODEC_FRAME_FLAG_DECODE_ONLY);
|
|
|
|
|
2013-05-06 12:07:17 +00:00
|
|
|
g_async_queue_push(decoder->frames, gst_video_codec_frame_ref(frame));
|
2013-01-30 15:33:48 +00:00
|
|
|
}
|
|
|
|
|
2012-01-26 13:54:31 +00:00
|
|
|
static inline void
|
2012-12-13 14:34:10 +00:00
|
|
|
push_frame(GstVaapiDecoder *decoder, GstVideoCodecFrame *frame)
|
2010-04-28 23:09:52 +00:00
|
|
|
{
|
2013-04-16 16:56:24 +00:00
|
|
|
GstVaapiSurfaceProxy * const proxy = frame->user_data;
|
2010-04-28 23:09:52 +00:00
|
|
|
|
2014-01-22 17:11:26 +00:00
|
|
|
GST_DEBUG("push frame %d (surface 0x%08x)", frame->system_frame_number,
|
2014-01-23 21:47:19 +00:00
|
|
|
(guint32) GST_VAAPI_SURFACE_PROXY_SURFACE_ID(proxy));
|
2010-05-03 21:14:01 +00:00
|
|
|
|
2013-05-06 12:07:17 +00:00
|
|
|
g_async_queue_push(decoder->frames, gst_video_codec_frame_ref(frame));
|
2010-04-28 23:09:52 +00:00
|
|
|
}
|
|
|
|
|
2012-12-13 14:34:10 +00:00
|
|
|
static inline GstVideoCodecFrame *
|
2013-04-25 11:56:18 +00:00
|
|
|
pop_frame(GstVaapiDecoder *decoder, guint64 timeout)
|
2010-04-28 23:09:52 +00:00
|
|
|
{
|
2012-12-13 14:34:10 +00:00
|
|
|
GstVideoCodecFrame *frame;
|
2013-04-16 16:56:24 +00:00
|
|
|
GstVaapiSurfaceProxy *proxy;
|
2012-12-13 14:34:10 +00:00
|
|
|
|
2013-04-25 11:56:18 +00:00
|
|
|
if (G_LIKELY(timeout > 0))
|
2013-05-06 12:07:17 +00:00
|
|
|
frame = g_async_queue_timeout_pop(decoder->frames, timeout);
|
2013-04-25 11:56:18 +00:00
|
|
|
else
|
2013-05-06 12:07:17 +00:00
|
|
|
frame = g_async_queue_try_pop(decoder->frames);
|
2012-12-13 14:34:10 +00:00
|
|
|
if (!frame)
|
|
|
|
return NULL;
|
|
|
|
|
2013-04-16 16:56:24 +00:00
|
|
|
proxy = frame->user_data;
|
2014-01-22 17:11:26 +00:00
|
|
|
GST_DEBUG("pop frame %d (surface 0x%08x)", frame->system_frame_number,
|
2014-01-23 21:47:19 +00:00
|
|
|
(proxy ? (guint32) GST_VAAPI_SURFACE_PROXY_SURFACE_ID(proxy) :
|
|
|
|
VA_INVALID_ID));
|
2010-04-28 23:09:52 +00:00
|
|
|
|
2012-12-13 14:34:10 +00:00
|
|
|
return frame;
|
2010-04-28 23:09:52 +00:00
|
|
|
}
|
|
|
|
|
2013-05-06 12:07:17 +00:00
|
|
|
static gboolean
|
2012-12-12 14:09:21 +00:00
|
|
|
set_caps(GstVaapiDecoder *decoder, const GstCaps *caps)
|
2010-05-03 21:49:35 +00:00
|
|
|
{
|
2013-05-06 12:07:17 +00:00
|
|
|
GstVideoCodecState * const codec_state = decoder->codec_state;
|
2010-05-03 22:02:41 +00:00
|
|
|
GstStructure * const structure = gst_caps_get_structure(caps, 0);
|
2010-05-03 21:49:35 +00:00
|
|
|
GstVaapiProfile profile;
|
|
|
|
const GValue *v_codec_data;
|
|
|
|
|
2010-05-03 22:02:41 +00:00
|
|
|
profile = gst_vaapi_profile_from_caps(caps);
|
|
|
|
if (!profile)
|
2013-05-06 12:07:17 +00:00
|
|
|
return FALSE;
|
2010-05-03 22:02:41 +00:00
|
|
|
|
2013-05-06 12:07:17 +00:00
|
|
|
decoder->codec = gst_vaapi_profile_get_codec(profile);
|
|
|
|
if (!decoder->codec)
|
|
|
|
return FALSE;
|
2010-05-03 21:49:35 +00:00
|
|
|
|
2012-12-12 14:09:21 +00:00
|
|
|
if (!gst_video_info_from_caps(&codec_state->info, caps))
|
2013-05-06 12:07:17 +00:00
|
|
|
return FALSE;
|
2010-05-15 15:33:20 +00:00
|
|
|
|
2012-12-12 14:09:21 +00:00
|
|
|
codec_state->caps = gst_caps_copy(caps);
|
2012-02-07 14:54:15 +00:00
|
|
|
|
2010-05-03 22:02:41 +00:00
|
|
|
v_codec_data = gst_structure_get_value(structure, "codec_data");
|
|
|
|
if (v_codec_data)
|
2012-12-12 14:09:21 +00:00
|
|
|
gst_buffer_replace(&codec_state->codec_data,
|
2012-12-07 15:40:44 +00:00
|
|
|
gst_value_get_buffer(v_codec_data));
|
2013-05-06 12:07:17 +00:00
|
|
|
return TRUE;
|
2010-05-03 21:49:35 +00:00
|
|
|
}
|
|
|
|
|
2012-12-12 14:09:21 +00:00
|
|
|
static inline GstCaps *
|
|
|
|
get_caps(GstVaapiDecoder *decoder)
|
|
|
|
{
|
|
|
|
return GST_VAAPI_DECODER_CODEC_STATE(decoder)->caps;
|
|
|
|
}
|
|
|
|
|
2010-04-23 16:05:58 +00:00
|
|
|
static void
|
2013-05-06 12:07:17 +00:00
|
|
|
notify_codec_state_changed(GstVaapiDecoder *decoder)
|
2010-04-23 16:05:58 +00:00
|
|
|
{
|
2013-05-06 12:07:17 +00:00
|
|
|
if (decoder->codec_state_changed_func)
|
|
|
|
decoder->codec_state_changed_func(decoder, decoder->codec_state,
|
|
|
|
decoder->codec_state_changed_data);
|
|
|
|
}
|
2010-04-23 16:05:58 +00:00
|
|
|
|
2013-05-06 12:07:17 +00:00
|
|
|
void
|
|
|
|
gst_vaapi_decoder_finalize(GstVaapiDecoder *decoder)
|
|
|
|
{
|
|
|
|
const GstVaapiDecoderClass * const klass =
|
|
|
|
GST_VAAPI_DECODER_GET_CLASS(decoder);
|
2012-12-12 14:09:21 +00:00
|
|
|
|
2013-05-06 12:07:17 +00:00
|
|
|
if (klass->destroy)
|
|
|
|
klass->destroy(decoder);
|
|
|
|
|
|
|
|
gst_video_codec_state_unref(decoder->codec_state);
|
|
|
|
decoder->codec_state = NULL;
|
|
|
|
|
|
|
|
parser_state_finalize(&decoder->parser_state);
|
2010-05-03 21:49:35 +00:00
|
|
|
|
2013-05-06 12:07:17 +00:00
|
|
|
if (decoder->buffers) {
|
|
|
|
g_async_queue_unref(decoder->buffers);
|
|
|
|
decoder->buffers = NULL;
|
2010-04-23 16:05:58 +00:00
|
|
|
}
|
|
|
|
|
2013-05-06 12:07:17 +00:00
|
|
|
if (decoder->frames) {
|
|
|
|
g_async_queue_unref(decoder->frames);
|
|
|
|
decoder->frames = NULL;
|
2010-04-23 16:05:58 +00:00
|
|
|
}
|
|
|
|
|
2013-05-06 12:07:17 +00:00
|
|
|
gst_vaapi_object_replace(&decoder->context, NULL);
|
|
|
|
decoder->va_context = VA_INVALID_ID;
|
2010-04-23 16:05:58 +00:00
|
|
|
|
2013-05-07 09:39:34 +00:00
|
|
|
gst_vaapi_display_replace(&decoder->display, NULL);
|
2013-05-06 12:07:17 +00:00
|
|
|
decoder->va_display = NULL;
|
2010-04-23 16:05:58 +00:00
|
|
|
}
|
|
|
|
|
2013-05-06 12:07:17 +00:00
|
|
|
static gboolean
|
|
|
|
gst_vaapi_decoder_init(GstVaapiDecoder *decoder, GstVaapiDisplay *display,
|
|
|
|
GstCaps *caps)
|
2010-04-23 16:05:58 +00:00
|
|
|
{
|
2013-05-06 12:07:17 +00:00
|
|
|
const GstVaapiDecoderClass * const klass =
|
|
|
|
GST_VAAPI_DECODER_GET_CLASS(decoder);
|
|
|
|
GstVideoCodecState *codec_state;
|
|
|
|
guint sub_size;
|
2010-04-23 16:05:58 +00:00
|
|
|
|
2013-05-06 12:07:17 +00:00
|
|
|
parser_state_init(&decoder->parser_state);
|
2010-04-23 16:05:58 +00:00
|
|
|
|
2013-05-06 12:07:17 +00:00
|
|
|
codec_state = g_slice_new0(GstVideoCodecState);
|
|
|
|
codec_state->ref_count = 1;
|
|
|
|
gst_video_info_init(&codec_state->info);
|
2010-04-23 16:05:58 +00:00
|
|
|
|
2013-05-06 12:07:17 +00:00
|
|
|
decoder->user_data = NULL;
|
2013-05-07 09:39:34 +00:00
|
|
|
decoder->display = gst_vaapi_display_ref(display);
|
2013-05-06 12:07:17 +00:00
|
|
|
decoder->va_display = GST_VAAPI_DISPLAY_VADISPLAY(display);
|
|
|
|
decoder->context = NULL;
|
|
|
|
decoder->va_context = VA_INVALID_ID;
|
|
|
|
decoder->codec = 0;
|
|
|
|
decoder->codec_state = codec_state;
|
|
|
|
decoder->codec_state_changed_func = NULL;
|
|
|
|
decoder->codec_state_changed_data = NULL;
|
|
|
|
|
|
|
|
decoder->buffers = g_async_queue_new_full((GDestroyNotify)gst_buffer_unref);
|
|
|
|
decoder->frames = g_async_queue_new_full((GDestroyNotify)
|
|
|
|
gst_video_codec_frame_unref);
|
|
|
|
|
|
|
|
if (!set_caps(decoder, caps))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
sub_size = GST_VAAPI_MINI_OBJECT_CLASS(klass)->size - sizeof(*decoder);
|
|
|
|
if (sub_size > 0)
|
|
|
|
memset(((guchar *)decoder) + sizeof(*decoder), 0, sub_size);
|
|
|
|
|
|
|
|
if (klass->create && !klass->create(decoder))
|
|
|
|
return FALSE;
|
|
|
|
return TRUE;
|
2010-04-23 16:05:58 +00:00
|
|
|
}
|
|
|
|
|
2013-05-06 12:07:17 +00:00
|
|
|
GstVaapiDecoder *
|
|
|
|
gst_vaapi_decoder_new(const GstVaapiDecoderClass *klass,
|
|
|
|
GstVaapiDisplay *display, GstCaps *caps)
|
2010-04-23 16:05:58 +00:00
|
|
|
{
|
2013-05-06 12:07:17 +00:00
|
|
|
GstVaapiDecoder *decoder;
|
|
|
|
|
2013-05-23 16:15:48 +00:00
|
|
|
g_return_val_if_fail(display != NULL, NULL);
|
2013-05-06 12:07:17 +00:00
|
|
|
g_return_val_if_fail(GST_IS_CAPS(caps), NULL);
|
2010-04-23 16:05:58 +00:00
|
|
|
|
2013-05-06 12:07:17 +00:00
|
|
|
decoder = (GstVaapiDecoder *)
|
|
|
|
gst_vaapi_mini_object_new(GST_VAAPI_MINI_OBJECT_CLASS(klass));
|
|
|
|
if (!decoder)
|
|
|
|
return NULL;
|
2010-04-23 16:05:58 +00:00
|
|
|
|
2013-05-06 12:07:17 +00:00
|
|
|
if (!gst_vaapi_decoder_init(decoder, display, caps))
|
|
|
|
goto error;
|
|
|
|
return decoder;
|
2010-04-23 16:05:58 +00:00
|
|
|
|
2013-05-06 12:07:17 +00:00
|
|
|
error:
|
|
|
|
gst_vaapi_decoder_unref(decoder);
|
|
|
|
return NULL;
|
|
|
|
}
|
2010-04-23 16:05:58 +00:00
|
|
|
|
2013-05-06 12:07:17 +00:00
|
|
|
/**
|
|
|
|
* gst_vaapi_decoder_ref:
|
|
|
|
* @decoder: a #GstVaapiDecoder
|
|
|
|
*
|
|
|
|
* Atomically increases the reference count of the given @decoder by one.
|
|
|
|
*
|
|
|
|
* Returns: The same @decoder argument
|
|
|
|
*/
|
|
|
|
GstVaapiDecoder *
|
|
|
|
gst_vaapi_decoder_ref(GstVaapiDecoder *decoder)
|
|
|
|
{
|
|
|
|
return gst_vaapi_object_ref(decoder);
|
|
|
|
}
|
2012-08-08 03:50:41 +00:00
|
|
|
|
2013-05-06 12:07:17 +00:00
|
|
|
/**
|
|
|
|
* gst_vaapi_decoder_unref:
|
|
|
|
* @decoder: a #GstVaapiDecoder
|
|
|
|
*
|
|
|
|
* Atomically decreases the reference count of the @decoder by one. If
|
|
|
|
* the reference count reaches zero, the decoder will be free'd.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_vaapi_decoder_unref(GstVaapiDecoder *decoder)
|
|
|
|
{
|
|
|
|
gst_vaapi_object_unref(decoder);
|
2010-04-23 16:05:58 +00:00
|
|
|
}
|
|
|
|
|
2013-05-06 12:07:17 +00:00
|
|
|
/**
|
|
|
|
* gst_vaapi_decoder_replace:
|
|
|
|
* @old_decoder_ptr: a pointer to a #GstVaapiDecoder
|
|
|
|
* @new_decoder: a #GstVaapiDecoder
|
|
|
|
*
|
|
|
|
* Atomically replaces the decoder decoder held in @old_decoder_ptr
|
|
|
|
* with @new_decoder. This means that @old_decoder_ptr shall reference
|
|
|
|
* a valid decoder. However, @new_decoder can be NULL.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_vaapi_decoder_replace(GstVaapiDecoder **old_decoder_ptr,
|
|
|
|
GstVaapiDecoder *new_decoder)
|
2010-04-23 16:05:58 +00:00
|
|
|
{
|
2013-05-06 12:07:17 +00:00
|
|
|
gst_vaapi_object_replace(old_decoder_ptr, new_decoder);
|
|
|
|
}
|
2010-04-23 16:05:58 +00:00
|
|
|
|
2013-05-06 12:07:17 +00:00
|
|
|
/**
|
|
|
|
* gst_vaapi_decoder_get_user_data:
|
|
|
|
* @decoder: a #GstVaapiDecoder
|
|
|
|
*
|
|
|
|
* Retrieves the user-defined data associated with the @decoder, if any.
|
|
|
|
*
|
|
|
|
* Return value: the user-defined data associated with the @decoder
|
|
|
|
*/
|
|
|
|
gpointer
|
|
|
|
gst_vaapi_decoder_get_user_data(GstVaapiDecoder *decoder)
|
|
|
|
{
|
2013-05-23 16:15:48 +00:00
|
|
|
g_return_val_if_fail(decoder != NULL, NULL);
|
2012-12-06 12:57:42 +00:00
|
|
|
|
2013-05-06 12:07:17 +00:00
|
|
|
return decoder->user_data;
|
|
|
|
}
|
2012-12-12 14:09:21 +00:00
|
|
|
|
2013-05-06 12:07:17 +00:00
|
|
|
/**
|
|
|
|
* gst_vaapi_decoder_set_user_data:
|
|
|
|
* @decoder: a #GstVaapiDecoder
|
|
|
|
* @user_data: the pointer to user-defined data
|
|
|
|
*
|
|
|
|
* Associates user-defined @user_data to the @decoder. Retrieve the
|
|
|
|
* attached value with gst_vaapi_decoder_get_user_data() function.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_vaapi_decoder_set_user_data(GstVaapiDecoder *decoder, gpointer user_data)
|
|
|
|
{
|
2013-05-23 16:15:48 +00:00
|
|
|
g_return_if_fail(decoder != NULL);
|
2013-04-25 11:56:18 +00:00
|
|
|
|
2013-05-06 12:07:17 +00:00
|
|
|
decoder->user_data = user_data;
|
2010-04-26 11:44:32 +00:00
|
|
|
}
|
|
|
|
|
2012-09-11 15:03:33 +00:00
|
|
|
/**
|
|
|
|
* gst_vaapi_decoder_get_codec:
|
|
|
|
* @decoder: a #GstVaapiDecoder
|
|
|
|
*
|
|
|
|
* Retrieves the @decoder codec type.
|
|
|
|
*
|
|
|
|
* Return value: the #GstVaapiCodec type for @decoder
|
|
|
|
*/
|
|
|
|
GstVaapiCodec
|
|
|
|
gst_vaapi_decoder_get_codec(GstVaapiDecoder *decoder)
|
|
|
|
{
|
2013-05-23 16:15:48 +00:00
|
|
|
g_return_val_if_fail(decoder != NULL, (GstVaapiCodec)0);
|
2012-09-11 15:03:33 +00:00
|
|
|
|
2013-05-06 12:07:17 +00:00
|
|
|
return decoder->codec;
|
2012-09-11 15:03:33 +00:00
|
|
|
}
|
|
|
|
|
2012-12-12 14:09:21 +00:00
|
|
|
/**
|
|
|
|
* gst_vaapi_decoder_get_codec_state:
|
|
|
|
* @decoder: a #GstVaapiDecoder
|
|
|
|
*
|
2013-04-15 11:58:58 +00:00
|
|
|
* Retrieves the @decoder codec state. The decoder owns the returned
|
|
|
|
* #GstVideoCodecState structure, so use gst_video_codec_state_ref()
|
|
|
|
* whenever necessary.
|
2012-12-12 14:09:21 +00:00
|
|
|
*
|
|
|
|
* Return value: the #GstVideoCodecState object for @decoder
|
|
|
|
*/
|
|
|
|
GstVideoCodecState *
|
|
|
|
gst_vaapi_decoder_get_codec_state(GstVaapiDecoder *decoder)
|
|
|
|
{
|
2013-05-23 16:15:48 +00:00
|
|
|
g_return_val_if_fail(decoder != NULL, NULL);
|
2012-12-12 14:09:21 +00:00
|
|
|
|
2013-04-15 12:22:57 +00:00
|
|
|
return GST_VAAPI_DECODER_CODEC_STATE(decoder);
|
2012-12-12 14:09:21 +00:00
|
|
|
}
|
|
|
|
|
2013-05-06 12:07:17 +00:00
|
|
|
/**
|
|
|
|
* gst_vaapi_decoder_set_codec_state_changed_func:
|
|
|
|
* @decoder: a #GstVaapiDecoder
|
|
|
|
* @func: the function to call when codec state changed
|
|
|
|
* @user_data: a pointer to user-defined data
|
|
|
|
*
|
|
|
|
* Sets @func as the function to call whenever the @decoder codec
|
|
|
|
* state changes.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_vaapi_decoder_set_codec_state_changed_func(GstVaapiDecoder *decoder,
|
|
|
|
GstVaapiDecoderStateChangedFunc func, gpointer user_data)
|
|
|
|
{
|
2013-05-23 16:15:48 +00:00
|
|
|
g_return_if_fail(decoder != NULL);
|
2013-05-06 12:07:17 +00:00
|
|
|
|
|
|
|
decoder->codec_state_changed_func = func;
|
|
|
|
decoder->codec_state_changed_data = user_data;
|
|
|
|
}
|
|
|
|
|
2010-05-15 15:33:20 +00:00
|
|
|
/**
|
|
|
|
* gst_vaapi_decoder_get_caps:
|
|
|
|
* @decoder: a #GstVaapiDecoder
|
|
|
|
*
|
2013-04-15 11:58:58 +00:00
|
|
|
* Retrieves the @decoder caps. The decoder owns the returned caps, so
|
2010-05-15 15:33:20 +00:00
|
|
|
* use gst_caps_ref() whenever necessary.
|
|
|
|
*
|
|
|
|
* Return value: the @decoder caps
|
|
|
|
*/
|
|
|
|
GstCaps *
|
|
|
|
gst_vaapi_decoder_get_caps(GstVaapiDecoder *decoder)
|
|
|
|
{
|
2012-12-12 14:09:21 +00:00
|
|
|
return get_caps(decoder);
|
2010-05-15 15:33:20 +00:00
|
|
|
}
|
|
|
|
|
2010-04-23 16:05:58 +00:00
|
|
|
/**
|
|
|
|
* gst_vaapi_decoder_put_buffer:
|
|
|
|
* @decoder: a #GstVaapiDecoder
|
|
|
|
* @buf: a #GstBuffer
|
|
|
|
*
|
|
|
|
* Queues a #GstBuffer to the HW decoder. The decoder holds a
|
|
|
|
* reference to @buf.
|
|
|
|
*
|
2012-10-09 12:48:00 +00:00
|
|
|
* Caller can notify an End-Of-Stream with @buf set to %NULL. However,
|
|
|
|
* if an empty buffer is passed, i.e. a buffer with %NULL data pointer
|
|
|
|
* or size equals to zero, then the function ignores this buffer and
|
|
|
|
* returns %TRUE.
|
2010-04-23 16:05:58 +00:00
|
|
|
*
|
|
|
|
* Return value: %TRUE on success
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
gst_vaapi_decoder_put_buffer(GstVaapiDecoder *decoder, GstBuffer *buf)
|
|
|
|
{
|
2013-05-23 16:15:48 +00:00
|
|
|
g_return_val_if_fail(decoder != NULL, FALSE);
|
2010-04-23 16:05:58 +00:00
|
|
|
|
2012-10-09 12:48:00 +00:00
|
|
|
if (buf) {
|
2012-09-04 12:12:18 +00:00
|
|
|
if (gst_buffer_get_size(buf) == 0)
|
2012-10-09 12:48:00 +00:00
|
|
|
return TRUE;
|
|
|
|
buf = gst_buffer_ref(buf);
|
|
|
|
}
|
|
|
|
return push_buffer(decoder, buf);
|
2010-04-23 16:05:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_vaapi_decoder_get_surface:
|
|
|
|
* @decoder: a #GstVaapiDecoder
|
2012-12-12 12:44:07 +00:00
|
|
|
* @out_proxy_ptr: the next decoded surface as a #GstVaapiSurfaceProxy
|
2010-04-23 16:05:58 +00:00
|
|
|
*
|
2010-04-30 15:37:28 +00:00
|
|
|
* Flushes encoded buffers to the decoder and returns a decoded
|
|
|
|
* surface, if any.
|
2010-04-23 16:05:58 +00:00
|
|
|
*
|
2012-12-12 12:44:07 +00:00
|
|
|
* On successful return, *@out_proxy_ptr contains the decoded surface
|
|
|
|
* as a #GstVaapiSurfaceProxy. The caller owns this object, so
|
|
|
|
* gst_vaapi_surface_proxy_unref() shall be called after usage.
|
|
|
|
*
|
|
|
|
* Return value: a #GstVaapiDecoderStatus
|
2010-04-23 16:05:58 +00:00
|
|
|
*/
|
2012-12-12 12:44:07 +00:00
|
|
|
GstVaapiDecoderStatus
|
|
|
|
gst_vaapi_decoder_get_surface(GstVaapiDecoder *decoder,
|
|
|
|
GstVaapiSurfaceProxy **out_proxy_ptr)
|
2010-04-23 16:05:58 +00:00
|
|
|
{
|
2012-12-13 14:34:10 +00:00
|
|
|
GstVideoCodecFrame *frame;
|
2010-05-03 21:14:01 +00:00
|
|
|
GstVaapiDecoderStatus status;
|
|
|
|
|
2013-05-23 16:15:48 +00:00
|
|
|
g_return_val_if_fail(decoder != NULL,
|
2012-12-12 12:44:07 +00:00
|
|
|
GST_VAAPI_DECODER_STATUS_ERROR_INVALID_PARAMETER);
|
|
|
|
g_return_val_if_fail(out_proxy_ptr != NULL,
|
|
|
|
GST_VAAPI_DECODER_STATUS_ERROR_INVALID_PARAMETER);
|
2010-04-30 15:37:28 +00:00
|
|
|
|
2013-01-15 15:55:29 +00:00
|
|
|
do {
|
2013-04-25 11:56:18 +00:00
|
|
|
frame = pop_frame(decoder, 0);
|
2013-01-30 17:58:01 +00:00
|
|
|
while (frame) {
|
|
|
|
if (!GST_VIDEO_CODEC_FRAME_IS_DECODE_ONLY(frame)) {
|
2013-04-16 17:09:30 +00:00
|
|
|
GstVaapiSurfaceProxy * const proxy = frame->user_data;
|
|
|
|
proxy->timestamp = frame->pts;
|
|
|
|
proxy->duration = frame->duration;
|
2013-04-25 12:16:01 +00:00
|
|
|
*out_proxy_ptr = gst_vaapi_surface_proxy_ref(proxy);
|
2013-01-30 17:58:01 +00:00
|
|
|
gst_video_codec_frame_unref(frame);
|
|
|
|
return GST_VAAPI_DECODER_STATUS_SUCCESS;
|
|
|
|
}
|
2013-01-18 16:00:18 +00:00
|
|
|
gst_video_codec_frame_unref(frame);
|
2013-04-25 11:56:18 +00:00
|
|
|
frame = pop_frame(decoder, 0);
|
2013-01-18 16:00:18 +00:00
|
|
|
}
|
2013-01-15 15:55:29 +00:00
|
|
|
status = decode_step(decoder);
|
|
|
|
} while (status == GST_VAAPI_DECODER_STATUS_SUCCESS);
|
2010-04-30 15:37:28 +00:00
|
|
|
|
2013-01-18 16:00:18 +00:00
|
|
|
*out_proxy_ptr = NULL;
|
2012-12-12 12:44:07 +00:00
|
|
|
return status;
|
2010-04-23 16:05:58 +00:00
|
|
|
}
|
|
|
|
|
2012-12-13 13:27:18 +00:00
|
|
|
/**
|
|
|
|
* gst_vaapi_decoder_get_frame:
|
|
|
|
* @decoder: a #GstVaapiDecoder
|
|
|
|
* @out_frame_ptr: the next decoded frame as a #GstVideoCodecFrame
|
|
|
|
*
|
2012-12-13 14:34:10 +00:00
|
|
|
* On successful return, *@out_frame_ptr contains the next decoded
|
|
|
|
* frame available as a #GstVideoCodecFrame. The caller owns this
|
|
|
|
* object, so gst_video_codec_frame_unref() shall be called after
|
|
|
|
* usage. Otherwise, @GST_VAAPI_DECODER_STATUS_ERROR_NO_DATA is
|
|
|
|
* returned if no decoded frame is available.
|
2012-12-13 13:27:18 +00:00
|
|
|
*
|
|
|
|
* The actual surface is available as a #GstVaapiSurfaceProxy attached
|
|
|
|
* to the user-data anchor of the output frame. Ownership of the proxy
|
|
|
|
* is transferred to the frame.
|
|
|
|
*
|
2013-04-25 11:56:18 +00:00
|
|
|
* This is equivalent to gst_vaapi_decoder_get_frame_with_timeout()
|
|
|
|
* with a timeout value of zero.
|
|
|
|
*
|
2012-12-13 13:27:18 +00:00
|
|
|
* Return value: a #GstVaapiDecoderStatus
|
|
|
|
*/
|
|
|
|
GstVaapiDecoderStatus
|
|
|
|
gst_vaapi_decoder_get_frame(GstVaapiDecoder *decoder,
|
|
|
|
GstVideoCodecFrame **out_frame_ptr)
|
2013-04-25 11:56:18 +00:00
|
|
|
{
|
|
|
|
return gst_vaapi_decoder_get_frame_with_timeout(decoder, out_frame_ptr, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_vaapi_decoder_get_frame_with_timeout:
|
|
|
|
* @decoder: a #GstVaapiDecoder
|
|
|
|
* @out_frame_ptr: the next decoded frame as a #GstVideoCodecFrame
|
|
|
|
* @timeout: the number of microseconds to wait for the frame, at most
|
|
|
|
*
|
|
|
|
* On successful return, *@out_frame_ptr contains the next decoded
|
|
|
|
* frame available as a #GstVideoCodecFrame. The caller owns this
|
|
|
|
* object, so gst_video_codec_frame_unref() shall be called after
|
|
|
|
* usage. Otherwise, @GST_VAAPI_DECODER_STATUS_ERROR_NO_DATA is
|
|
|
|
* returned if no decoded frame is available.
|
|
|
|
*
|
|
|
|
* The actual surface is available as a #GstVaapiSurfaceProxy attached
|
|
|
|
* to the user-data anchor of the output frame. Ownership of the proxy
|
|
|
|
* is transferred to the frame.
|
|
|
|
*
|
|
|
|
* Return value: a #GstVaapiDecoderStatus
|
|
|
|
*/
|
|
|
|
GstVaapiDecoderStatus
|
|
|
|
gst_vaapi_decoder_get_frame_with_timeout(GstVaapiDecoder *decoder,
|
|
|
|
GstVideoCodecFrame **out_frame_ptr, guint64 timeout)
|
2012-12-13 13:27:18 +00:00
|
|
|
{
|
|
|
|
GstVideoCodecFrame *out_frame;
|
|
|
|
|
2013-05-23 16:15:48 +00:00
|
|
|
g_return_val_if_fail(decoder != NULL,
|
2012-12-13 13:27:18 +00:00
|
|
|
GST_VAAPI_DECODER_STATUS_ERROR_INVALID_PARAMETER);
|
|
|
|
g_return_val_if_fail(out_frame_ptr != NULL,
|
|
|
|
GST_VAAPI_DECODER_STATUS_ERROR_INVALID_PARAMETER);
|
|
|
|
|
2013-04-25 11:56:18 +00:00
|
|
|
out_frame = pop_frame(decoder, timeout);
|
2012-12-13 14:34:10 +00:00
|
|
|
if (!out_frame)
|
2012-12-13 13:27:18 +00:00
|
|
|
return GST_VAAPI_DECODER_STATUS_ERROR_NO_DATA;
|
|
|
|
|
2013-04-16 16:56:24 +00:00
|
|
|
#if !GST_CHECK_VERSION(1,0,0)
|
|
|
|
if (!GST_VIDEO_CODEC_FRAME_IS_DECODE_ONLY(out_frame)) {
|
|
|
|
const guint flags = GST_VAAPI_SURFACE_PROXY_FLAGS(out_frame->user_data);
|
|
|
|
guint out_flags = 0;
|
|
|
|
|
|
|
|
if (flags & GST_VAAPI_SURFACE_PROXY_FLAG_TFF)
|
|
|
|
out_flags |= GST_VIDEO_CODEC_FRAME_FLAG_TFF;
|
|
|
|
if (flags & GST_VAAPI_SURFACE_PROXY_FLAG_RFF)
|
|
|
|
out_flags |= GST_VIDEO_CODEC_FRAME_FLAG_RFF;
|
|
|
|
if (flags & GST_VAAPI_SURFACE_PROXY_FLAG_ONEFIELD)
|
|
|
|
out_flags |= GST_VIDEO_CODEC_FRAME_FLAG_ONEFIELD;
|
2013-04-17 08:14:55 +00:00
|
|
|
GST_VIDEO_CODEC_FRAME_FLAG_SET(out_frame, out_flags);
|
2013-04-16 16:56:24 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-12-13 13:27:18 +00:00
|
|
|
*out_frame_ptr = out_frame;
|
|
|
|
return GST_VAAPI_DECODER_STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2010-05-15 15:33:20 +00:00
|
|
|
void
|
|
|
|
gst_vaapi_decoder_set_picture_size(
|
|
|
|
GstVaapiDecoder *decoder,
|
|
|
|
guint width,
|
|
|
|
guint height
|
|
|
|
)
|
|
|
|
{
|
2013-05-06 12:07:17 +00:00
|
|
|
GstVideoCodecState * const codec_state = decoder->codec_state;
|
2011-07-22 13:34:48 +00:00
|
|
|
gboolean size_changed = FALSE;
|
2010-05-15 15:33:20 +00:00
|
|
|
|
2012-12-12 14:09:21 +00:00
|
|
|
if (codec_state->info.width != width) {
|
2010-05-15 15:33:20 +00:00
|
|
|
GST_DEBUG("picture width changed to %d", width);
|
2012-12-12 14:09:21 +00:00
|
|
|
codec_state->info.width = width;
|
|
|
|
gst_caps_set_simple(codec_state->caps,
|
|
|
|
"width", G_TYPE_INT, width, NULL);
|
2011-07-22 13:34:48 +00:00
|
|
|
size_changed = TRUE;
|
2010-05-15 15:33:20 +00:00
|
|
|
}
|
|
|
|
|
2012-12-12 14:09:21 +00:00
|
|
|
if (codec_state->info.height != height) {
|
2010-05-15 15:33:20 +00:00
|
|
|
GST_DEBUG("picture height changed to %d", height);
|
2012-12-12 14:09:21 +00:00
|
|
|
codec_state->info.height = height;
|
|
|
|
gst_caps_set_simple(codec_state->caps,
|
|
|
|
"height", G_TYPE_INT, height, NULL);
|
2011-07-22 13:34:48 +00:00
|
|
|
size_changed = TRUE;
|
2010-05-15 15:33:20 +00:00
|
|
|
}
|
|
|
|
|
2011-07-22 13:34:48 +00:00
|
|
|
if (size_changed)
|
2013-05-06 12:07:17 +00:00
|
|
|
notify_codec_state_changed(decoder);
|
2010-05-15 15:33:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gst_vaapi_decoder_set_framerate(
|
|
|
|
GstVaapiDecoder *decoder,
|
|
|
|
guint fps_n,
|
|
|
|
guint fps_d
|
|
|
|
)
|
|
|
|
{
|
2013-05-06 12:07:17 +00:00
|
|
|
GstVideoCodecState * const codec_state = decoder->codec_state;
|
2010-05-15 15:33:20 +00:00
|
|
|
|
|
|
|
if (!fps_n || !fps_d)
|
|
|
|
return;
|
|
|
|
|
2012-12-12 14:09:21 +00:00
|
|
|
if (codec_state->info.fps_n != fps_n || codec_state->info.fps_d != fps_d) {
|
2010-05-15 15:33:20 +00:00
|
|
|
GST_DEBUG("framerate changed to %u/%u", fps_n, fps_d);
|
2012-12-12 14:09:21 +00:00
|
|
|
codec_state->info.fps_n = fps_n;
|
|
|
|
codec_state->info.fps_d = fps_d;
|
|
|
|
gst_caps_set_simple(codec_state->caps,
|
|
|
|
"framerate", GST_TYPE_FRACTION, fps_n, fps_d, NULL);
|
2013-05-06 12:07:17 +00:00
|
|
|
notify_codec_state_changed(decoder);
|
2010-05-15 15:33:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gst_vaapi_decoder_set_pixel_aspect_ratio(
|
|
|
|
GstVaapiDecoder *decoder,
|
|
|
|
guint par_n,
|
|
|
|
guint par_d
|
|
|
|
)
|
|
|
|
{
|
2013-05-06 12:07:17 +00:00
|
|
|
GstVideoCodecState * const codec_state = decoder->codec_state;
|
2010-05-15 15:33:20 +00:00
|
|
|
|
|
|
|
if (!par_n || !par_d)
|
|
|
|
return;
|
|
|
|
|
2012-12-12 14:09:21 +00:00
|
|
|
if (codec_state->info.par_n != par_n || codec_state->info.par_d != par_d) {
|
2010-05-15 15:33:20 +00:00
|
|
|
GST_DEBUG("pixel-aspect-ratio changed to %u/%u", par_n, par_d);
|
2012-12-12 14:09:21 +00:00
|
|
|
codec_state->info.par_n = par_n;
|
|
|
|
codec_state->info.par_d = par_d;
|
|
|
|
gst_caps_set_simple(codec_state->caps,
|
|
|
|
"pixel-aspect-ratio", GST_TYPE_FRACTION, par_n, par_d, NULL);
|
2013-05-06 12:07:17 +00:00
|
|
|
notify_codec_state_changed(decoder);
|
2010-05-15 15:33:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-12-12 14:09:21 +00:00
|
|
|
static const gchar *
|
|
|
|
gst_interlace_mode_to_string(GstVideoInterlaceMode mode)
|
2012-02-07 14:54:15 +00:00
|
|
|
{
|
2012-12-12 14:09:21 +00:00
|
|
|
switch (mode) {
|
|
|
|
case GST_VIDEO_INTERLACE_MODE_PROGRESSIVE: return "progressive";
|
|
|
|
case GST_VIDEO_INTERLACE_MODE_INTERLEAVED: return "interleaved";
|
|
|
|
case GST_VIDEO_INTERLACE_MODE_MIXED: return "mixed";
|
|
|
|
}
|
|
|
|
return "<unknown>";
|
|
|
|
}
|
2012-02-07 14:54:15 +00:00
|
|
|
|
2012-12-12 14:09:21 +00:00
|
|
|
void
|
|
|
|
gst_vaapi_decoder_set_interlace_mode(GstVaapiDecoder *decoder,
|
|
|
|
GstVideoInterlaceMode mode)
|
|
|
|
{
|
2013-05-06 12:07:17 +00:00
|
|
|
GstVideoCodecState * const codec_state = decoder->codec_state;
|
2012-12-12 14:09:21 +00:00
|
|
|
|
|
|
|
if (codec_state->info.interlace_mode != mode) {
|
|
|
|
GST_DEBUG("interlace mode changed to %s",
|
|
|
|
gst_interlace_mode_to_string(mode));
|
|
|
|
codec_state->info.interlace_mode = mode;
|
|
|
|
gst_caps_set_simple(codec_state->caps, "interlaced",
|
|
|
|
G_TYPE_BOOLEAN, mode != GST_VIDEO_INTERLACE_MODE_PROGRESSIVE, NULL);
|
2013-05-06 12:07:17 +00:00
|
|
|
notify_codec_state_changed(decoder);
|
2012-02-07 14:54:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-12-12 14:09:21 +00:00
|
|
|
void
|
|
|
|
gst_vaapi_decoder_set_interlaced(GstVaapiDecoder *decoder, gboolean interlaced)
|
|
|
|
{
|
|
|
|
gst_vaapi_decoder_set_interlace_mode(decoder,
|
|
|
|
(interlaced ?
|
|
|
|
GST_VIDEO_INTERLACE_MODE_INTERLEAVED :
|
|
|
|
GST_VIDEO_INTERLACE_MODE_PROGRESSIVE));
|
|
|
|
}
|
|
|
|
|
2010-04-23 16:05:58 +00:00
|
|
|
gboolean
|
|
|
|
gst_vaapi_decoder_ensure_context(
|
2012-09-10 16:26:51 +00:00
|
|
|
GstVaapiDecoder *decoder,
|
|
|
|
GstVaapiContextInfo *cip
|
2010-04-23 16:05:58 +00:00
|
|
|
)
|
|
|
|
{
|
2013-05-07 14:43:51 +00:00
|
|
|
gst_vaapi_decoder_set_picture_size(decoder, cip->width, cip->height);
|
|
|
|
|
2014-01-23 12:30:41 +00:00
|
|
|
cip->usage = GST_VAAPI_CONTEXT_USAGE_DECODE;
|
2013-05-06 12:07:17 +00:00
|
|
|
if (decoder->context) {
|
2014-01-23 08:41:07 +00:00
|
|
|
if (!gst_vaapi_context_reset(decoder->context, cip))
|
2012-09-10 16:26:51 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else {
|
2014-01-23 08:41:07 +00:00
|
|
|
decoder->context = gst_vaapi_context_new(decoder->display, cip);
|
2013-05-06 12:07:17 +00:00
|
|
|
if (!decoder->context)
|
2012-09-10 16:26:51 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2013-05-06 12:07:17 +00:00
|
|
|
decoder->va_context = gst_vaapi_context_get_id(decoder->context);
|
2011-08-05 09:53:50 +00:00
|
|
|
return TRUE;
|
2010-04-23 16:05:58 +00:00
|
|
|
}
|
|
|
|
|
2012-01-26 13:54:31 +00:00
|
|
|
void
|
2012-12-13 14:34:10 +00:00
|
|
|
gst_vaapi_decoder_push_frame(GstVaapiDecoder *decoder,
|
|
|
|
GstVideoCodecFrame *frame)
|
2012-01-05 16:09:35 +00:00
|
|
|
{
|
2012-12-13 14:34:10 +00:00
|
|
|
push_frame(decoder, frame);
|
2010-04-23 16:05:58 +00:00
|
|
|
}
|
2012-02-06 14:54:09 +00:00
|
|
|
|
|
|
|
GstVaapiDecoderStatus
|
|
|
|
gst_vaapi_decoder_check_status(GstVaapiDecoder *decoder)
|
|
|
|
{
|
2013-05-06 12:07:17 +00:00
|
|
|
if (decoder->context &&
|
|
|
|
gst_vaapi_context_get_surface_count(decoder->context) < 1)
|
2012-02-06 14:54:09 +00:00
|
|
|
return GST_VAAPI_DECODER_STATUS_ERROR_NO_SURFACE;
|
|
|
|
return GST_VAAPI_DECODER_STATUS_SUCCESS;
|
|
|
|
}
|
2012-11-29 14:06:00 +00:00
|
|
|
|
|
|
|
GstVaapiDecoderStatus
|
|
|
|
gst_vaapi_decoder_parse(GstVaapiDecoder *decoder,
|
|
|
|
GstVideoCodecFrame *base_frame, GstAdapter *adapter, gboolean at_eos,
|
|
|
|
guint *got_unit_size_ptr, gboolean *got_frame_ptr)
|
|
|
|
{
|
2013-05-23 16:15:48 +00:00
|
|
|
g_return_val_if_fail(decoder != NULL,
|
2012-11-29 14:06:00 +00:00
|
|
|
GST_VAAPI_DECODER_STATUS_ERROR_INVALID_PARAMETER);
|
|
|
|
g_return_val_if_fail(base_frame != NULL,
|
|
|
|
GST_VAAPI_DECODER_STATUS_ERROR_INVALID_PARAMETER);
|
|
|
|
g_return_val_if_fail(adapter != NULL,
|
|
|
|
GST_VAAPI_DECODER_STATUS_ERROR_INVALID_PARAMETER);
|
|
|
|
g_return_val_if_fail(got_unit_size_ptr != NULL,
|
|
|
|
GST_VAAPI_DECODER_STATUS_ERROR_INVALID_PARAMETER);
|
|
|
|
g_return_val_if_fail(got_frame_ptr != NULL,
|
|
|
|
GST_VAAPI_DECODER_STATUS_ERROR_INVALID_PARAMETER);
|
|
|
|
|
|
|
|
return do_parse(decoder, base_frame, adapter, at_eos,
|
|
|
|
got_unit_size_ptr, got_frame_ptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
GstVaapiDecoderStatus
|
2012-12-13 13:27:18 +00:00
|
|
|
gst_vaapi_decoder_decode(GstVaapiDecoder *decoder, GstVideoCodecFrame *frame)
|
2012-11-29 14:06:00 +00:00
|
|
|
{
|
|
|
|
GstVaapiDecoderStatus status;
|
|
|
|
|
2013-05-23 16:15:48 +00:00
|
|
|
g_return_val_if_fail(decoder != NULL,
|
2012-11-29 14:06:00 +00:00
|
|
|
GST_VAAPI_DECODER_STATUS_ERROR_INVALID_PARAMETER);
|
2012-12-13 13:27:18 +00:00
|
|
|
g_return_val_if_fail(frame != NULL,
|
2012-11-29 14:06:00 +00:00
|
|
|
GST_VAAPI_DECODER_STATUS_ERROR_INVALID_PARAMETER);
|
2012-12-13 13:27:18 +00:00
|
|
|
g_return_val_if_fail(frame->user_data != NULL,
|
2012-11-29 14:06:00 +00:00
|
|
|
GST_VAAPI_DECODER_STATUS_ERROR_INVALID_PARAMETER);
|
|
|
|
|
|
|
|
status = gst_vaapi_decoder_check_status(decoder);
|
|
|
|
if (status != GST_VAAPI_DECODER_STATUS_SUCCESS)
|
|
|
|
return status;
|
2012-12-13 13:27:18 +00:00
|
|
|
return do_decode(decoder, frame);
|
2012-11-29 14:06:00 +00:00
|
|
|
}
|
2013-01-17 17:33:32 +00:00
|
|
|
|
|
|
|
GstVaapiDecoderStatus
|
|
|
|
gst_vaapi_decoder_flush(GstVaapiDecoder *decoder)
|
|
|
|
{
|
2013-05-23 16:15:48 +00:00
|
|
|
g_return_val_if_fail(decoder != NULL,
|
2013-01-17 17:33:32 +00:00
|
|
|
GST_VAAPI_DECODER_STATUS_ERROR_INVALID_PARAMETER);
|
|
|
|
|
|
|
|
return do_flush(decoder);
|
|
|
|
}
|
2013-03-21 13:36:40 +00:00
|
|
|
|
|
|
|
GstVaapiDecoderStatus
|
|
|
|
gst_vaapi_decoder_decode_codec_data(GstVaapiDecoder *decoder)
|
|
|
|
{
|
|
|
|
GstVaapiDecoderClass * const klass = GST_VAAPI_DECODER_GET_CLASS(decoder);
|
|
|
|
GstBuffer * const codec_data = GST_VAAPI_DECODER_CODEC_DATA(decoder);
|
|
|
|
GstVaapiDecoderStatus status;
|
2012-09-04 12:12:18 +00:00
|
|
|
GstMapInfo map_info;
|
2013-03-21 13:36:40 +00:00
|
|
|
const guchar *buf;
|
|
|
|
guint buf_size;
|
|
|
|
|
|
|
|
if (!codec_data)
|
|
|
|
return GST_VAAPI_DECODER_STATUS_SUCCESS;
|
|
|
|
|
|
|
|
/* FIXME: add a meaningful error code? */
|
|
|
|
if (!klass->decode_codec_data)
|
|
|
|
return GST_VAAPI_DECODER_STATUS_SUCCESS;
|
|
|
|
|
2012-09-04 12:12:18 +00:00
|
|
|
if (!gst_buffer_map(codec_data, &map_info, GST_MAP_READ)) {
|
|
|
|
GST_ERROR("failed to map buffer");
|
|
|
|
return GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN;
|
|
|
|
}
|
2013-03-21 13:36:40 +00:00
|
|
|
|
2012-09-04 12:12:18 +00:00
|
|
|
buf = map_info.data;
|
|
|
|
buf_size = map_info.size;
|
|
|
|
if (G_LIKELY(buf && buf_size > 0))
|
|
|
|
status = klass->decode_codec_data(decoder, buf, buf_size);
|
|
|
|
else
|
|
|
|
status = GST_VAAPI_DECODER_STATUS_SUCCESS;
|
2013-03-20 10:26:38 +00:00
|
|
|
gst_buffer_unmap(codec_data, &map_info);
|
2013-03-21 13:36:40 +00:00
|
|
|
return status;
|
|
|
|
}
|