summaryrefslogtreecommitdiffstats
path: root/TOOLS
diff options
context:
space:
mode:
authorcompn <compn@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-02-22 19:03:36 +0000
committercompn <compn@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-02-22 19:03:36 +0000
commitfccd5900c7fdb1ec7d999565e67180f6d6404a09 (patch)
tree77c9f4a0e60baf9cc0aabbb912cebf49a65d72b0 /TOOLS
parent2bd9114c0d74ae467af344d1a19e67d8c4678c97 (diff)
downloadmpv-fccd5900c7fdb1ec7d999565e67180f6d6404a09.tar.bz2
mpv-fccd5900c7fdb1ec7d999565e67180f6d6404a09.tar.xz
update to 0.1 version from website
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@22314 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'TOOLS')
-rw-r--r--TOOLS/vfw2menc.c59
1 files changed, 51 insertions, 8 deletions
diff --git a/TOOLS/vfw2menc.c b/TOOLS/vfw2menc.c
index c45913b15e..c2df69a391 100644
--- a/TOOLS/vfw2menc.c
+++ b/TOOLS/vfw2menc.c
@@ -20,14 +20,16 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-/* On mingw compile with: gcc getopt.c vfw2menc.c -o vfw2menc.exe -lwinmm */
-/* Using wine: winegcc getopt.c vfw2menc.c -o vfw2menc -lwinmm */
+/* On mingw compile with: gcc getopt.c vfw2menc.c -o vfw2menc.exe -lwinmm -lole32 */
+/* Using wine: winegcc getopt.c vfw2menc.c -o vfw2menc -lwinmm -lole32 */
#ifdef _MSC_VER
#define _CRT_SECURE_NO_DEPRECATE
#pragma warning(disable: 4996)
#endif
+#define __VERSION__ "0.1"
+
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
@@ -37,6 +39,17 @@
#define BAIL(msg) { printf("%s: %s\n", argv[0], msg); ret = -1; goto cleanup; }
+typedef struct {
+ UINT uDriverSignature;
+ HINSTANCE hDriverModule;
+ DRIVERPROC DriverProc;
+ DWORD dwDriverID;
+} DRVR;
+
+typedef DRVR *PDRVR;
+typedef DRVR *NPDRVR;
+typedef DRVR *LPDRVR;
+
enum
{
MODE_NONE = 0,
@@ -138,7 +151,7 @@ static struct option long_options[] =
void help(const char *progname)
{
- printf("VFW to mencoder - Copyright 2006 - Gianluigi Tiesi <sherpya@netfarm.it>\n");
+ printf("VFW to mencoder v"__VERSION__" - Copyright 2007 - Gianluigi Tiesi <sherpya@netfarm.it>\n");
printf("This program is Free Software\n\n");
printf("Usage: %s\n", progname);
printf(" -h|--help - displays this help\n");
@@ -157,13 +170,16 @@ void help(const char *progname)
printf("Usage with mencoder -ovc vfw -xvfwopts codec=vp6vfw.dll:compdata=settings.mcf\n");
}
-
int main(int argc, char *argv[])
{
char *driver = NULL;
char *fourcc = NULL;
char *filename = NULL;
unsigned char mode = 0;
+ DWORD dwFCC = 0;
+ ICOPEN icopen;
+ HRESULT coinit = S_FALSE;
+ /* ICINFO icinfo; */
wchar_t drvfile[MAX_PATH];
HDRVR hDriver = NULL;
@@ -208,10 +224,11 @@ int main(int argc, char *argv[])
break;
default:
printf("Wrong arguments!\n");
+ help(argv[0]);
+ goto cleanup;
}
}
-
if (!(argc == optind) && (mode != MODE_NONE) &&
driver && (filename || (mode == MODE_VIEW)))
{
@@ -222,12 +239,34 @@ int main(int argc, char *argv[])
if (!MultiByteToWideChar(CP_ACP, 0, driver, -1, drvfile, MAX_PATH))
BAIL("MultiByteToWideChar() failed\n");
- if (!(hDriver = OpenDriver(drvfile, 0, (fourcc) ? ((LPARAM) fourcc) : 0)))
+ if (fourcc) memcpy(&dwFCC, fourcc, 4);
+ memset(&icopen, 0, sizeof(icopen));
+
+ icopen.dwSize = sizeof(icopen);
+ icopen.fccType = ICTYPE_VIDEO; /* VIDC */
+ icopen.fccHandler = dwFCC;
+ icopen.dwVersion = 0x00001000; /* FIXME */
+ icopen.dwFlags = ICMODE_COMPRESS;
+ icopen.dwError = 0;
+ icopen.pV1Reserved = NULL;
+ icopen.pV2Reserved = NULL;
+ icopen.dnDevNode = -1; /* FIXME */
+
+ coinit = CoInitialize(NULL);
+
+ if (!(hDriver = OpenDriver(drvfile, NULL, (LPARAM) &icopen)))
BAIL("OpenDriver() failed\n");
+ /*
+ memset(&icinfo, 0, sizeof(ICINFO));
+ icinfo.dwSize = sizeof(ICINFO);
+ SendDriverMessage(hDriver, ICM_GETINFO, (LPARAM) &icinfo, sizeof(ICINFO));
+ */
+
if (SendDriverMessage(hDriver, ICM_CONFIGURE, -1, 0) != ICERR_OK)
BAIL("The driver doesn't provide a configure dialog");
+
switch(mode)
{
case MODE_CHECK:
@@ -243,8 +282,11 @@ int main(int argc, char *argv[])
BAIL("Cannot save settings to file");
break;
case MODE_VIEW:
- if (SendDriverMessage(hDriver, ICM_CONFIGURE, 0, 0) != ICERR_OK)
- BAIL("ICM_CONFIGURE failed");
+ {
+ HWND hwnd = GetDesktopWindow();
+ if (SendDriverMessage(hDriver, ICM_CONFIGURE, (LPARAM) hwnd, 0) != ICERR_OK)
+ BAIL("ICM_CONFIGURE failed");
+ }
break;
default:
BAIL("This should not happen :)");
@@ -255,5 +297,6 @@ cleanup:
if (fourcc) free(fourcc);
if (filename) free(filename);
if (hDriver) CloseDriver(hDriver, 0, 0);
+ if (coinit == S_OK) CoUninitialize();
return ret;
}