Ignore:
Timestamp:
May 13, 2006 10:46:23 PM (18 years ago)
Author:
bennylp
Message:

Another major modifications in PJMEDIA:

  • handle multiple frames in one packet
  • split stream creation into two steps to allow customization
  • PLC framework and implementation with G.711 and speex
  • stream returns NO_FRAME correctly.
  • added ptime argument in pjsua
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/include/pjmedia/codec.h

    r421 r438  
    111111struct pjmedia_codec_param 
    112112{ 
    113     unsigned    clock_rate;         /**< Sampling rate in Hz            */ 
    114     unsigned    channel_cnt;        /**< Channel count.                 */ 
    115     pj_uint32_t avg_bps;            /**< Average bandwidth in bits/sec  */ 
    116  
    117     pj_uint16_t ptime;              /**< Packet time in miliseconds     */ 
    118     pj_uint8_t  pcm_bits_per_sample;/**< Bits/sample in the PCM side    */ 
    119  
    120     unsigned    pt:8;               /**< Payload type.                  */ 
    121     unsigned    vad:1;              /**< Voice Activity Detector.       */ 
    122     unsigned    cng:1;              /**< Comfort Noise Generator.       */ 
    123     unsigned    lpf:1;              /**< Low pass filter                */ 
    124     unsigned    hpf:1;              /**< High pass filter               */ 
    125     unsigned    penh:1;             /**< Perceptual Enhancement         */ 
    126     unsigned    concl:1;            /**< Packet loss concealment        */ 
    127     unsigned    reserved:1;         /**< Reserved, must be NULL.        */ 
    128  
     113    /** 
     114     * The "info" part of codec param describes the capability of the codec, 
     115     * and the value should NOT be changed by application. 
     116     */ 
     117    struct { 
     118       unsigned    clock_rate;          /**< Sampling rate in Hz            */ 
     119       unsigned    channel_cnt;         /**< Channel count.                 */ 
     120       pj_uint32_t avg_bps;             /**< Average bandwidth in bits/sec  */ 
     121       pj_uint16_t frm_ptime;           /**< Base frame ptime in msec.      */ 
     122       pj_uint8_t  pcm_bits_per_sample; /**< Bits/sample in the PCM side    */ 
     123       pj_uint8_t  pt;                  /**< Payload type.                  */ 
     124    } info; 
     125 
     126    /** 
     127     * The "setting" part of codec param describes various settings to be 
     128     * applied to the codec. When the codec param is retrieved from the codec 
     129     * or codec factory, the values of these will be filled by the capability 
     130     * of the codec. Any features that are supported by the codec (e.g. vad 
     131     * or plc) will be turned on, so that application can query which  
     132     * capabilities are supported by the codec. Application may change the 
     133     * settings here before instantiating the codec/stream. 
     134     */ 
     135    struct { 
     136        pj_uint8_t  frm_per_pkt;    /**< Number of frames per packet.   */ 
     137        unsigned    vad:1;          /**< Voice Activity Detector.       */ 
     138        unsigned    cng:1;          /**< Comfort Noise Generator.       */ 
     139        unsigned    lpf:1;          /**< Low pass filter                */ 
     140        unsigned    hpf:1;          /**< High pass filter               */ 
     141        unsigned    penh:1;         /**< Perceptual Enhancement         */ 
     142        unsigned    plc:1;          /**< Packet loss concealment        */ 
     143        unsigned    reserved:1;     /**< Reserved, must be zero.        */ 
     144    } setting; 
    129145}; 
    130146 
     
    183199    /** 
    184200     * Instruct the codec to inspect the specified payload/packet and 
    185      * split the packet info individual frames. 
     201     * split the packet into individual base frames. Each output frames will 
     202     * have ptime that is equal to basic frame ptime (i.e. the value of 
     203     * info.frm_ptime in #pjmedia_codec_param). 
    186204     * 
    187205     * @param codec     The codec instance 
    188206     * @param pkt       The input packet. 
    189207     * @param pkt_size  Size of the packet. 
     208     * @param timestamp The timestamp of the first sample in the packet. 
    190209     * @param frame_cnt On input, specifies the maximum number of frames 
    191210     *                  in the array. On output, the codec must fill 
     
    196215     * @return          PJ_SUCCESS on success. 
    197216     */ 
    198     pj_status_t (*get_frames)(pjmedia_codec *codec, 
    199                               void *pkt, 
    200                               pj_size_t pkt_size, 
    201                               unsigned *frame_cnt, 
    202                               pjmedia_frame frames[]); 
    203  
    204     /**  
    205      * Instruct the codec to encode the specified input frame. 
     217    pj_status_t (*parse)( pjmedia_codec *codec, 
     218                          void *pkt, 
     219                          pj_size_t pkt_size, 
     220                          const pj_timestamp *timestamp, 
     221                          unsigned *frame_cnt, 
     222                          pjmedia_frame frames[]); 
     223 
     224    /**  
     225     * Instruct the codec to encode the specified input frame. The input 
     226     * PCM samples MUST have ptime that is exactly equal to base frame 
     227     * ptime (i.e. the value of info.frm_ptime in #pjmedia_codec_param). 
    206228     * 
    207229     * @param codec     The codec instance. 
     
    218240 
    219241    /**  
    220      * Instruct the codec to decode the specified input frame. 
     242     * Instruct the codec to decode the specified input frame. The input 
     243     * frame MUST have ptime that is exactly equal to base frame 
     244     * ptime (i.e. the value of info.frm_ptime in #pjmedia_codec_param). 
     245     * Application can achieve this by parsing the packet into base 
     246     * frames before decoding each frame. 
    221247     * 
    222248     * @param codec     The codec instance. 
     
    232258                          struct pjmedia_frame *output); 
    233259 
     260    /** 
     261     * Instruct the codec to recover a missing frame. Not all codec has 
     262     * this capability, so this function may be NULL. 
     263     * 
     264     * @param codec     The codec instance. 
     265     * @param out_size  The length of buffer in the output frame. 
     266     * @param output    The output frame. 
     267     * 
     268     * @return          PJ_SUCCESS on success; 
     269     */ 
     270    pj_status_t (*recover)(pjmedia_codec *codec, 
     271                           unsigned out_size, 
     272                           struct pjmedia_frame *output); 
    234273}; 
    235274 
Note: See TracChangeset for help on using the changeset viewer.