[MPlayer-cvslog] CVS: main/libmpdemux muxer_lavf.c, 1.2, 1.3 demux_lavf.c, 1.13, 1.14

Michael Niedermayer CVS syncmail at mplayerhq.hu
Fri Mar 25 23:47:11 CET 2005


CVS change done by Michael Niedermayer CVS

Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var2/tmp/cvs-serv4441

Modified Files:
	muxer_lavf.c demux_lavf.c 
Log Message:
various (de)muxer_lavf fixes


Index: muxer_lavf.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/muxer_lavf.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- muxer_lavf.c	25 Mar 2005 02:41:08 -0000	1.2
+++ muxer_lavf.c	25 Mar 2005 22:47:09 -0000	1.3
@@ -161,7 +161,9 @@
 		ctx->sample_rate = stream->wf->nSamplesPerSec;
 //                mp_msg(MSGT_MUXER, MSGL_INFO, "stream->h.dwSampleSize: %d\n", stream->h.dwSampleSize);
 		ctx->channels = stream->wf->nChannels;
-		ctx->frame_size = 576;
+                if(stream->h.dwRate && (stream->h.dwScale * (int64_t)ctx->sample_rate) % stream->h.dwRate == 0)
+                    ctx->frame_size= (stream->h.dwScale * (int64_t)ctx->sample_rate) / stream->h.dwRate;
+//                printf("ctx->block_align = stream->wf->nBlockAlign; %d=%d stream->wf->nAvgBytesPerSec:%d\n", ctx->block_align, stream->wf->nBlockAlign, stream->wf->nAvgBytesPerSec);
 		ctx->block_align = stream->wf->nBlockAlign;
 	}
 	else if(stream->type == MUXER_TYPE_VIDEO)
@@ -171,8 +173,8 @@
 		ctx->width = stream->bih->biWidth;
 		ctx->height = stream->bih->biHeight;
 		ctx->bit_rate = 800000;
-		ctx->frame_rate = (int) (10000 * stream->h.dwRate)/ stream->h.dwScale;;
-		ctx->frame_rate_base = 10000;
+		ctx->frame_rate = stream->h.dwRate;
+		ctx->frame_rate_base = stream->h.dwScale;
 	}
 }
 

Index: demux_lavf.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_lavf.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- demux_lavf.c	25 Mar 2005 11:09:42 -0000	1.13
+++ demux_lavf.c	25 Mar 2005 22:47:09 -0000	1.14
@@ -47,6 +47,8 @@
 extern void print_wave_header(WAVEFORMATEX *h);
 extern void print_video_header(BITMAPINFOHEADER *h);
 
+int64_t ff_gcd(int64_t a, int64_t b);
+
 static int mp_open(URLContext *h, const char *filename, int flags){
     return 0;
 }
@@ -129,7 +131,7 @@
     AVFormatContext *avfc;
     AVFormatParameters ap;
     lavf_priv_t *priv= demuxer->priv;
-    int i;
+    int i,g;
     char mp_filename[256]="mp:";
 
     memset(&ap, 0, sizeof(AVFormatParameters));
@@ -193,6 +195,18 @@
                     codec->extradata_size);
             }
             sh_audio->wf= wf;
+            sh_audio->audio.dwSampleSize= codec->block_align;
+            if(codec->frame_size && codec->sample_rate){
+                sh_audio->audio.dwScale=codec->frame_size;
+                sh_audio->audio.dwRate= codec->sample_rate;
+            }else{
+                sh_audio->audio.dwScale= codec->block_align ? codec->block_align*8 : 8;
+                sh_audio->audio.dwRate = codec->bit_rate;
+            }
+            g= ff_gcd(sh_audio->audio.dwScale, sh_audio->audio.dwRate);
+            sh_audio->audio.dwScale /= g;
+            sh_audio->audio.dwRate  /= g;
+//            printf("sca:%d rat:%d fs:%d sr:%d ba:%d\n", sh_audio->audio.dwScale, sh_audio->audio.dwRate, codec->frame_size, codec->sample_rate, codec->block_align);
             sh_audio->ds= demuxer->audio;
             sh_audio->format= codec->codec_tag;
             sh_audio->channels= codec->channels;




More information about the MPlayer-cvslog mailing list