2 * gstvaapidecoder.h - VA decoder abstraction
4 * gstreamer-vaapi (C) 2010 Splitted-Desktop Systems
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
21 #ifndef GST_VAAPI_DECODER_H
22 #define GST_VAAPI_DECODER_H
24 #include <gst/gstbuffer.h>
25 #include <gst/vaapi/gstvaapicontext.h>
26 #include <gst/vaapi/gstvaapisurfaceproxy.h>
30 #define GST_VAAPI_TYPE_DECODER \
31 (gst_vaapi_decoder_get_type())
33 #define GST_VAAPI_DECODER(obj) \
34 (G_TYPE_CHECK_INSTANCE_CAST((obj), \
35 GST_VAAPI_TYPE_DECODER, \
38 #define GST_VAAPI_DECODER_CLASS(klass) \
39 (G_TYPE_CHECK_CLASS_CAST((klass), \
40 GST_VAAPI_TYPE_DECODER, \
41 GstVaapiDecoderClass))
43 #define GST_VAAPI_IS_DECODER(obj) \
44 (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_VAAPI_TYPE_DECODER))
46 #define GST_VAAPI_IS_DECODER_CLASS(klass) \
47 (G_TYPE_CHECK_CLASS_TYPE((klass), GST_VAAPI_TYPE_DECODER))
49 #define GST_VAAPI_DECODER_GET_CLASS(obj) \
50 (G_TYPE_INSTANCE_GET_CLASS((obj), \
51 GST_VAAPI_TYPE_DECODER, \
52 GstVaapiDecoderClass))
54 typedef enum _GstVaapiDecoderStatus GstVaapiDecoderStatus;
55 typedef struct _GstVaapiDecoder GstVaapiDecoder;
56 typedef struct _GstVaapiDecoderPrivate GstVaapiDecoderPrivate;
57 typedef struct _GstVaapiDecoderClass GstVaapiDecoderClass;
60 * GstVaapiDecoderStatus:
61 * @GST_VAAPI_DECODER_STATUS_SUCCESS: Success.
62 * @GST_VAAPI_DECODER_STATUS_TIMEOUT: Timeout. Try again later.
63 * @GST_VAAPI_DECODER_STATUS_END_OF_STREAM: End-Of-Stream.
64 * @GST_VAAPI_DECODER_STATUS_ERROR_ALLOCATION_FAILED: No memory left.
65 * @GST_VAAPI_DECODER_STATUS_ERROR_INIT_FAILED: Decoder initialization failure.
66 * @GST_VAAPI_DECODER_STATUS_ERROR_UNSUPPORTED_CODEC: Unsupported codec.
67 * @GST_VAAPI_DECODER_STATUS_ERROR_NO_DATA: Not enough input data to decode.
68 * @GST_VAAPI_DECODER_STATUS_ERROR_INVALID_SURFACE: Invalid surface.
69 * @GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN: Unknown error.
71 * Decoder status for gst_vaapi_decoder_get_surface().
73 enum _GstVaapiDecoderStatus {
74 GST_VAAPI_DECODER_STATUS_SUCCESS = 0,
75 GST_VAAPI_DECODER_STATUS_TIMEOUT,
76 GST_VAAPI_DECODER_STATUS_END_OF_STREAM,
77 GST_VAAPI_DECODER_STATUS_ERROR_ALLOCATION_FAILED,
78 GST_VAAPI_DECODER_STATUS_ERROR_INIT_FAILED,
79 GST_VAAPI_DECODER_STATUS_ERROR_UNSUPPORTED_CODEC,
80 GST_VAAPI_DECODER_STATUS_ERROR_NO_DATA,
81 GST_VAAPI_DECODER_STATUS_ERROR_INVALID_SURFACE,
82 GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN
88 * A VA decoder base instance.
90 struct _GstVaapiDecoder {
92 GObject parent_instance;
94 GstVaapiDecoderPrivate *priv;
98 * GstVaapiDecoderClass:
99 * @decode: decode one frame.
101 * A VA decoder base class.
103 struct _GstVaapiDecoderClass {
105 GObjectClass parent_class;
107 GstVaapiDecoderStatus (*decode)(GstVaapiDecoder *decoder, GstBuffer *buffer);
111 gst_vaapi_decoder_get_type(void);
114 gst_vaapi_decoder_get_frame_rate(
115 GstVaapiDecoder *decoder,
121 gst_vaapi_decoder_set_frame_rate(
122 GstVaapiDecoder *decoder,
128 gst_vaapi_decoder_start(GstVaapiDecoder *decoder);
131 gst_vaapi_decoder_pause(GstVaapiDecoder *decoder);
134 gst_vaapi_decoder_stop(GstVaapiDecoder *decoder);
137 gst_vaapi_decoder_put_buffer_data(
138 GstVaapiDecoder *decoder,
144 gst_vaapi_decoder_put_buffer_data_copy(
145 GstVaapiDecoder *decoder,
151 gst_vaapi_decoder_put_buffer(GstVaapiDecoder *decoder, GstBuffer *buf);
153 GstVaapiSurfaceProxy *
154 gst_vaapi_decoder_get_surface(
155 GstVaapiDecoder *decoder,
156 GstVaapiDecoderStatus *pstatus
161 #endif /* GST_VAAPI_DECODER_H */