changeset 4575:0245a06f9efd

VfW encoding support (very alpha yet)
author arpi
date Thu, 07 Feb 2002 20:22:03 +0000
parents 683a0585420c
children ccc0fd9ff352
files cfg-mencoder.h mencoder.c
diffstat 2 files changed, 47 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/cfg-mencoder.h	Thu Feb 07 20:20:14 2002 +0000
+++ b/cfg-mencoder.h	Thu Feb 07 20:22:03 2002 +0000
@@ -73,8 +73,9 @@
 	{"raw", &out_video_codec, CONF_TYPE_FLAG, 0, 0, VCODEC_RAW, NULL},
 	{"lavc", &out_video_codec, CONF_TYPE_FLAG, 0, 0, VCODEC_LIBAVCODEC, NULL},
 	{"null", &out_video_codec, CONF_TYPE_FLAG, 0, 0, VCODEC_NULL, NULL},
-    {"rawrgb", &out_video_codec, CONF_TYPE_FLAG, 0, 0, VCODEC_RAWRGB, NULL},
-	{"help", "\nAvailable codecs:\n   copy\n   frameno\n   divx4\n   raw\n   lavc\n   rawrgb\n   null\n\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
+	{"rawrgb", &out_video_codec, CONF_TYPE_FLAG, 0, 0, VCODEC_RAWRGB, NULL},
+	{"vfw", &out_video_codec, CONF_TYPE_FLAG, 0, 0, VCODEC_VFW, NULL},
+	{"help", "\nAvailable codecs:\n   copy\n   frameno\n   divx4\n   raw\n   lavc\n   rawrgb\n   vfw\n   null\n\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
 	{NULL, NULL, 0, 0, 0, 0, NULL}
 };
 
--- a/mencoder.c	Thu Feb 07 20:20:14 2002 +0000
+++ b/mencoder.c	Thu Feb 07 20:22:03 2002 +0000
@@ -5,6 +5,7 @@
 #define VCODEC_LIBAVCODEC 4
 #define VCODEC_NULL 5
 #define VCODEC_RAWRGB 6
+#define VCODEC_VFW 7
 
 #define ACODEC_COPY 0
 #define ACODEC_PCM 1
@@ -79,6 +80,8 @@
 int lavc_param_keyint = -1;
 #endif
 
+static BITMAPINFOHEADER* vfw_bih=NULL;
+
 #ifdef HAVE_LIBCSS
 #include "libmpdemux/dvdauth.h"
 #endif
@@ -545,6 +548,9 @@
     
     if(out_video_codec == VCODEC_RAWRGB) {
         if(IMGFMT_IS_BGR(out_fmt) && IMGFMT_BGR_DEPTH(out_fmt) == 32) break;
+    } else
+    if(out_video_codec == VCODEC_VFW) {
+        if(IMGFMT_IS_BGR(out_fmt) && IMGFMT_BGR_DEPTH(out_fmt) == 24) break;
     }
     else {
         if(IMGFMT_IS_BGR(out_fmt)) break;   
@@ -652,7 +658,7 @@
 
 mux_v=aviwrite_new_stream(muxer,AVIWRITE_TYPE_VIDEO);
 
-mux_v->buffer_size=0x200000;
+mux_v->buffer_size=0x200000; // 2MB
 mux_v->buffer=malloc(mux_v->buffer_size);
 
 mux_v->source=sh_video;
@@ -736,6 +742,23 @@
     mux_v->bih->biCompression=mmioFOURCC('F','r','N','o');
     mux_v->bih->biSizeImage=mux_v->bih->biWidth*mux_v->bih->biHeight*(mux_v->bih->biBitCount/8);
     break;
+case VCODEC_VFW:
+#ifdef USE_WIN32DLL
+    vfw_bih=malloc(sizeof(BITMAPINFOHEADER));
+    vfw_bih->biSize=sizeof(BITMAPINFOHEADER);
+    vfw_bih->biWidth=vo_w;
+    vfw_bih->biHeight=vo_h;
+    vfw_bih->biPlanes=0;
+    vfw_bih->biBitCount=24;
+    vfw_bih->biCompression=0;
+    vfw_bih->biSizeImage=vo_w*vo_h*((vfw_bih->biBitCount+7)/8);
+//    mux_v->bih=vfw_open_encoder("divxc32.dll",vfw_bih);
+    mux_v->bih=vfw_open_encoder("AvidAVICodec.dll",vfw_bih);
+    break;
+#else
+    printf("No support for Win32/VfW codecs compiled in\n");
+    return 0; /* FIXME */
+#endif
 case VCODEC_NULL:
     mux_v->bih=malloc(sizeof(BITMAPINFOHEADER));
     mux_v->bih->biSize=sizeof(BITMAPINFOHEADER);
@@ -1396,6 +1419,26 @@
     mux_v->buffer=&decoded_frameno; // tricky
     if(skip_flag<=0) aviwrite_write_chunk(muxer,mux_v,muxer_f,sizeof(int),0x10);
     break; }
+#ifdef USE_WIN32DLL
+case VCODEC_VFW: {
+//int vfw_encode_frame(BITMAPINFOHEADER* biOutput,void* OutBuf,
+//		     BITMAPINFOHEADER* biInput,void* Image,
+//		     long* keyframe, int quality);
+    long flags=0;
+    int ret;
+    blit_frame=decode_video(&video_out,sh_video,start,in_size,0);
+    if(skip_flag>0) break;
+    if(!blit_frame){
+	// empty.
+	aviwrite_write_chunk(muxer,mux_v,muxer_f,0,0);
+	break;
+    }
+    ret=vfw_encode_frame(mux_v->bih, mux_v->buffer, vfw_bih, vo_image_ptr, &flags, 10000);
+//    printf("vfw_encode_frame -> %d  (size=%d,flag=%X)\n",ret,mux_v->bih->biSizeImage,flags);
+    aviwrite_write_chunk(muxer,mux_v,muxer_f,mux_v->bih->biSizeImage,flags);
+    break;
+}
+#endif
 case VCODEC_DIVX4:
 #ifndef HAVE_DIVX4ENCORE
     printf("No support for Divx4 encore compiled in\n");