Main Page   Modules   Compound List   File List   Compound Members   File Members  

xlv_codec.h

Go to the documentation of this file.
00001 /*
00002  * xlv_codec.h
00003  *
00004  * Copyright (C) 2001 Guilhem Lavaux
00005  *
00006  * This file is part of XLV, a free middleware audio-video stream coder/decoder.
00007  *
00008  * This library is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU Library General Public
00010  * License as published by the Free Software Foundation; either
00011  * version 2 of the License, or (at your option) any later version.
00012  *
00013  * XLV is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program; if not, write to the Free Software
00020  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021  */
00025 #ifndef _XLV_CODEC_H
00026 #define _XLV_CODEC_H
00027 
00028 #include "xlv_plugin_mgr.h"
00029 #include "xlv_audio.h"
00030 #include "xlv_video.h"
00031 #include "xlv_session.h"
00032 
00038 typedef XLV_Stream XLV_ICodec;
00039 
00040 /* IOCTL API */
00041 
00042 /* Codec specific */
00043 
00044 #if 0
00045 #define XLV_CODEC_GET_SPEC        300
00046 #endif
00047 
00051 #    define XLV_CODEC_QUERY_ENCODING 0xffffffff
00052 #    define XLV_CODEC_ZERO_ENCODING 0
00053 
00054 /* For compatibility */
00055 #    define XLV_CODEC_RGB8_ENCODING  xlv_fourcc('R','G','3','2')
00056 /* New types */
00057 #    define XLV_CODEC_RGB32_ENCODING  xlv_fourcc('R','G','3','2')
00058 #    define XLV_CODEC_RGB24_ENCODING  xlv_fourcc('R','G','2','4')
00059 #    define XLV_CODEC_RGB16_565_ENCODING  xlv_fourcc('R','G','6','5')
00060 #    define XLV_CODEC_RGB15_555_ENCODING  xlv_fourcc('R','G','5','5')
00061 #    define XLV_CODEC_BGR32_ENCODING  xlv_fourcc('B','G','3','2')
00062 #    define XLV_CODEC_BGR24_ENCODING  xlv_fourcc('B','G','2','4')
00063 #    define XLV_CODEC_BGR16_565_ENCODING  xlv_fourcc('B','G','6','5')
00064 #    define XLV_CODEC_BGR15_555_ENCODING  xlv_fourcc('B','G','5','5')
00065 #    define XLV_CODEC_YV12_ENCODING  xlv_fourcc('Y','V','1','2')
00066 #    define XLV_CODEC_YUY2_ENCODING  xlv_fourcc('Y','U','Y','2')
00067 #    define XLV_CODEC_IYUV_ENCODING  xlv_fourcc('I','Y','U','V')
00068 #    define XLV_CODEC_YVYU_ENCODING  xlv_fourcc('Y','V','Y','U')
00069 #    define XLV_CODEC_UYVY_ENCODING  xlv_fourcc('U','V','Y','V')
00070 #    define XLV_CODEC_I420_ENCODING  xlv_fourcc('I','4','2','0')
00071 #    define XLV_CODEC_CMAP4_ENCODING  xlv_fourcc('C','M','P','4')
00072 #    define XLV_CODEC_CMAP8_ENCODING  xlv_fourcc('C','M','P','4')
00073 
00074 #    define XLV_CODEC_COMPRESSED_ENCODING xlv_fourcc('C','O','M','P')
00075 
00076 #    define XLV_CODEC_PCM_MASK           0x000fUL
00077 #    define XLV_CODEC_PCM_LITTLE_ENDIAN  0x0001UL
00078 #    define XLV_CODEC_PCM_BIG_ENDIAN     0x0002UL
00079 #    define XLV_CODEC_PCM_SIGNED         0x0004UL
00080 #    define XLV_CODEC_PCM_UNSIGNED       0x0008UL
00081 
00088 #define XLV_CODEC_SET_SPEC        301
00089 #define XLV_CODEC_DROP_FRAME      302
00090 
00096 #define XLV_CODEC_GET_INPUT       303
00097 
00102 #define XLV_CODEC_SET_INPUT       304
00103 
00120 #define XLV_CODEC_GET_OUTPUT      305
00121 
00130 #define XLV_CODEC_SET_DATA        306
00131 
00132 /* This is the pair of two calls important for the codec. They are separated
00133  * because their call structure are different
00134  */
00135 
00141 #define XLV_DECODER_GET_FRAME     307
00142 #define XLV_DECODER_PUSH_FRAME    308
00143 #define XLV_CODER_GET_FRAME       309
00144 #define XLV_CODER_PUSH_FRAME      310
00145 
00146 #define XLV_CODEC_CHECK_WATERMARK 311
00147 
00150 #define XLV_CODEC_SET_MODE        312
00151 
00153 #    define XLV_CODEC_ENCODE 0
00154 #    define XLV_CODEC_DECODE 1
00155 
00157 /* Returns the preferred IO buffer size if supported */
00158 #define XLV_CODEC_GET_OUTSIZE     313
00159 #define XLV_CODEC_GET_INSIZE      314
00160 
00161 /* Watermarks */
00162 #define XLV_CODEC_LOW_WATERMARK   0
00163 #define XLV_CODEC_HIGH_WATERMARK  1
00164 
00171 typedef struct _XLV_CodecSpec {
00174     guint8 m_type;
00175 
00179     const gchar *m_plugin_id;
00180 
00185     guint32 m_fourcc;
00186 
00188     guint32 m_bitrate;
00196     guint32 m_flags;
00197     gfloat m_frame_rate;
00198 
00200     guint32 m_codec_data_len;
00201     union {
00202         XLV_PCMData *pcm;
00203         XLV_VideoData *video;
00204         gpointer data;
00205     } m_codec_data;
00206 } XLV_CodecSpec;
00207 
00210 #define XLV_CODEC_AUDIO       0
00211 #define XLV_CODEC_VIDEO       1
00212 
00216 #define XLV_CODEC_Y_FLIPPED  0x0001
00217 #define XLV_CODEC_NEED_DELTA 0x0002
00218 
00225 typedef struct _XLV_CodecFrame {
00227     XLV_Data m_frame;
00234     guint32 m_timestamp;
00237     gboolean m_render;
00238 } XLV_CodecFrame;
00239 
00240 typedef struct _XLV_CodecQuality {
00241     guint8 m_valid_entries;
00242     /* It is a percentage: 0-100% */
00243     guint8 m_relative_quality;
00244     /* It is a bitrate */
00245     guint8 m_bitrate;
00246 } XLV_CodecQuality;
00247 
00248 /* Realtime Codec API */
00249 
00250 #define XLV_CODEC_RT_BASE_CMD   350
00251 #define XLV_CODEC_RT_ENABLE     (XLV_CODEC_RT_BASE_CMD+1)
00252 #define XLV_CODEC_RT_QUERY_POOL (XLV_CODEC_RT_BASE_CMD+2)
00253 
00254 typedef struct _XLV_CodecRTBuffer {
00255         gpointer m_buffer;
00256         guint32 m_id;
00257         guint32 m_size;
00258 } XLV_CodecRTBuffer;
00259         
00260 typedef struct _XLV_CodecQueryRealtime {
00261         guint32 m_q_n_buffers;
00262         XLV_CodecRTBuffer *m_buffers;
00263 } XLV_CodecQueryRealtime;
00264 
00265 #ifdef __cplusplus
00266 extern "C" {
00267 #endif
00268 
00269 /* Simple API */
00270 
00286     XLV_ICodec *xlv_decoder_open (XLV_Session * session, const guint8 * name,
00287                                   guint32 raw_format);
00288 
00289 
00305     XLV_ICodec *xlv_coder_open (XLV_Session * session, const guint8 * name,
00306                                 XLV_CodecSpec * input_format);
00307 
00309     XLV_ICodec *xlv_decoder_build_adaptor (XLV_Session * session,
00310                                            XLV_ICodec * codec,
00311                                            guint32 raw_format);
00313     XLV_ICodec *xlv_coder_build_adaptor (XLV_Session * session,
00314                                          XLV_ICodec * codec,
00315                                          XLV_CodecSpec * input_format,
00316                                          XLV_CodecSpec * req_format);
00317 
00322     guint32 xlv_codec_support (XLV_ICodec * codec);
00324     void xlv_codec_release (XLV_ICodec * codec);
00326     guint32 xlv_codec_get_outsize (XLV_ICodec * codec);
00327     gboolean xlv_codec_set_spec (XLV_ICodec * codec, XLV_CodecSpec * spec);
00328     gboolean xlv_codec_need_data (XLV_ICodec * codec);
00329     gboolean xlv_codec_drop_frame (XLV_ICodec * codec);
00330     gboolean xlv_codec_get_output (XLV_ICodec * codec,
00331                                    XLV_CodecSpec * output);
00332     gboolean xlv_codec_get_input (XLV_ICodec * codec, XLV_CodecSpec * input);
00333     gboolean xlv_codec_get_new_output (XLV_ICodec * codec,
00334                                        XLV_CodecSpec * output);
00335     gboolean xlv_decoder_get_frame (XLV_ICodec * codec,
00336                                     XLV_CodecFrame * frame);
00337     gboolean xlv_coder_put_frame (XLV_ICodec * codec, XLV_CodecFrame * frame);
00338     gint xlv_decoder_push_data (XLV_ICodec * codec, gpointer data,
00339                                 guint32 len);
00340     gint xlv_coder_get_data (XLV_ICodec * codec, gpointer data,
00341                              guint32 * len);
00342 
00343     void xlv_codec_set_parameters (XLV_ICodec * codec, gpointer data);
00344 
00346     XLV_CodecSpec *xlv_codecspec_dup (XLV_CodecSpec * spec);
00348     XLV_CodecSpec *xlv_codecspec_new ();
00350     void xlv_codecspec_release (XLV_CodecSpec * spec);
00351 
00352 #ifdef __cplusplus
00353 }
00354 #endif
00355 
00358 #endif

Generated on Mon Jul 1 19:39:05 2002 for XLV by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002