vlc_codec.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * vlc_codec.h: Definition of the decoder and encoder structures
00003  *****************************************************************************
00004  * Copyright (C) 1999-2003 the VideoLAN team
00005  * $Id$
00006  *
00007  * Authors: Gildas Bazin <gbazin@netcourrier.com>
00008  *
00009  * This program is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
00022  *****************************************************************************/
00023 
00024 #ifndef VLC_CODEC_H
00025 #define VLC_CODEC_H 1
00026 
00027 #include <vlc_block.h>
00028 #include <vlc_es.h>
00029 
00030 /**
00031  * \file
00032  * This file defines the structure and types used by decoders and encoders
00033  */
00034 
00035 typedef struct decoder_owner_sys_t decoder_owner_sys_t;
00036 
00037 /**
00038  * \defgroup decoder Decoder
00039  *
00040  * The structure describing a decoder
00041  *
00042  * @{
00043  */
00044 
00045 /*
00046  * BIG FAT WARNING : the code relies in the first 4 members of filter_t
00047  * and decoder_t to be the same, so if you have anything to add, do it
00048  * at the end of the structure.
00049  */
00050 struct decoder_t
00051 {
00052     VLC_COMMON_MEMBERS
00053 
00054     /* Module properties */
00055     module_t *          p_module;
00056     decoder_sys_t *     p_sys;
00057 
00058     /* Input format ie from demuxer (XXX: a lot of field could be invalid) */
00059     es_format_t         fmt_in;
00060 
00061     /* Output format of decoder/packetizer */
00062     es_format_t         fmt_out;
00063 
00064     /* Some decoders only accept packetized data (ie. not truncated) */
00065     bool          b_need_packetized;
00066 
00067     /* Tell the decoder if it is allowed to drop frames */
00068     bool          b_pace_control;
00069 
00070     /* */
00071     picture_t *         ( * pf_decode_video )( decoder_t *, block_t ** );
00072     aout_buffer_t *     ( * pf_decode_audio )( decoder_t *, block_t ** );
00073     subpicture_t *      ( * pf_decode_sub)   ( decoder_t *, block_t ** );
00074     block_t *           ( * pf_packetize )   ( decoder_t *, block_t ** );
00075 
00076     /* Closed Caption (CEA 608/708) extraction.
00077      * If set, it *may* be called after pf_decode_video/pf_packetize
00078      * returned data. It should return CC for the pictures returned by the
00079      * last pf_packetize/pf_decode_video call only,
00080      * pb_present will be used to known which cc channel are present (but
00081      * globaly, not necessary for the current packet */
00082     block_t *           ( * pf_get_cc )      ( decoder_t *, bool pb_present[4] );
00083 
00084     /*
00085      * Buffers allocation
00086      */
00087 
00088     /* Audio output callbacks */
00089     aout_buffer_t * ( * pf_aout_buffer_new) ( decoder_t *, int );
00090     void            ( * pf_aout_buffer_del) ( decoder_t *, aout_buffer_t * );
00091 
00092     /* Video output callbacks */
00093     picture_t     * ( * pf_vout_buffer_new) ( decoder_t * );
00094     void            ( * pf_vout_buffer_del) ( decoder_t *, picture_t * );
00095     void            ( * pf_picture_link)    ( decoder_t *, picture_t * );
00096     void            ( * pf_picture_unlink)  ( decoder_t *, picture_t * );
00097 
00098     /* SPU output callbacks */
00099     subpicture_t *  ( * pf_spu_buffer_new) ( decoder_t * );
00100     void            ( * pf_spu_buffer_del) ( decoder_t *, subpicture_t * );
00101 
00102     /* Private structure for the owner of the decoder */
00103     decoder_owner_sys_t *p_owner;
00104 };
00105 
00106 /**
00107  * @}
00108  */
00109 
00110 /**
00111  * \defgroup decoder Encoder
00112  *
00113  * The structure describing a Encoder
00114  *
00115  * @{
00116  */
00117 
00118 struct encoder_t
00119 {
00120     VLC_COMMON_MEMBERS
00121 
00122     /* Module properties */
00123     module_t *          p_module;
00124     encoder_sys_t *     p_sys;
00125 
00126     /* Properties of the input data fed to the encoder */
00127     es_format_t         fmt_in;
00128 
00129     /* Properties of the output of the encoder */
00130     es_format_t         fmt_out;
00131 
00132     block_t *           ( * pf_encode_video )( encoder_t *, picture_t * );
00133     block_t *           ( * pf_encode_audio )( encoder_t *, aout_buffer_t * );
00134     block_t *           ( * pf_encode_sub )( encoder_t *, subpicture_t * );
00135 
00136     /* Common encoder options */
00137     int i_threads;               /* Number of threads to use during encoding */
00138     int i_iframes;               /* One I frame per i_iframes */
00139     int i_bframes;               /* One B frame per i_bframes */
00140     int i_tolerance;             /* Bitrate tolerance */
00141 
00142     /* Encoder config */
00143     config_chain_t *p_cfg;
00144 };
00145 
00146 /**
00147  * @}
00148  */
00149 
00150 VLC_EXPORT( input_attachment_t *, decoder_GetInputAttachment, ( decoder_t *, const char *psz_name ) );
00151 VLC_EXPORT( int, decoder_GetInputAttachments, ( decoder_t *p_dec, input_attachment_t ***ppp_attachment, int *pi_attachment ) );
00152 VLC_EXPORT( mtime_t, decoder_GetDisplayDate, ( decoder_t *, mtime_t ) );
00153 
00154 #endif /* _VLC_CODEC_H */

Generated on Wed Aug 13 08:02:37 2008 for VLC by  doxygen 1.5.1