gstreamer/gst-libs/gst/vaapi/gstvaapidecoder_frame.c
Gwenole Beauchesne f5e6444b78 decoder: add new "decoder-frame" object.
Introduce a new GstVaapiDecoderFrame that is just a list of decoder units
(GstVaapiDecoderUnit objects) that constitute a frame. This object is just
an extension to GstVideoCodecFrame for VA decoder purposes. It is available
as the user-data member element.

This is a libgstvaapi internal object.
2012-12-18 15:31:51 +01:00

81 lines
2.2 KiB
C

/*
* gstvaapidecoder_frame.c - VA decoder frame
*
* Copyright (C) 2012 Intel Corporation
*
* 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.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* 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
*/
/**
* SECTION:gstvaapidecoder_frame
* @short_description: VA decoder frame
*/
#include "sysdeps.h"
#include "gstvaapidecoder_frame.h"
static inline const GstVaapiMiniObjectClass *
gst_vaapi_decoder_frame_class(void)
{
static const GstVaapiMiniObjectClass GstVaapiDecoderFrameClass = {
sizeof(GstVaapiDecoderFrame),
(GDestroyNotify)gst_vaapi_decoder_frame_free
};
return &GstVaapiDecoderFrameClass;
}
/**
* gst_vaapi_decoder_frame_new:
*
* Creates a new #GstVaapiDecoderFrame object.
*
* Returns: The newly allocated #GstVaapiDecoderFrame
*/
GstVaapiDecoderFrame *
gst_vaapi_decoder_frame_new(void)
{
GstVaapiDecoderFrame *frame;
frame = (GstVaapiDecoderFrame *)
gst_vaapi_mini_object_new(gst_vaapi_decoder_frame_class());
if (!frame)
return NULL;
frame->output_offset = 0;
frame->units = NULL;
frame->prev_slice = NULL;
return frame;
}
/**
* gst_vaapi_decoder_frame_free:
* @frame: a #GstVaapiDecoderFrame
*
* Deallocates any internal resources bound to the supplied decoder
* @frame.
*
* @note This is an internal function used to implement lightweight
* sub-classes.
*/
void
gst_vaapi_decoder_frame_free(GstVaapiDecoderFrame *frame)
{
if (frame->units) {
g_slist_free_full(frame->units,
(GDestroyNotify)gst_vaapi_mini_object_unref);
frame->units = NULL;
}
}