Tizen 2.0 Release
[framework/multimedia/gstreamer-vaapi.git] / gst / vaapi / gstvaapiencode.h
1 /*
2  *  gstvaapiencode.h - VA-API video encoder
3  *
4  *  Copyright (C) 2011 Intel Corporation
5  *
6  *  This library is free software; you can redistribute it and/or
7  *  modify it under the terms of the GNU Lesser General Public License
8  *  as published by the Free Software Foundation; either version 2.1
9  *  of the License, or (at your option) any later version.
10  *
11  *  This library 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 GNU
14  *  Lesser General Public License for more details.
15  *
16  *  You should have received a copy of the GNU Lesser General Public
17  *  License along with this library; if not, write to the Free
18  *  Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  *  Boston, MA 02110-1301 USA
20  */
21
22 #ifndef GST_VAAPI_ENCODE_H
23 #define GST_VAAPI_ENCODE_H
24
25 #include <gst/gst.h>
26 #include "gst/vaapi/gstvaapiencoder.h"
27
28 G_BEGIN_DECLS
29
30 /* Default templates */
31 #define GST_CAPS_CODEC(CODEC)          \
32     CODEC ", "                         \
33     "width  = (int) [ 1, MAX ], "      \
34     "height = (int) [ 1, MAX ]; "
35
36 #define GST_TYPE_VAAPI_ENCODE \
37     (gst_vaapi_encode_get_type())
38
39 #define GST_IS_VAAPI_ENCODE(obj) \
40     (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VAAPI_ENCODE))
41
42 #define GST_IS_VAAPI_ENCODE_CLASS(klass) \
43     (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_VAAPI_ENCODE))
44
45 #define GST_VAAPI_ENCODE_GET_CLASS(obj)                 \
46     (G_TYPE_INSTANCE_GET_CLASS ((obj),                  \
47                                 GST_TYPE_VAAPI_ENCODE,  \
48                                 GstVaapiEncodeClass))
49
50 #define GST_VAAPI_ENCODE(obj)                           \
51     (G_TYPE_CHECK_INSTANCE_CAST ((obj),                 \
52                                  GST_TYPE_VAAPI_ENCODE, \
53                                  GstVaapiEncode))
54
55 #define GST_VAAPI_ENCODE_CLASS(klass)                   \
56     (G_TYPE_CHECK_CLASS_CAST ((klass),                  \
57                                GST_TYPE_VAAPI_ENCODE,   \
58                                GstVaapiEncodeClass))
59
60 typedef struct _GstVaapiEncode        GstVaapiEncode;
61 typedef struct _GstVaapiEncodeClass   GstVaapiEncodeClass;
62
63 struct _GstVaapiEncode {
64     GstElement          parent_instance;
65
66     GstPad             *sinkpad;
67     GstCaps            *sinkpad_caps;
68
69     GstPad             *srcpad;
70     GstCaps            *srcpad_caps;
71
72     GstVaapiEncoder    *encoder;
73     gboolean            first_src_frame;
74
75     GstVaapiVideoPool  *video_pool;
76
77     /*encode chain lock*/
78     GMutex             *mutex;
79     GCond              *idle_buf_added;
80     GCond              *busy_buf_added;
81     gboolean            is_running;
82     gboolean            is_buffer_sharing;
83 };
84
85 struct _GstVaapiEncodeClass {
86     GstElementClass     parent_class;
87     gboolean          (*set_encoder_src_caps)(GstVaapiEncode* encode, GstCaps *caps);
88 };
89
90 GType gst_vaapi_encode_get_type(void);
91
92 G_END_DECLS
93
94 #endif /* GST_VAAPI_ENCODE_H */
95