Changes between Initial Version and Version 1 of Ticket #1294


Ignore:
Timestamp:
Jul 15, 2011 9:43:23 AM (11 years ago)
Author:
bennylp
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #1294 – Description

    initial v1  
    1 New API to register all known codecs, and to automatically deregister them on shutdown. 
     1New API to register all known codecs, and to automatically deregister them on shutdown: 
     2 
     3{{{ 
     4/* file <pjmedia-codec/audio_codecs.h> */ 
     5 
     6/** 
     7 * Codec configuration. Call #pjmedia_audio_codec_config_default() to initialize 
     8 * this structure with the default values. 
     9 */ 
     10typedef struct pjmedia_audio_codec_config 
     11{ 
     12    /** Speex codec settings. See #pjmedia_codec_speex_init() for more info */ 
     13    struct { 
     14        unsigned        option;         /**< Bitmask of options.        */ 
     15        unsigned        quality;        /**< Codec quality.             */ 
     16        unsigned        complexity;     /**< Codec complexity.          */ 
     17    } speex; 
     18 
     19    /** iLBC settings */ 
     20    struct { 
     21        unsigned        mode;           /**< iLBC mode.                 */ 
     22    } ilbc; 
     23 
     24    /** Passthrough */ 
     25    struct { 
     26        pjmedia_codec_passthrough_setting setting; /**< Passthrough     */ 
     27    } passthrough; 
     28 
     29} pjmedia_audio_codec_config; 
     30 
     31 
     32/** 
     33 * Initialize pjmedia_audio_codec_config structure with default values. 
     34 * 
     35 * @param cfg           The codec config to be initialized. 
     36 */ 
     37PJ_DECL(void) pjmedia_audio_codec_config_default(pjmedia_audio_codec_config *cfg); 
     38 
     39/** 
     40 * Register all known audio codecs implemented in PJMEDA-CODEC library to the 
     41 * specified media endpoint. 
     42 * 
     43 * @param endpt         The media endpoint. 
     44 * @param c             Optional codec configuration, or NULL to use default 
     45 *                      values. 
     46 * 
     47 * @return              PJ_SUCCESS on success or the appropriate error code. 
     48 */ 
     49PJ_DECL(pj_status_t) 
     50pjmedia_codec_register_audio_codecs(pjmedia_endpt *endpt, 
     51                                    const pjmedia_audio_codec_config *c); 
     52 
     53}}} 
     54 
     55'''Note to codec writers:''' 
     56 
     57A new mandatory '''destroy''' callback has been added to factory operation. You must implement this callback (hint: just point it to your existing function that deinitialize your codec factory). 
     58 
     59'''Note to app writers:''' 
     60 
     61You don't need to initialize each codec now, just use {{{pjmedia_codec_register_audio_codecs()}}} above. Similarly you should remove all the calls to codec deinitialization routines since that will be done automatically when the media endpoint is destroyed (leaving these calls as they are is harmless though; they will render to no-ops).