]> git.sesse.net Git - x264/blob - vfw/x264vfw.h
bfbb5894a95334efe82a10996d8eb5558b099b2a
[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     int b_fast1pass;    /* turns off some flags during 1st pass */    
47     int b_updatestats;  /* updates the statsfile during 2nd pass */
48
49     /* Our config */
50     int i_refmax;
51     int i_keyint_max;
52     int i_keyint_min;
53
54     int i_qp;
55     int b_filter;
56
57     int b_cabac;
58
59     int b_i4x4;
60     int b_psub16x16;
61     int b_psub8x8;
62     int b_bsub16x16;
63
64     int i_bframe;
65     int i_subpel_refine;
66     int i_direct_mv_pred;
67
68     int i_inloop_a;
69     int i_inloop_b;
70     
71     int i_key_boost;
72     int i_b_red;
73     int i_curve_comp;
74
75     /* vfw interface */
76     int b_save;
77     /* fourcc used */
78     char fcc[4+1];
79     int  i_encoding_type;
80 } CONFIG;
81
82 /* CODEC: vfw codec instance
83  */
84 typedef struct
85 {
86     CONFIG config;
87
88     /* handle */
89     x264_t *h;
90
91     /* error console handle */
92     HWND *hCons;
93
94     /* XXX: needed ? */
95     unsigned int fincr;
96     unsigned int fbase;
97 } CODEC;
98
99 /* Compress functions */
100 LRESULT compress_query(CODEC *, BITMAPINFO *, BITMAPINFO *);
101 LRESULT compress_get_format(CODEC *, BITMAPINFO *, BITMAPINFO *);
102 LRESULT compress_get_size(CODEC *, BITMAPINFO *, BITMAPINFO *);
103 LRESULT compress_frames_info(CODEC *, ICCOMPRESSFRAMES *);
104 LRESULT compress_begin(CODEC *, BITMAPINFO *, BITMAPINFO *);
105 LRESULT compress_end(CODEC *);
106 LRESULT compress(CODEC *, ICCOMPRESS *);
107
108
109 /* config functions */
110 void config_reg_load( CONFIG * config );
111 void config_reg_save( CONFIG * config );
112
113
114 /* Dialog callbacks */
115 BOOL CALLBACK callback_about( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
116 BOOL CALLBACK callback_main ( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
117 BOOL CALLBACK callback_advanced( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
118 BOOL CALLBACK callback_err_console( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
119
120 /* Dll instance */
121 extern HINSTANCE g_hInst;
122
123 #if defined(_DEBUG)
124 #include <stdio.h> /* vsprintf */
125 #define DPRINTF_BUF_SZ  1024
126 static __inline void DPRINTF(char *fmt, ...)
127 {
128     va_list args;
129     char buf[DPRINTF_BUF_SZ];
130
131     va_start(args, fmt);
132     vsprintf(buf, fmt, args);
133     OutputDebugString(buf);
134 }
135 #else
136 static __inline void DPRINTF(char *fmt, ...) { }
137 #endif
138
139
140 #endif
141