]> git.sesse.net Git - ffmpeg/blobdiff - libavdevice/vfwcap.c
ff_parse_close() is not the correct function for H264Context.
[ffmpeg] / libavdevice / vfwcap.c
index 5bf94c03ae726cfc8cb4174b133120324e649ff6..1bab834db207369721046a2c19e9f363b0563212 100644 (file)
@@ -19,7 +19,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "avformat.h"
+#include "libavformat/avformat.h"
 #include <vfw.h>
 #include <windows.h>
 
 
 #define BI_RGB                      0
 
-typedef struct videohdr_tag {
-    LPBYTE      lpData;
-    DWORD       dwBufferLength;
-    DWORD       dwBytesUsed;
-    DWORD       dwTimeCaptured;
-    DWORD       dwUser;
-    DWORD       dwFlags;
-    DWORD_PTR   dwReserved[4];
-} VIDEOHDR, NEAR *PVIDEOHDR, FAR * LPVIDEOHDR;
-
-typedef struct {
-    DWORD dwRequestMicroSecPerFrame;
-    BOOL  fMakeUserHitOKToCapture;
-    UINT  wPercentDropForError;
-    BOOL  fYield;
-    DWORD dwIndexSize;
-    UINT  wChunkGranularity;
-    BOOL  fUsingDOSMemory;
-    UINT  wNumVideoRequested;
-    BOOL  fCaptureAudio;
-    UINT  wNumAudioRequested;
-    UINT  vKeyAbort;
-    BOOL  fAbortLeftMouse;
-    BOOL  fAbortRightMouse;
-    BOOL  fLimitEnabled;
-    UINT  wTimeLimit;
-    BOOL  fMCIControl;
-    BOOL  fStepMCIDevice;
-    DWORD dwMCIStartTime;
-    DWORD dwMCIStopTime;
-    BOOL  fStepCaptureAt2x;
-    UINT  wStepCaptureAverageFrames;
-    DWORD dwAudioBufferSize;
-    BOOL  fDisableWriteCache;
-    UINT  AVStreamMaster;
-} CAPTUREPARMS;
 /* End of missing MinGW defines */
 
 struct vfw_ctx {
@@ -96,6 +60,8 @@ static enum PixelFormat vfw_pixfmt(DWORD biCompression, WORD biBitCount)
     switch(biCompression) {
     case MKTAG('Y', 'U', 'Y', '2'):
         return PIX_FMT_YUYV422;
+    case MKTAG('I', '4', '2', '0'):
+        return PIX_FMT_YUV420P;
     case BI_RGB:
         switch(biBitCount) { /* 1-8 are untested */
             case 1:
@@ -316,6 +282,18 @@ 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
+
     ret = SendMessage(ctx->hwnd, WM_CAP_SET_VIDEOFORMAT, bisize, (LPARAM) bi);
     if(!ret) {
         av_log(s, AV_LOG_ERROR, "Could not set Video Format.\n");
@@ -356,7 +334,7 @@ static int vfw_read_header(AVFormatContext *s, AVFormatParameters *ap)
     codec->codec_id = CODEC_ID_RAWVIDEO;
     codec->pix_fmt = vfw_pixfmt(biCompression, biBitCount);
     if(biCompression == BI_RGB)
-        codec->bits_per_sample = biBitCount;
+        codec->bits_per_coded_sample = biBitCount;
 
     av_set_pts_info(st, 32, 1, 1000);
 
@@ -442,7 +420,7 @@ static int vfw_read_close(AVFormatContext *s)
 
 AVInputFormat vfwcap_demuxer = {
     "vfwcap",
-    "VFW video capture",
+    NULL_IF_CONFIG_SMALL("VFW video capture"),
     sizeof(struct vfw_ctx),
     NULL,
     vfw_read_header,