FFmpeg
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 FFmpeg.
6  *
7  * FFmpeg 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  * FFmpeg 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 FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #include "libavutil/internal.h"
23 #include "libavutil/log.h"
24 #include "libavutil/mem.h"
25 #include "libavutil/opt.h"
26 #include "libavutil/parseutils.h"
27 
29 #include "libavformat/demux.h"
30 #include "libavformat/internal.h"
31 
32 // windows.h must no be included before winsock2.h, and libavformat internal
33 // headers may include winsock2.h
34 #include <windows.h>
35 // windows.h needs to be included before vfw.h
36 #include <vfw.h>
37 
38 #include "avdevice.h"
39 
40 /* Some obsolete versions of MinGW32 before 4.0.0 lack this. */
41 #ifndef HWND_MESSAGE
42 #define HWND_MESSAGE ((HWND) -3)
43 #endif
44 
45 struct vfw_ctx {
46  const AVClass *class;
47  HWND hwnd;
48  HANDLE mutex;
49  HANDLE event;
51  unsigned int curbufsize;
52  unsigned int frame_num;
53  char *video_size; /**< A string describing video size, set by a private option. */
54  char *framerate; /**< Set by a private option. */
55 };
56 
57 static enum AVPixelFormat vfw_pixfmt(DWORD biCompression, WORD biBitCount)
58 {
59  switch(biCompression) {
60  case MKTAG('U', 'Y', 'V', 'Y'):
61  return AV_PIX_FMT_UYVY422;
62  case MKTAG('Y', 'U', 'Y', '2'):
63  return AV_PIX_FMT_YUYV422;
64  case MKTAG('I', '4', '2', '0'):
65  return AV_PIX_FMT_YUV420P;
66  case BI_RGB:
67  switch(biBitCount) { /* 1-8 are untested */
68  case 1:
69  return AV_PIX_FMT_MONOWHITE;
70  case 4:
71  return AV_PIX_FMT_RGB4;
72  case 8:
73  return AV_PIX_FMT_RGB8;
74  case 16:
75  return AV_PIX_FMT_RGB555;
76  case 24:
77  return AV_PIX_FMT_BGR24;
78  case 32:
79  return AV_PIX_FMT_RGB32;
80  }
81  }
82  return AV_PIX_FMT_NONE;
83 }
84 
85 static enum AVCodecID vfw_codecid(DWORD biCompression)
86 {
87  switch(biCompression) {
88  case MKTAG('d', 'v', 's', 'd'):
89  return AV_CODEC_ID_DVVIDEO;
90  case MKTAG('M', 'J', 'P', 'G'):
91  case MKTAG('m', 'j', 'p', 'g'):
92  return AV_CODEC_ID_MJPEG;
93  }
94  return AV_CODEC_ID_NONE;
95 }
96 
97 #define dstruct(pctx, sname, var, type) \
98  av_log(pctx, AV_LOG_DEBUG, #var":\t%"type"\n", sname->var)
99 
100 static void dump_captureparms(AVFormatContext *s, CAPTUREPARMS *cparms)
101 {
102  av_log(s, AV_LOG_DEBUG, "CAPTUREPARMS\n");
103  dstruct(s, cparms, dwRequestMicroSecPerFrame, "lu");
104  dstruct(s, cparms, fMakeUserHitOKToCapture, "d");
105  dstruct(s, cparms, wPercentDropForError, "u");
106  dstruct(s, cparms, fYield, "d");
107  dstruct(s, cparms, dwIndexSize, "lu");
108  dstruct(s, cparms, wChunkGranularity, "u");
109  dstruct(s, cparms, fUsingDOSMemory, "d");
110  dstruct(s, cparms, wNumVideoRequested, "u");
111  dstruct(s, cparms, fCaptureAudio, "d");
112  dstruct(s, cparms, wNumAudioRequested, "u");
113  dstruct(s, cparms, vKeyAbort, "u");
114  dstruct(s, cparms, fAbortLeftMouse, "d");
115  dstruct(s, cparms, fAbortRightMouse, "d");
116  dstruct(s, cparms, fLimitEnabled, "d");
117  dstruct(s, cparms, wTimeLimit, "u");
118  dstruct(s, cparms, fMCIControl, "d");
119  dstruct(s, cparms, fStepMCIDevice, "d");
120  dstruct(s, cparms, dwMCIStartTime, "lu");
121  dstruct(s, cparms, dwMCIStopTime, "lu");
122  dstruct(s, cparms, fStepCaptureAt2x, "d");
123  dstruct(s, cparms, wStepCaptureAverageFrames, "u");
124  dstruct(s, cparms, dwAudioBufferSize, "lu");
125  dstruct(s, cparms, fDisableWriteCache, "d");
126  dstruct(s, cparms, AVStreamMaster, "u");
127 }
128 
129 static void dump_videohdr(AVFormatContext *s, VIDEOHDR *vhdr)
130 {
131 #ifdef DEBUG
132  av_log(s, AV_LOG_DEBUG, "VIDEOHDR\n");
133  dstruct(s, vhdr, lpData, "p");
134  dstruct(s, vhdr, dwBufferLength, "lu");
135  dstruct(s, vhdr, dwBytesUsed, "lu");
136  dstruct(s, vhdr, dwTimeCaptured, "lu");
137  dstruct(s, vhdr, dwUser, "lu");
138  dstruct(s, vhdr, dwFlags, "lu");
139  dstruct(s, vhdr, dwReserved[0], "lu");
140  dstruct(s, vhdr, dwReserved[1], "lu");
141  dstruct(s, vhdr, dwReserved[2], "lu");
142  dstruct(s, vhdr, dwReserved[3], "lu");
143 #endif
144 }
145 
146 static void dump_bih(AVFormatContext *s, BITMAPINFOHEADER *bih)
147 {
148  av_log(s, AV_LOG_DEBUG, "BITMAPINFOHEADER\n");
149  dstruct(s, bih, biSize, "lu");
150  dstruct(s, bih, biWidth, "ld");
151  dstruct(s, bih, biHeight, "ld");
152  dstruct(s, bih, biPlanes, "d");
153  dstruct(s, bih, biBitCount, "d");
154  dstruct(s, bih, biCompression, "lu");
155  av_log(s, AV_LOG_DEBUG, " biCompression:\t\"%.4s\"\n",
156  (char*) &bih->biCompression);
157  dstruct(s, bih, biSizeImage, "lu");
158  dstruct(s, bih, biXPelsPerMeter, "lu");
159  dstruct(s, bih, biYPelsPerMeter, "lu");
160  dstruct(s, bih, biClrUsed, "lu");
161  dstruct(s, bih, biClrImportant, "lu");
162 }
163 
165 {
166  struct vfw_ctx *ctx = s->priv_data;
167  static const uint8_t dropscore[4] = { 62, 75, 87, 100 };
168  const int ndropscores = FF_ARRAY_ELEMS(dropscore);
169  unsigned int buffer_fullness = (ctx->curbufsize*100)/s->max_picture_buffer;
170 
171  if(dropscore[++ctx->frame_num%ndropscores] <= buffer_fullness) {
173  "real-time buffer %d%% full! frame dropped!\n", buffer_fullness);
174  return 1;
175  }
176 
177  return 0;
178 }
179 
180 static LRESULT CALLBACK videostream_cb(HWND hwnd, LPVIDEOHDR vdhdr)
181 {
183  struct vfw_ctx *ctx;
184  PacketListEntry **ppktl, *pktl_next;
185 
186  s = (AVFormatContext *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
187  ctx = s->priv_data;
188 
189  dump_videohdr(s, vdhdr);
190 
191  if(shall_we_drop(s))
192  return FALSE;
193 
194  WaitForSingleObject(ctx->mutex, INFINITE);
195 
196  pktl_next = av_mallocz(sizeof(*pktl_next));
197  if(!pktl_next)
198  goto fail;
199 
200  if(av_new_packet(&pktl_next->pkt, vdhdr->dwBytesUsed) < 0) {
201  av_free(pktl_next);
202  goto fail;
203  }
204 
205  pktl_next->pkt.pts = vdhdr->dwTimeCaptured;
206  memcpy(pktl_next->pkt.data, vdhdr->lpData, vdhdr->dwBytesUsed);
207 
208  for(ppktl = &ctx->pktl ; *ppktl ; ppktl = &(*ppktl)->next);
209  *ppktl = pktl_next;
210 
211  ctx->curbufsize += vdhdr->dwBytesUsed;
212 
213  SetEvent(ctx->event);
214  ReleaseMutex(ctx->mutex);
215 
216  return TRUE;
217 fail:
218  ReleaseMutex(ctx->mutex);
219  return FALSE;
220 }
221 
223 {
224  struct vfw_ctx *ctx = s->priv_data;
226 
227  if(ctx->hwnd) {
228  SendMessage(ctx->hwnd, WM_CAP_SET_CALLBACK_VIDEOSTREAM, 0, 0);
229  SendMessage(ctx->hwnd, WM_CAP_DRIVER_DISCONNECT, 0, 0);
230  DestroyWindow(ctx->hwnd);
231  }
232  if(ctx->mutex)
233  CloseHandle(ctx->mutex);
234  if(ctx->event)
235  CloseHandle(ctx->event);
236 
237  pktl = ctx->pktl;
238  while (pktl) {
239  PacketListEntry *next = pktl->next;
241  av_free(pktl);
242  pktl = next;
243  }
244 
245  return 0;
246 }
247 
249 {
250  struct vfw_ctx *ctx = s->priv_data;
251  AVCodecParameters *par;
252  AVStream *st;
253  int devnum;
254  int bisize;
255  BITMAPINFO *bi = NULL;
256  CAPTUREPARMS cparms;
257  DWORD biCompression;
258  WORD biBitCount;
259  int ret;
260  AVRational framerate_q;
261 
262  if (!strcmp(s->url, "list")) {
263  for (devnum = 0; devnum <= 9; devnum++) {
264  char driver_name[256];
265  char driver_ver[256];
266  ret = capGetDriverDescription(devnum,
267  driver_name, sizeof(driver_name),
268  driver_ver, sizeof(driver_ver));
269  if (ret) {
270  av_log(s, AV_LOG_INFO, "Driver %d\n", devnum);
271  av_log(s, AV_LOG_INFO, " %s\n", driver_name);
272  av_log(s, AV_LOG_INFO, " %s\n", driver_ver);
273  }
274  }
275  return AVERROR(EIO);
276  }
277 
278  ctx->hwnd = capCreateCaptureWindow(NULL, 0, 0, 0, 0, 0, HWND_MESSAGE, 0);
279  if(!ctx->hwnd) {
280  av_log(s, AV_LOG_ERROR, "Could not create capture window.\n");
281  return AVERROR(EIO);
282  }
283 
284  /* If atoi fails, devnum==0 and the default device is used */
285  devnum = atoi(s->url);
286 
287  ret = SendMessage(ctx->hwnd, WM_CAP_DRIVER_CONNECT, devnum, 0);
288  if(!ret) {
289  av_log(s, AV_LOG_ERROR, "Could not connect to device.\n");
290  DestroyWindow(ctx->hwnd);
291  return AVERROR(ENODEV);
292  }
293 
294  SendMessage(ctx->hwnd, WM_CAP_SET_OVERLAY, 0, 0);
295  SendMessage(ctx->hwnd, WM_CAP_SET_PREVIEW, 0, 0);
296 
297  ret = SendMessage(ctx->hwnd, WM_CAP_SET_CALLBACK_VIDEOSTREAM, 0,
298  (LPARAM) videostream_cb);
299  if(!ret) {
300  av_log(s, AV_LOG_ERROR, "Could not set video stream callback.\n");
301  goto fail;
302  }
303 
304  SetWindowLongPtr(ctx->hwnd, GWLP_USERDATA, (LONG_PTR) s);
305 
306  st = avformat_new_stream(s, NULL);
307  if(!st) {
308  vfw_read_close(s);
309  return AVERROR(ENOMEM);
310  }
311 
312  /* Set video format */
313  bisize = SendMessage(ctx->hwnd, WM_CAP_GET_VIDEOFORMAT, 0, 0);
314  if(!bisize)
315  goto fail;
316  bi = av_malloc(bisize);
317  if(!bi) {
318  vfw_read_close(s);
319  return AVERROR(ENOMEM);
320  }
321  ret = SendMessage(ctx->hwnd, WM_CAP_GET_VIDEOFORMAT, bisize, (LPARAM) bi);
322  if(!ret)
323  goto fail;
324 
325  dump_bih(s, &bi->bmiHeader);
326 
327  ret = av_parse_video_rate(&framerate_q, ctx->framerate);
328  if (ret < 0) {
329  av_log(s, AV_LOG_ERROR, "Could not parse framerate '%s'.\n", ctx->framerate);
330  goto fail;
331  }
332 
333  if (ctx->video_size) {
334  int w, h;
335  ret = av_parse_video_size(&w, &h, ctx->video_size);
336  if (ret < 0) {
337  av_log(s, AV_LOG_ERROR, "Couldn't parse video size.\n");
338  goto fail;
339  }
340  bi->bmiHeader.biWidth = w;
341  bi->bmiHeader.biHeight = h;
342  }
343 
344  if (0) {
345  /* For testing yet unsupported compressions
346  * Copy these values from user-supplied verbose information */
347  bi->bmiHeader.biWidth = 320;
348  bi->bmiHeader.biHeight = 240;
349  bi->bmiHeader.biPlanes = 1;
350  bi->bmiHeader.biBitCount = 12;
351  bi->bmiHeader.biCompression = MKTAG('I','4','2','0');
352  bi->bmiHeader.biSizeImage = 115200;
353  dump_bih(s, &bi->bmiHeader);
354  }
355 
356  ret = SendMessage(ctx->hwnd, WM_CAP_SET_VIDEOFORMAT, bisize, (LPARAM) bi);
357  if(!ret) {
358  av_log(s, AV_LOG_ERROR, "Could not set Video Format.\n");
359  goto fail;
360  }
361 
362  biCompression = bi->bmiHeader.biCompression;
363  biBitCount = bi->bmiHeader.biBitCount;
364 
365  /* Set sequence setup */
366  ret = SendMessage(ctx->hwnd, WM_CAP_GET_SEQUENCE_SETUP, sizeof(cparms),
367  (LPARAM) &cparms);
368  if(!ret)
369  goto fail;
370 
371  dump_captureparms(s, &cparms);
372 
373  cparms.fYield = 1; // Spawn a background thread
374  cparms.dwRequestMicroSecPerFrame =
375  (framerate_q.den*1000000) / framerate_q.num;
376  cparms.fAbortLeftMouse = 0;
377  cparms.fAbortRightMouse = 0;
378  cparms.fCaptureAudio = 0;
379  cparms.vKeyAbort = 0;
380 
381  ret = SendMessage(ctx->hwnd, WM_CAP_SET_SEQUENCE_SETUP, sizeof(cparms),
382  (LPARAM) &cparms);
383  if(!ret)
384  goto fail;
385 
386  st->avg_frame_rate = framerate_q;
387 
388  par = st->codecpar;
390  par->width = bi->bmiHeader.biWidth;
391  par->height = bi->bmiHeader.biHeight;
392  par->format = vfw_pixfmt(biCompression, biBitCount);
393  if (par->format == AV_PIX_FMT_NONE) {
394  par->codec_id = vfw_codecid(biCompression);
395  if (par->codec_id == AV_CODEC_ID_NONE) {
396  avpriv_report_missing_feature(s, "This compression type");
397  vfw_read_close(s);
398  return AVERROR_PATCHWELCOME;
399  }
400  par->bits_per_coded_sample = biBitCount;
401  } else {
403  if(biCompression == BI_RGB) {
404  par->bits_per_coded_sample = biBitCount;
406  if (par->extradata) {
407  par->extradata_size = 9;
408  memcpy(par->extradata, "BottomUp", 9);
409  }
410  }
411  }
412 
413  av_freep(&bi);
414 
415  avpriv_set_pts_info(st, 32, 1, 1000);
416 
417  ctx->mutex = CreateMutex(NULL, 0, NULL);
418  if(!ctx->mutex) {
419  av_log(s, AV_LOG_ERROR, "Could not create Mutex.\n" );
420  goto fail;
421  }
422  ctx->event = CreateEvent(NULL, 1, 0, NULL);
423  if(!ctx->event) {
424  av_log(s, AV_LOG_ERROR, "Could not create Event.\n" );
425  goto fail;
426  }
427 
428  ret = SendMessage(ctx->hwnd, WM_CAP_SEQUENCE_NOFILE, 0, 0);
429  if(!ret) {
430  av_log(s, AV_LOG_ERROR, "Could not start capture sequence.\n" );
431  goto fail;
432  }
433 
434  return 0;
435 
436 fail:
437  av_freep(&bi);
438  vfw_read_close(s);
439  return AVERROR(EIO);
440 }
441 
443 {
444  struct vfw_ctx *ctx = s->priv_data;
446 
447  while(!pktl) {
448  WaitForSingleObject(ctx->mutex, INFINITE);
449  pktl = ctx->pktl;
450  if(ctx->pktl) {
451  *pkt = ctx->pktl->pkt;
452  ctx->pktl = ctx->pktl->next;
453  av_free(pktl);
454  }
455  ResetEvent(ctx->event);
456  ReleaseMutex(ctx->mutex);
457  if(!pktl) {
458  if(s->flags & AVFMT_FLAG_NONBLOCK) {
459  return AVERROR(EAGAIN);
460  } else {
461  WaitForSingleObject(ctx->event, INFINITE);
462  }
463  }
464  }
465 
466  ctx->curbufsize -= pkt->size;
467 
468  return pkt->size;
469 }
470 
471 #define OFFSET(x) offsetof(struct vfw_ctx, x)
472 #define DEC AV_OPT_FLAG_DECODING_PARAM
473 static const AVOption options[] = {
474  { "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
475  { "framerate", "", OFFSET(framerate), AV_OPT_TYPE_STRING, {.str = "ntsc"}, 0, 0, DEC },
476  { NULL },
477 };
478 
479 static const AVClass vfw_class = {
480  .class_name = "VFW indev",
481  .item_name = av_default_item_name,
482  .option = options,
483  .version = LIBAVUTIL_VERSION_INT,
485 };
486 
488  .p.name = "vfwcap",
489  .p.long_name = NULL_IF_CONFIG_SMALL("VfW video capture"),
490  .p.flags = AVFMT_NOFILE,
491  .p.priv_class = &vfw_class,
492  .priv_data_size = sizeof(struct vfw_ctx),
494  .read_packet = vfw_read_packet,
495  .read_close = vfw_read_close,
496 };
av_packet_unref
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
Definition: packet.c:429
dump_captureparms
static void dump_captureparms(AVFormatContext *s, CAPTUREPARMS *cparms)
Definition: vfwcap.c:100
AVCodecParameters::extradata
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
Definition: codec_par.h:69
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:71
vfw_pixfmt
static enum AVPixelFormat vfw_pixfmt(DWORD biCompression, WORD biBitCount)
Definition: vfwcap.c:57
AVERROR
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
opt.h
AVCodecParameters::codec_type
enum AVMediaType codec_type
General type of the encoded data.
Definition: codec_par.h:51
dump_videohdr
static void dump_videohdr(AVFormatContext *s, VIDEOHDR *vhdr)
Definition: vfwcap.c:129
AVCodecParameters
This struct describes the properties of an encoded stream.
Definition: codec_par.h:47
avformat_new_stream
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
AV_CODEC_ID_RAWVIDEO
@ AV_CODEC_ID_RAWVIDEO
Definition: codec_id.h:65
vfw_ctx::mutex
HANDLE mutex
Definition: vfwcap.c:48
vfw_read_packet
static int vfw_read_packet(AVFormatContext *s, AVPacket *pkt)
Definition: vfwcap.c:442
ff_vfwcap_demuxer
const FFInputFormat ff_vfwcap_demuxer
Definition: vfwcap.c:487
w
uint8_t w
Definition: llviddspenc.c:38
AVPacket::data
uint8_t * data
Definition: packet.h:539
AVOption
AVOption.
Definition: opt.h:429
AVStream::avg_frame_rate
AVRational avg_frame_rate
Average framerate.
Definition: avformat.h:837
AV_PIX_FMT_MONOWHITE
@ AV_PIX_FMT_MONOWHITE
Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb.
Definition: pixfmt.h:82
vfw_ctx::video_size
char * video_size
A string describing video size, set by a private option.
Definition: vfwcap.c:53
AV_PIX_FMT_BGR24
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
Definition: pixfmt.h:76
av_malloc
#define av_malloc(s)
Definition: tableprint_vlc.h:30
avpriv_set_pts_info
void avpriv_set_pts_info(AVStream *st, int pts_wrap_bits, unsigned int pts_num, unsigned int pts_den)
Set the time base and wrapping info for a given stream.
Definition: avformat.c:862
vfw_ctx::pktl
PacketListEntry * pktl
Definition: vfwcap.c:50
fail
#define fail()
Definition: checkasm.h:188
HWND_MESSAGE
#define HWND_MESSAGE
Definition: vfwcap.c:42
vfw_read_close
static int vfw_read_close(AVFormatContext *s)
Definition: vfwcap.c:222
AVRational::num
int num
Numerator.
Definition: rational.h:59
dump_bih
static void dump_bih(AVFormatContext *s, BITMAPINFOHEADER *bih)
Definition: vfwcap.c:146
pkt
AVPacket * pkt
Definition: movenc.c:60
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:209
FF_ARRAY_ELEMS
#define FF_ARRAY_ELEMS(a)
Definition: sinewin_tablegen.c:29
s
#define s(width, name)
Definition: cbs_vp9.c:198
av_new_packet
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
Definition: packet.c:98
AVInputFormat::name
const char * name
A comma separated list of short names for the format.
Definition: avformat.h:553
AVCodecParameters::width
int width
Video only.
Definition: codec_par.h:134
AV_LOG_DEBUG
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:230
ctx
AVFormatContext * ctx
Definition: movenc.c:49
AV_PIX_FMT_RGB4
@ AV_PIX_FMT_RGB4
packed RGB 1:2:1 bitstream, 4bpp, (msb)1R 2G 1B(lsb), a byte contains two pixels, the first pixel in ...
Definition: pixfmt.h:94
vfw_ctx::frame_num
unsigned int frame_num
Definition: vfwcap.c:52
vfw_ctx::event
HANDLE event
Definition: vfwcap.c:49
AV_PIX_FMT_YUV420P
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:73
AVFormatContext
Format I/O context.
Definition: avformat.h:1300
internal.h
AVStream::codecpar
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Definition: avformat.h:771
framerate
float framerate
Definition: av1_levels.c:29
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
read_header
static int read_header(FFV1Context *f)
Definition: ffv1dec.c:538
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:75
NULL
#define NULL
Definition: coverity.c:32
AVERROR_PATCHWELCOME
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
Definition: error.h:64
videostream_cb
static LRESULT CALLBACK videostream_cb(HWND hwnd, LPVIDEOHDR vdhdr)
Definition: vfwcap.c:180
AV_PIX_FMT_YUYV422
@ AV_PIX_FMT_YUYV422
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
Definition: pixfmt.h:74
options
static const AVOption options[]
Definition: vfwcap.c:473
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
vfw_read_header
static int vfw_read_header(AVFormatContext *s)
Definition: vfwcap.c:248
parseutils.h
AV_PIX_FMT_RGB8
@ AV_PIX_FMT_RGB8
packed RGB 3:3:2, 8bpp, (msb)3R 3G 2B(lsb)
Definition: pixfmt.h:93
AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT
@ AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT
Definition: log.h:41
PacketListEntry::next
struct PacketListEntry * next
Definition: packet_internal.h:29
OFFSET
#define OFFSET(x)
Definition: vfwcap.c:471
AVCodecID
AVCodecID
Identify the syntax and semantics of the bitstream.
Definition: codec_id.h:49
AVCodecParameters::extradata_size
int extradata_size
Size of the extradata content in bytes.
Definition: codec_par.h:73
vfw_ctx::framerate
char * framerate
Set by a private option.
Definition: vfwcap.c:54
AVPacket::size
int size
Definition: packet.h:540
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:94
avpriv_report_missing_feature
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
PacketListEntry::pkt
AVPacket pkt
Definition: packet_internal.h:30
AVFMT_NOFILE
#define AVFMT_NOFILE
Demuxer will use avio_open, no opened file should be provided by the caller.
Definition: avformat.h:468
avdevice.h
FFInputFormat::p
AVInputFormat p
The public AVInputFormat.
Definition: demux.h:41
vfw_codecid
static enum AVCodecID vfw_codecid(DWORD biCompression)
Definition: vfwcap.c:85
AV_PIX_FMT_RGB32
#define AV_PIX_FMT_RGB32
Definition: pixfmt.h:451
av_parse_video_size
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:150
AV_LOG_INFO
#define AV_LOG_INFO
Standard information.
Definition: log.h:220
AV_CODEC_ID_MJPEG
@ AV_CODEC_ID_MJPEG
Definition: codec_id.h:59
av_parse_video_rate
int av_parse_video_rate(AVRational *rate, const char *arg)
Parse str and store the detected values in *rate.
Definition: parseutils.c:181
vfw_ctx::hwnd
HWND hwnd
Definition: vfwcap.c:47
PacketListEntry
Definition: packet_internal.h:28
log.h
AV_CODEC_ID_NONE
@ AV_CODEC_ID_NONE
Definition: codec_id.h:50
AVPacket::pts
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
Definition: packet.h:532
internal.h
AVCodecParameters::height
int height
Definition: codec_par.h:135
AV_PIX_FMT_RGB555
#define AV_PIX_FMT_RGB555
Definition: pixfmt.h:466
AV_CODEC_ID_DVVIDEO
@ AV_CODEC_ID_DVVIDEO
Definition: codec_id.h:76
av_mallocz
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
Definition: mem.c:256
demux.h
AVFMT_FLAG_NONBLOCK
#define AVFMT_FLAG_NONBLOCK
Do not block when reading packets from input.
Definition: avformat.h:1454
vfw_ctx::curbufsize
unsigned int curbufsize
Definition: vfwcap.c:51
ret
ret
Definition: filter_design.txt:187
AVStream
Stream structure.
Definition: avformat.h:748
AVClass::class_name
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:80
AV_INPUT_BUFFER_PADDING_SIZE
#define AV_INPUT_BUFFER_PADDING_SIZE
Definition: defs.h:40
AV_PIX_FMT_UYVY422
@ AV_PIX_FMT_UYVY422
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
Definition: pixfmt.h:88
shall_we_drop
static int shall_we_drop(AVFormatContext *s)
Definition: vfwcap.c:164
dstruct
#define dstruct(pctx, sname, var, type)
Definition: vfwcap.c:97
AVRational::den
int den
Denominator.
Definition: rational.h:60
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
vfw_class
static const AVClass vfw_class
Definition: vfwcap.c:479
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AVCodecParameters::bits_per_coded_sample
int bits_per_coded_sample
The number of bits per sample in the codedwords.
Definition: codec_par.h:110
mem.h
packet_internal.h
AVCodecParameters::format
int format
Definition: codec_par.h:92
av_free
#define av_free(p)
Definition: tableprint_vlc.h:33
vfw_ctx
Definition: vfwcap.c:45
AVCodecParameters::codec_id
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
Definition: codec_par.h:55
AVPacket
This structure stores compressed data.
Definition: packet.h:516
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:34
FFInputFormat
Definition: demux.h:37
WaitForSingleObject
#define WaitForSingleObject(a, b)
Definition: w32pthreads.h:63
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
MKTAG
#define MKTAG(a, b, c, d)
Definition: macros.h:55
h
h
Definition: vp9dsp_template.c:2070
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
Definition: opt.h:276
DEC
#define DEC
Definition: vfwcap.c:472