]> git.sesse.net Git - x264/blob - vfw/x264vfw.h
updated VfW interface by Radek Czyz
[x264] / vfw / x264vfw.h
1 #ifndef _X264_VFW_H
2 #define _X264_VFW_H
3
4 #include <stdlib.h>
5 #include <string.h>
6 #include <stdint.h>
7
8 #include <windows.h>
9 #include <vfw.h>
10
11 #include <x264.h>
12
13 #include "resource.h"
14
15 /* Name */
16 #define X264_NAME_L     L"x264"
17 #define X264_DESC_L     L"x264 - H264/AVC encoder"
18
19 /* Codec fcc */
20 #define FOURCC_X264 mmioFOURCC('X','2','6','4')
21
22 /* yuv 4:2:0 planar */
23 #define FOURCC_I420 mmioFOURCC('I','4','2','0')
24 #define FOURCC_IYUV mmioFOURCC('I','Y','U','V')
25 #define FOURCC_YV12 mmioFOURCC('Y','V','1','2')
26
27 /* yuv 4:2:2 packed */
28 #define FOURCC_YUY2 mmioFOURCC('Y','U','Y','2')
29 #define FOURCC_YUYV mmioFOURCC('Y','U','Y','V')
30
31 #define X264_WEBSITE    "http://videolan.org/x264.html"
32
33 /* CONFIG: vfw config
34  */
35 typedef struct
36 {
37     /********** ATTENTION **********/
38     int mode;                   /* Vidomi directly accesses these vars */
39     int bitrate;
40     int desired_size;           /* please try to avoid modifications here */
41     char stats[MAX_PATH];
42     /*******************************/
43     int i_2passbitrate;
44     int i_pass;
45
46     /* Our config */
47     int i_refmax;
48     int i_idrframe;
49     int i_iframe;
50
51     int i_qp;
52     int b_filter;
53
54     int b_cabac;
55
56     int b_i4x4;
57     int b_psub16x16;
58     int b_psub8x8;
59     int b_bsub16x16;
60
61     int i_bframe;
62     int i_subpel_refine;
63     int i_direct_mv_pred;
64
65     int i_inloop_a;
66     int i_inloop_b;
67
68     /* vfw interface */
69     int b_save;
70     /* fourcc used */
71     char fcc[4+1];
72     int  i_encoding_type;
73 } CONFIG;
74
75 /* CODEC: vfw codec instance
76  */
77 typedef struct
78 {
79     CONFIG config;
80
81     /* handle */
82     x264_t *h;
83
84     /* XXX: needed ? */
85     unsigned int fincr;
86     unsigned int fbase;
87 } CODEC;
88
89 /* Compress functions */
90 LRESULT compress_query(CODEC *, BITMAPINFO *, BITMAPINFO *);
91 LRESULT compress_get_format(CODEC *, BITMAPINFO *, BITMAPINFO *);
92 LRESULT compress_get_size(CODEC *, BITMAPINFO *, BITMAPINFO *);
93 LRESULT compress_frames_info(CODEC *, ICCOMPRESSFRAMES *);
94 LRESULT compress_begin(CODEC *, BITMAPINFO *, BITMAPINFO *);
95 LRESULT compress_end(CODEC *);
96 LRESULT compress(CODEC *, ICCOMPRESS *);
97
98
99 /* config functions */
100 void config_reg_load( CONFIG * config );
101 void config_reg_save( CONFIG * config );
102
103
104 /* Dialog callbacks */
105 BOOL CALLBACK callback_about( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
106 BOOL CALLBACK callback_main ( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
107 BOOL CALLBACK callback_advanced( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
108
109 /* Dll instance */
110 extern HINSTANCE g_hInst;
111
112 #if defined(_DEBUG)
113 #include <stdio.h> /* vsprintf */
114 #define DPRINTF_BUF_SZ  1024
115 static __inline void DPRINTF(char *fmt, ...)
116 {
117     va_list args;
118     char buf[DPRINTF_BUF_SZ];
119
120     va_start(args, fmt);
121     vsprintf(buf, fmt, args);
122     OutputDebugString(buf);
123 }
124 #else
125 static __inline void DPRINTF(char *fmt, ...) { }
126 #endif
127
128
129 #endif
130