decoder: rename GstVaapiDecoderFrame to GstVaapiParserFrame.

Rename GstVaapiDecoderFrame to GstVaapiParserFrame because this data
structure was only useful to parsing and a proper GstvaapiDecoderFrame
instance will be created instead.
This commit is contained in:
Gwenole Beauchesne 2013-04-16 13:23:41 +02:00
parent 2ac474b207
commit a24e216466
5 changed files with 57 additions and 70 deletions

View file

@ -46,7 +46,6 @@ libgstvaapi_source_c = \
gstvaapicontext.c \ gstvaapicontext.c \
gstvaapidecoder.c \ gstvaapidecoder.c \
gstvaapidecoder_dpb.c \ gstvaapidecoder_dpb.c \
gstvaapidecoder_frame.c \
gstvaapidecoder_h264.c \ gstvaapidecoder_h264.c \
gstvaapidecoder_mpeg2.c \ gstvaapidecoder_mpeg2.c \
gstvaapidecoder_mpeg4.c \ gstvaapidecoder_mpeg4.c \
@ -61,6 +60,7 @@ libgstvaapi_source_c = \
gstvaapiminiobject.c \ gstvaapiminiobject.c \
gstvaapiobject.c \ gstvaapiobject.c \
gstvaapiparamspecs.c \ gstvaapiparamspecs.c \
gstvaapiparser_frame.c \
gstvaapiprofile.c \ gstvaapiprofile.c \
gstvaapisubpicture.c \ gstvaapisubpicture.c \
gstvaapisurface.c \ gstvaapisurface.c \
@ -105,13 +105,13 @@ libgstvaapi_source_priv_h = \
gstvaapicompat.h \ gstvaapicompat.h \
gstvaapidebug.h \ gstvaapidebug.h \
gstvaapidecoder_dpb.h \ gstvaapidecoder_dpb.h \
gstvaapidecoder_frame.h \
gstvaapidecoder_objects.h \ gstvaapidecoder_objects.h \
gstvaapidecoder_priv.h \ gstvaapidecoder_priv.h \
gstvaapidecoder_unit.h \ gstvaapidecoder_unit.h \
gstvaapidisplay_priv.h \ gstvaapidisplay_priv.h \
gstvaapiminiobject.h \ gstvaapiminiobject.h \
gstvaapiobject_priv.h \ gstvaapiobject_priv.h \
gstvaapiparser_frame.h \
gstvaapisurface_priv.h \ gstvaapisurface_priv.h \
gstvaapisurfaceproxy_priv.h \ gstvaapisurfaceproxy_priv.h \
gstvaapiutils.h \ gstvaapiutils.h \

View file

