home *** CD-ROM | disk | FTP | other *** search
/ PCGUIA 2010 Software/Programs / PCGuia_programas.iso / Software / Utils / VLC Media Player / vlc-1.0.3-win32.exe / sdk / include / vlc / plugins / vlc_codec.h < prev    next >
Encoding:
C/C++ Source or Header  |  2009-10-30  |  8.0 KB  |  243 lines

  1. /*****************************************************************************
  2.  * vlc_codec.h: Definition of the decoder and encoder structures
  3.  *****************************************************************************
  4.  * Copyright (C) 1999-2003 the VideoLAN team
  5.  * $Id$
  6.  *
  7.  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  8.  *
  9.  * This program is free software; you can redistribute it and/or modify
  10.  * it under the terms of the GNU General Public License as published by
  11.  * the Free Software Foundation; either version 2 of the License, or
  12.  * (at your option) any later version.
  13.  *
  14.  * This program is distributed in the hope that it will be useful,
  15.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17.  * GNU General Public License for more details.
  18.  *
  19.  * You should have received a copy of the GNU General Public License
  20.  * along with this program; if not, write to the Free Software
  21.  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  22.  *****************************************************************************/
  23.  
  24. #ifndef VLC_CODEC_H
  25. #define VLC_CODEC_H 1
  26.  
  27. #include <vlc_block.h>
  28. #include <vlc_es.h>
  29.  
  30. /**
  31.  * \file
  32.  * This file defines the structure and types used by decoders and encoders
  33.  */
  34.  
  35. typedef struct decoder_owner_sys_t decoder_owner_sys_t;
  36.  
  37. /**
  38.  * \defgroup decoder Decoder
  39.  *
  40.  * The structure describing a decoder
  41.  *
  42.  * @{
  43.  */
  44.  
  45. /*
  46.  * BIG FAT WARNING : the code relies in the first 4 members of filter_t
  47.  * and decoder_t to be the same, so if you have anything to add, do it
  48.  * at the end of the structure.
  49.  */
  50. struct decoder_t
  51. {
  52.     VLC_COMMON_MEMBERS
  53.  
  54.     /* Module properties */
  55.     module_t *          p_module;
  56.     decoder_sys_t *     p_sys;
  57.  
  58.     /* Input format ie from demuxer (XXX: a lot of field could be invalid) */
  59.     es_format_t         fmt_in;
  60.  
  61.     /* Output format of decoder/packetizer */
  62.     es_format_t         fmt_out;
  63.  
  64.     /* Some decoders only accept packetized data (ie. not truncated) */
  65.     bool                b_need_packetized;
  66.  
  67.     /* Tell the decoder if it is allowed to drop frames */
  68.     bool                b_pace_control;
  69.  
  70.     /* */
  71.     picture_t *         ( * pf_decode_video )( decoder_t *, block_t ** );
  72.     aout_buffer_t *     ( * pf_decode_audio )( decoder_t *, block_t ** );
  73.     subpicture_t *      ( * pf_decode_sub)   ( decoder_t *, block_t ** );
  74.     block_t *           ( * pf_packetize )   ( decoder_t *, block_t ** );
  75.  
  76.     /* Closed Caption (CEA 608/708) extraction.
  77.      * If set, it *may* be called after pf_decode_video/pf_packetize
  78.      * returned data. It should return CC for the pictures returned by the
  79.      * last pf_packetize/pf_decode_video call only,
  80.      * pb_present will be used to known which cc channel are present (but
  81.      * globaly, not necessary for the current packet */
  82.     block_t *           ( * pf_get_cc )      ( decoder_t *, bool pb_present[4] );
  83.  
  84.     /* Meta data at codec level
  85.      *  The decoder owner set it back to NULL once it has retreived what it needs.
  86.      *  The decoder owner is responsible of its release except when you overwrite it.
  87.      */
  88.     vlc_meta_t          *p_description;
  89.  
  90.     /*
  91.      * Owner fields
  92.      * XXX You MUST not use them directly.
  93.      */
  94.  
  95.     /* Video output callbacks
  96.      * XXX use decoder_NewPicture/decoder_DeletePicture
  97.      * and decoder_LinkPicture/decoder_UnlinkPicture */
  98.     picture_t      *(*pf_vout_buffer_new)( decoder_t * );
  99.     void            (*pf_vout_buffer_del)( decoder_t *, picture_t * );
  100.     void            (*pf_picture_link)   ( decoder_t *, picture_t * );
  101.     void            (*pf_picture_unlink) ( decoder_t *, picture_t * );
  102.  
  103.     /* Audio output callbacks
  104.      * XXX use decoder_NewAudioBuffer/decoder_DeleteAudioBuffer */
  105.     aout_buffer_t  *(*pf_aout_buffer_new)( decoder_t *, int );
  106.     void            (*pf_aout_buffer_del)( decoder_t *, aout_buffer_t * );
  107.  
  108.     /* SPU output callbacks
  109.      * XXX use decoder_NewSubpicture and decoder_DeleteSubpicture */
  110.     subpicture_t   *(*pf_spu_buffer_new)( decoder_t * );
  111.     void            (*pf_spu_buffer_del)( decoder_t *, subpicture_t * );
  112.  
  113.     /* Input attachments
  114.      * XXX use decoder_GetInputAttachments */
  115.     int             (*pf_get_attachments)( decoder_t *p_dec, input_attachment_t ***ppp_attachment, int *pi_attachment );
  116.  
  117.     /* Display date
  118.      * XXX use decoder_GetDisplayDate */
  119.     mtime_t         (*pf_get_display_date)( decoder_t *, mtime_t );
  120.  
  121.     /* Display rate
  122.      * XXX use decoder_GetDisplayRate */
  123.     int             (*pf_get_display_rate)( decoder_t * );
  124.  
  125.     /* Private structure for the owner of the decoder */
  126.     decoder_owner_sys_t *p_owner;
  127. };
  128.  
  129. /**
  130.  * @}
  131.  */
  132.  
  133. /**
  134.  * \defgroup decoder Encoder
  135.  *
  136.  * The structure describing a Encoder
  137.  *
  138.  * @{
  139.  */
  140.  
  141. struct encoder_t
  142. {
  143.     VLC_COMMON_MEMBERS
  144.  
  145.     /* Module properties */
  146.     module_t *          p_module;
  147.     encoder_sys_t *     p_sys;
  148.  
  149.     /* Properties of the input data fed to the encoder */
  150.     es_format_t         fmt_in;
  151.  
  152.     /* Properties of the output of the encoder */
  153.     es_format_t         fmt_out;
  154.  
  155.     block_t *           ( * pf_encode_video )( encoder_t *, picture_t * );
  156.     block_t *           ( * pf_encode_audio )( encoder_t *, aout_buffer_t * );
  157.     block_t *           ( * pf_encode_sub )( encoder_t *, subpicture_t * );
  158.  
  159.     /* Common encoder options */
  160.     int i_threads;               /* Number of threads to use during encoding */
  161.     int i_iframes;               /* One I frame per i_iframes */
  162.     int i_bframes;               /* One B frame per i_bframes */
  163.     int i_tolerance;             /* Bitrate tolerance */
  164.  
  165.     /* Encoder config */
  166.     config_chain_t *p_cfg;
  167. };
  168.  
  169. /**
  170.  * @}
  171.  */
  172.  
  173.  
  174. /**
  175.  * This function will return a new picture usable by a decoder as an output
  176.  * buffer. You have to release it using decoder_DeletePicture or by returning
  177.  * it to the caller as a pf_decode_video return value.
  178.  */
  179. VLC_EXPORT( picture_t *, decoder_NewPicture, ( decoder_t * ) );
  180.  
  181. /**
  182.  * This function will release a picture create by decoder_NewPicture.
  183.  */
  184. VLC_EXPORT( void, decoder_DeletePicture, ( decoder_t *, picture_t *p_picture ) );
  185.  
  186. /**
  187.  * This function will increase the picture reference count.
  188.  * (picture_Hold is not usable.)
  189.  */
  190. VLC_EXPORT( void, decoder_LinkPicture, ( decoder_t *, picture_t * ) );
  191.  
  192. /**
  193.  * This function will decrease the picture reference count.
  194.  * (picture_Release is not usable.)
  195.  */
  196. VLC_EXPORT( void, decoder_UnlinkPicture, ( decoder_t *, picture_t * ) );
  197.  
  198. /**
  199.  * This function will return a new audio buffer usable by a decoder as an
  200.  * output buffer. You have to release it using decoder_DeleteAudioBuffer
  201.  * or by returning it to the caller as a pf_decode_audio return value.
  202.  */
  203. VLC_EXPORT( aout_buffer_t *, decoder_NewAudioBuffer, ( decoder_t *, int i_size ) );
  204.  
  205. /**
  206.  * This function will release a audio buffer created by decoder_NewAudioBuffer.
  207.  */
  208. VLC_EXPORT( void, decoder_DeleteAudioBuffer, ( decoder_t *, aout_buffer_t *p_buffer ) );
  209.  
  210. /**
  211.  * This function will return a new subpicture usable by a decoder as an output
  212.  * buffer. You have to release it using decoder_DeleteSubpicture or by returning
  213.  * it to the caller as a pf_decode_sub return value.
  214.  */
  215. VLC_EXPORT( subpicture_t *, decoder_NewSubpicture, ( decoder_t * ) );
  216.  
  217. /**
  218.  * This function will release a subpicture created by decoder_NewSubicture.
  219.  */
  220. VLC_EXPORT( void, decoder_DeleteSubpicture, ( decoder_t *, subpicture_t *p_subpicture ) );
  221.  
  222. /**
  223.  * This function gives all input attachments at once.
  224.  *
  225.  * You MUST release the returned values
  226.  */
  227. VLC_EXPORT( int, decoder_GetInputAttachments, ( decoder_t *, input_attachment_t ***ppp_attachment, int *pi_attachment ) );
  228.  
  229. /**
  230.  * This function converts a decoder timestamp into a display date comparable
  231.  * to mdate().
  232.  * You MUST use it *only* for gathering statistics about speed.
  233.  */
  234. VLC_EXPORT( mtime_t, decoder_GetDisplayDate, ( decoder_t *, mtime_t ) LIBVLC_USED );
  235.  
  236. /**
  237.  * This function returns the current input rate.
  238.  * You MUST use it *only* for gathering statistics about speed.
  239.  */
  240. VLC_EXPORT( int, decoder_GetDisplayRate, ( decoder_t * ) );
  241.  
  242. #endif /* _VLC_CODEC_H */
  243.