changeset 1462:a776747517c0

ffmpeg12 fix - now passing sequence header
author arpi
date Wed, 08 Aug 2001 13:34:08 +0000
parents 5a748a93b7b4
children d377ea93892d
files dec_video.c mplayer.c
diffstat 2 files changed, 22 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/dec_video.c	Wed Aug 08 06:58:12 2001 +0000
+++ b/dec_video.c	Wed Aug 08 13:34:08 2001 +0000
@@ -287,6 +287,7 @@
 	return 0; //exit(1);
     }
     memset(&lavc_context, 0, sizeof(lavc_context));
+//    sh_video->disp_h/=2; // !!
     lavc_context.width=sh_video->disp_w;
     lavc_context.height=sh_video->disp_h;
     printf("libavcodec.size: %d x %d\n",lavc_context.width,lavc_context.height);
@@ -406,17 +407,31 @@
 #ifdef USE_LIBAVCODEC
   case VFM_FFMPEG: {        // libavcodec
     int got_picture=0;
-    printf("Calling ffmpeg...\n");
+if(verbose) printf("Calling ffmpeg...\n");
     if(drop_frame<2 && in_size>0){
         int ret = avcodec_decode_video(&lavc_context, &lavc_picture,
 	     &got_picture, start, in_size);
-    printf("DONE -> got_picture=%d\n",got_picture);
+if(verbose){
+     unsigned char *x="???";
+     switch(lavc_context.pix_fmt){
+     case PIX_FMT_YUV420P: x="YUV420P";break;
+     case PIX_FMT_YUV422: x="YUV422";break;
+     case PIX_FMT_RGB24: x="RGB24";break;
+     case PIX_FMT_BGR24: x="BGR24";break;
+     case PIX_FMT_YUV422P: x="YUV422P";break;
+     case PIX_FMT_YUV444P: x="YUV444P";break;
+     }
+     printf("DONE -> got_picture=%d  format=0x%X (%s) \n",got_picture,
+	lavc_context.pix_fmt,x);
+}
 	if(ret<0) fprintf(stderr, "Error while decoding frame!\n");
 	if(!drop_frame && got_picture){
 //	if(!drop_frame){
 	  if(planar){
 	    planes=lavc_picture.data;
 	    stride=lavc_picture.linesize;
+	    //stride[1]=stride[2]=0;
+	    //stride[0]/=2;
             blit_frame=2;
 	  } else {
 	    int y;
@@ -579,14 +594,15 @@
 //     exit(1);
    }
    if(sync_video_packet(d_video)==0x1B5){ // next packet is seq. ext.
-    videobuf_len=0;
+//    videobuf_len=0;
+    int pos=videobuf_len;
     if(!read_video_packet(d_video)){ 
       fprintf(stderr,"FATAL: Cannot read sequence header extension!\n");
       return 0;
 //      GUI_MSG( mplMPEGErrorCannotReadSeqHeaderExt )
 //      exit(1);
     }
-    if(header_process_extension (picture, &videobuffer[4])) {
+    if(header_process_extension (picture, &videobuffer[pos+4])) {
       printf ("bad sequence header extension!\n");  
       return 0;
 //      GUI_MSG( mplMPEGErrorBadSeqHeaderExt )
--- a/mplayer.c	Wed Aug 08 06:58:12 2001 +0000
+++ b/mplayer.c	Wed Aug 08 13:34:08 2001 +0000
@@ -1252,7 +1252,7 @@
   if(file_format==DEMUXER_TYPE_MPEG_ES || file_format==DEMUXER_TYPE_MPEG_PS){
         int in_frame=0;
         float newfps;
-        videobuf_len=0;
+        //videobuf_len=0;
         while(videobuf_len<VIDEOBUFFER_SIZE-MAX_VIDEO_PACKET_SIZE){
           int i=sync_video_packet(d_video);
 	  void* buffer=&videobuffer[videobuf_len+4];
@@ -1307,6 +1307,7 @@
     // fix mpeg2 frametime:
     frame_time=(100+picture->repeat_count)*0.01f;
     picture->repeat_count=0;
+    videobuf_len=0;
 
   } else {
       // frame-based file formats: (AVI,ASF,MOV)