FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
dshow.c File Reference
#include "dshow_capture.h"
#include "libavutil/parseutils.h"
#include "libavutil/pixdesc.h"
#include "libavutil/opt.h"
#include "libavformat/internal.h"
#include "libavformat/riff.h"
#include "avdevice.h"
#include "libavcodec/raw.h"
#include "objidl.h"
#include "shlwapi.h"

Go to the source code of this file.

Macros

#define OFFSET(x)   offsetof(struct dshow_ctx, x)
 
#define DEC   AV_OPT_FLAG_DECODING_PARAM
 

Functions

static enum AVPixelFormat dshow_pixfmt (DWORD biCompression, WORD biBitCount)
 
static int dshow_read_close (AVFormatContext *s)
 
static char * dup_wchar_to_utf8 (wchar_t *w)
 
static int shall_we_drop (AVFormatContext *s, int index, enum dshowDeviceType devtype)
 
static void callback (void *priv_data, int index, uint8_t *buf, int buf_size, int64_t time, enum dshowDeviceType devtype)
 
static int dshow_cycle_devices (AVFormatContext *avctx, ICreateDevEnum *devenum, enum dshowDeviceType devtype, enum dshowSourceFilterType sourcetype, IBaseFilter **pfilter)
 Cycle through available devices using the device enumerator devenum, retrieve the device with type specified by devtype and return the pointer to the object found in *pfilter. More...
 
static void dshow_cycle_formats (AVFormatContext *avctx, enum dshowDeviceType devtype, IPin *pin, int *pformat_set)
 Cycle through available formats using the specified pin, try to set parameters specified through AVOptions and if successful return 1 in *pformat_set. More...
 
static int dshow_set_audio_buffer_size (AVFormatContext *avctx, IPin *pin)
 Set audio device buffer size in milliseconds (which can directly impact latency, depending on the device). More...
 
void dshow_show_filter_properties (IBaseFilter *device_filter, AVFormatContext *avctx)
 Pops up a user dialog allowing them to adjust properties for the given filter, if possible. More...
 
static int dshow_cycle_pins (AVFormatContext *avctx, enum dshowDeviceType devtype, enum dshowSourceFilterType sourcetype, IBaseFilter *device_filter, IPin **ppin)
 Cycle through available pins using the device_filter device, of type devtype, retrieve the first output pin and return the pointer to the object found in *ppin. More...
 
static int dshow_list_device_options (AVFormatContext *avctx, ICreateDevEnum *devenum, enum dshowDeviceType devtype, enum dshowSourceFilterType sourcetype)
 List options for device with type devtype, source filter type sourcetype. More...
 
static int dshow_open_device (AVFormatContext *avctx, ICreateDevEnum *devenum, enum dshowDeviceType devtype, enum dshowSourceFilterType sourcetype)
 
static enum AVCodecID waveform_codec_id (enum AVSampleFormat sample_fmt)
 
static enum AVSampleFormat sample_fmt_bits_per_sample (int bits)
 
static int dshow_add_device (AVFormatContext *avctx, enum dshowDeviceType devtype)
 
static int parse_device_name (AVFormatContext *avctx)
 
static int dshow_read_header (AVFormatContext *avctx)
 
static int dshow_check_event_queue (IMediaEvent *media_event)
 Checks media events from DirectShow and returns -1 on error or EOF. More...
 
static int dshow_read_packet (AVFormatContext *s, AVPacket *pkt)
 

Variables

static const AVOption options []
 
static const AVClass dshow_class
 
AVInputFormat ff_dshow_demuxer
 

Macro Definition Documentation

#define OFFSET (   x)    offsetof(struct dshow_ctx, x)

Definition at line 1261 of file dshow.c.

#define DEC   AV_OPT_FLAG_DECODING_PARAM

Definition at line 1262 of file dshow.c.

Function Documentation

static enum AVPixelFormat dshow_pixfmt ( DWORD  biCompression,
WORD  biBitCount 
)
static

Definition at line 34 of file dshow.c.

Referenced by dshow_add_device(), and dshow_cycle_formats().

static int dshow_read_close ( AVFormatContext s)
static

Definition at line 58 of file dshow.c.

Referenced by dshow_read_header().

static char* dup_wchar_to_utf8 ( wchar_t *  w)
static

Definition at line 132 of file dshow.c.

Referenced by dshow_cycle_pins().

static int shall_we_drop ( AVFormatContext s,
int  index,
enum dshowDeviceType  devtype 
)
static

Definition at line 142 of file dshow.c.

Referenced by callback().

static void callback ( void priv_data,
int  index,
uint8_t buf,
int  buf_size,
int64_t  time,
enum dshowDeviceType  devtype 
)
static
static int dshow_cycle_devices ( AVFormatContext avctx,
ICreateDevEnum *  devenum,
enum dshowDeviceType  devtype,
enum dshowSourceFilterType  sourcetype,
IBaseFilter **  pfilter 
)
static

Cycle through available devices using the device enumerator devenum, retrieve the device with type specified by devtype and return the pointer to the object found in *pfilter.

