changeset 29913:9e76a5f9e717

Switch ad_ffmpeg to avcodec_decode_audio3
author reimar
date Sun, 22 Nov 2009 13:14:39 +0000
parents 49f3853e9105
children 67b386883561
files libmpcodecs/ad_ffmpeg.c
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/ad_ffmpeg.c	Sun Nov 22 13:08:43 2009 +0000
+++ b/libmpcodecs/ad_ffmpeg.c	Sun Nov 22 13:14:39 2009 +0000
@@ -163,15 +163,19 @@
     unsigned char *start=NULL;
     int y,len=-1;
     while(len<minlen){
+	AVPacket pkt;
 	int len2=maxlen;
 	double pts;
 	int x=ds_get_packet_pts(sh_audio->ds,&start, &pts);
 	if(x<=0) break; // error
+	av_init_packet(&pkt);
+	pkt.data = start;
+	pkt.size = x;
 	if (pts != MP_NOPTS_VALUE) {
 	    sh_audio->pts = pts;
 	    sh_audio->pts_bytes = 0;
 	}
-	y=avcodec_decode_audio2(sh_audio->context,(int16_t*)buf,&len2,start,x);
+	y=avcodec_decode_audio3(sh_audio->context,(int16_t*)buf,&len2,&pkt);
 //printf("return:%d samples_out:%d bitstream_in:%d sample_sum:%d\n", y, len2, x, len); fflush(stdout);
 	if(y<0){ mp_msg(MSGT_DECAUDIO,MSGL_V,"lavc_audio: error\n");break; }
 	if(y<x) sh_audio->ds->buffer_pos+=y-x;  // put back data (HACK!)