changeset 3980:cdd55ab40363

libmpeg2 is now able to decode framecopied (with mencoder) mpeg files
author alex
date Fri, 04 Jan 2002 16:48:13 +0000
parents b28af7b58f4c
children 001c05d69f6c
files libmpdemux/video.c
diffstat 1 files changed, 28 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/video.c	Fri Jan 04 14:03:02 2002 +0000
+++ b/libmpdemux/video.c	Fri Jan 04 16:48:13 2002 +0000
@@ -32,10 +32,38 @@
     sh_video->format=sh_video->bih->biCompression;
     sh_video->disp_w=sh_video->bih->biWidth;
     sh_video->disp_h=abs(sh_video->bih->biHeight);
+
+#if 1
+    /* hack to support decoding of mpeg1 chunks in AVI's with libmpeg2 -- 2002 alex */
+    if ((sh_video->format == 0x10000001) ||
+	(sh_video->format == 0x10000002) ||
+	(sh_video->format == mmioFOURCC('m','p','g','1')) ||
+	(sh_video->format == mmioFOURCC('M','P','G','1')) ||
+	(sh_video->format == mmioFOURCC('m','p','g','2')) ||
+	(sh_video->format == mmioFOURCC('M','P','G','2')) ||
+	(sh_video->format == mmioFOURCC('m','p','e','g')) ||
+	(sh_video->format == mmioFOURCC('m','p','e','g')))
+    {
+	int saved_pos, saved_type;
+
+	/* demuxer pos saving is required for libavcodec mpeg decoder as it's
+	   reading the mpeg header self! */
+	
+	saved_pos = d_video->buffer_pos;
+	saved_type = d_video->demuxer->file_format;
+
+	d_video->demuxer->file_format = DEMUXER_TYPE_MPEG_ES;
+	video_read_properties(sh_video);
+	d_video->demuxer->file_format = saved_type;
+	d_video->buffer_pos = saved_pos;
+//	goto mpeg_header_parser;
+    }
+#endif
   break;
  }
  case DEMUXER_TYPE_MPEG_ES:
  case DEMUXER_TYPE_MPEG_PS: {
+//mpeg_header_parser:
    // Find sequence_header first:
    videobuf_len=0; videobuf_code_len=0;
    mp_msg(MSGT_DECVIDEO,MSGL_V,"Searching for sequence header... ");fflush(stdout);