mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 05:28:32 +00:00
decoder: decoder units are no longer dynamically allocated objects.
This commit is contained in:
parent
a486d1af66
commit
8c403c2d98
2 changed files with 44 additions and 68 deletions
|
@ -27,16 +27,6 @@
|
||||||
#include "sysdeps.h"
|
#include "sysdeps.h"
|
||||||
#include "gstvaapidecoder_unit.h"
|
#include "gstvaapidecoder_unit.h"
|
||||||
|
|
||||||
static inline const GstVaapiMiniObjectClass *
|
|
||||||
gst_vaapi_decoder_unit_class(void)
|
|
||||||
{
|
|
||||||
static const GstVaapiMiniObjectClass GstVaapiDecoderUnitClass = {
|
|
||||||
sizeof(GstVaapiDecoderUnit),
|
|
||||||
(GDestroyNotify)gst_vaapi_decoder_unit_clear
|
|
||||||
};
|
|
||||||
return &GstVaapiDecoderUnitClass;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_vaapi_decoder_unit_init:
|
* gst_vaapi_decoder_unit_init:
|
||||||
* @unit: a #GstVaapiDecoderUnit
|
* @unit: a #GstVaapiDecoderUnit
|
||||||
|
@ -46,23 +36,16 @@ gst_vaapi_decoder_unit_class(void)
|
||||||
* @note This is an internal function used to implement lightweight
|
* @note This is an internal function used to implement lightweight
|
||||||
* sub-classes.
|
* sub-classes.
|
||||||
*/
|
*/
|
||||||
static inline void
|
void
|
||||||
decoder_unit_init(GstVaapiDecoderUnit *unit)
|
gst_vaapi_decoder_unit_init(GstVaapiDecoderUnit *unit)
|
||||||
{
|
{
|
||||||
|
unit->flags = 0;
|
||||||
unit->size = 0;
|
unit->size = 0;
|
||||||
unit->offset = 0;
|
unit->offset = 0;
|
||||||
unit->buffer = NULL;
|
unit->buffer = NULL;
|
||||||
|
|
||||||
unit->parsed_info = NULL;
|
unit->parsed_info = NULL;
|
||||||
unit->parsed_info_destroy_notify = NULL;
|
unit->parsed_info_destroy_notify = NULL;
|
||||||
|
|
||||||
GST_VAAPI_DECODER_UNIT_FLAGS(unit) = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
gst_vaapi_decoder_unit_init(GstVaapiDecoderUnit *unit)
|
|
||||||
{
|
|
||||||
decoder_unit_init(unit);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -75,39 +58,11 @@ gst_vaapi_decoder_unit_init(GstVaapiDecoderUnit *unit)
|
||||||
* @note This is an internal function used to implement lightweight
|
* @note This is an internal function used to implement lightweight
|
||||||
* sub-classes.
|
* sub-classes.
|
||||||
*/
|
*/
|
||||||
static inline void
|
|
||||||
decoder_unit_clear(GstVaapiDecoderUnit *unit)
|
|
||||||
{
|
|
||||||
gst_buffer_replace(&unit->buffer, NULL);
|
|
||||||
gst_vaapi_decoder_unit_set_parsed_info(unit, NULL, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
gst_vaapi_decoder_unit_clear(GstVaapiDecoderUnit *unit)
|
gst_vaapi_decoder_unit_clear(GstVaapiDecoderUnit *unit)
|
||||||
{
|
{
|
||||||
decoder_unit_clear(unit);
|
gst_buffer_replace(&unit->buffer, NULL);
|
||||||
}
|
gst_vaapi_decoder_unit_set_parsed_info(unit, NULL, NULL);
|
||||||
|
|
||||||
/**
|
|
||||||
* gst_vaapi_decoder_unit_new:
|
|
||||||
* @size: size in bytes of this bitstream data chunk
|
|
||||||
*
|
|
||||||
* Creates a new #GstVaapiDecoderUnit object.
|
|
||||||
*
|
|
||||||
* Returns: The newly allocated #GstVaapiDecoderUnit
|
|
||||||
*/
|
|
||||||
GstVaapiDecoderUnit *
|
|
||||||
gst_vaapi_decoder_unit_new(void)
|
|
||||||
{
|
|
||||||
GstVaapiDecoderUnit *unit;
|
|
||||||
|
|
||||||
unit = (GstVaapiDecoderUnit *)
|
|
||||||
gst_vaapi_mini_object_new(gst_vaapi_decoder_unit_class());
|
|
||||||
if (!unit)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
decoder_unit_init(unit);
|
|
||||||
return unit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#define GST_VAAPI_DECODER_UNIT_H
|
#define GST_VAAPI_DECODER_UNIT_H
|
||||||
|
|
||||||
#include <gst/gstbuffer.h>
|
#include <gst/gstbuffer.h>
|
||||||
#include <gst/vaapi/gstvaapiminiobject.h>
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
@ -54,10 +53,44 @@ typedef enum {
|
||||||
GST_VAAPI_DECODER_UNIT_FLAG_LAST = (1 << 5)
|
GST_VAAPI_DECODER_UNIT_FLAG_LAST = (1 << 5)
|
||||||
} GstVaapiDecoderUnitFlags;
|
} GstVaapiDecoderUnitFlags;
|
||||||
|
|
||||||
#define GST_VAAPI_DECODER_UNIT_FLAGS GST_VAAPI_MINI_OBJECT_FLAGS
|
/**
|
||||||
#define GST_VAAPI_DECODER_UNIT_FLAG_IS_SET GST_VAAPI_MINI_OBJECT_FLAG_IS_SET
|
* GST_VAAPI_DECODER_UNIT_FLAGS:
|
||||||
#define GST_VAAPI_DECODER_UNIT_FLAG_SET GST_VAAPI_MINI_OBJECT_FLAG_SET
|
* @unit: a #GstVaapiDecoderUnit
|
||||||
#define GST_VAAPI_DECODER_UNIT_FLAG_UNSET GST_VAAPI_MINI_OBJECT_FLAG_UNSET
|
*
|
||||||
|
* The entire set of flags for the @unit
|
||||||
|
*/
|
||||||
|
#define GST_VAAPI_DECODER_UNIT_FLAGS(unit) \
|
||||||
|
((unit)->flags)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GST_VAAPI_DECODER_UNIT_FLAG_IS_SET:
|
||||||
|
* @unit: a #GstVaapiDecoderUnit
|
||||||
|
* @flag: a flag to check for
|
||||||
|
*
|
||||||
|
* Checks whether the given @flag is set
|
||||||
|
*/
|
||||||
|
#define GST_VAAPI_DECODER_UNIT_FLAG_IS_SET(unit, flag) \
|
||||||
|
((GST_VAAPI_DECODER_UNIT_FLAGS(unit) & (flag)) != 0)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GST_VAAPI_DECODER_UNIT_FLAG_SET:
|
||||||
|
* @unit: a #GstVaapiDecoderUnit
|
||||||
|
* @flags: flags to set
|
||||||
|
*
|
||||||
|
* This macro sets the given bits
|
||||||
|
*/
|
||||||
|
#define GST_VAAPI_DECODER_UNIT_FLAG_SET(unit, flags) \
|
||||||
|
(GST_VAAPI_DECODER_UNIT_FLAGS(unit) |= (flags))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GST_VAAPI_DECODER_UNIT_FLAG_UNSET:
|
||||||
|
* @unit: a #GstVaapiDecoderUnit
|
||||||
|
* @flags: flags to unset
|
||||||
|
*
|
||||||
|
* This macro unsets the given bits.
|
||||||
|
*/
|
||||||
|
#define GST_VAAPI_DECODER_UNIT_FLAG_UNSET(unit, flags) \
|
||||||
|
(GST_VAAPI_DECODER_UNIT_FLAGS(unit) &= ~(flags))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GST_VAAPI_DECODER_UNIT_IS_FRAME_START:
|
* GST_VAAPI_DECODER_UNIT_IS_FRAME_START:
|
||||||
|
@ -129,9 +162,7 @@ typedef enum {
|
||||||
* A chunk of bitstream data that was parsed.
|
* A chunk of bitstream data that was parsed.
|
||||||
*/
|
*/
|
||||||
struct _GstVaapiDecoderUnit {
|
struct _GstVaapiDecoderUnit {
|
||||||
/*< private >*/
|
guint flags;
|
||||||
GstVaapiMiniObject parent_instance;
|
|
||||||
|
|
||||||
guint size;
|
guint size;
|
||||||
guint offset;
|
guint offset;
|
||||||
GstBuffer *buffer;
|
GstBuffer *buffer;
|
||||||
|
@ -160,16 +191,6 @@ void
|
||||||
gst_vaapi_decoder_unit_set_parsed_info(GstVaapiDecoderUnit *unit,
|
gst_vaapi_decoder_unit_set_parsed_info(GstVaapiDecoderUnit *unit,
|
||||||
gpointer parsed_info, GDestroyNotify destroy_notify);
|
gpointer parsed_info, GDestroyNotify destroy_notify);
|
||||||
|
|
||||||
#define gst_vaapi_decoder_unit_ref(unit) \
|
|
||||||
gst_vaapi_mini_object_ref(GST_VAAPI_MINI_OBJECT(unit))
|
|
||||||
|
|
||||||
#define gst_vaapi_decoder_unit_unref(unit) \
|
|
||||||
gst_vaapi_mini_object_unref(GST_VAAPI_MINI_OBJECT(unit))
|
|
||||||
|
|
||||||
#define gst_vaapi_decoder_unit_replace(old_unit_p, new_unit) \
|
|
||||||
gst_vaapi_mini_object_replace((GstVaapiMiniObject **)(old_unit_p), \
|
|
||||||
(GstVaapiMiniObject *)(new_unit))
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* GST_VAAPI_DECODER_UNIT_H */
|
#endif /* GST_VAAPI_DECODER_UNIT_H */
|
||||||
|
|
Loading…
Reference in a new issue