Play Wav File

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello to you, i have implement a call record feature and i would like to
playback the record sound but it does not play at all.

I get the code from playfile.c

Perhaps the same sound/file port issues

[code]
void VOIP::StartCallRecord(std::string& recordFile)
{
 pj_caching_pool_init(&cachingPool,
  &pj_pool_factory_default_policy, 0);

 status = pjmedia_endpt_create(&cachingPool.factory,
  NULL, 1, &mediaEndPt);

 pool = pj_pool_create(&cachingPool.factory,
  "Recorder Pool", 4000, 4000, NULL);

 recordFile.insert(0, "D:\\C++\\FYP\\");
 recordFile.append(".wav");
 myRecordFile = recordFile;

 status = pjmedia_wav_writer_port_create(pool,
  recordFile.c_str(), 44100, 2,
        2 * ((44100 * 10) / 1000), 16, 0, 0,
        &filePort);

 status = pjmedia_snd_port_create_rec(pool,-1,
   filePort->info.clock_rate,
         filePort->info.channel_count,
         filePort->info.samples_per_frame,
         filePort->info.bits_per_sample, 0, &sndPort);

 status = pjmedia_snd_port_connect(sndPort, filePort);
 pj_thread_sleep(10);

 if (status == PJ_SUCCESS)
 {
  CallRecordStatus = true;
 }


/*
 if (!recordFile.empty() )
 {
  pjsua_recorder_create(&pj_str(const_cast<char*>(recordFile.c_str())),
    0, NULL, 0, 0, &callRecordID);
 }
*/
}

void VOIP::StopCallRecord()
{
 status = pjmedia_snd_port_destroy(sndPort);
 status = pjmedia_port_destroy(filePort );
 pj_pool_release(pool);
 status = pjmedia_endpt_destroy(mediaEndPt );
 pj_caching_pool_destroy(&cachingPool);

 if (status == PJ_SUCCESS)
 {
  CallRecordStatus = false;
 }
}

// Play wav code
/* pj_caching_pool_init(&cachingPool,
  &pj_pool_factory_default_policy, 0);

 status = pjmedia_endpt_create(&cachingPool.factory,
  NULL, 1, &mediaEndPt);

 pool = pj_pool_create(&cachingPool.factory, "PlayWAV",
  4000, 4000, NULL);

 status = pjmedia_wav_player_port_create(pool,
  myRecordFile.c_str(),
  20, 0, 0, &filePort);

 status = pjmedia_snd_port_create_player(pool, -1,
           filePort->info.clock_rate,
           filePort->info.channel_count,
           filePort->info.samples_per_frame,
           filePort->info.bits_per_sample,
             0, &sndPort);

 status = pjmedia_snd_port_connect(sndPort, filePort);
 pj_thread_sleep(100);
*/

[/code]

Can anyone spot any error ?

Please help.

Thanks.

-- 
Linux
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20091028/bacd76ee/attachment.html>


[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux