diff options
author | Gwenole Beauchesne <gwenole.beauchesne@intel.com> | 2013-01-07 14:04:22 +0100 |
---|---|---|
committer | Gwenole Beauchesne <gwenole.beauchesne@intel.com> | 2013-01-07 14:11:39 +0100 |
commit | 8c403c2d98310aec59893f41c4c966dc4b176e2f (patch) | |
tree | d1e7cb2c81f1c8bbe6994d372130cc87b166055c /gst-libs/gst | |
parent | a486d1af667e93e299b35b83625d49ee12575a90 (diff) | |
download | gst-vaapi-8c403c2d98310aec59893f41c4c966dc4b176e2f.tar.gz |
decoder: decoder units are no longer dynamically allocated objects.
Diffstat (limited to 'gst-libs/gst')
-rw-r--r-- | gst-libs/gst/vaapi/gstvaapidecoder_unit.c | 55 | ||||
-rw-r--r-- | gst-libs/gst/vaapi/gstvaapidecoder_unit.h | 57 |
2 files changed, 44 insertions, 68 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_unit.c b/gst-libs/gst/vaapi/gstvaapidecoder_unit.c index 27e64165..217dde60 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder_unit.c +++ b/gst-libs/gst/vaapi/gstvaapidecoder_unit.c @@ -27,16 +27,6 @@ #include "sysdeps.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: * @unit: a #GstVaapiDecoderUnit @@ -46,23 +36,16 @@ gst_vaapi_decoder_unit_class(void) * @note This is an internal function used to implement lightweight * sub-classes. */ -static inline void -decoder_unit_init(GstVaapiDecoderUnit *unit) +void +gst_vaapi_decoder_unit_init(GstVaapiDecoderUnit *unit) { + unit->flags = 0; unit->size = 0; unit->offset = 0; unit->buffer = NULL; unit->parsed_info = 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 * 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 gst_vaapi_decoder_unit_clear(GstVaapiDecoderUnit *unit) { - decoder_unit_clear(unit); -} - -/** - * 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; + gst_buffer_replace(&unit->buffer, NULL); + gst_vaapi_decoder_unit_set_parsed_info(unit, NULL, NULL); } /** diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_unit.h b/gst-libs/gst/vaapi/gstvaapidecoder_unit.h index 9842afb8..2c10129f 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder_unit.h +++ b/gst-libs/gst/vaapi/gstvaapidecoder_unit.h @@ -23,7 +23,6 @@ #define GST_VAAPI_DECODER_UNIT_H #include <gst/gstbuffer.h> -#include <gst/vaapi/gstvaapiminiobject.h> G_BEGIN_DECLS @@ -54,10 +53,44 @@ typedef enum { GST_VAAPI_DECODER_UNIT_FLAG_LAST = (1 << 5) } 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 -#define GST_VAAPI_DECODER_UNIT_FLAG_SET GST_VAAPI_MINI_OBJECT_FLAG_SET -#define GST_VAAPI_DECODER_UNIT_FLAG_UNSET GST_VAAPI_MINI_OBJECT_FLAG_UNSET +/** + * GST_VAAPI_DECODER_UNIT_FLAGS: + * @unit: a #GstVaapiDecoderUnit + * + * 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: @@ -129,9 +162,7 @@ typedef enum { * A chunk of bitstream data that was parsed. */ struct _GstVaapiDecoderUnit { - /*< private >*/ - GstVaapiMiniObject parent_instance; - + guint flags; guint size; guint offset; GstBuffer *buffer; @@ -160,16 +191,6 @@ void gst_vaapi_decoder_unit_set_parsed_info(GstVaapiDecoderUnit *unit, 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 #endif /* GST_VAAPI_DECODER_UNIT_H */ |