decoder: re-indent GstVaapiDecoder base object.

This commit is contained in:
Gwenole Beauchesne 2014-04-25 13:57:02 +02:00
parent 14e9d383e3
commit 1b79049317
3 changed files with 721 additions and 737 deletions

File diff suppressed because it is too large Load diff

View file

@ -35,9 +35,9 @@ G_BEGIN_DECLS
#define GST_VAAPI_DECODER(obj) \ #define GST_VAAPI_DECODER(obj) \
((GstVaapiDecoder *)(obj)) ((GstVaapiDecoder *)(obj))
typedef struct _GstVaapiDecoder GstVaapiDecoder; typedef struct _GstVaapiDecoder GstVaapiDecoder;
typedef void (*GstVaapiDecoderStateChangedFunc)(GstVaapiDecoder *decoder, typedef void (*GstVaapiDecoderStateChangedFunc) (GstVaapiDecoder * decoder,
const GstVideoCodecState *codec_state, gpointer user_data); const GstVideoCodecState * codec_state, gpointer user_data);
/** /**
* GstVaapiDecoderStatus: * GstVaapiDecoderStatus:
@ -58,75 +58,76 @@ typedef void (*GstVaapiDecoderStateChangedFunc)(GstVaapiDecoder *decoder,
* Decoder status for gst_vaapi_decoder_get_surface(). * Decoder status for gst_vaapi_decoder_get_surface().
*/ */
typedef enum { typedef enum {
GST_VAAPI_DECODER_STATUS_SUCCESS = 0, GST_VAAPI_DECODER_STATUS_SUCCESS = 0,
GST_VAAPI_DECODER_STATUS_END_OF_STREAM, GST_VAAPI_DECODER_STATUS_END_OF_STREAM,
GST_VAAPI_DECODER_STATUS_ERROR_ALLOCATION_FAILED, GST_VAAPI_DECODER_STATUS_ERROR_ALLOCATION_FAILED,
GST_VAAPI_DECODER_STATUS_ERROR_INIT_FAILED, GST_VAAPI_DECODER_STATUS_ERROR_INIT_FAILED,
GST_VAAPI_DECODER_STATUS_ERROR_UNSUPPORTED_CODEC, GST_VAAPI_DECODER_STATUS_ERROR_UNSUPPORTED_CODEC,
GST_VAAPI_DECODER_STATUS_ERROR_NO_DATA, GST_VAAPI_DECODER_STATUS_ERROR_NO_DATA,
GST_VAAPI_DECODER_STATUS_ERROR_NO_SURFACE, GST_VAAPI_DECODER_STATUS_ERROR_NO_SURFACE,
GST_VAAPI_DECODER_STATUS_ERROR_INVALID_SURFACE, GST_VAAPI_DECODER_STATUS_ERROR_INVALID_SURFACE,
GST_VAAPI_DECODER_STATUS_ERROR_BITSTREAM_PARSER, GST_VAAPI_DECODER_STATUS_ERROR_BITSTREAM_PARSER,
GST_VAAPI_DECODER_STATUS_ERROR_UNSUPPORTED_PROFILE, GST_VAAPI_DECODER_STATUS_ERROR_UNSUPPORTED_PROFILE,
GST_VAAPI_DECODER_STATUS_ERROR_UNSUPPORTED_CHROMA_FORMAT, GST_VAAPI_DECODER_STATUS_ERROR_UNSUPPORTED_CHROMA_FORMAT,
GST_VAAPI_DECODER_STATUS_ERROR_INVALID_PARAMETER, GST_VAAPI_DECODER_STATUS_ERROR_INVALID_PARAMETER,
GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN = -1 GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN = -1
} GstVaapiDecoderStatus; } GstVaapiDecoderStatus;
GstVaapiDecoder * GstVaapiDecoder *
gst_vaapi_decoder_ref(GstVaapiDecoder *decoder); gst_vaapi_decoder_ref (GstVaapiDecoder * decoder);
void void
gst_vaapi_decoder_unref(GstVaapiDecoder *decoder); gst_vaapi_decoder_unref (GstVaapiDecoder * decoder);
void void
gst_vaapi_decoder_replace(GstVaapiDecoder **old_decoder_ptr, gst_vaapi_decoder_replace (GstVaapiDecoder ** old_decoder_ptr,
GstVaapiDecoder *new_decoder); GstVaapiDecoder * new_decoder);
gpointer gpointer
gst_vaapi_decoder_get_user_data(GstVaapiDecoder *decoder); gst_vaapi_decoder_get_user_data (GstVaapiDecoder * decoder);
void void
gst_vaapi_decoder_set_user_data(GstVaapiDecoder *decoder, gpointer user_data); gst_vaapi_decoder_set_user_data (GstVaapiDecoder * decoder, gpointer user_data);
GstVaapiCodec GstVaapiCodec
gst_vaapi_decoder_get_codec(GstVaapiDecoder *decoder); gst_vaapi_decoder_get_codec (GstVaapiDecoder * decoder);
GstVideoCodecState * GstVideoCodecState *
gst_vaapi_decoder_get_codec_state(GstVaapiDecoder *decoder); gst_vaapi_decoder_get_codec_state (GstVaapiDecoder * decoder);
void void
gst_vaapi_decoder_set_codec_state_changed_func(GstVaapiDecoder *decoder, gst_vaapi_decoder_set_codec_state_changed_func (GstVaapiDecoder * decoder,
GstVaapiDecoderStateChangedFunc func, gpointer user_data); GstVaapiDecoderStateChangedFunc func, gpointer user_data);
GstCaps * GstCaps *
gst_vaapi_decoder_get_caps(GstVaapiDecoder *decoder); gst_vaapi_decoder_get_caps (GstVaapiDecoder * decoder);
gboolean gboolean
gst_vaapi_decoder_put_buffer(GstVaapiDecoder *decoder, GstBuffer *buf); gst_vaapi_decoder_put_buffer (GstVaapiDecoder * decoder, GstBuffer * buf);
GstVaapiDecoderStatus GstVaapiDecoderStatus
gst_vaapi_decoder_get_surface(GstVaapiDecoder *decoder, gst_vaapi_decoder_get_surface (GstVaapiDecoder * decoder,
GstVaapiSurfaceProxy **out_proxy_ptr); GstVaapiSurfaceProxy ** out_proxy_ptr);
GstVaapiDecoderStatus GstVaapiDecoderStatus
gst_vaapi_decoder_get_frame(GstVaapiDecoder *decoder, gst_vaapi_decoder_get_frame (GstVaapiDecoder * decoder,
GstVideoCodecFrame **out_frame_ptr); GstVideoCodecFrame ** out_frame_ptr);
GstVaapiDecoderStatus GstVaapiDecoderStatus
gst_vaapi_decoder_get_frame_with_timeout(GstVaapiDecoder *decoder, gst_vaapi_decoder_get_frame_with_timeout (GstVaapiDecoder * decoder,
GstVideoCodecFrame **out_frame_ptr, guint64 timeout); GstVideoCodecFrame ** out_frame_ptr, guint64 timeout);
GstVaapiDecoderStatus GstVaapiDecoderStatus
gst_vaapi_decoder_parse(GstVaapiDecoder *decoder, gst_vaapi_decoder_parse (GstVaapiDecoder * decoder,
GstVideoCodecFrame *frame, GstAdapter *adapter, gboolean at_eos, GstVideoCodecFrame * frame, GstAdapter * adapter, gboolean at_eos,
guint *got_unit_size_ptr, gboolean *got_frame_ptr); guint * got_unit_size_ptr, gboolean * got_frame_ptr);
GstVaapiDecoderStatus GstVaapiDecoderStatus
gst_vaapi_decoder_decode(GstVaapiDecoder *decoder, GstVideoCodecFrame *frame); gst_vaapi_decoder_decode (GstVaapiDecoder * decoder,
GstVideoCodecFrame * frame);
GstVaapiDecoderStatus GstVaapiDecoderStatus
gst_vaapi_decoder_flush(GstVaapiDecoder *decoder); gst_vaapi_decoder_flush (GstVaapiDecoder * decoder);
G_END_DECLS G_END_DECLS

