Libav
vfwcap.c
Go to the documentation of this file.
1 /*
2  * VFW capture interface
3  * Copyright (c) 2006-2008 Ramiro Polla
4  *
5  * This file is part of Libav.
6  *
7  * Libav is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * Libav is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with Libav; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #include "libavformat/avformat.h"
23 #include "libavformat/internal.h"
24 #include "libavutil/log.h"
25 #include "libavutil/opt.h"
26 #include "libavutil/parseutils.h"
27 #include <windows.h>
28 #include <vfw.h>
29 
30 /* Some obsolete versions of MinGW32 before 4.0.0 lack this. */
31 #ifndef HWND_MESSAGE
32 #define HWND_MESSAGE ((HWND) -3)
33 #endif
34 
35 struct vfw_ctx {
36  const AVClass *class;
37  HWND hwnd;
38  HANDLE mutex;
39  HANDLE event;
41  unsigned int curbufsize;
42  unsigned int frame_num;
43  char *video_size;
44  char *framerate;
45 };
46 
47 static enum AVPixelFormat vfw_pixfmt(DWORD biCompression, WORD biBitCount)
48 {
49  switch(biCompression) {
50  case MKTAG('U', 'Y', 'V', 'Y'):
51  return AV_PIX_FMT_UYVY422;
52  case MKTAG('Y', 'U', 'Y', '2'):
53  return AV_PIX_FMT_YUYV422;
54  case MKTAG('I', '4', '2', '0'):
55  return AV_PIX_FMT_YUV420P;
56  case BI_RGB:
57  switch(biBitCount) { /* 1-8 are untested */
58  case 1:
59  return AV_PIX_FMT_MONOWHITE;
60  case 4:
61  return AV_PIX_FMT_RGB4;
62  case 8:
63  return AV_PIX_FMT_RGB8;
64  case 16:
65  return AV_PIX_FMT_RGB555;
66  case 24:
67  return AV_PIX_FMT_BGR24;
68  case 32:
69  return AV_PIX_FMT_RGB32;
70  }
71  }
72  return AV_PIX_FMT_NONE;
73 }
74 
75 static enum AVCodecID vfw_codecid(DWORD biCompression)
76 {
77  switch(biCompression) {
78  case MKTAG('d', 'v', 's', 'd'):
79  return AV_CODEC_ID_DVVIDEO;
80  case MKTAG('M', 'J', 'P', 'G'):
81  case MKTAG('m', 'j', 'p', 'g'):
82  return AV_CODEC_ID_MJPEG;
83  }
84  return AV_CODEC_ID_NONE;
85 }
86 
87 #define dstruct(pctx, sname, var, type) \
88  av_log(pctx, AV_LOG_DEBUG, #var":\t%"type"\n", sname->var)
89 
90 static void dump_captureparms(AVFormatContext *s, CAPTUREPARMS *cparms)
91 {
92  av_log(s, AV_LOG_DEBUG, "CAPTUREPARMS\n");
93  dstruct(s, cparms, dwRequestMicroSecPerFrame, "lu");
94  dstruct(s, cparms, fMakeUserHitOKToCapture, "d");
95  dstruct(s, cparms, wPercentDropForError, "u");
96  dstruct(s, cparms, fYield, "d");
97  dstruct(s, cparms, dwIndexSize, "lu");
98  dstruct(s, cparms, wChunkGranularity, "u");
99  dstruct(s, cparms, fUsingDOSMemory, "d");
100  dstruct(s, cparms, wNumVideoRequested, "u");
101  dstruct(s, cparms, fCaptureAudio, "d");
102  dstruct(s, cparms, wNumAudioRequested, "u");
103  dstruct(s, cparms, vKeyAbort, "u");
104  dstruct(s, cparms, fAbortLeftMouse, "d");
105  dstruct(s, cparms, fAbortRightMouse, "d");
106  dstruct(s, cparms, fLimitEnabled, "d");
107  dstruct(s, cparms, wTimeLimit, "u");
108  dstruct(s, cparms, fMCIControl, "d");
109  dstruct(s, cparms, fStepMCIDevice, "d");
110  dstruct(s, cparms, dwMCIStartTime, "lu");
111  dstruct(s, cparms, dwMCIStopTime, "lu");
112  dstruct(s, cparms, fStepCaptureAt2x, "d");
113  dstruct(s, cparms, wStepCaptureAverageFrames, "u");
114  dstruct(s, cparms, dwAudioBufferSize, "lu");
115  dstruct(s, cparms, fDisableWriteCache, "d");
116  dstruct(s, cparms, AVStreamMaster, "u");
117 }
118 
119 static void dump_videohdr(AVFormatContext *s, VIDEOHDR *vhdr)
120 {
121 #ifdef DEBUG
122  av_log(s, AV_LOG_DEBUG, "VIDEOHDR\n");
123  dstruct(s, vhdr, lpData, "p");
124  dstruct(s, vhdr, dwBufferLength, "lu");
125  dstruct(s, vhdr, dwBytesUsed, "lu");
126  dstruct(s, vhdr, dwTimeCaptured, "lu");
127  dstruct(s, vhdr, dwUser, "lu");
128  dstruct(s, vhdr, dwFlags, "lu");
129  dstruct(s, vhdr, dwReserved[0], "lu");
130  dstruct(s, vhdr, dwReserved[1], "lu");
131  dstruct(s, vhdr, dwReserved[2], "lu");
132  dstruct(s, vhdr, dwReserved[3], "lu");
133 #endif
134 }
135 
136 static void dump_bih(AVFormatContext *s, BITMAPINFOHEADER *bih)
137 {
138  av_log(s, AV_LOG_DEBUG, "BITMAPINFOHEADER\n");
139  dstruct(s, bih, biSize, "lu");
140  dstruct(s, bih, biWidth, "ld");
141  dstruct(s, bih, biHeight, "ld");
142  dstruct(s, bih, biPlanes, "d");
143  dstruct(s, bih, biBitCount, "d");
144  dstruct(s, bih, biCompression, "lu");
145  av_log(s, AV_LOG_DEBUG, " biCompression:\t\"%.4s\"\n",
146  (char*) &bih->biCompression);
147  dstruct(s, bih, biSizeImage, "lu");
148  dstruct(s, bih, biXPelsPerMeter, "lu");
149  dstruct(s, bih, biYPelsPerMeter, "lu");
150  dstruct(s, bih, biClrUsed, "lu");
151  dstruct(s, bih, biClrImportant, "lu");
152 }
153 
155 {
156  struct vfw_ctx *ctx = s->priv_data;
157  const uint8_t dropscore[] = {62, 75, 87, 100};
158  const int ndropscores = FF_ARRAY_ELEMS(dropscore);
159  unsigned int buffer_fullness = (ctx->curbufsize*100)/s->max_picture_buffer;
160 
161  if(dropscore[++ctx->frame_num%ndropscores] <= buffer_fullness) {
162  av_log(s, AV_LOG_ERROR,
163  "real-time buffer %d%% full! frame dropped!\n", buffer_fullness);
164  return 1;
165  }
166 
167  return 0;
168 }
169 
170 static LRESULT CALLBACK videostream_cb(HWND hwnd, LPVIDEOHDR vdhdr)
171 {
172  AVFormatContext *s;
173  struct vfw_ctx *ctx;
174  AVPacketList **ppktl, *pktl_next;
175 
176  s = (AVFormatContext *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
177  ctx = s->priv_data;
178 
179  dump_videohdr(s, vdhdr);
180 
181  if(shall_we_drop(s))
182  return FALSE;
183 
184  WaitForSingleObject(ctx->mutex, INFINITE);
185 
186  pktl_next = av_mallocz(sizeof(AVPacketList));
187  if(!pktl_next)
188  goto fail;
189 
190  if(av_new_packet(&pktl_next->pkt, vdhdr->dwBytesUsed) < 0) {
191  av_free(pktl_next);
192  goto fail;
193  }
194 
195  pktl_next->pkt.pts = vdhdr->dwTimeCaptured;
196  memcpy(pktl_next->pkt.data, vdhdr->lpData, vdhdr->dwBytesUsed);
197 
198  for(ppktl = &ctx->pktl ; *ppktl ; ppktl = &(*ppktl)->next);
199  *ppktl = pktl_next;
200 
201  ctx->curbufsize += vdhdr->dwBytesUsed;
202 
203  SetEvent(ctx->event);
204  ReleaseMutex(ctx->mutex);
205 
206  return TRUE;
207 fail:
208  ReleaseMutex(ctx->mutex);
209  return FALSE;
210 }
211 
213 {
214  struct vfw_ctx *ctx = s->priv_data;
216 
217  if(ctx->hwnd) {
218  SendMessage(ctx->hwnd, WM_CAP_SET_CALLBACK_VIDEOSTREAM, 0, 0);
219  SendMessage(ctx->hwnd, WM_CAP_DRIVER_DISCONNECT, 0, 0);
220  DestroyWindow(ctx->hwnd);
221  }
222  if(ctx->mutex)
223  CloseHandle(ctx->mutex);
224  if(ctx->event)
225  CloseHandle(ctx->event);
226 
227  pktl = ctx->pktl;
228  while (pktl) {
229  AVPacketList *next = pktl->next;
230  av_free_packet(&pktl->pkt);
231  av_free(pktl);
232  pktl = next;
233  }
234 
235  return 0;
236 }
237 
239 {
240  struct vfw_ctx *ctx = s->priv_data;
241  AVCodecContext *codec;
242  AVStream *st;
243  int devnum;
244  int bisize;
245  BITMAPINFO *bi;
246  CAPTUREPARMS cparms;
247  DWORD biCompression;
248  WORD biBitCount;
249  int ret;
250  AVRational framerate_q;
251 
252  if (!strcmp(s->filename, "list")) {
253  for (devnum = 0; devnum <= 9; devnum++) {
254  char driver_name[256];
255  char driver_ver[256];
256  ret = capGetDriverDescription(devnum,
257  driver_name, sizeof(driver_name),
258  driver_ver, sizeof(driver_ver));
259  if (ret) {
260  av_log(s, AV_LOG_INFO, "Driver %d\n", devnum);
261  av_log(s, AV_LOG_INFO, " %s\n", driver_name);
262  av_log(s, AV_LOG_INFO, " %s\n", driver_ver);
263  }
264  }
265  return AVERROR(EIO);
266  }
267 
268  ctx->hwnd = capCreateCaptureWindow(NULL, 0, 0, 0, 0, 0, HWND_MESSAGE, 0);
269  if(!ctx->hwnd) {
270  av_log(s, AV_LOG_ERROR, "Could not create capture window.\n");
271  return AVERROR(EIO);
272  }
273 
274  /* If atoi fails, devnum==0 and the default device is used */
275  devnum = atoi(s->filename);
276 
277  ret = SendMessage(ctx->hwnd, WM_CAP_DRIVER_CONNECT, devnum, 0);
278  if(!ret) {
279  av_log(s, AV_LOG_ERROR, "Could not connect to device.\n");
280  DestroyWindow(ctx->hwnd);
281  return AVERROR(ENODEV);
282  }
283 
284  SendMessage(ctx->hwnd, WM_CAP_SET_OVERLAY, 0, 0);
285  SendMessage(ctx->hwnd, WM_CAP_SET_PREVIEW, 0, 0);
286 
287  ret = SendMessage(ctx->hwnd, WM_CAP_SET_CALLBACK_VIDEOSTREAM, 0,
288  (LPARAM) videostream_cb);
289  if(!ret) {
290  av_log(s, AV_LOG_ERROR, "Could not set video stream callback.\n");
291  goto fail_io;
292  }
293 
294  SetWindowLongPtr(ctx->hwnd, GWLP_USERDATA, (LONG_PTR) s);
295 
296  st = avformat_new_stream(s, NULL);
297  if(!st) {
298  vfw_read_close(s);
299  return AVERROR(ENOMEM);
300  }
301 
302  /* Set video format */
303  bisize = SendMessage(ctx->hwnd, WM_CAP_GET_VIDEOFORMAT, 0, 0);
304  if(!bisize)
305  goto fail_io;
306  bi = av_malloc(bisize);
307  if(!bi) {
308  vfw_read_close(s);
309  return AVERROR(ENOMEM);
310  }
311  ret = SendMessage(ctx->hwnd, WM_CAP_GET_VIDEOFORMAT, bisize, (LPARAM) bi);
312  if(!ret)
313  goto fail_bi;
314 
315  dump_bih(s, &bi->bmiHeader);
316 
317 
318  if (ctx->video_size) {
319  ret = av_parse_video_size(&bi->bmiHeader.biWidth, &bi->bmiHeader.biHeight, ctx->video_size);
320  if (ret < 0) {
321  av_log(s, AV_LOG_ERROR, "Couldn't parse video size.\n");
322  goto fail_bi;
323  }
324  }
325 
326  if (0) {
327  /* For testing yet unsupported compressions
328  * Copy these values from user-supplied verbose information */
329  bi->bmiHeader.biWidth = 320;
330  bi->bmiHeader.biHeight = 240;
331  bi->bmiHeader.biPlanes = 1;
332  bi->bmiHeader.biBitCount = 12;
333  bi->bmiHeader.biCompression = MKTAG('I','4','2','0');
334  bi->bmiHeader.biSizeImage = 115200;
335  dump_bih(s, &bi->bmiHeader);
336  }
337 
338  ret = SendMessage(ctx->hwnd, WM_CAP_SET_VIDEOFORMAT, bisize, (LPARAM) bi);
339  if(!ret) {
340  av_log(s, AV_LOG_ERROR, "Could not set Video Format.\n");
341  goto fail_bi;
342  }
343 
344  biCompression = bi->bmiHeader.biCompression;
345  biBitCount = bi->bmiHeader.biBitCount;
346 
347  av_free(bi);
348 
349  /* Set sequence setup */
350  ret = SendMessage(ctx->hwnd, WM_CAP_GET_SEQUENCE_SETUP, sizeof(cparms),
351  (LPARAM) &cparms);
352  if(!ret)
353  goto fail_io;
354 
355  dump_captureparms(s, &cparms);
356 
357  cparms.fYield = 1; // Spawn a background thread
358  cparms.dwRequestMicroSecPerFrame =
359  (framerate_q.den*1000000) / framerate_q.num;
360  cparms.fAbortLeftMouse = 0;
361  cparms.fAbortRightMouse = 0;
362  cparms.fCaptureAudio = 0;
363  cparms.vKeyAbort = 0;
364 
365  ret = SendMessage(ctx->hwnd, WM_CAP_SET_SEQUENCE_SETUP, sizeof(cparms),
366  (LPARAM) &cparms);
367  if(!ret)
368  goto fail_io;
369 
370  codec = st->codec;
371  codec->time_base = (AVRational){framerate_q.den, framerate_q.num};
373  codec->width = bi->bmiHeader.biWidth;
374  codec->height = bi->bmiHeader.biHeight;
375  codec->pix_fmt = vfw_pixfmt(biCompression, biBitCount);
376  if(codec->pix_fmt == AV_PIX_FMT_NONE) {
377  codec->codec_id = vfw_codecid(biCompression);
378  if(codec->codec_id == AV_CODEC_ID_NONE) {
379  av_log(s, AV_LOG_ERROR, "Unknown compression type. "
380  "Please report verbose (-v 9) debug information.\n");
381  vfw_read_close(s);
382  return AVERROR_PATCHWELCOME;
383  }
384  codec->bits_per_coded_sample = biBitCount;
385  } else {
387  if(biCompression == BI_RGB) {
388  codec->bits_per_coded_sample = biBitCount;
390  if (codec->extradata) {
391  codec->extradata_size = 9;
392  memcpy(codec->extradata, "BottomUp", 9);
393  }
394  }
395  }
396 
397  avpriv_set_pts_info(st, 32, 1, 1000);
398 
399  ctx->mutex = CreateMutex(NULL, 0, NULL);
400  if(!ctx->mutex) {
401  av_log(s, AV_LOG_ERROR, "Could not create Mutex.\n" );
402  goto fail_io;
403  }
404  ctx->event = CreateEvent(NULL, 1, 0, NULL);
405  if(!ctx->event) {
406  av_log(s, AV_LOG_ERROR, "Could not create Event.\n" );
407  goto fail_io;
408  }
409 
410  ret = SendMessage(ctx->hwnd, WM_CAP_SEQUENCE_NOFILE, 0, 0);
411  if(!ret) {
412  av_log(s, AV_LOG_ERROR, "Could not start capture sequence.\n" );
413  goto fail_io;
414  }
415 
416  return 0;
417 
418 fail_bi:
419  av_free(bi);
420 
421 fail_io:
422  vfw_read_close(s);
423  return AVERROR(EIO);
424 }
425 
427 {
428  struct vfw_ctx *ctx = s->priv_data;
430 
431  while(!pktl) {
432  WaitForSingleObject(ctx->mutex, INFINITE);
433  pktl = ctx->pktl;
434  if(ctx->pktl) {
435  *pkt = ctx->pktl->pkt;
436  ctx->pktl = ctx->pktl->next;
437  av_free(pktl);
438  }
439  ResetEvent(ctx->event);
440  ReleaseMutex(ctx->mutex);
441  if(!pktl) {
442  if(s->flags & AVFMT_FLAG_NONBLOCK) {
443  return AVERROR(EAGAIN);
444  } else {
445  WaitForSingleObject(ctx->event, INFINITE);
446  }
447  }
448  }
449 
450  ctx->curbufsize -= pkt->size;
451 
452  return pkt->size;
453 }
454 
455 #define OFFSET(x) offsetof(struct vfw_ctx, x)
456 #define DEC AV_OPT_FLAG_DECODING_PARAM
457 static const AVOption options[] = {
458  { "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
459  { "framerate", "", OFFSET(framerate), AV_OPT_TYPE_STRING, {.str = "ntsc"}, 0, 0, DEC },
460  { NULL },
461 };
462 
463 static const AVClass vfw_class = {
464  .class_name = "VFW indev",
465  .item_name = av_default_item_name,
466  .option = options,
467  .version = LIBAVUTIL_VERSION_INT,
468 };
469 
471  .name = "vfwcap",
472  .long_name = NULL_IF_CONFIG_SMALL("VfW video capture"),
473  .priv_data_size = sizeof(struct vfw_ctx),
474  .read_header = vfw_read_header,
475  .read_packet = vfw_read_packet,
476  .read_close = vfw_read_close,
477  .flags = AVFMT_NOFILE,
478  .priv_class = &vfw_class,
479 };
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
Definition: pixfmt.h:84
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
Definition: mem.c:62
void av_free_packet(AVPacket *pkt)
Free a packet.
Definition: avpacket.c:243
AVOption.
Definition: opt.h:234
int av_parse_video_size(int *width_ptr, int *height_ptr, const char *str)
Parse str and put in width_ptr and height_ptr the detected values.
Definition: parseutils.c:95
void avpriv_set_pts_info(AVStream *s, int pts_wrap_bits, unsigned int pts_num, unsigned int pts_den)
Set the time base and wrapping info for a given stream.
Definition: utils.c:2829
static enum AVPixelFormat vfw_pixfmt(DWORD biCompression, WORD biBitCount)
Definition: vfwcap.c:47
unsigned int max_picture_buffer
Maximum amount of memory in bytes to use for buffering frames obtained from realtime capture devices...
Definition: avformat.h:1106
static void dump_captureparms(AVFormatContext *s, CAPTUREPARMS *cparms)
Definition: vfwcap.c:90
#define HWND_MESSAGE
Definition: vfwcap.c:32
HANDLE mutex
Definition: vfwcap.c:38
int num
numerator
Definition: rational.h:44
int size
Definition: avcodec.h:974
static int vfw_read_close(AVFormatContext *s)
Definition: vfwcap.c:212
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:1254
#define FF_ARRAY_ELEMS(a)
static const AVClass vfw_class
Definition: vfwcap.c:463
packed RGB 1:2:1 bitstream, 4bpp, (msb)1R 2G 1B(lsb), a byte contains two pixels, the first pixel in ...
Definition: pixfmt.h:90
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
Definition: avcodec.h:1175
HWND hwnd
Definition: vfwcap.c:37
Format I/O context.
Definition: avformat.h:922
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
Definition: log.h:38
#define AVFMT_FLAG_NONBLOCK
Do not block when reading packets from input.
Definition: avformat.h:1036
unsigned int curbufsize
Definition: vfwcap.c:41
static void dump_videohdr(AVFormatContext *s, VIDEOHDR *vhdr)
Definition: vfwcap.c:119
uint8_t
AVOptions.
AVPacket pkt
Definition: avformat.h:1260
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
Definition: avcodec.h:1164
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
Definition: utils.c:2521
int flags
Flags modifying the (de)muxer behaviour.
Definition: avformat.h:1033
uint8_t * data
Definition: avcodec.h:973
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
Definition: avcodec.h:2507
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
Definition: avpacket.c:81
static void dump_bih(AVFormatContext *s, BITMAPINFOHEADER *bih)
Definition: vfwcap.c:136
AVCodecID
Identify the syntax and semantics of the bitstream.
Definition: avcodec.h:105
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:123
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
Definition: mem.c:186
#define AVERROR(e)
Definition: error.h:43
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:150
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:144
void av_log(void *avcl, int level, const char *fmt,...)
Definition: log.c:168
AVCodecContext * codec
Codec context associated with this stream.
Definition: avformat.h:718
#define dstruct(pctx, sname, var, type)
Definition: vfwcap.c:87
#define FF_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
Definition: avcodec.h:531
char filename[1024]
input or output filename
Definition: avformat.h:998
int width
picture width / height.
Definition: avcodec.h:1224
static enum AVCodecID vfw_codecid(DWORD biCompression)
Definition: vfwcap.c:75
packed RGB 8:8:8, 24bpp, BGRBGR...
Definition: pixfmt.h:68
HANDLE event
Definition: vfwcap.c:39
LIBAVUTIL_VERSION_INT
Definition: eval.c:55
Stream structure.
Definition: avformat.h:699
#define AVERROR_PATCHWELCOME
Not yet implemented in Libav, patches welcome.
Definition: error.h:57
NULL
Definition: eval.c:55
#define AV_LOG_INFO
Standard information.
Definition: log.h:134
enum AVMediaType codec_type
Definition: avcodec.h:1058
enum AVCodecID codec_id
Definition: avcodec.h:1067
av_default_item_name
Definition: dnxhdenc.c:52
unsigned int frame_num
Definition: vfwcap.c:42
main external API structure.
Definition: avcodec.h:1050
#define AV_PIX_FMT_RGB32
Definition: pixfmt.h:222
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
Definition: pixfmt.h:66
int extradata_size
Definition: avcodec.h:1165
Describe the class of an AVClass context structure.
Definition: log.h:33
rational number numerator/denominator
Definition: rational.h:43
static int vfw_read_header(AVFormatContext *s)
Definition: vfwcap.c:238
misc parsing utilities
AVInputFormat ff_vfwcap_demuxer
Definition: vfwcap.c:470
#define OFFSET(x)
Definition: vfwcap.c:455
Main libavformat public API header.
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:65
struct AVPacketList * next
Definition: avformat.h:1261
#define AVFMT_NOFILE
Demuxer will use avio_open, no opened file should be provided by the caller.
Definition: avformat.h:409
Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb...
Definition: pixfmt.h:74
char * framerate
Set by a private option.
Definition: vfwcap.c:44
AVPacketList * pktl
Definition: vfwcap.c:40
static const AVOption options[]
Definition: vfwcap.c:457
#define DEC
Definition: vfwcap.c:456
packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb)
Definition: pixfmt.h:89
#define AV_PIX_FMT_RGB555
Definition: pixfmt.h:231
int den
denominator
Definition: rational.h:45
static int vfw_read_packet(AVFormatContext *s, AVPacket *pkt)
Definition: vfwcap.c:426
char * video_size
A string describing video size, set by a private option.
Definition: vfwcap.c:43
static int shall_we_drop(AVFormatContext *s)
Definition: vfwcap.c:154
void * priv_data
Format private data.
Definition: avformat.h:950
static LRESULT CALLBACK videostream_cb(HWND hwnd, LPVIDEOHDR vdhdr)
Definition: vfwcap.c:170
const char * name
A comma separated list of short names for the format.
Definition: avformat.h:525
Definition: vfwcap.c:35
#define MKTAG(a, b, c, d)
Definition: common.h:238
AVPixelFormat
Pixel format.
Definition: pixfmt.h:63
This structure stores compressed data.
Definition: avcodec.h:950
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
Definition: mem.c:205
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
Definition: avcodec.h:966