@ -29,6 +29,7 @@
#include "gstvaapicompat.h" #include "gstvaapicompat.h"
#include "gstvaapidecoder.h" #include "gstvaapidecoder.h"
#include "gstvaapidecoder_priv.h" #include "gstvaapidecoder_priv.h"
#include "gstvaapiparser_frame.h"
#include "gstvaapisurfaceproxy_priv.h" #include "gstvaapisurfaceproxy_priv.h"
#include "gstvaapiutils.h" #include "gstvaapiutils.h"
#include "gstvaapi_priv.h" #include "gstvaapi_priv.h"
@ -141,7 +142,7 @@ do_parse(GstVaapiDecoder *decoder,
{ {
GstVaapiDecoderPrivate * const priv = decoder->priv; GstVaapiDecoderPrivate * const priv = decoder->priv;
GstVaapiParserState * const ps = &priv->parser_state; GstVaapiParserState * const ps = &priv->parser_state;
GstVaapiDecoderFrame *frame; GstVaapiParserFrame *frame;
GstVaapiDecoderUnit *unit; GstVaapiDecoderUnit *unit;
GstVaapiDecoderStatus status; GstVaapiDecoderStatus status;
@ -151,7 +152,7 @@ do_parse(GstVaapiDecoder *decoder,
frame = gst_video_codec_frame_get_user_data(base_frame); frame = gst_video_codec_frame_get_user_data(base_frame);
if (!frame) { if (!frame) {
GstVideoCodecState * const codec_state = priv->codec_state; GstVideoCodecState * const codec_state = priv->codec_state;
frame = gst_vaapi_decoder_frame_new(codec_state->info.width, frame = gst_vaapi_parser_frame_new(codec_state->info.width,
codec_state->info.height); codec_state->info.height);
if (!frame) if (!frame)
return GST_VAAPI_DECODER_STATUS_ERROR_ALLOCATION_FAILED; return GST_VAAPI_DECODER_STATUS_ERROR_ALLOCATION_FAILED;
@ -188,7 +189,7 @@ do_parse(GstVaapiDecoder *decoder,
} }
got_unit: got_unit:
gst_vaapi_decoder_frame_append_unit(frame, unit); gst_vaapi_parser_frame_append_unit(frame, unit);
*got_unit_size_ptr = unit->size; *got_unit_size_ptr = unit->size;
*got_frame_ptr = GST_VAAPI_DECODER_UNIT_IS_FRAME_END(unit); *got_frame_ptr = GST_VAAPI_DECODER_UNIT_IS_FRAME_END(unit);
return GST_VAAPI_DECODER_STATUS_SUCCESS; return GST_VAAPI_DECODER_STATUS_SUCCESS;
@ -214,7 +215,7 @@ do_decode_units(GstVaapiDecoder *decoder, GArray *units)
} }
static GstVaapiDecoderStatus static GstVaapiDecoderStatus
do_decode_1(GstVaapiDecoder *decoder, GstVaapiDecoderFrame *frame) do_decode_1(GstVaapiDecoder *decoder, GstVaapiParserFrame *frame)
{ {
GstVaapiDecoderClass * const klass = GST_VAAPI_DECODER_GET_CLASS(decoder); GstVaapiDecoderClass * const klass = GST_VAAPI_DECODER_GET_CLASS(decoder);
GstVaapiDecoderStatus status; GstVaapiDecoderStatus status;
@ -261,14 +262,14 @@ static inline GstVaapiDecoderStatus
do_decode(GstVaapiDecoder *decoder, GstVideoCodecFrame *base_frame) do_decode(GstVaapiDecoder *decoder, GstVideoCodecFrame *base_frame)
{ {
GstVaapiParserState * const ps = &decoder->priv->parser_state; GstVaapiParserState * const ps = &decoder->priv->parser_state;
GstVaapiDecoderFrame * const frame = base_frame->user_data; GstVaapiParserFrame * const frame = base_frame->user_data;
GstVaapiDecoderStatus status; GstVaapiDecoderStatus status;
ps->current_frame = base_frame; ps->current_frame = base_frame;
gst_vaapi_decoder_frame_ref(frame); gst_vaapi_parser_frame_ref(frame);
status = do_decode_1(decoder, frame); status = do_decode_1(decoder, frame);
gst_vaapi_decoder_frame_unref(frame); gst_vaapi_parser_frame_unref(frame);
switch ((guint)status) { switch ((guint)status) {
case GST_VAAPI_DECODER_STATUS_DROP_FRAME: case GST_VAAPI_DECODER_STATUS_DROP_FRAME:

View file

@ -25,7 +25,7 @@
#include <glib.h> #include <glib.h>
#include <gst/vaapi/gstvaapidecoder.h> #include <gst/vaapi/gstvaapidecoder.h>
#include <gst/vaapi/gstvaapidecoder_frame.h> #include <gst/vaapi/gstvaapidecoder_unit.h>
#include <gst/vaapi/gstvaapicontext.h> #include <gst/vaapi/gstvaapicontext.h>
G_BEGIN_DECLS G_BEGIN_DECLS

View file

@ -1,5 +1,5 @@
/* /*
* gstvaapidecoder_frame.c - VA decoder frame * gstvaapiparser_frame.c - VA parser frame
* *
* Copyright (C) 2012-2013 Intel Corporation * Copyright (C) 2012-2013 Intel Corporation
* *
@ -20,21 +20,21 @@
*/ */
/** /**
* SECTION:gstvaapidecoder_frame * SECTION:gstvaapiparser_frame
* @short_description: VA decoder frame * @short_description: VA decoder frame
*/ */
#include "sysdeps.h" #include "sysdeps.h"
#include "gstvaapidecoder_frame.h" #include "gstvaapiparser_frame.h"
static inline const GstVaapiMiniObjectClass * static inline const GstVaapiMiniObjectClass *
gst_vaapi_decoder_frame_class(void) gst_vaapi_parser_frame_class(void)
{ {
static const GstVaapiMiniObjectClass GstVaapiDecoderFrameClass = { static const GstVaapiMiniObjectClass GstVaapiParserFrameClass = {
sizeof(GstVaapiDecoderFrame), sizeof(GstVaapiParserFrame),
(GDestroyNotify)gst_vaapi_decoder_frame_free (GDestroyNotify)gst_vaapi_parser_frame_free
}; };
return &GstVaapiDecoderFrameClass; return &GstVaapiParserFrameClass;
} }
static inline gboolean static inline gboolean
@ -65,22 +65,22 @@ free_units(GArray **units_ptr)
} }
/** /**
* gst_vaapi_decoder_frame_new: * gst_vaapi_parser_frame_new:
* @width: frame width in pixels * @width: frame width in pixels
* @height: frame height in pixels * @height: frame height in pixels
* *
* Creates a new #GstVaapiDecoderFrame object. * Creates a new #GstVaapiParserFrame object.
* *
* Returns: The newly allocated #GstVaapiDecoderFrame * Returns: The newly allocated #GstVaapiParserFrame
*/ */
GstVaapiDecoderFrame * GstVaapiParserFrame *
gst_vaapi_decoder_frame_new(guint width, guint height) gst_vaapi_parser_frame_new(guint width, guint height)
{ {
GstVaapiDecoderFrame *frame; GstVaapiParserFrame *frame;
guint num_slices; guint num_slices;
frame = (GstVaapiDecoderFrame *) frame = (GstVaapiParserFrame *)
gst_vaapi_mini_object_new(gst_vaapi_decoder_frame_class()); gst_vaapi_mini_object_new(gst_vaapi_parser_frame_class());
if (!frame) if (!frame)
return NULL; return NULL;
@ -98,13 +98,13 @@ gst_vaapi_decoder_frame_new(guint width, guint height)
return frame; return frame;
error: error:
gst_vaapi_decoder_frame_unref(frame); gst_vaapi_parser_frame_unref(frame);
return NULL; return NULL;
} }
/** /**
* gst_vaapi_decoder_frame_free: * gst_vaapi_parser_frame_free:
* @frame: a #GstVaapiDecoderFrame * @frame: a #GstVaapiParserFrame
* *
* Deallocates any internal resources bound to the supplied decoder * Deallocates any internal resources bound to the supplied decoder
* @frame. * @frame.
@ -113,7 +113,7 @@ error:
* sub-classes. * sub-classes.
*/ */
void void
gst_vaapi_decoder_frame_free(GstVaapiDecoderFrame *frame) gst_vaapi_parser_frame_free(GstVaapiParserFrame *frame)
{ {
free_units(&frame->units); free_units(&frame->units);
free_units(&frame->pre_units); free_units(&frame->pre_units);
@ -121,14 +121,14 @@ gst_vaapi_decoder_frame_free(GstVaapiDecoderFrame *frame)
} }
/** /**
* gst_vaapi_decoder_frame_append_unit: * gst_vaapi_parser_frame_append_unit:
* @frame: a #GstVaapiDecoderFrame * @frame: a #GstVaapiParserFrame
* @unit: a #GstVaapiDecoderUnit * @unit: a #GstVaapiDecoderUnit
* *
* Appends unit to the @frame. * Appends unit to the @frame.
*/ */
void void
gst_vaapi_decoder_frame_append_unit(GstVaapiDecoderFrame *frame, gst_vaapi_parser_frame_append_unit(GstVaapiParserFrame *frame,
GstVaapiDecoderUnit *unit) GstVaapiDecoderUnit *unit)
{ {
GArray **unit_array_ptr; GArray **unit_array_ptr;

View file

@ -1,5 +1,5 @@
/* /*
* gstvaapidecoder_frame.h - VA decoder frame * gstvaapiparser_frame.h - VA parser frame
* *
* Copyright (C) 2012-2013 Intel Corporation * Copyright (C) 2012-2013 Intel Corporation
* *
@ -19,38 +19,24 @@
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*/ */
#ifndef GST_VAAPI_DECODER_FRAME_H #ifndef GST_VAAPI_PARSER_FRAME_H
#define GST_VAAPI_DECODER_FRAME_H #define GST_VAAPI_PARSER_FRAME_H
#include <gst/vaapi/gstvaapiminiobject.h> #include <gst/vaapi/gstvaapiminiobject.h>
#include <gst/vaapi/gstvaapidecoder_unit.h> #include <gst/vaapi/gstvaapidecoder_unit.h>
G_BEGIN_DECLS G_BEGIN_DECLS
typedef struct _GstVaapiDecoderFrame GstVaapiDecoderFrame; typedef struct _GstVaapiParserFrame GstVaapiParserFrame;
#define GST_VAAPI_DECODER_FRAME(frame) \ #define GST_VAAPI_PARSER_FRAME(frame) \
((GstVaapiDecoderFrame *)(frame)) ((GstVaapiParserFrame *)(frame))
#define GST_VAAPI_IS_DECODER_FRAME(frame) \ #define GST_VAAPI_IS_PARSER_FRAME(frame) \
(GST_VAAPI_DECODER_FRAME(frame) != NULL) (GST_VAAPI_PARSER_FRAME(frame) != NULL)
/** /**
* GstVaapiDecoderFrameFlags: * GstVaapiParserFrame:
*
* 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 * @output_offset: current offset to the reconstructed #GstBuffer for
* this #GstVideoCodecFrame. This is used to initialize the decoder * this #GstVideoCodecFrame. This is used to initialize the decoder
* unit offset * unit offset
@ -62,39 +48,39 @@ typedef enum {
* information. Decoder frames are usually attached to codec frames as * information. Decoder frames are usually attached to codec frames as
* the user_data anchor point. * the user_data anchor point.
*/ */
struct _GstVaapiDecoderFrame { struct _GstVaapiParserFrame {
/*< private >*/ /*< private >*/
GstVaapiMiniObject parent_instance; GstVaapiMiniObject parent_instance;
guint output_offset; guint output_offset;
GArray *units; GArray *units;
GArray *pre_units; GArray *pre_units;
GArray *post_units; GArray *post_units;
}; };
G_GNUC_INTERNAL G_GNUC_INTERNAL
GstVaapiDecoderFrame * GstVaapiParserFrame *
gst_vaapi_decoder_frame_new(guint width, guint height); gst_vaapi_parser_frame_new(guint width, guint height);
G_GNUC_INTERNAL G_GNUC_INTERNAL
void void
gst_vaapi_decoder_frame_free(GstVaapiDecoderFrame *frame); gst_vaapi_parser_frame_free(GstVaapiParserFrame *frame);
G_GNUC_INTERNAL G_GNUC_INTERNAL
void void
gst_vaapi_decoder_frame_append_unit(GstVaapiDecoderFrame *frame, gst_vaapi_parser_frame_append_unit(GstVaapiParserFrame *frame,
GstVaapiDecoderUnit *unit); GstVaapiDecoderUnit *unit);
#define gst_vaapi_decoder_frame_ref(frame) \ #define gst_vaapi_parser_frame_ref(frame) \
gst_vaapi_mini_object_ref(GST_VAAPI_MINI_OBJECT(frame)) gst_vaapi_mini_object_ref(GST_VAAPI_MINI_OBJECT(frame))
#define gst_vaapi_decoder_frame_unref(frame) \ #define gst_vaapi_parser_frame_unref(frame) \
gst_vaapi_mini_object_unref(GST_VAAPI_MINI_OBJECT(frame)) gst_vaapi_mini_object_unref(GST_VAAPI_MINI_OBJECT(frame))
#define gst_vaapi_decoder_frame_replace(old_frame_p, new_frame) \ #define gst_vaapi_parser_frame_replace(old_frame_p, new_frame) \
gst_vaapi_mini_object_replace((GstVaapiMiniObject **)(old_frame_p), \ gst_vaapi_mini_object_replace((GstVaapiMiniObject **)(old_frame_p), \
(GstVaapiMiniObject *)(new_frame)) (GstVaapiMiniObject *)(new_frame))
G_END_DECLS G_END_DECLS
#endif /* GST_VAAPI_DECODER_FRAME_H */ #endif /* GST_VAAPI_PARSER_FRAME_H */