1 /*
2  INTEL CONFIDENTIAL
3  Copyright 2009 Intel Corporation All Rights Reserved.
4  The source code contained or described herein and all documents related to the source code ("Material") are owned by Intel Corporation or its suppliers or licensors. Title to the Material remains with Intel Corporation or its suppliers and licensors. The Material contains trade secrets and proprietary and confidential information of Intel or its suppliers and licensors. The Material is protected by worldwide copyright and trade secret laws and treaty provisions. No part of the Material may be used, copied, reproduced, modified, published, uploaded, posted, transmitted, distributed, or disclosed in any way without Intel’s prior express written permission.
5 
6  No license under any patent, copyright, trade secret or other intellectual property right is granted to or conferred upon you by disclosure or delivery of the Materials, either expressly, by implication, inducement, estoppel or otherwise. Any license under such intellectual property rights must be express and approved by Intel in writing.
7  */
8 
9 #ifndef __MIX_VIDEO_H__
10 #define __MIX_VIDEO_H__
11 
12 #include <glib-object.h>
13 
14 #include "mixdrmparams.h"
15 #include "mixvideoinitparams.h"
16 #include "mixvideoconfigparamsdec.h"
17 #include "mixvideoconfigparamsenc.h"
18 #include "mixvideodecodeparams.h"
19 #include "mixvideoencodeparams.h"
20 #include "mixvideorenderparams.h"
21 #include "mixvideocaps.h"
22 #include "mixbuffer.h"
23 
24 /*
25  * Type macros.
26  */
27 #define MIX_TYPE_VIDEO                  (mix_video_get_type ())
28 #define MIX_VIDEO(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), MIX_TYPE_VIDEO, MixVideo))
29 #define MIX_IS_VIDEO(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MIX_TYPE_VIDEO))
30 #define MIX_VIDEO_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), MIX_TYPE_VIDEO, MixVideoClass))
31 #define MIX_IS_VIDEO_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), MIX_TYPE_VIDEO))
32 #define MIX_VIDEO_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), MIX_TYPE_VIDEO, MixVideoClass))
33 
34 typedef struct _MixVideo MixVideo;
35 typedef struct _MixVideoClass MixVideoClass;
36 
37 /*
38  * Virtual methods typedef
39  */
40 
41 typedef MIX_RESULT (*MixVideoGetVersionFunc)(MixVideo * mix, guint * major,
42 		guint * minor);
43 
44 typedef MIX_RESULT (*MixVideoInitializeFunc)(MixVideo * mix, MixCodecMode mode,
45 		MixVideoInitParams * init_params, MixDrmParams * drm_init_params);
46 
47 typedef MIX_RESULT (*MixVideoDeinitializeFunc)(MixVideo * mix);
48 
49 typedef MIX_RESULT (*MixVideoConfigureFunc)(MixVideo * mix,
50 		MixVideoConfigParams * config_params,
51 		MixDrmParams * drm_config_params);
52 
53 typedef MIX_RESULT (*MixVideoGetConfigFunc)(MixVideo * mix,
54 		MixVideoConfigParams ** config_params);
55 
56 typedef MIX_RESULT (*MixVideoDecodeFunc)(MixVideo * mix, MixBuffer * bufin[],
57 		gint bufincnt, MixVideoDecodeParams * decode_params);
58 
59 typedef MIX_RESULT (*MixVideoGetFrameFunc)(MixVideo * mix,
60 		MixVideoFrame ** frame);
61 
62 typedef MIX_RESULT (*MixVideoReleaseFrameFunc)(MixVideo * mix,
63 		MixVideoFrame * frame);
64 
65 typedef MIX_RESULT (*MixVideoRenderFunc)(MixVideo * mix,
66 		MixVideoRenderParams * render_params, MixVideoFrame *frame);
67 
68 typedef MIX_RESULT (*MixVideoEncodeFunc)(MixVideo * mix, MixBuffer * bufin[],
69 		gint bufincnt, MixIOVec * iovout[], gint iovoutcnt,
70 		MixVideoEncodeParams * encode_params);
71 
72 typedef MIX_RESULT (*MixVideoFlushFunc)(MixVideo * mix);
73 
74 typedef MIX_RESULT (*MixVideoEOSFunc)(MixVideo * mix);
75 
76 typedef MIX_RESULT (*MixVideoGetStateFunc)(MixVideo * mix, MixState * state);
77 
78 typedef MIX_RESULT
79 (*MixVideoGetMixBufferFunc)(MixVideo * mix, MixBuffer ** buf);
80 
81 typedef MIX_RESULT (*MixVideoReleaseMixBufferFunc)(MixVideo * mix,
82 		MixBuffer * buf);
83 
84 typedef MIX_RESULT (*MixVideoGetMaxCodedBufferSizeFunc) (MixVideo * mix,
85 	      guint *max_size);
86 
87 /**
88  * MixVideo:
89  * @parent: Parent object.
90  * @streamState: Current state of the stream
91  * @decodeMode: Current decode mode of the device. This value is valid only when @codingMode equals #MIX_CODING_ENCODE.
92  * @encoding: <comment>TBD...</comment>
93  *
94  * MI-X Video object
95  */
96 struct _MixVideo {
97 	/*< public > */
98 	GObject parent;
99 
100 	/*< public > */
101 
102 	/*< private > */
103 	gpointer context;
104 };
105 
106 /**
107  * MixVideoClass:
108  *
109  * MI-X Video object class
110  */
111 struct _MixVideoClass {
112 	/*< public > */
113 	GObjectClass parent_class;
114 
115 	/* class members */
116 
117 	MixVideoGetVersionFunc get_version_func;
118 	MixVideoInitializeFunc initialize_func;
119 	MixVideoDeinitializeFunc deinitialize_func;
120 	MixVideoConfigureFunc configure_func;
121 	MixVideoGetConfigFunc get_config_func;
122 	MixVideoDecodeFunc decode_func;
123 	MixVideoGetFrameFunc get_frame_func;
124 	MixVideoReleaseFrameFunc release_frame_func;
125 	MixVideoRenderFunc render_func;
126 	MixVideoEncodeFunc encode_func;
127 	MixVideoFlushFunc flush_func;
128 	MixVideoEOSFunc eos_func;
129 	MixVideoGetStateFunc get_state_func;
130 	MixVideoGetMixBufferFunc get_mix_buffer_func;
131 	MixVideoReleaseMixBufferFunc release_mix_buffer_func;
132 	MixVideoGetMaxCodedBufferSizeFunc get_max_coded_buffer_size_func;
133 };
134 
135 /**
136  * mix_video_get_type:
137  * @returns: type
138  *
139  * Get the type of object.
140  */
141 GType mix_video_get_type(void);
142 
143 /**
144  * mix_video_new:
145  * @returns: A newly allocated instance of #MixVideo
146  *
147  * Use this method to create new instance of #MixVideo
148  */
149 MixVideo *mix_video_new(void);
150 
151 /**
152  * mix_video_ref:
153  * @mix: object to add reference
154  * @returns: the MixVideo instance where reference count has been increased.
155  *
156  * Add reference count.
157  */
158 MixVideo *mix_video_ref(MixVideo * mix);
159 
160 /**
161  * mix_video_unref:
162  * @obj: object to unref.
163  *
164  * Decrement reference count of the object.
165  */
166 #define mix_video_unref(obj) g_object_unref (G_OBJECT(obj))
167 
168 /* Class Methods */
169 
170 MIX_RESULT mix_video_get_version(MixVideo * mix, guint * major, guint * minor);
171 
172 MIX_RESULT mix_video_initialize(MixVideo * mix, MixCodecMode mode,
173 		MixVideoInitParams * init_params, MixDrmParams * drm_init_params);
174 
175 MIX_RESULT mix_video_deinitialize(MixVideo * mix);
176 
177 MIX_RESULT mix_video_configure(MixVideo * mix,
178 		MixVideoConfigParams * config_params,
179 		MixDrmParams * drm_config_params);
180 
181 MIX_RESULT mix_video_get_config(MixVideo * mix,
182 		MixVideoConfigParams ** config_params);
183 
184 MIX_RESULT mix_video_decode(MixVideo * mix, MixBuffer * bufin[], gint bufincnt,
185 		MixVideoDecodeParams * decode_params);
186 
187 MIX_RESULT mix_video_get_frame(MixVideo * mix, MixVideoFrame ** frame);
188 
189 MIX_RESULT mix_video_release_frame(MixVideo * mix, MixVideoFrame * frame);
190 
191 MIX_RESULT mix_video_render(MixVideo * mix,
192 		MixVideoRenderParams * render_params, MixVideoFrame *frame);
193 
194 MIX_RESULT mix_video_encode(MixVideo * mix, MixBuffer * bufin[], gint bufincnt,
195 		MixIOVec * iovout[], gint iovoutcnt,
196 		MixVideoEncodeParams * encode_params);
197 
198 MIX_RESULT mix_video_flush(MixVideo * mix);
199 
200 MIX_RESULT mix_video_eos(MixVideo * mix);
201 
202 MIX_RESULT mix_video_get_state(MixVideo * mix, MixState * state);
203 
204 MIX_RESULT mix_video_get_mixbuffer(MixVideo * mix, MixBuffer ** buf);
205 
206 MIX_RESULT mix_video_release_mixbuffer(MixVideo * mix, MixBuffer * buf);
207 
208 #endif /* __MIX_VIDEO_H__ */
209