Ignore:
Timestamp:
Mar 14, 2014 4:09:50 AM (10 years ago)
Author:
bennylp
Message:

Closed #1748: enhancements to WAV player API

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/include/pjsua2/media.hpp

    r4771 r4793  
    315315 
    316316/** 
     317 * This structure contains additional info about AudioMediaPlayer. 
     318 */ 
     319struct AudioMediaPlayerInfo 
     320{ 
     321    /** 
     322     * Format ID of the payload. 
     323     */ 
     324    pjmedia_format_id   formatId; 
     325 
     326    /** 
     327     * The number of bits per sample of the file payload. For example, 
     328     * the value is 16 for PCM WAV and 8 for Alaw/Ulas WAV files. 
     329     */ 
     330    unsigned            payloadBitsPerSample; 
     331 
     332    /** 
     333     * The WAV payload size in bytes. 
     334     */ 
     335    pj_uint32_t         sizeBytes; 
     336 
     337    /** 
     338     * The WAV payload size in samples. 
     339     */ 
     340    pj_uint32_t         sizeSamples; 
     341}; 
     342 
     343/** 
    317344 * Audio Media Player. 
    318345 */ 
     
    355382 
    356383    /** 
    357      * Set playback position. This operation is not valid for playlist. 
     384     * Get additional info about the player. This operation is only valid 
     385     * for player. For playlist, Error will be thrown. 
     386     * 
     387     * @return          the info. 
     388     */ 
     389    AudioMediaPlayerInfo getInfo() const throw(Error); 
     390 
     391    /** 
     392     * Get current playback position in samples. This operation is not valid 
     393     * for playlist. 
     394     * 
     395     * @return             Current playback position, in samples. 
     396     */ 
     397    pj_uint32_t getPos() const throw(Error); 
     398 
     399    /** 
     400     * Set playback position in samples. This operation is not valid for 
     401     * playlist. 
    358402     * 
    359403     * @param samples      The desired playback position, in samples. 
     
    372416 
    373417    /** 
    374      * Virtual destructor. 
     418     * Destructor. 
    375419     */ 
    376420    virtual ~AudioMediaPlayer(); 
    377421 
     422public: 
     423    /* 
     424     * Callbacks 
     425     */ 
     426 
     427    /** 
     428     * Register a callback to be called when the file player reading has 
     429     * reached the end of file, or when the file reading has reached the 
     430     * end of file of the last file for a playlist. If the file or playlist 
     431     * is set to play repeatedly, then the callback will be called multiple 
     432     * times. 
     433     * 
     434     * @return                  If the callback returns false, the playback 
     435     *                          will stop. Note that if application destroys 
     436     *                          the player in the callback, it must return 
     437     *                          false here. 
     438     */ 
     439    virtual bool onEof() 
     440    { return true; } 
     441 
     442 
    378443private: 
    379444    /** 
     
    382447    int playerId; 
    383448 
     449    /** 
     450     *  Low level PJMEDIA callback 
     451     */ 
     452    static pj_status_t eof_cb(pjmedia_port *port, 
     453                              void *usr_data); 
    384454}; 
    385455 
     
    431501 
    432502    /** 
    433      * Virtual destructor. 
     503     * Destructor. 
    434504     */ 
    435505    virtual ~AudioMediaRecorder(); 
Note: See TracChangeset for help on using the changeset viewer.