gstvaapidecoder.h 4.67 KB
Newer Older
1 2 3
/*
 *  gstvaapidecoder.h - VA decoder abstraction
 *
4
 *  Copyright (C) 2010-2011 Splitted-Desktop Systems
5
 *  Copyright (C) 2011-2013 Intel Corporation
6
 *
gb's avatar
gb committed
7 8 9 10
 *  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.
11
 *
gb's avatar
gb committed
12
 *  This library is distributed in the hope that it will be useful,
13
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
gb's avatar
gb committed
14 15
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
16
 *
gb's avatar
gb committed
17 18 19 20
 *  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
21 22 23 24 25 26
 */

#ifndef GST_VAAPI_DECODER_H
#define GST_VAAPI_DECODER_H

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

G_BEGIN_DECLS

33 34
#define GST_VAAPI_DECODER(obj) \
    ((GstVaapiDecoder *)(obj))
35 36

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

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

74 75
GstVaapiDecoder *
gst_vaapi_decoder_ref(GstVaapiDecoder *decoder);
76

77 78
void
gst_vaapi_decoder_unref(GstVaapiDecoder *decoder);
79

80 81 82 83 84 85 86 87 88
void
gst_vaapi_decoder_replace(GstVaapiDecoder **old_decoder_ptr,
    GstVaapiDecoder *new_decoder);

gpointer
gst_vaapi_decoder_get_user_data(GstVaapiDecoder *decoder);

void
gst_vaapi_decoder_set_user_data(GstVaapiDecoder *decoder, gpointer user_data);
89

90 91 92
GstVaapiCodec
gst_vaapi_decoder_get_codec(GstVaapiDecoder *decoder);

93 94 95
GstVideoCodecState *
gst_vaapi_decoder_get_codec_state(GstVaapiDecoder *decoder);

96 97 98 99
void
gst_vaapi_decoder_set_codec_state_changed_func(GstVaapiDecoder *decoder,
    GstVaapiDecoderStateChangedFunc func, gpointer user_data);

gb's avatar
gb committed
100 101 102
GstCaps *
gst_vaapi_decoder_get_caps(GstVaapiDecoder *decoder);

103 104 105
gboolean
gst_vaapi_decoder_put_buffer(GstVaapiDecoder *decoder, GstBuffer *buf);

106 107 108
GstVaapiDecoderStatus
gst_vaapi_decoder_get_surface(GstVaapiDecoder *decoder,
    GstVaapiSurfaceProxy **out_proxy_ptr);
109

110 111 112 113
GstVaapiDecoderStatus
gst_vaapi_decoder_get_frame(GstVaapiDecoder *decoder,
    GstVideoCodecFrame **out_frame_ptr);

114 115 116 117
GstVaapiDecoderStatus
gst_vaapi_decoder_get_frame_with_timeout(GstVaapiDecoder *decoder,
    GstVideoCodecFrame **out_frame_ptr, guint64 timeout);

118 119 120 121 122 123
GstVaapiDecoderStatus
gst_vaapi_decoder_parse(GstVaapiDecoder *decoder,
    GstVideoCodecFrame *frame, GstAdapter *adapter, gboolean at_eos,
    guint *got_unit_size_ptr, gboolean *got_frame_ptr);

GstVaapiDecoderStatus
124
gst_vaapi_decoder_decode(GstVaapiDecoder *decoder, GstVideoCodecFrame *frame);
125

126 127 128
GstVaapiDecoderStatus
gst_vaapi_decoder_flush(GstVaapiDecoder *decoder);

129 130 131
G_END_DECLS

#endif /* GST_VAAPI_DECODER_H */