gstvaapidecoder.h 4.62 KB
Newer Older
1 2 3
/*
 *  gstvaapidecoder.h - VA decoder abstraction
 *
4
 *  Copyright (C) 2010-2011 Splitted-Desktop Systems
5
 *  Copyright (C) 2011 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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
 */

#ifndef GST_VAAPI_DECODER_H
#define GST_VAAPI_DECODER_H

#include <gst/gstbuffer.h>
#include <gst/vaapi/gstvaapicontext.h>
#include <gst/vaapi/gstvaapisurfaceproxy.h>

G_BEGIN_DECLS

#define GST_VAAPI_TYPE_DECODER \
    (gst_vaapi_decoder_get_type())

#define GST_VAAPI_DECODER(obj)                          \
    (G_TYPE_CHECK_INSTANCE_CAST((obj),                  \
                                GST_VAAPI_TYPE_DECODER, \
                                GstVaapiDecoder))

#define GST_VAAPI_DECODER_CLASS(klass)                  \
    (G_TYPE_CHECK_CLASS_CAST((klass),                   \
                             GST_VAAPI_TYPE_DECODER,    \
                             GstVaapiDecoderClass))

#define GST_VAAPI_IS_DECODER(obj) \
    (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_VAAPI_TYPE_DECODER))

#define GST_VAAPI_IS_DECODER_CLASS(klass) \
    (G_TYPE_CHECK_CLASS_TYPE((klass), GST_VAAPI_TYPE_DECODER))

#define GST_VAAPI_DECODER_GET_CLASS(obj)                \
    (G_TYPE_INSTANCE_GET_CLASS((obj),                   \
                               GST_VAAPI_TYPE_DECODER,  \
                               GstVaapiDecoderClass))

typedef enum _GstVaapiDecoderStatus             GstVaapiDecoderStatus;
typedef struct _GstVaapiDecoder                 GstVaapiDecoder;
typedef struct _GstVaapiDecoderPrivate          GstVaapiDecoderPrivate;
typedef struct _GstVaapiDecoderClass            GstVaapiDecoderClass;

/**
 * GstVaapiDecoderStatus:
 * @GST_VAAPI_DECODER_STATUS_SUCCESS: Success.
gb's avatar
gb committed
64 65 66
 * @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.
67
 * @GST_VAAPI_DECODER_STATUS_ERROR_UNSUPPORTED_CODEC: Unsupported codec.
gb's avatar
gb committed
68
 * @GST_VAAPI_DECODER_STATUS_ERROR_NO_DATA: Not enough input data to decode.
gb's avatar
gb committed
69
 * @GST_VAAPI_DECODER_STATUS_ERROR_NO_SURFACE: No surface left to hold the decoded picture.
gb's avatar
gb committed
70
 * @GST_VAAPI_DECODER_STATUS_ERROR_INVALID_SURFACE: Invalid surface.
71 72 73
 * @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.
gb's avatar
gb committed
74
 * @GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN: Unknown error.
75 76 77 78 79 80 81 82
 *
 * Decoder status for gst_vaapi_decoder_get_surface().
 */
enum _GstVaapiDecoderStatus {
    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,
83
    GST_VAAPI_DECODER_STATUS_ERROR_UNSUPPORTED_CODEC,
gb's avatar
gb committed
84
    GST_VAAPI_DECODER_STATUS_ERROR_NO_DATA,
gb's avatar
gb committed
85
    GST_VAAPI_DECODER_STATUS_ERROR_NO_SURFACE,
gb's avatar
gb committed
86
    GST_VAAPI_DECODER_STATUS_ERROR_INVALID_SURFACE,
87 88 89
    GST_VAAPI_DECODER_STATUS_ERROR_BITSTREAM_PARSER,
    GST_VAAPI_DECODER_STATUS_ERROR_UNSUPPORTED_PROFILE,
    GST_VAAPI_DECODER_STATUS_ERROR_UNSUPPORTED_CHROMA_FORMAT,
90
    GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN = -1
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
};

/**
 * GstVaapiDecoder:
 *
 * A VA decoder base instance.
 */
struct _GstVaapiDecoder {
    /*< private >*/
    GObject parent_instance;

    GstVaapiDecoderPrivate *priv;
};

/**
 * GstVaapiDecoderClass:
 *
 * A VA decoder base class.
 */
struct _GstVaapiDecoderClass {
    /*< private >*/
    GObjectClass parent_class;

gb's avatar
gb committed
114
    GstVaapiDecoderStatus (*decode)(GstVaapiDecoder *decoder, GstBuffer *buffer);
115 116 117
};

GType
118
gst_vaapi_decoder_get_type(void) G_GNUC_CONST;
119

gb's avatar
gb committed
120 121 122
GstCaps *
gst_vaapi_decoder_get_caps(GstVaapiDecoder *decoder);

123 124 125 126 127 128 129 130 131 132 133 134
gboolean
gst_vaapi_decoder_put_buffer(GstVaapiDecoder *decoder, GstBuffer *buf);

GstVaapiSurfaceProxy *
gst_vaapi_decoder_get_surface(
    GstVaapiDecoder       *decoder,
    GstVaapiDecoderStatus *pstatus
);

G_END_DECLS

#endif /* GST_VAAPI_DECODER_H */