2002-04-10 23:23:36 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2002-09-01 23:06:15 +00:00
|
|
|
#include <unistd.h>
|
2002-12-27 22:43:20 +00:00
|
|
|
#include <inttypes.h>
|
2007-02-18 23:24:21 +00:00
|
|
|
#include <sys/stat.h>
|
2002-04-10 23:23:36 +00:00
|
|
|
|
2005-11-18 14:39:25 +00:00
|
|
|
#include "config.h"
|
2002-04-10 23:23:36 +00:00
|
|
|
|
2005-11-18 14:39:25 +00:00
|
|
|
#include "mp_msg.h"
|
2006-03-31 00:15:47 +00:00
|
|
|
#include "help_mp.h"
|
2002-04-10 23:23:36 +00:00
|
|
|
|
|
|
|
#include "codec-cfg.h"
|
2007-03-15 17:30:55 +00:00
|
|
|
//#include "stream/stream.h"
|
2007-03-15 17:51:32 +00:00
|
|
|
//#include "libmpdemux/demuxer.h"
|
|
|
|
//#include "libmpdemux/stheader.h"
|
2002-09-01 18:08:44 +00:00
|
|
|
|
2007-03-15 08:29:24 +00:00
|
|
|
#include "loader/loader.h"
|
|
|
|
//#include "loader/wine/mmreg.h"
|
|
|
|
#include "loader/wine/vfw.h"
|
2008-03-06 01:57:26 +00:00
|
|
|
#include "libmpdemux/aviheader.h"
|
2007-10-17 05:14:21 +00:00
|
|
|
#include "loader/wine/winerror.h"
|
|
|
|
#include "loader/wine/objbase.h"
|
2002-04-10 23:23:36 +00:00
|
|
|
|
2002-04-13 19:14:34 +00:00
|
|
|
#include "img_format.h"
|
|
|
|
#include "mp_image.h"
|
2002-04-10 23:23:36 +00:00
|
|
|
#include "vf.h"
|
|
|
|
|
2007-03-15 17:30:55 +00:00
|
|
|
#include "stream/stream.h"
|
2007-03-15 17:51:32 +00:00
|
|
|
#include "libmpdemux/muxer.h"
|
2002-12-27 22:43:20 +00:00
|
|
|
|
2002-04-10 23:23:36 +00:00
|
|
|
//===========================================================================//
|
|
|
|
|
2002-05-13 21:18:52 +00:00
|
|
|
static char *vfw_param_codec = NULL;
|
2007-02-18 23:24:21 +00:00
|
|
|
static char *vfw_param_compdata = NULL;
|
2007-10-17 05:14:21 +00:00
|
|
|
static HRESULT CoInitRes = -1;
|
2002-05-13 21:18:52 +00:00
|
|
|
|
2003-08-13 16:29:32 +00:00
|
|
|
#include "m_option.h"
|
2002-05-13 21:18:52 +00:00
|
|
|
|
2003-08-13 16:29:32 +00:00
|
|
|
m_option_t vfwopts_conf[]={
|
2002-05-13 21:18:52 +00:00
|
|
|
{"codec", &vfw_param_codec, CONF_TYPE_STRING, 0, 0, 0, NULL},
|
2007-02-18 23:24:21 +00:00
|
|
|
{"compdata", &vfw_param_compdata, CONF_TYPE_STRING, 0, 0, 0, NULL},
|
2002-05-13 21:18:52 +00:00
|
|
|
{NULL, NULL, 0, 0, 0, 0, NULL}
|
|
|
|
};
|
|
|
|
|
2002-04-10 23:23:36 +00:00
|
|
|
struct vf_priv_s {
|
2002-12-27 22:43:20 +00:00
|
|
|
muxer_stream_t* mux;
|
2002-04-10 23:23:36 +00:00
|
|
|
BITMAPINFOHEADER* bih;
|
|
|
|
};
|
|
|
|
|
2002-09-29 19:19:31 +00:00
|
|
|
static HIC encoder_hic;
|
2002-09-01 18:08:44 +00:00
|
|
|
static void* encoder_buf=NULL;
|
|
|
|
static int encoder_buf_size=0;
|
|
|
|
static int encoder_frameno=0;
|
|
|
|
|
|
|
|
//int init_vfw_encoder(char *dll_name, BITMAPINFOHEADER *input_bih, BITMAPINFOHEADER *output_bih)
|
2007-02-18 23:24:21 +00:00
|
|
|
static BITMAPINFOHEADER* vfw_open_encoder(char *dll_name, char *compdatafile, BITMAPINFOHEADER *input_bih,unsigned int out_fourcc)
|
2002-09-01 18:08:44 +00:00
|
|
|
{
|
|
|
|
HRESULT ret;
|
|
|
|
BITMAPINFOHEADER* output_bih=NULL;
|
|
|
|
int temp_len;
|
2007-02-18 23:24:21 +00:00
|
|
|
FILE *fd=NULL;
|
|
|
|
char *drvdata=NULL;
|
|
|
|
struct stat st;
|
2002-09-01 18:08:44 +00:00
|
|
|
|
|
|
|
//sh_video = malloc(sizeof(sh_video_t));
|
|
|
|
|
|
|
|
mp_msg(MSGT_WIN32,MSGL_V,"======= Win32 (VFW) VIDEO Encoder init =======\n");
|
2007-10-17 05:14:21 +00:00
|
|
|
CoInitRes = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
|
2002-09-01 18:08:44 +00:00
|
|
|
// memset(&sh_video->o_bih, 0, sizeof(BITMAPINFOHEADER));
|
|
|
|
// output_bih->biSize = sizeof(BITMAPINFOHEADER);
|
|
|
|
|
2002-09-13 21:55:55 +00:00
|
|
|
// encoder_hic = ICOpen( 0x63646976, out_fourcc, ICMODE_COMPRESS);
|
2002-09-29 19:19:31 +00:00
|
|
|
encoder_hic = ICOpen( (long) dll_name, out_fourcc, ICMODE_COMPRESS);
|
2002-09-01 18:08:44 +00:00
|
|
|
if(!encoder_hic){
|
|
|
|
mp_msg(MSGT_WIN32,MSGL_ERR,"ICOpen failed! unknown codec / wrong parameters?\n");
|
|
|
|
return NULL;
|
|
|
|
}
|
2006-03-31 00:15:47 +00:00
|
|
|
mp_msg(MSGT_WIN32,MSGL_INFO,"HIC: %x\n", encoder_hic);
|
2002-09-01 18:08:44 +00:00
|
|
|
|
|
|
|
#if 1
|
|
|
|
{
|
|
|
|
ICINFO icinfo;
|
|
|
|
|
|
|
|
ret = ICGetInfo(encoder_hic, &icinfo, sizeof(ICINFO));
|
2006-03-31 00:15:47 +00:00
|
|
|
mp_msg(MSGT_WIN32,MSGL_INFO,"%ld - %ld - %d\n", ret, icinfo.dwSize, sizeof(ICINFO));
|
|
|
|
mp_msg(MSGT_WIN32,MSGL_INFO,MSGTR_MPCODECS_CompressorType, icinfo.fccType);
|
|
|
|
mp_msg(MSGT_WIN32,MSGL_INFO,MSGTR_MPCODECS_CompressorSubtype, icinfo.fccHandler);
|
|
|
|
mp_msg(MSGT_WIN32,MSGL_INFO,MSGTR_MPCODECS_CompressorFlags,
|
2002-09-01 18:08:44 +00:00
|
|
|
icinfo.dwFlags, icinfo.dwVersion, icinfo.dwVersionICM);
|
|
|
|
//printf("Compressor name: %s\n", icinfo.szName);
|
|
|
|
//printf("Compressor description: %s\n", icinfo.szDescription);
|
|
|
|
|
2006-03-31 00:15:47 +00:00
|
|
|
mp_msg(MSGT_WIN32,MSGL_INFO,MSGTR_MPCODECS_Flags);
|
2002-09-01 18:08:44 +00:00
|
|
|
if (icinfo.dwFlags & VIDCF_QUALITY)
|
2006-03-31 00:15:47 +00:00
|
|
|
mp_msg(MSGT_WIN32,MSGL_INFO,MSGTR_MPCODECS_Quality);
|
2002-09-01 18:08:44 +00:00
|
|
|
if (icinfo.dwFlags & VIDCF_FASTTEMPORALD)
|
2006-03-31 00:15:47 +00:00
|
|
|
mp_msg(MSGT_WIN32,MSGL_INFO," fast-decompr");
|
2002-09-01 18:08:44 +00:00
|
|
|
if (icinfo.dwFlags & VIDCF_QUALITYTIME)
|
2006-03-31 00:15:47 +00:00
|
|
|
mp_msg(MSGT_WIN32,MSGL_INFO," temp-quality");
|
|
|
|
mp_msg(MSGT_WIN32,MSGL_INFO,"\n");
|
2002-09-01 18:08:44 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2007-02-18 23:24:21 +00:00
|
|
|
if(compdatafile){
|
|
|
|
if (!strncmp(compdatafile, "dialog", 6)){
|
|
|
|
if (ICSendMessage(encoder_hic, ICM_CONFIGURE, -1, 0) != ICERR_OK){
|
|
|
|
mp_msg(MSGT_WIN32,MSGL_ERR,"Compressor doesn't have a configure dialog!\n");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
if (ICSendMessage(encoder_hic, ICM_CONFIGURE, 0, 0) != ICERR_OK){
|
|
|
|
mp_msg(MSGT_WIN32,MSGL_ERR,"Compressor configure dialog failed!\n");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (stat(compdatafile, &st) < 0){
|
|
|
|
mp_msg(MSGT_WIN32,MSGL_ERR,"Compressor data file not found!\n");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
fd = fopen(compdatafile, "rb");
|
|
|
|
if (!fd){
|
|
|
|
mp_msg(MSGT_WIN32,MSGL_ERR,"Cannot open Compressor data file!\n");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
drvdata = (char *) malloc(st.st_size);
|
|
|
|
if (fread(drvdata, st.st_size, 1, fd) != 1) {
|
|
|
|
mp_msg(MSGT_WIN32,MSGL_ERR,"Cannot read Compressor data file!\n");
|
|
|
|
fclose(fd);
|
|
|
|
free(drvdata);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
fclose(fd);
|
|
|
|
mp_msg(MSGT_WIN32,MSGL_ERR,"Compressor data %d bytes\n", st.st_size);
|
|
|
|
if (!(temp_len = (unsigned int) ICSendMessage(encoder_hic, ICM_SETSTATE, (LPARAM) drvdata, (int) st.st_size))){
|
|
|
|
mp_msg(MSGT_WIN32,MSGL_ERR,"ICSetState failed!\n");
|
|
|
|
free(drvdata);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
free(drvdata);
|
|
|
|
mp_msg(MSGT_WIN32,MSGL_INFO,"ICSetState ret: %d\n", temp_len);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-09-01 18:08:44 +00:00
|
|
|
temp_len = ICCompressGetFormatSize(encoder_hic, input_bih);
|
2006-03-31 00:15:47 +00:00
|
|
|
mp_msg(MSGT_WIN32,MSGL_INFO,"ICCompressGetFormatSize ret: %d\n", temp_len);
|
2002-09-01 18:08:44 +00:00
|
|
|
|
|
|
|
if (temp_len < sizeof(BITMAPINFOHEADER)) temp_len=sizeof(BITMAPINFOHEADER);
|
|
|
|
|
|
|
|
output_bih = malloc(temp_len+4);
|
|
|
|
memset(output_bih,0,temp_len);
|
|
|
|
output_bih->biSize = temp_len; //sizeof(BITMAPINFOHEADER);
|
|
|
|
|
|
|
|
return output_bih;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int vfw_start_encoder(BITMAPINFOHEADER *input_bih, BITMAPINFOHEADER *output_bih){
|
|
|
|
HRESULT ret;
|
|
|
|
int temp_len=output_bih->biSize;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
ret = ICCompressGetFormat(encoder_hic, input_bih, output_bih);
|
|
|
|
if(ret < 0){
|
|
|
|
unsigned char* temp=(unsigned char*)output_bih;
|
|
|
|
mp_msg(MSGT_WIN32,MSGL_ERR,"ICCompressGetFormat failed: Error %d (0x%X)\n", (int)ret, (int)ret);
|
|
|
|
for (i=0; i < temp_len; i++) mp_msg(MSGT_WIN32, MSGL_DBG2, "%02x ", temp[i]);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
mp_msg(MSGT_WIN32,MSGL_V,"ICCompressGetFormat OK\n");
|
2009-05-13 02:58:57 +00:00
|
|
|
|
2002-09-01 18:08:44 +00:00
|
|
|
if (temp_len > sizeof(BITMAPINFOHEADER))
|
|
|
|
{
|
|
|
|
unsigned char* temp=(unsigned char*)output_bih;
|
|
|
|
mp_msg(MSGT_WIN32, MSGL_V, "Extra info in o_bih (%d bytes)!\n",
|
|
|
|
temp_len-sizeof(BITMAPINFOHEADER));
|
|
|
|
for(i=sizeof(output_bih);i<temp_len;i++) mp_msg(MSGT_WIN32, MSGL_DBG2, "%02X ",temp[i]);
|
|
|
|
}
|
|
|
|
|
2006-03-27 07:22:48 +00:00
|
|
|
// if( mp_msg_test(MSGT_WIN32,MSGL_V) ) {
|
2002-09-01 18:08:44 +00:00
|
|
|
printf("Starting compression:\n");
|
|
|
|
printf(" Input format:\n");
|
Use correct printf length modifiers, fixes the following warnings:
ve_vfw.c: In function 'vfw_start_encoder':
ve_vfw.c:182: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
ve_vfw.c:183: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
ve_vfw.c:184: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
ve_vfw.c:187: warning: format '%x' expects type 'unsigned int', but argument 2 has type 'long int'
ve_vfw.c:188: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
ve_vfw.c:190: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
ve_vfw.c:191: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
ve_vfw.c:192: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
ve_vfw.c:195: warning: format '%x' expects type 'unsigned int', but argument 2 has type 'long int'
ve_vfw.c:196: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
ve_vfw.c:216: warning: format '%d' expects type 'int', but argument 4 has type 'long int'
ve_vfw.c:217: warning: format '%d' expects type 'int', but argument 4 has type 'long int'
ve_vfw.c:218: warning: format '%d' expects type 'int', but argument 4 has type 'long int'
ve_vfw.c:221: warning: format '%x' expects type 'unsigned int', but argument 4 has type 'long int'
ve_vfw.c:222: warning: format '%d' expects type 'int', but argument 4 has type 'long int'
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25290 b3059339-0415-0410-9bf9-f77b7e298cf2
2007-12-03 23:38:51 +00:00
|
|
|
printf(" biSize %ld\n", input_bih->biSize);
|
|
|
|
printf(" biWidth %ld\n", input_bih->biWidth);
|
|
|
|
printf(" biHeight %ld\n", input_bih->biHeight);
|
2002-09-01 18:08:44 +00:00
|
|
|
printf(" biPlanes %d\n", input_bih->biPlanes);
|
|
|
|
printf(" biBitCount %d\n", input_bih->biBitCount);
|
Use correct printf length modifiers, fixes the following warnings:
ve_vfw.c: In function 'vfw_start_encoder':
ve_vfw.c:182: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
ve_vfw.c:183: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
ve_vfw.c:184: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
ve_vfw.c:187: warning: format '%x' expects type 'unsigned int', but argument 2 has type 'long int'
ve_vfw.c:188: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
ve_vfw.c:190: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
ve_vfw.c:191: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
ve_vfw.c:192: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
ve_vfw.c:195: warning: format '%x' expects type 'unsigned int', but argument 2 has type 'long int'
ve_vfw.c:196: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
ve_vfw.c:216: warning: format '%d' expects type 'int', but argument 4 has type 'long int'
ve_vfw.c:217: warning: format '%d' expects type 'int', but argument 4 has type 'long int'
ve_vfw.c:218: warning: format '%d' expects type 'int', but argument 4 has type 'long int'
ve_vfw.c:221: warning: format '%x' expects type 'unsigned int', but argument 4 has type 'long int'
ve_vfw.c:222: warning: format '%d' expects type 'int', but argument 4 has type 'long int'
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25290 b3059339-0415-0410-9bf9-f77b7e298cf2
2007-12-03 23:38:51 +00:00
|
|
|
printf(" biCompression 0x%lx ('%.4s')\n", input_bih->biCompression, (char *)&input_bih->biCompression);
|
|
|
|
printf(" biSizeImage %ld\n", input_bih->biSizeImage);
|
2002-09-01 18:08:44 +00:00
|
|
|
printf(" Output format:\n");
|
Use correct printf length modifiers, fixes the following warnings:
ve_vfw.c: In function 'vfw_start_encoder':
ve_vfw.c:182: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
ve_vfw.c:183: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
ve_vfw.c:184: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
ve_vfw.c:187: warning: format '%x' expects type 'unsigned int', but argument 2 has type 'long int'
ve_vfw.c:188: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
ve_vfw.c:190: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
ve_vfw.c:191: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
ve_vfw.c:192: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
ve_vfw.c:195: warning: format '%x' expects type 'unsigned int', but argument 2 has type 'long int'
ve_vfw.c:196: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
ve_vfw.c:216: warning: format '%d' expects type 'int', but argument 4 has type 'long int'
ve_vfw.c:217: warning: format '%d' expects type 'int', but argument 4 has type 'long int'
ve_vfw.c:218: warning: format '%d' expects type 'int', but argument 4 has type 'long int'
ve_vfw.c:221: warning: format '%x' expects type 'unsigned int', but argument 4 has type 'long int'
ve_vfw.c:222: warning: format '%d' expects type 'int', but argument 4 has type 'long int'
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25290 b3059339-0415-0410-9bf9-f77b7e298cf2
2007-12-03 23:38:51 +00:00
|
|
|
printf(" biSize %ld\n", output_bih->biSize);
|
|
|
|
printf(" biWidth %ld\n", output_bih->biWidth);
|
|
|
|
printf(" biHeight %ld\n", output_bih->biHeight);
|
2002-09-01 18:08:44 +00:00
|
|
|
printf(" biPlanes %d\n", output_bih->biPlanes);
|
|
|
|
printf(" biBitCount %d\n", output_bih->biBitCount);
|
Use correct printf length modifiers, fixes the following warnings:
ve_vfw.c: In function 'vfw_start_encoder':
ve_vfw.c:182: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
ve_vfw.c:183: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
ve_vfw.c:184: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
ve_vfw.c:187: warning: format '%x' expects type 'unsigned int', but argument 2 has type 'long int'
ve_vfw.c:188: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
ve_vfw.c:190: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
ve_vfw.c:191: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
ve_vfw.c:192: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
ve_vfw.c:195: warning: format '%x' expects type 'unsigned int', but argument 2 has type 'long int'
ve_vfw.c:196: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
ve_vfw.c:216: warning: format '%d' expects type 'int', but argument 4 has type 'long int'
ve_vfw.c:217: warning: format '%d' expects type 'int', but argument 4 has type 'long int'
ve_vfw.c:218: warning: format '%d' expects type 'int', but argument 4 has type 'long int'
ve_vfw.c:221: warning: format '%x' expects type 'unsigned int', but argument 4 has type 'long int'
ve_vfw.c:222: warning: format '%d' expects type 'int', but argument 4 has type 'long int'
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25290 b3059339-0415-0410-9bf9-f77b7e298cf2
2007-12-03 23:38:51 +00:00
|
|
|
printf(" biCompression 0x%lx ('%.4s')\n", output_bih->biCompression, (char *)&output_bih->biCompression);
|
|
|
|
printf(" biSizeImage %ld\n", output_bih->biSizeImage);
|
2002-09-01 18:08:44 +00:00
|
|
|
// }
|
|
|
|
|
|
|
|
output_bih->biWidth=input_bih->biWidth;
|
|
|
|
output_bih->biHeight=input_bih->biHeight;
|
|
|
|
|
|
|
|
ret = ICCompressQuery(encoder_hic, input_bih, output_bih);
|
|
|
|
if(ret){
|
|
|
|
mp_msg(MSGT_WIN32,MSGL_ERR,"ICCompressQuery failed: Error %d\n", (int)ret);
|
|
|
|
return 0;
|
|
|
|
} else
|
|
|
|
mp_msg(MSGT_WIN32,MSGL_V,"ICCompressQuery OK\n");
|
|
|
|
|
|
|
|
ret = ICCompressBegin(encoder_hic, input_bih, output_bih);
|
|
|
|
if(ret){
|
|
|
|
mp_msg(MSGT_WIN32,MSGL_ERR,"ICCompressBegin failed: Error %d\n", (int)ret);
|
|
|
|
// return 0;
|
|
|
|
} else
|
2006-03-31 00:15:47 +00:00
|
|
|
mp_msg(MSGT_WIN32,MSGL_V,"ICCompressBegin OK\n");
|
|
|
|
mp_msg(MSGT_WIN32,MSGL_INFO," Output format after query/begin:\n");
|
Use correct printf length modifiers, fixes the following warnings:
ve_vfw.c: In function 'vfw_start_encoder':
ve_vfw.c:182: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
ve_vfw.c:183: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
ve_vfw.c:184: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
ve_vfw.c:187: warning: format '%x' expects type 'unsigned int', but argument 2 has type 'long int'
ve_vfw.c:188: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
ve_vfw.c:190: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
ve_vfw.c:191: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
ve_vfw.c:192: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
ve_vfw.c:195: warning: format '%x' expects type 'unsigned int', but argument 2 has type 'long int'
ve_vfw.c:196: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
ve_vfw.c:216: warning: format '%d' expects type 'int', but argument 4 has type 'long int'
ve_vfw.c:217: warning: format '%d' expects type 'int', but argument 4 has type 'long int'
ve_vfw.c:218: warning: format '%d' expects type 'int', but argument 4 has type 'long int'
ve_vfw.c:221: warning: format '%x' expects type 'unsigned int', but argument 4 has type 'long int'
ve_vfw.c:222: warning: format '%d' expects type 'int', but argument 4 has type 'long int'
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25290 b3059339-0415-0410-9bf9-f77b7e298cf2
2007-12-03 23:38:51 +00:00
|
|
|
mp_msg(MSGT_WIN32,MSGL_INFO," biSize %ld\n", output_bih->biSize);
|
|
|
|
mp_msg(MSGT_WIN32,MSGL_INFO," biWidth %ld\n", output_bih->biWidth);
|
|
|
|
mp_msg(MSGT_WIN32,MSGL_INFO," biHeight %ld\n", output_bih->biHeight);
|
2006-03-31 00:15:47 +00:00
|
|
|
mp_msg(MSGT_WIN32,MSGL_INFO," biPlanes %d\n", output_bih->biPlanes);
|
|
|
|
mp_msg(MSGT_WIN32,MSGL_INFO," biBitCount %d\n", output_bih->biBitCount);
|
Use correct printf length modifiers, fixes the following warnings:
ve_vfw.c: In function 'vfw_start_encoder':
ve_vfw.c:182: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
ve_vfw.c:183: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
ve_vfw.c:184: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
ve_vfw.c:187: warning: format '%x' expects type 'unsigned int', but argument 2 has type 'long int'
ve_vfw.c:188: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
ve_vfw.c:190: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
ve_vfw.c:191: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
ve_vfw.c:192: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
ve_vfw.c:195: warning: format '%x' expects type 'unsigned int', but argument 2 has type 'long int'
ve_vfw.c:196: warning: format '%d' expects type 'int', but argument 2 has type 'long int'
ve_vfw.c:216: warning: format '%d' expects type 'int', but argument 4 has type 'long int'
ve_vfw.c:217: warning: format '%d' expects type 'int', but argument 4 has type 'long int'
ve_vfw.c:218: warning: format '%d' expects type 'int', but argument 4 has type 'long int'
ve_vfw.c:221: warning: format '%x' expects type 'unsigned int', but argument 4 has type 'long int'
ve_vfw.c:222: warning: format '%d' expects type 'int', but argument 4 has type 'long int'
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25290 b3059339-0415-0410-9bf9-f77b7e298cf2
2007-12-03 23:38:51 +00:00
|
|
|
mp_msg(MSGT_WIN32,MSGL_INFO," biCompression 0x%lx ('%.4s')\n", output_bih->biCompression, (char *)&output_bih->biCompression);
|
|
|
|
mp_msg(MSGT_WIN32,MSGL_INFO," biSizeImage %ld\n", output_bih->biSizeImage);
|
2009-05-13 02:58:57 +00:00
|
|
|
|
2002-09-01 18:08:44 +00:00
|
|
|
encoder_buf_size=input_bih->biSizeImage;
|
|
|
|
encoder_buf=malloc(encoder_buf_size);
|
|
|
|
encoder_frameno=0;
|
|
|
|
|
|
|
|
mp_msg(MSGT_WIN32,MSGL_V,"VIDEO CODEC Init OK!!! ;-)\n");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int vfw_encode_frame(BITMAPINFOHEADER* biOutput,void* OutBuf,
|
|
|
|
BITMAPINFOHEADER* biInput,void* Image,
|
|
|
|
long* keyframe, int quality){
|
|
|
|
HRESULT ret;
|
|
|
|
|
|
|
|
//long VFWAPIV ICCompress(
|
|
|
|
// HIC hic,long dwFlags,LPBITMAPINFOHEADER lpbiOutput,void* lpOutputBuf,
|
|
|
|
// LPBITMAPINFOHEADER lpbiInput,void* lpImage,long* lpckid,
|
|
|
|
// long* lpdwFlags,long lFrameNum,long dwFrameSize,long dwQuality,
|
|
|
|
// LPBITMAPINFOHEADER lpbiInputPrev,void* lpImagePrev
|
|
|
|
//);
|
|
|
|
|
|
|
|
// printf("vfw_encode_frame(%p,%p, %p,%p, %p,%d)\n",biOutput,OutBuf,biInput,Image,keyframe,quality);
|
|
|
|
|
|
|
|
ret=ICCompress(encoder_hic, 0,
|
|
|
|
biOutput, OutBuf,
|
|
|
|
biInput, Image,
|
|
|
|
NULL, keyframe, encoder_frameno, 0, quality,
|
|
|
|
biInput, encoder_buf);
|
|
|
|
|
2008-03-06 08:43:20 +00:00
|
|
|
// printf("ok. size=%ld\n",biOutput->biSizeImage);
|
2002-09-01 18:08:44 +00:00
|
|
|
|
|
|
|
memcpy(encoder_buf,Image,encoder_buf_size);
|
|
|
|
++encoder_frameno;
|
|
|
|
|
|
|
|
return (int)ret;
|
|
|
|
}
|
2002-04-10 23:23:36 +00:00
|
|
|
#define mux_v (vf->priv->mux)
|
|
|
|
#define vfw_bih (vf->priv->bih)
|
|
|
|
|
|
|
|
static int config(struct vf_instance_s* vf,
|
|
|
|
int width, int height, int d_width, int d_height,
|
|
|
|
unsigned int flags, unsigned int outfmt){
|
|
|
|
|
|
|
|
vfw_bih->biWidth=width;
|
|
|
|
vfw_bih->biHeight=height;
|
|
|
|
vfw_bih->biSizeImage=width*height*((vfw_bih->biBitCount+7)/8);
|
2004-03-24 15:16:36 +00:00
|
|
|
mux_v->aspect = (float)d_width/d_height;
|
2002-04-11 02:50:47 +00:00
|
|
|
|
|
|
|
if(!vfw_start_encoder(vfw_bih, mux_v->bih)) return 0;
|
|
|
|
|
|
|
|
// mux_v->bih->biWidth=width;
|
|
|
|
// mux_v->bih->biHeight=height;
|
|
|
|
// mux_v->bih->biSizeImage=width*height*((mux_v->bih->biBitCount+7)/8);
|
2002-04-10 23:23:36 +00:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int control(struct vf_instance_s* vf, int request, void* data){
|
|
|
|
|
|
|
|
return CONTROL_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int query_format(struct vf_instance_s* vf, unsigned int fmt){
|
2005-04-18 15:52:38 +00:00
|
|
|
if(fmt==IMGFMT_BGR24) return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_FLIPPED;
|
2002-04-10 23:23:36 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-03-21 21:26:42 +00:00
|
|
|
static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
|
2002-04-10 23:23:36 +00:00
|
|
|
long flags=0;
|
|
|
|
int ret;
|
|
|
|
// flip_upside_down(vo_image_ptr,vo_image_ptr,3*vo_w,vo_h); // dirty hack
|
|
|
|
ret=vfw_encode_frame(mux_v->bih, mux_v->buffer, vfw_bih, mpi->planes[0], &flags, 10000);
|
2007-02-18 23:24:21 +00:00
|
|
|
// if (ret != ICERR_OK)
|
|
|
|
// return 0;
|
2006-03-21 21:26:42 +00:00
|
|
|
muxer_write_chunk(mux_v,mux_v->bih->biSizeImage,flags, pts, pts);
|
2002-09-10 22:18:32 +00:00
|
|
|
return 1;
|
2002-04-10 23:23:36 +00:00
|
|
|
}
|
|
|
|
|
2007-10-17 05:14:21 +00:00
|
|
|
static void uninit(struct vf_instance_s* vf)
|
|
|
|
{
|
|
|
|
HRESULT ret;
|
|
|
|
|
|
|
|
if(encoder_hic){
|
|
|
|
if(encoder_buf){
|
|
|
|
ret=ICCompressEnd(encoder_hic);
|
|
|
|
if(ret) mp_msg(MSGT_WIN32, MSGL_WARN, "ICCompressEnd failed: %ld\n", ret);
|
|
|
|
free(encoder_buf);
|
|
|
|
encoder_buf=NULL;
|
|
|
|
}
|
|
|
|
ret=ICClose(encoder_hic);
|
|
|
|
if(ret) mp_msg(MSGT_WIN32, MSGL_WARN, "ICClose failed: %ld\n", ret);
|
|
|
|
encoder_hic=0;
|
|
|
|
if ((CoInitRes == S_OK) || (CoInitRes == S_FALSE)) CoUninitialize();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-04-10 23:23:36 +00:00
|
|
|
//===========================================================================//
|
|
|
|
|
|
|
|
static int vf_open(vf_instance_t *vf, char* args){
|
|
|
|
vf->config=config;
|
2005-03-01 20:21:58 +00:00
|
|
|
vf->default_caps=VFCAP_CONSTANT;
|
2002-04-10 23:23:36 +00:00
|
|
|
vf->control=control;
|
|
|
|
vf->query_format=query_format;
|
|
|
|
vf->put_image=put_image;
|
2007-10-17 05:14:21 +00:00
|
|
|
vf->uninit=uninit;
|
2002-04-10 23:23:36 +00:00
|
|
|
vf->priv=malloc(sizeof(struct vf_priv_s));
|
|
|
|
memset(vf->priv,0,sizeof(struct vf_priv_s));
|
2002-12-27 22:43:20 +00:00
|
|
|
vf->priv->mux=(muxer_stream_t*)args;
|
2002-04-10 23:23:36 +00:00
|
|
|
|
2005-01-20 22:53:37 +00:00
|
|
|
vfw_bih=calloc(1, sizeof(BITMAPINFOHEADER));
|
2002-04-10 23:23:36 +00:00
|
|
|
vfw_bih->biSize=sizeof(BITMAPINFOHEADER);
|
|
|
|
vfw_bih->biWidth=0; // FIXME ?
|
|
|
|
vfw_bih->biHeight=0;
|
|
|
|
vfw_bih->biPlanes=1;
|
|
|
|
vfw_bih->biBitCount=24;
|
|
|
|
vfw_bih->biCompression=0;
|
|
|
|
// vfw_bih->biSizeImage=vo_w*vo_h*((vfw_bih->biBitCount+7)/8);
|
2002-05-13 21:18:52 +00:00
|
|
|
|
|
|
|
if (!vfw_param_codec)
|
|
|
|
{
|
2006-03-31 00:15:47 +00:00
|
|
|
mp_msg(MSGT_WIN32,MSGL_WARN, MSGTR_MPCODECS_NoVfwCodecSpecified);
|
2002-05-13 21:18:52 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2002-04-10 23:23:36 +00:00
|
|
|
// mux_v->bih=vfw_open_encoder("divxc32.dll",vfw_bih,mmioFOURCC('D', 'I', 'V', '3'));
|
2002-05-13 21:18:52 +00:00
|
|
|
// mux_v->bih=vfw_open_encoder("AvidAVICodec.dll",vfw_bih, 0);
|
2007-02-18 23:24:21 +00:00
|
|
|
mux_v->bih = vfw_open_encoder(vfw_param_codec, vfw_param_compdata, vfw_bih, 0);
|
2002-04-10 23:23:36 +00:00
|
|
|
if(!mux_v->bih) return 0;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
vf_info_t ve_info_vfw = {
|
|
|
|
"Win32/VfW encoders",
|
|
|
|
"vfw",
|
|
|
|
"A'rpi",
|
|
|
|
"for internal use by mencoder",
|
|
|
|
vf_open
|
|
|
|
};
|
|
|
|
|
|
|
|
//===========================================================================//
|