Fix seek issue
[profile/ivi/gstreamer-vaapi.git] / gst-libs / gst / vaapi / gstvaapidecoder.h
1 /*
2  *  gstvaapidecoder.h - VA decoder abstraction
3  *
4  *  Copyright (C) 2010-2011 Splitted-Desktop Systems
5  *  Copyright (C) 2011 Intel Corporation
6  *
7  *  This library is free software; you can redistribute it and/or
8  *  modify it under the terms of the GNU Lesser General Public License
9  *  as published by the Free Software Foundation; either version 2.1
10  *  of the License, or (at your option) any later version.
11  *
12  *  This library is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  *  Lesser General Public License for more details.
16  *
17  *  You should have received a copy of the GNU Lesser General Public
18  *  License along with this library; if not, write to the Free
19  *  Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  *  Boston, MA 02110-1301 USA
21  */
22
23 #ifndef GST_VAAPI_DECODER_H
24 #define GST_VAAPI_DECODER_H
25
26 #include <gst/gstbuffer.h>
27 #include <gst/vaapi/gstvaapicontext.h>
28 #include <gst/vaapi/gstvaapisurfaceproxy.h>
29
30 G_BEGIN_DECLS
31
32 #define GST_VAAPI_TYPE_DECODER \
33     (gst_vaapi_decoder_get_type())
34
35 #define GST_VAAPI_DECODER(obj)                          \
36     (G_TYPE_CHECK_INSTANCE_CAST((obj),                  \
37                                 GST_VAAPI_TYPE_DECODER, \
38                                 GstVaapiDecoder))
39
40 #define GST_VAAPI_DECODER_CLASS(klass)                  \
41     (G_TYPE_CHECK_CLASS_CAST((klass),                   \
42                              GST_VAAPI_TYPE_DECODER,    \
43                              GstVaapiDecoderClass))
44
45 #define GST_VAAPI_IS_DECODER(obj) \
46     (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_VAAPI_TYPE_DECODER))
47
48 #define GST_VAAPI_IS_DECODER_CLASS(klass) \
49     (G_TYPE_CHECK_CLASS_TYPE((klass), GST_VAAPI_TYPE_DECODER))
50
51 #define GST_VAAPI_DECODER_GET_CLASS(obj)                \
52     (G_TYPE_INSTANCE_GET_CLASS((obj),                   \
53                                GST_VAAPI_TYPE_DECODER,  \
54                                GstVaapiDecoderClass))
55
56 typedef struct _GstVaapiDecoder                 GstVaapiDecoder;
57 typedef struct _GstVaapiDecoderPrivate          GstVaapiDecoderPrivate;
58 typedef struct _GstVaapiDecoderClass            GstVaapiDecoderClass;
59
60 /**
61  * GstVaapiDecoderStatus:
62  * @GST_VAAPI_DECODER_STATUS_SUCCESS: Success.
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_NO_SURFACE: No surface left to hold the decoded picture.
69  * @GST_VAAPI_DECODER_STATUS_ERROR_INVALID_SURFACE: Invalid surface.
70  * @GST_VAAPI_DECODER_STATUS_ERROR_BITSTREAM_PARSER: Invalid or unsupported bitstream data.
71  * @GST_VAAPI_DECODER_STATUS_ERROR_UNSUPPORTED_PROFILE: Unsupported codec profile.
72  * @GST_VAAPI_DECODER_STATUS_ERROR_UNSUPPORTED_CHROMA_FORMAT: Unsupported chroma format.
73  * @GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN: Unknown error.
74  *
75  * Decoder status for gst_vaapi_decoder_get_surface().
76  */
77 typedef enum {
78     GST_VAAPI_DECODER_STATUS_SUCCESS = 0,
79     GST_VAAPI_DECODER_STATUS_END_OF_STREAM,
80     GST_VAAPI_DECODER_STATUS_ERROR_ALLOCATION_FAILED,
81     GST_VAAPI_DECODER_STATUS_ERROR_INIT_FAILED,
82     GST_VAAPI_DECODER_STATUS_ERROR_UNSUPPORTED_CODEC,
83     GST_VAAPI_DECODER_STATUS_ERROR_NO_DATA,
84     GST_VAAPI_DECODER_STATUS_ERROR_NO_SURFACE,
85     GST_VAAPI_DECODER_STATUS_ERROR_INVALID_SURFACE,
86     GST_VAAPI_DECODER_STATUS_ERROR_BITSTREAM_PARSER,
87     GST_VAAPI_DECODER_STATUS_ERROR_UNSUPPORTED_PROFILE,
88     GST_VAAPI_DECODER_STATUS_ERROR_UNSUPPORTED_CHROMA_FORMAT,
89     GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN = -1
90 } GstVaapiDecoderStatus;
91
92 /**
93  * GstVaapiDecoder:
94  *
95  * A VA decoder base instance.
96  */
97 struct _GstVaapiDecoder {
98     /*< private >*/
99     GObject parent_instance;
100
101     GstVaapiDecoderPrivate *priv;
102 };
103
104 /**
105  * GstVaapiDecoderClass:
106  *
107  * A VA decoder base class.
108  */
109 struct _GstVaapiDecoderClass {
110     /*< private >*/
111     GObjectClass parent_class;
112
113     GstVaapiDecoderStatus (*decode)(GstVaapiDecoder *decoder, GstBuffer *buffer);
114     void                  (*clear_buffer)(GstVaapiDecoder *decoder);
115 };
116
117 GType
118 gst_vaapi_decoder_get_type(void) G_GNUC_CONST;
119
120 GstVaapiCodec
121 gst_vaapi_decoder_get_codec(GstVaapiDecoder *decoder);
122
123 GstCaps *
124 gst_vaapi_decoder_get_caps(GstVaapiDecoder *decoder);
125
126 gboolean
127 gst_vaapi_decoder_put_buffer(GstVaapiDecoder *decoder, GstBuffer *buf);
128
129 GstVaapiSurfaceProxy *
130 gst_vaapi_decoder_get_surface(
131     GstVaapiDecoder       *decoder,
132     GstVaapiDecoderStatus *pstatus,
133     gboolean              try_again
134 );
135
136 void
137 gst_vaapi_decoder_clear_buffer(GstVaapiDecoder *decoder);
138
139 G_END_DECLS
140
141 #endif /* GST_VAAPI_DECODER_H */