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