FFmpeg
Loading...
Searching...
No Matches
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"
27
29#include "libavformat/demux.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
45struct 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
57static 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:
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
85static enum AVCodecID vfw_codecid(DWORD biCompression)
86{
87 switch(biCompression) {
88 case MKTAG('d', 'v', 's', 'd'):
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
100static 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
129static 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
146static 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
180static 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;
217fail:
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;
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
307 if(!st) {
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) {
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");
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
436fail:
437 av_freep(&bi);
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
473static 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
479static 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};
const FFInputFormat ff_vfwcap_demuxer
Definition vfwcap.c:487
static AVFormatContext * ctx
Main libavdevice API header.
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:834
#define AVFMT_FLAG_NONBLOCK
Do not block when reading packets from input.
Definition avformat.h:1487
#define AVFMT_NOFILE
Demuxer will use avio_open, no opened file should be provided by the caller.
Definition avformat.h:488
#define s(width, name)
Definition cbs_vp9.c:198
#define NULL
Definition coverity.c:32
static AVPacket * pkt
static int read_header(FFV1Context *f, RangeCoder *c)
Definition ffv1dec.c:578
#define fail
Definition test.h:479
@ 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:275
AVCodecID
Identify the syntax and semantics of the bitstream.
Definition codec_id.h:47
@ AV_CODEC_ID_RAWVIDEO
Definition codec_id.h:63
@ AV_CODEC_ID_NONE
Definition codec_id.h:48
@ AV_CODEC_ID_DVVIDEO
Definition codec_id.h:74
@ AV_CODEC_ID_MJPEG
Definition codec_id.h:57
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding.
Definition defs.h:40
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
Definition packet.c:434
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
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
Definition error.h:64
#define AVERROR(e)
Definition error.h:45
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition log.h:231
#define AV_LOG_INFO
Standard information.
Definition log.h:221
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition log.h:210
const char * av_default_item_name(void *ptr)
Return the context name.
Definition log.c:241
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
#define LIBAVUTIL_VERSION_INT
Definition version.h:85
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition internal.h:88
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
#define DEC
Definition librsvgdec.c:149
uint8_t w
Definition llvidencdsp.c:39
@ AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT
Definition log.h:42
#define MKTAG(a, b, c, d)
Definition macros.h:55
Memory handling functions.
#define av_malloc(s)
Definition ops_static.c:52
AVOptions.
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
int av_parse_video_rate(AVRational *rate, const char *arg)
Parse str and store the detected values in *rate.
Definition parseutils.c:181
misc parsing utilities
AVPixelFormat
Pixel format.
Definition pixfmt.h:71
@ AV_PIX_FMT_NONE
Definition pixfmt.h:72
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition pixfmt.h:73
@ AV_PIX_FMT_UYVY422
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
Definition pixfmt.h:88
@ AV_PIX_FMT_RGB8
packed RGB 3:3:2, 8bpp, (msb)3R 3G 2B(lsb)
Definition pixfmt.h:93
@ AV_PIX_FMT_YUYV422
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
Definition pixfmt.h:74
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
Definition pixfmt.h:76
@ 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
@ 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
#define AV_PIX_FMT_RGB32
Definition pixfmt.h:517
#define AV_PIX_FMT_RGB555
Definition pixfmt.h:533
#define FF_ARRAY_ELEMS(a)
Describe the class of an AVClass context structure.
Definition log.h:76
This struct describes the properties of an encoded stream.
Definition codec_par.h:49
int extradata_size
Size of the extradata content in bytes.
Definition codec_par.h:75
int height
The height of the video frame in pixels.
Definition codec_par.h:150
int bits_per_coded_sample
The number of bits per sample in the codedwords.
Definition codec_par.h:113
int width
The width of the video frame in pixels.
Definition codec_par.h:143
enum AVMediaType codec_type
General type of the encoded data.
Definition codec_par.h:53
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
Definition codec_par.h:71
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
Definition codec_par.h:57
Format I/O context.
Definition avformat.h:1333
AVOption.
Definition opt.h:428
This structure stores compressed data.
Definition packet.h:580
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
Definition packet.h:596
uint8_t * data
Definition packet.h:603
Rational number (pair of numerator and denominator).
Definition rational.h:58
int num
Numerator.
Definition rational.h:59
int den
Denominator.
Definition rational.h:60
Stream structure.
Definition avformat.h:766
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Definition avformat.h:789
AVRational avg_frame_rate
Average framerate.
Definition avformat.h:855
struct PacketListEntry * next
char * video_size
A string describing video size, set by a private option.
Definition vfwcap.c:53
HWND hwnd
Definition vfwcap.c:47
unsigned int frame_num
Definition vfwcap.c:52
PacketListEntry * pktl
Definition vfwcap.c:50
unsigned int curbufsize
Definition vfwcap.c:51
char * framerate
Set by a private option.
Definition vfwcap.c:54
HANDLE event
Definition vfwcap.c:49
HANDLE mutex
Definition vfwcap.c:48
#define av_free(p)
#define av_mallocz(s)
#define av_freep(p)
#define av_log(a,...)
float framerate
Definition av1_levels.c:29
#define HWND_MESSAGE
Definition vfwcap.c:42
static void dump_videohdr(AVFormatContext *s, VIDEOHDR *vhdr)
Definition vfwcap.c:129
static int vfw_read_close(AVFormatContext *s)
Definition vfwcap.c:222
#define dstruct(pctx, sname, var, type)
Definition vfwcap.c:97
static LRESULT CALLBACK videostream_cb(HWND hwnd, LPVIDEOHDR vdhdr)
Definition vfwcap.c:180
static int vfw_read_packet(AVFormatContext *s, AVPacket *pkt)
Definition vfwcap.c:442
static enum AVPixelFormat vfw_pixfmt(DWORD biCompression, WORD biBitCount)
Definition vfwcap.c:57
static void dump_bih(AVFormatContext *s, BITMAPINFOHEADER *bih)
Definition vfwcap.c:146
static int vfw_read_header(AVFormatContext *s)
Definition vfwcap.c:248
static void dump_captureparms(AVFormatContext *s, CAPTUREPARMS *cparms)
Definition vfwcap.c:100
static int shall_we_drop(AVFormatContext *s)
Definition vfwcap.c:164
static enum AVCodecID vfw_codecid(DWORD biCompression)
Definition vfwcap.c:85
static const AVClass vfw_class
Definition vfwcap.c:479
#define OFFSET(x)
Definition vfwcap.c:471
#define WaitForSingleObject(a, b)
Definition w32pthreads.h:64