Ignore:
Timestamp:
Mar 5, 2009 6:02:28 PM (10 years ago)
Author:
bennylp
Message:

Ticket #736 (aps-direct branch): implemented the compatibility layer for the old sound API

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/projects/aps-direct/pjmedia/include/pjmedia/sound.h

    r2468 r2489  
    2222 
    2323 
    24 /* This is legacy sound device code, which has been superseded by the 
    25  * new pjmedia-audiodev framework. Please see the documentation on how 
    26  * to use this legacy API. 
    27  */ 
    28 #if PJMEDIA_AUDIO_API==PJMEDIA_AUDIO_API_NEW_ONLY 
    29 #   error "The sound device API is deprecated. Please see doc for details." 
    30 #endif 
    31  
    32  
    3324/** 
    3425 * @file sound.h 
    35  * @brief Sound player and recorder device framework. 
    36  */ 
     26 * @brief Legacy sound device API 
     27 */ 
     28#include <pjmedia-audiodev/audiodev.h> 
    3729#include <pjmedia/types.h> 
    38 #include <pj/pool.h> 
     30 
    3931 
    4032PJ_BEGIN_DECL 
     
    4537 * @brief PJMEDIA abstraction for sound device hardware 
    4638 * @{ 
     39 * 
     40 * <strong>Warning: this sound device API has been deprecated 
     41 * and replaced by PJMEDIA Audio Device API. Please see 
     42 * http://trac.pjsip.org/repos/wiki/Audio_Dev_API for more 
     43 * information.</strong> 
    4744 * 
    4845 * This section describes lower level abstraction for sound device 
     
    7168 */ 
    7269 
    73 /** Opaque data type for audio stream. */ 
     70/** Opaque declaration for pjmedia_snd_stream. */ 
    7471typedef struct pjmedia_snd_stream pjmedia_snd_stream; 
    7572 
     
    10198    unsigned    play_latency;       /**< Playback latency, in samples.      */ 
    10299} pjmedia_snd_stream_info; 
    103  
    104 /** 
    105  * Audio routing destination. 
    106  */ 
    107 typedef enum pjmedia_snd_route 
    108 { 
    109     /** Route to default destination */ 
    110     PJMEDIA_SND_ROUTE_DEFAULT, 
    111  
    112     /** Route to loudspeaker */ 
    113     PJMEDIA_SND_ROUTE_LOUDSPEAKER, 
    114  
    115     /** Route to earpiece */ 
    116     PJMEDIA_SND_ROUTE_EARPIECE, 
    117  
    118 } pjmedia_snd_route; 
    119  
    120  
    121 /**  
    122  * Stream setting for opening sound device with non-PCM data. 
    123  */ 
    124 typedef struct pjmedia_snd_setting 
    125 { 
    126     pjmedia_format      format;   /**< Format.                      */  
    127     pj_bool_t           plc;      /**< PLC enabled/disabled.        */ 
    128     pjmedia_snd_route   route;    /**< Audio routing.               */ 
    129 } pjmedia_snd_setting; 
    130  
    131100 
    132101/**  
     
    310279 
    311280/** 
    312  * Create sound stream for capturing audio and/or audio playback, from the  
    313  * same device. This also allows opening sound stream with extended settings,  
    314  * e.g: stream format, see #pjmedia_snd_setting. 
    315  * 
    316  * @param dir               Sound stream direction. 
    317  * @param rec_id            Device index for recorder/capture stream, or 
    318  *                          -1 to use the first capable device. 
    319  * @param play_id           Device index for playback stream, or -1 to use  
    320  *                          the first capable device. 
    321  * @param clock_rate        Sound device's clock rate to set. 
    322  * @param channel_count     Set number of channels, 1 for mono, or 2 for 
    323  *                          stereo. The channel count determines the format 
    324  *                          of the frame. 
    325  * @param samples_per_frame Number of samples per frame. 
    326  * @param bits_per_sample   Set the number of bits per sample. The normal  
    327  *                          value for this parameter is 16 bits per sample. 
    328  * @param rec_cb            Callback to handle captured audio samples. 
    329  * @param play_cb           Callback to be called when the sound player needs 
    330  *                          more audio samples to play. 
    331  * @param user_data         User data to be associated with the stream. 
    332  * @param setting           Sound device extended setting. 
    333  * @param p_snd_strm        Pointer to receive the stream instance. 
    334  * 
    335  * @return                  PJ_SUCCESS on success. 
    336  */ 
    337 PJ_DECL(pj_status_t) pjmedia_snd_open2( pjmedia_dir dir, 
    338                                         int rec_id, 
    339                                         int play_id, 
    340                                         unsigned clock_rate, 
    341                                         unsigned channel_count, 
    342                                         unsigned samples_per_frame, 
    343                                         unsigned bits_per_sample, 
    344                                         pjmedia_snd_rec_cb rec_cb, 
    345                                         pjmedia_snd_play_cb play_cb, 
    346                                         void *user_data, 
    347                                         const pjmedia_snd_setting *setting, 
    348                                         pjmedia_snd_stream **p_snd_strm); 
    349  
    350  
    351 /** 
    352281 * Get information about live stream. 
    353282 * 
Note: See TracChangeset for help on using the changeset viewer.