Move up the $test variable definition, together with the other
[ffmpeg.git] / libavdevice / vfwcap.c
index 4a02722..60ab169 100644 (file)
@@ -201,7 +201,22 @@ fail:
     return FALSE;
 }
 
-static int vfw_read_close(AVFormatContext *s);
+static int vfw_read_close(AVFormatContext *s)
+{
+    struct vfw_ctx *ctx = s->priv_data;
+
+    if(ctx->hwnd) {
+        SendMessage(ctx->hwnd, WM_CAP_SET_CALLBACK_VIDEOSTREAM, 0, 0);
+        SendMessage(ctx->hwnd, WM_CAP_DRIVER_DISCONNECT, 0, 0);
+        DestroyWindow(ctx->hwnd);
+    }
+    if(ctx->mutex)
+        CloseHandle(ctx->mutex);
+    if(ctx->event)
+        CloseHandle(ctx->event);
+
+    return 0;
+}
 
 static int vfw_read_header(AVFormatContext *s, AVFormatParameters *ap)
 {
@@ -279,17 +294,17 @@ static int vfw_read_header(AVFormatContext *s, AVFormatParameters *ap)
     bi->bmiHeader.biWidth  = width ;
     bi->bmiHeader.biHeight = height;
 
-#if 0
-    /* For testing yet unsupported compressions
-     * Copy these values from user-supplied verbose information */
-    bi->bmiHeader.biWidth       = 320;
-    bi->bmiHeader.biHeight      = 240;
-    bi->bmiHeader.biPlanes      = 1;
-    bi->bmiHeader.biBitCount    = 12;
-    bi->bmiHeader.biCompression = MKTAG('I','4','2','0');
-    bi->bmiHeader.biSizeImage   = 115200;
-    dump_bih(s, &bi->bmiHeader);
-#endif
+    if (0) {
+        /* For testing yet unsupported compressions
+         * Copy these values from user-supplied verbose information */
+        bi->bmiHeader.biWidth       = 320;
+        bi->bmiHeader.biHeight      = 240;
+        bi->bmiHeader.biPlanes      = 1;
+        bi->bmiHeader.biBitCount    = 12;
+        bi->bmiHeader.biCompression = MKTAG('I','4','2','0');
+        bi->bmiHeader.biSizeImage   = 115200;
+        dump_bih(s, &bi->bmiHeader);
+    }
 
     ret = SendMessage(ctx->hwnd, WM_CAP_SET_VIDEOFORMAT, bisize, (LPARAM) bi);
     if(!ret) {
@@ -402,23 +417,6 @@ static int vfw_read_packet(AVFormatContext *s, AVPacket *pkt)
     return pkt->size;
 }
 
-static int vfw_read_close(AVFormatContext *s)
-{
-    struct vfw_ctx *ctx = s->priv_data;
-
-    if(ctx->hwnd) {
-        SendMessage(ctx->hwnd, WM_CAP_SET_CALLBACK_VIDEOSTREAM, 0, 0);
-        SendMessage(ctx->hwnd, WM_CAP_DRIVER_DISCONNECT, 0, 0);
-        DestroyWindow(ctx->hwnd);
-    }
-    if(ctx->mutex)
-        CloseHandle(ctx->mutex);
-    if(ctx->event)
-        CloseHandle(ctx->event);
-
-    return 0;
-}
-
 AVInputFormat vfwcap_demuxer = {
     "vfwcap",
     NULL_IF_CONFIG_SMALL("VFW video capture"),