Wav to wav file

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

 




Hello,
I am trying to create a copy of a wav file using the function pjmedia_port_get_frame() and pjmedia_port_put_frame.I have this code below. After the wav file is read (EOF), I tried listening to thenew created (copy) wav file. But the file cannot be opened. I think it is not copied/createdproperly (since filesize does not match).
Can you help me? Where did I possibly go wrong?
Thanks in advance! :)

<< snip >>	pjmedia_port *player, *writer;
	pj_status_t status;


	status = pjmedia_wav_player_port_create(pool, WAV_FILE_PLAYER, 20, 1, 0, 0, &player);
	PJ_ASSERT_RETURN(status==PJ_SUCCESS, PJ_SUCCESS);


	status = pjmedia_wav_writer_port_create(pool, 
	WAV_FILE_REC,
	player->info.clock_rate,
	player->info.channel_count,
	player->info.samples_per_frame,
	player->info.bits_per_sample,
	0,
	0, 
	&writer);




        int bpf = player->info.samples_per_frame *  player->info.bits_per_sample / 16;
	
	while (1) {
		pj_int16_t samplebuf[bpf];
		pjmedia_frame frame;
		pj_status_t status;


		frame.buf = samplebuf;
		frame.size = sizeof(samplebuf);
		


		status = pjmedia_port_get_frame(player, &frame);
		if (status != PJ_SUCCESS || frame.type == PJMEDIA_FRAME_TYPE_NONE) {
			// End-of-file, end the conversion.
			break;
		}


		// Put the frame to write port.
		status = pjmedia_port_put_frame(writer, &frame);
		if (status != PJ_SUCCESS) {
			break;
		}
	}//while
<< snip >>


Regards,Anj


_________________________________________________________________
Share your memories online with anyone you want.
http://www.microsoft.com/middleeast/windows/windowslive/products/photos-share.aspx?tab=1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20090810/a012dc40/attachment-0001.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