[MPlayer-cvslog] r23474 - trunk/libmpcodecs/ad_ffmpeg.c

reimar subversion at mplayerhq.hu
Tue Jun 5 16:12:37 CEST 2007


Author: reimar
Date: Tue Jun  5 16:12:37 2007
New Revision: 23474

Log:
Use avcodec_decode_audio2 in ad_ffmpeg.c


Modified:
   trunk/libmpcodecs/ad_ffmpeg.c

Modified: trunk/libmpcodecs/ad_ffmpeg.c
==============================================================================
--- trunk/libmpcodecs/ad_ffmpeg.c	(original)
+++ trunk/libmpcodecs/ad_ffmpeg.c	Tue Jun  5 16:12:37 2007
@@ -150,7 +150,7 @@ static int decode_audio(sh_audio_t *sh_a
     unsigned char *start=NULL;
     int y,len=-1;
     while(len<minlen){
-	int len2=0;
+	int len2=maxlen;
 	double pts;
 	int x=ds_get_packet_pts(sh_audio->ds,&start, &pts);
 	if(x<=0) break; // error
@@ -158,7 +158,7 @@ static int decode_audio(sh_audio_t *sh_a
 	    sh_audio->pts = pts;
 	    sh_audio->pts_bytes = 0;
 	}
-	y=avcodec_decode_audio(sh_audio->context,(int16_t*)buf,&len2,start,x);
+	y=avcodec_decode_audio2(sh_audio->context,(int16_t*)buf,&len2,start,x);
 //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!)
@@ -166,6 +166,7 @@ static int decode_audio(sh_audio_t *sh_a
 	  //len=len2;break;
 	  if(len<0) len=len2; else len+=len2;
 	  buf+=len2;
+	  maxlen -= len2;
 	  sh_audio->pts_bytes += len2;
 	}
         mp_dbg(MSGT_DECAUDIO,MSGL_DBG2,"Decoded %d -> %d  \n",y,len2);



More information about the MPlayer-cvslog mailing list