mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-14 05:12:09 +00:00
Port GstVaapiFrameStore to GstVaapiMiniObject.
This commit is contained in:
parent
f88374d642
commit
74533de9c6
1 changed files with 19 additions and 61 deletions
|
@ -261,36 +261,18 @@ gst_vaapi_slice_h264_new(
|
|||
/* --- Frame Buffers (DPB) --- */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
#define GST_VAAPI_TYPE_FRAME_STORE \
|
||||
(gst_vaapi_frame_store_get_type())
|
||||
|
||||
#define GST_VAAPI_FRAME_STORE_CAST(obj) \
|
||||
((GstVaapiFrameStore *)(obj))
|
||||
|
||||
#define GST_VAAPI_FRAME_STORE(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj), \
|
||||
GST_VAAPI_TYPE_FRAME_STORE, \
|
||||
GstVaapiFrameStore))
|
||||
|
||||
#define GST_VAAPI_FRAME_STORE_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST((klass), \
|
||||
GST_VAAPI_TYPE_FRAME_STORE, \
|
||||
GstVaapiFrameStoreClass))
|
||||
#define GST_VAAPI_FRAME_STORE(obj) \
|
||||
GST_VAAPI_FRAME_STORE_CAST(obj)
|
||||
|
||||
#define GST_VAAPI_IS_FRAME_STORE(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_VAAPI_TYPE_FRAME_STORE))
|
||||
|
||||
#define GST_VAAPI_IS_FRAME_STORE_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass), GST_VAAPI_TYPE_FRAME_STORE))
|
||||
|
||||
#define GST_VAAPI_FRAME_STORE_GET_CLASS(obj) \
|
||||
(G_TYPE_INSTANCE_GET_CLASS((obj), \
|
||||
GST_VAAPI_TYPE_FRAME_STORE, \
|
||||
GstVaapiFrameStoreClass))
|
||||
(GST_VAAPI_MINI_OBJECT(obj) != NULL)
|
||||
|
||||
struct _GstVaapiFrameStore {
|
||||
/*< private >*/
|
||||
GstMiniObject parent_instance;
|
||||
GstVaapiMiniObject parent_instance;
|
||||
|
||||
guint structure;
|
||||
GstVaapiPictureH264 *buffers[2];
|
||||
|
@ -298,45 +280,14 @@ struct _GstVaapiFrameStore {
|
|||
guint output_needed;
|
||||
};
|
||||
|
||||
struct _GstVaapiFrameStoreClass {
|
||||
/*< private >*/
|
||||
GstMiniObjectClass parent_class;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE(GstVaapiFrameStore, gst_vaapi_frame_store, GST_TYPE_MINI_OBJECT)
|
||||
|
||||
static void
|
||||
gst_vaapi_frame_store_finalize(GstMiniObject *object)
|
||||
gst_vaapi_frame_store_finalize(gpointer object)
|
||||
{
|
||||
GstVaapiFrameStore * const fs = GST_VAAPI_FRAME_STORE_CAST(object);
|
||||
GstMiniObjectClass *parent_class;
|
||||
GstVaapiFrameStore * const fs = object;
|
||||
guint i;
|
||||
|
||||
for (i = 0; i < fs->num_buffers; i++)
|
||||
gst_vaapi_picture_replace(&fs->buffers[i], NULL);
|
||||
|
||||
parent_class = GST_MINI_OBJECT_CLASS(gst_vaapi_frame_store_parent_class);
|
||||
if (parent_class->finalize)
|
||||
parent_class->finalize(object);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_vaapi_frame_store_init(GstVaapiFrameStore *fs)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gst_vaapi_frame_store_class_init(GstVaapiFrameStoreClass *klass)
|
||||
{
|
||||
GstMiniObjectClass * const object_class = GST_MINI_OBJECT_CLASS(klass);
|
||||
|
||||
object_class->finalize = gst_vaapi_frame_store_finalize;
|
||||
}
|
||||
|
||||
static inline gpointer
|
||||
_gst_vaapi_frame_store_new(void)
|
||||
{
|
||||
return gst_mini_object_new(GST_VAAPI_TYPE_FRAME_STORE);
|
||||
}
|
||||
|
||||
static GstVaapiFrameStore *
|
||||
|
@ -344,14 +295,21 @@ gst_vaapi_frame_store_new(GstVaapiPictureH264 *picture)
|
|||
{
|
||||
GstVaapiFrameStore *fs;
|
||||
|
||||
static const GstVaapiMiniObjectClass GstVaapiFrameStoreClass = {
|
||||
sizeof(GstVaapiFrameStore),
|
||||
gst_vaapi_frame_store_finalize
|
||||
};
|
||||
|
||||
g_return_val_if_fail(GST_VAAPI_IS_PICTURE_H264(picture), NULL);
|
||||
|
||||
fs = _gst_vaapi_frame_store_new();
|
||||
fs = (GstVaapiFrameStore *)
|
||||
gst_vaapi_mini_object_new(&GstVaapiFrameStoreClass);
|
||||
if (!fs)
|
||||
return NULL;
|
||||
|
||||
fs->structure = picture->structure;
|
||||
fs->buffers[0] = gst_vaapi_picture_ref(picture);
|
||||
fs->buffers[1] = NULL;
|
||||
fs->num_buffers = 1;
|
||||
fs->output_needed = picture->output_needed;
|
||||
return fs;
|
||||
|
@ -431,14 +389,14 @@ gst_vaapi_frame_store_has_reference(GstVaapiFrameStore *fs)
|
|||
}
|
||||
|
||||
#define gst_vaapi_frame_store_ref(fs) \
|
||||
gst_mini_object_ref(GST_MINI_OBJECT(fs))
|
||||
gst_vaapi_mini_object_ref(GST_VAAPI_MINI_OBJECT(fs))
|
||||
|
||||
#define gst_vaapi_frame_store_unref(fs) \
|
||||
gst_mini_object_unref(GST_MINI_OBJECT(fs))
|
||||
gst_vaapi_mini_object_unref(GST_VAAPI_MINI_OBJECT(fs))
|
||||
|
||||
#define gst_vaapi_frame_store_replace(old_fs_p, new_fs) \
|
||||
gst_mini_object_replace((GstMiniObject **)(old_fs_p), \
|
||||
(GstMiniObject *)(new_fs))
|
||||
#define gst_vaapi_frame_store_replace(old_fs_p, new_fs) \
|
||||
gst_vaapi_mini_object_replace((GstVaapiMiniObject **)(old_fs_p), \
|
||||
(GstVaapiMiniObject *)(new_fs))
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* --- H.264 Decoder --- */
|
||||
|
|
Loading…
Reference in a new issue