Commit 1b790493 authored by Gwenole Beauchesne's avatar Gwenole Beauchesne

decoder: re-indent GstVaapiDecoder base object.

parent 14e9d383
This diff is collapsed.
......@@ -35,9 +35,9 @@ G_BEGIN_DECLS
#define GST_VAAPI_DECODER(obj) \
((GstVaapiDecoder *)(obj))
typedef struct _GstVaapiDecoder GstVaapiDecoder;
typedef void (*GstVaapiDecoderStateChangedFunc)(GstVaapiDecoder *decoder,
const GstVideoCodecState *codec_state, gpointer user_data);
typedef struct _GstVaapiDecoder GstVaapiDecoder;
typedef void (*GstVaapiDecoderStateChangedFunc) (GstVaapiDecoder * decoder,
const GstVideoCodecState * codec_state, gpointer user_data);
/**
* GstVaapiDecoderStatus:
......@@ -58,75 +58,76 @@ typedef void (*GstVaapiDecoderStateChangedFunc)(GstVaapiDecoder *decoder,
* Decoder status for gst_vaapi_decoder_get_surface().
*/
typedef enum {
GST_VAAPI_DECODER_STATUS_SUCCESS = 0,
GST_VAAPI_DECODER_STATUS_END_OF_STREAM,
GST_VAAPI_DECODER_STATUS_ERROR_ALLOCATION_FAILED,
GST_VAAPI_DECODER_STATUS_ERROR_INIT_FAILED,
GST_VAAPI_DECODER_STATUS_ERROR_UNSUPPORTED_CODEC,
GST_VAAPI_DECODER_STATUS_ERROR_NO_DATA,
GST_VAAPI_DECODER_STATUS_ERROR_NO_SURFACE,
GST_VAAPI_DECODER_STATUS_ERROR_INVALID_SURFACE,
GST_VAAPI_DECODER_STATUS_ERROR_BITSTREAM_PARSER,
GST_VAAPI_DECODER_STATUS_ERROR_UNSUPPORTED_PROFILE,
GST_VAAPI_DECODER_STATUS_ERROR_UNSUPPORTED_CHROMA_FORMAT,
GST_VAAPI_DECODER_STATUS_ERROR_INVALID_PARAMETER,
GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN = -1
GST_VAAPI_DECODER_STATUS_SUCCESS = 0,
GST_VAAPI_DECODER_STATUS_END_OF_STREAM,
GST_VAAPI_DECODER_STATUS_ERROR_ALLOCATION_FAILED,
GST_VAAPI_DECODER_STATUS_ERROR_INIT_FAILED,
GST_VAAPI_DECODER_STATUS_ERROR_UNSUPPORTED_CODEC,
GST_VAAPI_DECODER_STATUS_ERROR_NO_DATA,
GST_VAAPI_DECODER_STATUS_ERROR_NO_SURFACE,
GST_VAAPI_DECODER_STATUS_ERROR_INVALID_SURFACE,
GST_VAAPI_DECODER_STATUS_ERROR_BITSTREAM_PARSER,
GST_VAAPI_DECODER_STATUS_ERROR_UNSUPPORTED_PROFILE,
GST_VAAPI_DECODER_STATUS_ERROR_UNSUPPORTED_CHROMA_FORMAT,
GST_VAAPI_DECODER_STATUS_ERROR_INVALID_PARAMETER,
GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN = -1
} GstVaapiDecoderStatus;
GstVaapiDecoder *
gst_vaapi_decoder_ref(GstVaapiDecoder *decoder);
gst_vaapi_decoder_ref (GstVaapiDecoder * decoder);
void
gst_vaapi_decoder_unref(GstVaapiDecoder *decoder);
gst_vaapi_decoder_unref (GstVaapiDecoder * decoder);
void
gst_vaapi_decoder_replace(GstVaapiDecoder **old_decoder_ptr,
GstVaapiDecoder *new_decoder);
gst_vaapi_decoder_replace (GstVaapiDecoder ** old_decoder_ptr,
GstVaapiDecoder * new_decoder);
gpointer
gst_vaapi_decoder_get_user_data(GstVaapiDecoder *decoder);
gst_vaapi_decoder_get_user_data (GstVaapiDecoder * decoder);
void
gst_vaapi_decoder_set_user_data(GstVaapiDecoder *decoder, gpointer user_data);
gst_vaapi_decoder_set_user_data (GstVaapiDecoder * decoder, gpointer user_data);
GstVaapiCodec
gst_vaapi_decoder_get_codec(GstVaapiDecoder *decoder);
gst_vaapi_decoder_get_codec (GstVaapiDecoder * decoder);
GstVideoCodecState *
gst_vaapi_decoder_get_codec_state(GstVaapiDecoder *decoder);
gst_vaapi_decoder_get_codec_state (GstVaapiDecoder * decoder);
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);
GstCaps *
gst_vaapi_decoder_get_caps(GstVaapiDecoder *decoder);
gst_vaapi_decoder_get_caps (GstVaapiDecoder * decoder);
gboolean
gst_vaapi_decoder_put_buffer(GstVaapiDecoder *decoder, GstBuffer *buf);
gst_vaapi_decoder_put_buffer (GstVaapiDecoder * decoder, GstBuffer * buf);
GstVaapiDecoderStatus
gst_vaapi_decoder_get_surface(GstVaapiDecoder *decoder,
GstVaapiSurfaceProxy **out_proxy_ptr);
gst_vaapi_decoder_get_surface (GstVaapiDecoder * decoder,
GstVaapiSurfaceProxy ** out_proxy_ptr);
GstVaapiDecoderStatus
gst_vaapi_decoder_get_frame(GstVaapiDecoder *decoder,
GstVideoCodecFrame **out_frame_ptr);
gst_vaapi_decoder_get_frame (GstVaapiDecoder * decoder,
GstVideoCodecFrame ** out_frame_ptr);
GstVaapiDecoderStatus
gst_vaapi_decoder_get_frame_with_timeout(GstVaapiDecoder *decoder,
GstVideoCodecFrame **out_frame_ptr, guint64 timeout);
gst_vaapi_decoder_get_frame_with_timeout (GstVaapiDecoder * decoder,
GstVideoCodecFrame ** out_frame_ptr, guint64 timeout);
GstVaapiDecoderStatus
gst_vaapi_decoder_parse(GstVaapiDecoder *decoder,
GstVideoCodecFrame *frame, GstAdapter *adapter, gboolean at_eos,
guint *got_unit_size_ptr, gboolean *got_frame_ptr);
gst_vaapi_decoder_parse (GstVaapiDecoder * decoder,
GstVideoCodecFrame * frame, GstAdapter * adapter, gboolean at_eos,
guint * got_unit_size_ptr, gboolean * got_frame_ptr);
GstVaapiDecoderStatus
gst_vaapi_decoder_decode(GstVaapiDecoder *decoder, GstVideoCodecFrame *frame);
gst_vaapi_decoder_decode (GstVaapiDecoder * decoder,
GstVideoCodecFrame * frame);
GstVaapiDecoderStatus
gst_vaapi_decoder_flush(GstVaapiDecoder *decoder);
gst_vaapi_decoder_flush (GstVaapiDecoder * decoder);
G_END_DECLS
......
......@@ -45,8 +45,8 @@ G_BEGIN_DECLS
#define GST_VAAPI_DECODER_GET_CLASS(obj) \
GST_VAAPI_DECODER_CLASS(GST_VAAPI_MINI_OBJECT_GET_CLASS(obj))
typedef struct _GstVaapiDecoderClass GstVaapiDecoderClass;
struct _GstVaapiDecoderUnit;
typedef struct _GstVaapiDecoderClass GstVaapiDecoderClass;
struct _GstVaapiDecoderUnit;
/**
* GST_VAAPI_PARSER_STATE:
......@@ -162,21 +162,22 @@ typedef struct _GstVaapiDecoderClass GstVaapiDecoderClass;
GstVaapiDecoderPrivate))
typedef enum {
GST_VAAPI_DECODER_STATUS_DROP_FRAME = -2
GST_VAAPI_DECODER_STATUS_DROP_FRAME = -2
} GstVaapiDecoderStatusPrivate;
typedef struct _GstVaapiParserState GstVaapiParserState;
struct _GstVaapiParserState {
GstVideoCodecFrame *current_frame;
guint32 current_frame_number;
GstAdapter *current_adapter;
GstAdapter *input_adapter;
gint input_offset1;
gint input_offset2;
GstAdapter *output_adapter;
GstVaapiDecoderUnit next_unit;
guint next_unit_pending : 1;
guint at_eos : 1;
struct _GstVaapiParserState
{
GstVideoCodecFrame *current_frame;
guint32 current_frame_number;
GstAdapter *current_adapter;
GstAdapter *input_adapter;
gint input_offset1;
gint input_offset2;
GstAdapter *output_adapter;
GstVaapiDecoderUnit next_unit;
guint next_unit_pending:1;
guint at_eos:1;
};
/**
......@@ -184,22 +185,23 @@ struct _GstVaapiParserState {
*
* A VA decoder base instance.
*/
struct _GstVaapiDecoder {
/*< private >*/
GstVaapiMiniObject parent_instance;
gpointer user_data;
GstVaapiDisplay *display;
VADisplay va_display;
GstVaapiContext *context;
VAContextID va_context;
GstVaapiCodec codec;
GstVideoCodecState *codec_state;
GAsyncQueue *buffers;
GAsyncQueue *frames;
GstVaapiParserState parser_state;
GstVaapiDecoderStateChangedFunc codec_state_changed_func;
gpointer codec_state_changed_data;
struct _GstVaapiDecoder
{
/*< private >*/
GstVaapiMiniObject parent_instance;
gpointer user_data;
GstVaapiDisplay *display;
VADisplay va_display;
GstVaapiContext *context;
VAContextID va_context;
GstVaapiCodec codec;
GstVideoCodecState *codec_state;
GAsyncQueue *buffers;
GAsyncQueue *frames;
GstVaapiParserState parser_state;
GstVaapiDecoderStateChangedFunc codec_state_changed_func;
gpointer codec_state_changed_data;
};
/**
......@@ -207,86 +209,77 @@ struct _GstVaapiDecoder {
*
* A VA decoder base class.
*/
struct _GstVaapiDecoderClass {
/*< private >*/
GstVaapiMiniObjectClass parent_class;
gboolean (*create)(GstVaapiDecoder *decoder);
void (*destroy)(GstVaapiDecoder *decoder);
GstVaapiDecoderStatus (*parse)(GstVaapiDecoder *decoder,
GstAdapter *adapter, gboolean at_eos,
struct _GstVaapiDecoderUnit *unit);
GstVaapiDecoderStatus (*decode)(GstVaapiDecoder *decoder,
struct _GstVaapiDecoderUnit *unit);
GstVaapiDecoderStatus (*start_frame)(GstVaapiDecoder *decoder,
struct _GstVaapiDecoderUnit *unit);
GstVaapiDecoderStatus (*end_frame)(GstVaapiDecoder *decoder);
GstVaapiDecoderStatus (*flush)(GstVaapiDecoder *decoder);
GstVaapiDecoderStatus (*decode_codec_data)(GstVaapiDecoder *decoder,
const guchar *buf, guint buf_size);
struct _GstVaapiDecoderClass
{
/*< private >*/
GstVaapiMiniObjectClass parent_class;
gboolean (*create) (GstVaapiDecoder * decoder);
void (*destroy) (GstVaapiDecoder * decoder);
GstVaapiDecoderStatus (*parse) (GstVaapiDecoder * decoder,
GstAdapter * adapter, gboolean at_eos,
struct _GstVaapiDecoderUnit * unit);
GstVaapiDecoderStatus (*decode) (GstVaapiDecoder * decoder,
struct _GstVaapiDecoderUnit * unit);
GstVaapiDecoderStatus (*start_frame) (GstVaapiDecoder * decoder,
struct _GstVaapiDecoderUnit * unit);
GstVaapiDecoderStatus (*end_frame) (GstVaapiDecoder * decoder);
GstVaapiDecoderStatus (*flush) (GstVaapiDecoder * decoder);
GstVaapiDecoderStatus (*decode_codec_data) (GstVaapiDecoder * decoder,
const guchar * buf, guint buf_size);
};
G_GNUC_INTERNAL
GstVaapiDecoder *
gst_vaapi_decoder_new(const GstVaapiDecoderClass *klass,
GstVaapiDisplay *display, GstCaps *caps);
gst_vaapi_decoder_new (const GstVaapiDecoderClass * klass,
GstVaapiDisplay * display, GstCaps * caps);
G_GNUC_INTERNAL
void
gst_vaapi_decoder_finalize(GstVaapiDecoder *decoder);
gst_vaapi_decoder_finalize (GstVaapiDecoder * decoder);
G_GNUC_INTERNAL
void
gst_vaapi_decoder_set_picture_size(
GstVaapiDecoder *decoder,
guint width,
guint height
);
gst_vaapi_decoder_set_picture_size (GstVaapiDecoder * decoder,
guint width, guint height);
G_GNUC_INTERNAL
void
gst_vaapi_decoder_set_framerate(
GstVaapiDecoder *decoder,
guint fps_n,
guint fps_d
);
gst_vaapi_decoder_set_framerate (GstVaapiDecoder * decoder,
guint fps_n, guint fps_d);
G_GNUC_INTERNAL
void
gst_vaapi_decoder_set_pixel_aspect_ratio(
GstVaapiDecoder *decoder,
guint par_n,
guint par_d
);
gst_vaapi_decoder_set_pixel_aspect_ratio (GstVaapiDecoder * decoder,
guint par_n, guint par_d);
G_GNUC_INTERNAL
void
gst_vaapi_decoder_set_interlace_mode(GstVaapiDecoder *decoder,
gst_vaapi_decoder_set_interlace_mode (GstVaapiDecoder * decoder,
GstVideoInterlaceMode mode);
G_GNUC_INTERNAL
void
gst_vaapi_decoder_set_interlaced(GstVaapiDecoder *decoder, gboolean interlaced);
gst_vaapi_decoder_set_interlaced (GstVaapiDecoder * decoder,
gboolean interlaced);
G_GNUC_INTERNAL
gboolean
gst_vaapi_decoder_ensure_context(
GstVaapiDecoder *decoder,
GstVaapiContextInfo *cip
);
gst_vaapi_decoder_ensure_context (GstVaapiDecoder * decoder,
GstVaapiContextInfo * cip);
G_GNUC_INTERNAL
void
gst_vaapi_decoder_push_frame(GstVaapiDecoder *decoder,
GstVideoCodecFrame *frame);
gst_vaapi_decoder_push_frame (GstVaapiDecoder * decoder,
GstVideoCodecFrame * frame);
G_GNUC_INTERNAL
GstVaapiDecoderStatus
gst_vaapi_decoder_check_status(GstVaapiDecoder *decoder);
gst_vaapi_decoder_check_status (GstVaapiDecoder * decoder);
G_GNUC_INTERNAL
GstVaapiDecoderStatus
gst_vaapi_decoder_decode_codec_data(GstVaapiDecoder *decoder);
gst_vaapi_decoder_decode_codec_data (GstVaapiDecoder * decoder);
G_END_DECLS
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment