mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-10 03:19:40 +00:00
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.
This commit is contained in:
parent
49dbb9af50
commit
f5e6444b78
3 changed files with 177 additions and 0 deletions
|
@ -45,6 +45,7 @@ libgstvaapi_source_c = \
|
|||
gstvaapicontext.c \
|
||||
gstvaapidecoder.c \
|
||||
gstvaapidecoder_dpb.c \
|
||||
gstvaapidecoder_frame.c \
|
||||
gstvaapidecoder_h264.c \
|
||||
gstvaapidecoder_mpeg2.c \
|
||||
gstvaapidecoder_mpeg4.c \
|
||||
|
@ -104,6 +105,7 @@ libgstvaapi_source_priv_h = \
|
|||
gstvaapicompat.h \
|
||||
gstvaapidebug.h \
|
||||
gstvaapidecoder_dpb.h \
|
||||
gstvaapidecoder_frame.h \
|
||||
gstvaapidecoder_objects.h \
|
||||
gstvaapidecoder_priv.h \
|
||||
gstvaapidecoder_unit.h \
|
||||
|
|
81
gst-libs/gst/vaapi/gstvaapidecoder_frame.c
Normal file
81
gst-libs/gst/vaapi/gstvaapidecoder_frame.c
Normal file
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
* 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;
|
||||
}
|
||||
}
|
94
gst-libs/gst/vaapi/gstvaapidecoder_frame.h
Normal file
94
gst-libs/gst/vaapi/gstvaapidecoder_frame.h
Normal file
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
* gstvaapidecoder_frame.h - 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
|
||||
*/
|
||||
|
||||
#ifndef GST_VAAPI_DECODER_FRAME_H
|
||||
#define GST_VAAPI_DECODER_FRAME_H
|
||||
|
||||
#include <gst/vaapi/gstvaapiminiobject.h>
|
||||
#include <gst/vaapi/gstvaapidecoder_unit.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _GstVaapiDecoderFrame GstVaapiDecoderFrame;
|
||||
|
||||
#define GST_VAAPI_DECODER_FRAME(frame) \
|
||||
((GstVaapiDecoderFrame *)(frame))
|
||||
|
||||
#define GST_VAAPI_IS_DECODER_FRAME(frame) \
|
||||
(GST_VAAPI_DECODER_FRAME(frame) != NULL)
|
||||
|
||||
/**
|
||||
* GstVaapiDecoderFrameFlags:
|
||||
*
|
||||
* Flags for #GstVaapiDecoderFrame.
|
||||
*/
|
||||
typedef enum {
|
||||
GST_VAAPI_DECODER_FRAME_FLAG_LAST = (1 << 0)
|
||||
} GstVaapiDecoderFrameFlags;
|
||||
|
||||
#define GST_VAAPI_DECODER_FRAME_FLAGS GST_VAAPI_MINI_OBJECT_FLAGS
|
||||
#define GST_VAAPI_DECODER_FRAME_FLAG_IS_SET GST_VAAPI_MINI_OBJECT_FLAG_IS_SET
|
||||
#define GST_VAAPI_DECODER_FRAME_FLAG_SET GST_VAAPI_MINI_OBJECT_FLAG_SET
|
||||
#define GST_VAAPI_DECODER_FRAME_FLAG_UNSET GST_VAAPI_MINI_OBJECT_FLAG_UNSET
|
||||
|
||||
/**
|
||||
* GstVaapiDecoderFrame:
|
||||
* @output_offset: current offset to the reconstructed #GstBuffer for
|
||||
* this #GstVideoCodecFrame. This is used to initialize the decoder
|
||||
* unit offset
|
||||
* @units: list of #GstVaapiDecoderUnit objects
|
||||
* @prev_slice: previous #GstVaapiDecoderUnit that was a slice, or NULL
|
||||
* if no slice data unit was received yet
|
||||
*
|
||||
* An extension to #GstVideoCodecFrame with #GstVaapiDecoder specific
|
||||
* information. Decoder frames are usually attached to codec frames as
|
||||
* the user_data anchor point.
|
||||
*/
|
||||
struct _GstVaapiDecoderFrame {
|
||||
/*< private >*/
|
||||
GstVaapiMiniObject parent_instance;
|
||||
|
||||
guint output_offset;
|
||||
GSList *units;
|
||||
GstVaapiDecoderUnit *prev_slice;
|
||||
};
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
GstVaapiDecoderFrame *
|
||||
gst_vaapi_decoder_frame_new(void);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
void
|
||||
gst_vaapi_decoder_frame_free(GstVaapiDecoderFrame *frame);
|
||||
|
||||
#define gst_vaapi_decoder_frame_ref(frame) \
|
||||
gst_vaapi_mini_object_ref(GST_VAAPI_MINI_OBJECT(frame))
|
||||
|
||||
#define gst_vaapi_decoder_frame_unref(frame) \
|
||||
gst_vaapi_mini_object_unref(GST_VAAPI_MINI_OBJECT(frame))
|
||||
|
||||
#define gst_vaapi_decoder_frame_replace(old_frame_p, new_frame) \
|
||||
gst_vaapi_mini_object_replace((GstVaapiMiniObject **)(old_frame_p), \
|
||||
(GstVaapiMiniObject *)(new_frame))
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* GST_VAAPI_DECODER_FRAME_H */
|
Loading…
Reference in a new issue