If pfilter is NULL, list all device names.

Definition at line 207 of file dshow.c.

Referenced by dshow_list_device_options(), dshow_open_device(), and dshow_read_header().

static void dshow_cycle_formats ( AVFormatContext avctx,
enum dshowDeviceType  devtype,
IPin *  pin,
int *  pformat_set 
)
static

Cycle through available formats using the specified pin, try to set parameters specified through AVOptions and if successful return 1 in *pformat_set.

If pformat_set is NULL, list all pin capabilities.

Definition at line 318 of file dshow.c.

Referenced by dshow_cycle_pins().

static int dshow_set_audio_buffer_size ( AVFormatContext avctx,
IPin *  pin 
)
static

Set audio device buffer size in milliseconds (which can directly impact latency, depending on the device).

Definition at line 465 of file dshow.c.

Referenced by dshow_cycle_pins().

void dshow_show_filter_properties ( IBaseFilter *  device_filter,
AVFormatContext avctx 
)

Pops up a user dialog allowing them to adjust properties for the given filter, if possible.

Definition at line 509 of file dshow.c.

Referenced by dshow_cycle_pins(), and dshow_try_setup_crossbar_options().

static int dshow_cycle_pins ( AVFormatContext avctx,
enum dshowDeviceType  devtype,
enum dshowSourceFilterType  sourcetype,
IBaseFilter *  device_filter,
IPin **  ppin 
)
static

Cycle through available pins using the device_filter device, of type devtype, retrieve the first output pin and return the pointer to the object found in *ppin.

If ppin is NULL, cycle through all pins listing audio/video capabilities.

Definition at line 559 of file dshow.c.

Referenced by dshow_list_device_options(), and dshow_open_device().

static int dshow_list_device_options ( AVFormatContext avctx,
ICreateDevEnum *  devenum,
enum dshowDeviceType  devtype,
enum dshowSourceFilterType  sourcetype 
)
static

List options for device with type devtype, source filter type sourcetype.

Parameters
devenumdevice enumerator used for accessing the device

Definition at line 704 of file dshow.c.

Referenced by dshow_read_header().

static int dshow_open_device ( AVFormatContext avctx,
ICreateDevEnum *  devenum,
enum dshowDeviceType  devtype,
enum dshowSourceFilterType  sourcetype 
)
static

Definition at line 721 of file dshow.c.

Referenced by dshow_read_header().

static enum AVCodecID waveform_codec_id ( enum AVSampleFormat  sample_fmt)
static

Definition at line 895 of file dshow.c.

Referenced by dshow_add_device().

static enum AVSampleFormat sample_fmt_bits_per_sample ( int  bits)
static

Definition at line 905 of file dshow.c.

Referenced by dshow_add_device().

static int dshow_add_device ( AVFormatContext avctx,
enum dshowDeviceType  devtype 
)
static

Definition at line 916 of file dshow.c.

Referenced by dshow_read_header().

static int parse_device_name ( AVFormatContext avctx)
static

Definition at line 1011 of file dshow.c.

Referenced by dshow_read_header().

static int dshow_read_header ( AVFormatContext avctx)
static

Definition at line 1048 of file dshow.c.

static int dshow_check_event_queue ( IMediaEvent *  media_event)
static

Checks media events from DirectShow and returns -1 on error or EOF.

Also purges all events that might be in the event queue to stop the trigger of event notification.

Definition at line 1216 of file dshow.c.

Referenced by dshow_read_packet().

static int dshow_read_packet ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 1231 of file dshow.c.

Variable Documentation

const AVOption options[]
static

Definition at line 1263 of file dshow.c.

const AVClass dshow_class
static
Initial value:
= {
.class_name = "dshow indev",
.item_name = av_default_item_name,
.option = options,
}
#define LIBAVUTIL_VERSION_INT
Definition: version.h:62
static const AVOption options[]
Definition: dshow.c:1263
av_default_item_name

Definition at line 1308 of file dshow.c.

AVInputFormat ff_dshow_demuxer
Initial value:
= {
.name = "dshow",
.long_name = NULL_IF_CONFIG_SMALL("DirectShow capture"),
.priv_data_size = sizeof(struct dshow_ctx),
.read_packet = dshow_read_packet,
.read_close = dshow_read_close,
.flags = AVFMT_NOFILE,
.priv_class = &dshow_class,
}
static int dshow_read_close(AVFormatContext *s)
Definition: dshow.c:58
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:175
static const AVClass dshow_class
Definition: dshow.c:1308
static int dshow_read_header(AVFormatContext *avctx)
Definition: dshow.c:1048
static int read_header(FFV1Context *f)
Definition: ffv1dec.c:620
#define AVFMT_NOFILE
Demuxer will use avio_open, no opened file should be provided by the caller.
Definition: avformat.h:465
static int dshow_read_packet(AVFormatContext *s, AVPacket *pkt)
Definition: dshow.c:1231

Definition at line 1316 of file dshow.c.