View file

@ -45,8 +45,8 @@ G_BEGIN_DECLS
#define GST_VAAPI_DECODER_GET_CLASS(obj) \ #define GST_VAAPI_DECODER_GET_CLASS(obj) \
GST_VAAPI_DECODER_CLASS(GST_VAAPI_MINI_OBJECT_GET_CLASS(obj)) GST_VAAPI_DECODER_CLASS(GST_VAAPI_MINI_OBJECT_GET_CLASS(obj))
typedef struct _GstVaapiDecoderClass GstVaapiDecoderClass; typedef struct _GstVaapiDecoderClass GstVaapiDecoderClass;
struct _GstVaapiDecoderUnit; struct _GstVaapiDecoderUnit;
/** /**
* GST_VAAPI_PARSER_STATE: * GST_VAAPI_PARSER_STATE:
@ -162,21 +162,22 @@ typedef struct _GstVaapiDecoderClass GstVaapiDecoderClass;
GstVaapiDecoderPrivate)) GstVaapiDecoderPrivate))
typedef enum { typedef enum {
GST_VAAPI_DECODER_STATUS_DROP_FRAME = -2 GST_VAAPI_DECODER_STATUS_DROP_FRAME = -2
} GstVaapiDecoderStatusPrivate; } GstVaapiDecoderStatusPrivate;
typedef struct _GstVaapiParserState GstVaapiParserState; typedef struct _GstVaapiParserState GstVaapiParserState;
struct _GstVaapiParserState { struct _GstVaapiParserState
GstVideoCodecFrame *current_frame; {
guint32 current_frame_number; GstVideoCodecFrame *current_frame;
GstAdapter *current_adapter; guint32 current_frame_number;
GstAdapter *input_adapter; GstAdapter *current_adapter;
gint input_offset1; GstAdapter *input_adapter;
gint input_offset2; gint input_offset1;
GstAdapter *output_adapter; gint input_offset2;
GstVaapiDecoderUnit next_unit; GstAdapter *output_adapter;
guint next_unit_pending : 1; GstVaapiDecoderUnit next_unit;
guint at_eos : 1; guint next_unit_pending:1;
guint at_eos:1;
}; };
/** /**
@ -184,22 +185,23 @@ struct _GstVaapiParserState {
* *
* A VA decoder base instance. * A VA decoder base instance.
*/ */
struct _GstVaapiDecoder { struct _GstVaapiDecoder
/*< private >*/ {
GstVaapiMiniObject parent_instance; /*< private >*/
GstVaapiMiniObject parent_instance;
gpointer user_data; gpointer user_data;
GstVaapiDisplay *display; GstVaapiDisplay *display;
VADisplay va_display; VADisplay va_display;
GstVaapiContext *context; GstVaapiContext *context;
VAContextID va_context; VAContextID va_context;
GstVaapiCodec codec; GstVaapiCodec codec;
GstVideoCodecState *codec_state; GstVideoCodecState *codec_state;
GAsyncQueue *buffers; GAsyncQueue *buffers;
GAsyncQueue *frames; GAsyncQueue *frames;
GstVaapiParserState parser_state; GstVaapiParserState parser_state;
GstVaapiDecoderStateChangedFunc codec_state_changed_func; GstVaapiDecoderStateChangedFunc codec_state_changed_func;
gpointer codec_state_changed_data; gpointer codec_state_changed_data;
}; };
/** /**
@ -207,86 +209,77 @@ struct _GstVaapiDecoder {
* *
* A VA decoder base class. * A VA decoder base class.
*/ */
struct _GstVaapiDecoderClass { struct _GstVaapiDecoderClass
/*< private >*/ {
GstVaapiMiniObjectClass parent_class; /*< private >*/
GstVaapiMiniObjectClass parent_class;
gboolean (*create)(GstVaapiDecoder *decoder); gboolean (*create) (GstVaapiDecoder * decoder);
void (*destroy)(GstVaapiDecoder *decoder); void (*destroy) (GstVaapiDecoder * decoder);
GstVaapiDecoderStatus (*parse)(GstVaapiDecoder *decoder, GstVaapiDecoderStatus (*parse) (GstVaapiDecoder * decoder,
GstAdapter *adapter, gboolean at_eos, GstAdapter * adapter, gboolean at_eos,
struct _GstVaapiDecoderUnit *unit); struct _GstVaapiDecoderUnit * unit);
GstVaapiDecoderStatus (*decode)(GstVaapiDecoder *decoder, GstVaapiDecoderStatus (*decode) (GstVaapiDecoder * decoder,
struct _GstVaapiDecoderUnit *unit); struct _GstVaapiDecoderUnit * unit);
GstVaapiDecoderStatus (*start_frame)(GstVaapiDecoder *decoder, GstVaapiDecoderStatus (*start_frame) (GstVaapiDecoder * decoder,
struct _GstVaapiDecoderUnit *unit); struct _GstVaapiDecoderUnit * unit);
GstVaapiDecoderStatus (*end_frame)(GstVaapiDecoder *decoder); GstVaapiDecoderStatus (*end_frame) (GstVaapiDecoder * decoder);
GstVaapiDecoderStatus (*flush)(GstVaapiDecoder *decoder); GstVaapiDecoderStatus (*flush) (GstVaapiDecoder * decoder);
GstVaapiDecoderStatus (*decode_codec_data)(GstVaapiDecoder *decoder, GstVaapiDecoderStatus (*decode_codec_data) (GstVaapiDecoder * decoder,
const guchar *buf, guint buf_size); const guchar * buf, guint buf_size);
}; };
G_GNUC_INTERNAL G_GNUC_INTERNAL
GstVaapiDecoder * GstVaapiDecoder *
gst_vaapi_decoder_new(const GstVaapiDecoderClass *klass, gst_vaapi_decoder_new (const GstVaapiDecoderClass * klass,
GstVaapiDisplay *display, GstCaps *caps); GstVaapiDisplay * display, GstCaps * caps);
G_GNUC_INTERNAL G_GNUC_INTERNAL
void void
gst_vaapi_decoder_finalize(GstVaapiDecoder *decoder); gst_vaapi_decoder_finalize (GstVaapiDecoder * decoder);
G_GNUC_INTERNAL G_GNUC_INTERNAL
void void
gst_vaapi_decoder_set_picture_size( gst_vaapi_decoder_set_picture_size (GstVaapiDecoder * decoder,
GstVaapiDecoder *decoder, guint width, guint height);
guint width,
guint height
);
G_GNUC_INTERNAL G_GNUC_INTERNAL
void void
gst_vaapi_decoder_set_framerate( gst_vaapi_decoder_set_framerate (GstVaapiDecoder * decoder,
GstVaapiDecoder *decoder, guint fps_n, guint fps_d);
guint fps_n,
guint fps_d
);
G_GNUC_INTERNAL G_GNUC_INTERNAL
void void
gst_vaapi_decoder_set_pixel_aspect_ratio( gst_vaapi_decoder_set_pixel_aspect_ratio (GstVaapiDecoder * decoder,
GstVaapiDecoder *decoder, guint par_n, guint par_d);
guint par_n,
guint par_d
);
G_GNUC_INTERNAL G_GNUC_INTERNAL
void void
gst_vaapi_decoder_set_interlace_mode(GstVaapiDecoder *decoder, gst_vaapi_decoder_set_interlace_mode (GstVaapiDecoder * decoder,
GstVideoInterlaceMode mode); GstVideoInterlaceMode mode);
G_GNUC_INTERNAL G_GNUC_INTERNAL
void void
gst_vaapi_decoder_set_interlaced(GstVaapiDecoder *decoder, gboolean interlaced); gst_vaapi_decoder_set_interlaced (GstVaapiDecoder * decoder,
gboolean interlaced);
G_GNUC_INTERNAL G_GNUC_INTERNAL
gboolean gboolean
gst_vaapi_decoder_ensure_context( gst_vaapi_decoder_ensure_context (GstVaapiDecoder * decoder,
GstVaapiDecoder *decoder, GstVaapiContextInfo * cip);
GstVaapiContextInfo *cip
);
G_GNUC_INTERNAL G_GNUC_INTERNAL
void void
gst_vaapi_decoder_push_frame(GstVaapiDecoder *decoder, gst_vaapi_decoder_push_frame (GstVaapiDecoder * decoder,
GstVideoCodecFrame *frame); GstVideoCodecFrame * frame);
G_GNUC_INTERNAL G_GNUC_INTERNAL
GstVaapiDecoderStatus GstVaapiDecoderStatus
gst_vaapi_decoder_check_status(GstVaapiDecoder *decoder); gst_vaapi_decoder_check_status (GstVaapiDecoder * decoder);
G_GNUC_INTERNAL G_GNUC_INTERNAL
GstVaapiDecoderStatus GstVaapiDecoderStatus
gst_vaapi_decoder_decode_codec_data(GstVaapiDecoder *decoder); gst_vaapi_decoder_decode_codec_data (GstVaapiDecoder * decoder);
G_END_DECLS G_END_DECLS