gstvaapidecoder.h 5.06 KB
Newer Older
1 2 3
/*
 *  gstvaapidecoder.h - VA decoder abstraction
 *
4
 *  Copyright (C) 2010-2011 Splitted-Desktop Systems
5
 *    Author: Gwenole Beauchesne <gwenole.beauchesne@splitted-desktop.com>
6
 *  Copyright (C) 2011-2013 Intel Corporation
7
 *    Author: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
8
 *
gb's avatar
gb committed
9 10 11 12
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public License
 *  as published by the Free Software Foundation; either version 2.1
 *  of the License, or (at your option) any later version.
13
 *
gb's avatar
gb committed
14
 *  This library is distributed in the hope that it will be useful,
15
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
gb's avatar
gb committed
16 17
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
18
 *
gb's avatar
gb committed
19 20 21 22
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free
 *  Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 *  Boston, MA 02110-1301 USA
23 24 25 26 27 28
 */

#ifndef GST_VAAPI_DECODER_H
#define GST_VAAPI_DECODER_H

#include <gst/gstbuffer.h>
29
#include <gst/base/gstadapter.h>
30
#include <gst/vaapi/gstvaapisurfaceproxy.h>
31
#include <gst/video/gstvideoutils.h>
32 33 34

G_BEGIN_DECLS

35 36
#define GST_VAAPI_DECODER(obj) \
    ((GstVaapiDecoder *)(obj))
37

38 39 40
typedef struct _GstVaapiDecoder GstVaapiDecoder;
typedef void (*GstVaapiDecoderStateChangedFunc) (GstVaapiDecoder * decoder,
    const GstVideoCodecState * codec_state, gpointer user_data);
41 42 43 44

/**
 * GstVaapiDecoderStatus:
 * @GST_VAAPI_DECODER_STATUS_SUCCESS: Success.
gb's avatar
gb committed
45 46 47
 * @GST_VAAPI_DECODER_STATUS_END_OF_STREAM: End-Of-Stream.
 * @GST_VAAPI_DECODER_STATUS_ERROR_ALLOCATION_FAILED: No memory left.
 * @GST_VAAPI_DECODER_STATUS_ERROR_INIT_FAILED: Decoder initialization failure.
48
 * @GST_VAAPI_DECODER_STATUS_ERROR_UNSUPPORTED_CODEC: Unsupported codec.
gb's avatar
gb committed
49
 * @GST_VAAPI_DECODER_STATUS_ERROR_NO_DATA: Not enough input data to decode.
gb's avatar
gb committed
50
 * @GST_VAAPI_DECODER_STATUS_ERROR_NO_SURFACE: No surface left to hold the decoded picture.
gb's avatar
gb committed
51
 * @GST_VAAPI_DECODER_STATUS_ERROR_INVALID_SURFACE: Invalid surface.
52 53 54
 * @GST_VAAPI_DECODER_STATUS_ERROR_BITSTREAM_PARSER: Invalid or unsupported bitstream data.
 * @GST_VAAPI_DECODER_STATUS_ERROR_UNSUPPORTED_PROFILE: Unsupported codec profile.
 * @GST_VAAPI_DECODER_STATUS_ERROR_UNSUPPORTED_CHROMA_FORMAT: Unsupported chroma format.
55
 * @GST_VAAPI_DECODER_STATUS_ERROR_INVALID_PARAMETER: Unsupported parameter.
gb's avatar
gb committed
56
 * @GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN: Unknown error.
57 58 59
 *
 * Decoder status for gst_vaapi_decoder_get_surface().
 */
Philip Lorenz's avatar
Philip Lorenz committed
60
typedef enum {
61 62 63 64 65 66 67 68 69 70 71 72 73
  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
Philip Lorenz's avatar
Philip Lorenz committed
74
} GstVaapiDecoderStatus;
75

76
GstVaapiDecoder *
77
gst_vaapi_decoder_ref (GstVaapiDecoder * decoder);
78

79
void
80
gst_vaapi_decoder_unref (GstVaapiDecoder * decoder);
81

82
void
83 84
gst_vaapi_decoder_replace (GstVaapiDecoder ** old_decoder_ptr,
    GstVaapiDecoder * new_decoder);
85 86

gpointer
87
gst_vaapi_decoder_get_user_data (GstVaapiDecoder * decoder);
88 89

void
90
gst_vaapi_decoder_set_user_data (GstVaapiDecoder * decoder, gpointer user_data);
91

92
GstVaapiCodec
93
gst_vaapi_decoder_get_codec (GstVaapiDecoder * decoder);
94

95
GstVideoCodecState *
96
gst_vaapi_decoder_get_codec_state (GstVaapiDecoder * decoder);
97

98
void
99
gst_vaapi_decoder_set_codec_state_changed_func (GstVaapiDecoder * decoder,
100 101
    GstVaapiDecoderStateChangedFunc func, gpointer user_data);

gb's avatar
gb committed
102
GstCaps *
103
gst_vaapi_decoder_get_caps (GstVaapiDecoder * decoder);
104 105 106

GArray *
gst_vaapi_decoder_get_surface_formats (GstVaapiDecoder * decoder);
gb's avatar
gb committed
107

108
gboolean
109
gst_vaapi_decoder_put_buffer (GstVaapiDecoder * decoder, GstBuffer * buf);
110

111
GstVaapiDecoderStatus
112 113
gst_vaapi_decoder_get_surface (GstVaapiDecoder * decoder,
    GstVaapiSurfaceProxy ** out_proxy_ptr);
114

115
GstVaapiDecoderStatus
116 117
gst_vaapi_decoder_get_frame (GstVaapiDecoder * decoder,
    GstVideoCodecFrame ** out_frame_ptr);
118

119
GstVaapiDecoderStatus
120 121
gst_vaapi_decoder_get_frame_with_timeout (GstVaapiDecoder * decoder,
    GstVideoCodecFrame ** out_frame_ptr, guint64 timeout);
122

123
GstVaapiDecoderStatus
124 125 126
gst_vaapi_decoder_parse (GstVaapiDecoder * decoder,
    GstVideoCodecFrame * frame, GstAdapter * adapter, gboolean at_eos,
    guint * got_unit_size_ptr, gboolean * got_frame_ptr);
127 128

GstVaapiDecoderStatus
129 130
gst_vaapi_decoder_decode (GstVaapiDecoder * decoder,
    GstVideoCodecFrame * frame);
131

132
GstVaapiDecoderStatus
133
gst_vaapi_decoder_flush (GstVaapiDecoder * decoder);
134

135 136 137
GstVaapiDecoderStatus
gst_vaapi_decoder_check_status (GstVaapiDecoder * decoder);

138 139 140
gboolean
gst_vaapi_decoder_update_caps (GstVaapiDecoder * decoder, GstCaps * caps);

141 142 143
G_END_DECLS

#endif /* GST_VAAPI_DECODER_H */