mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-26 19:01:44 +02:00
dshow: add options for allowing filter popup configuration dialogs to be presented to the user
Signed-off-by: rogerdpack <rogerpack2005@gmail.com>
This commit is contained in:
parent
ec81ad21c1
commit
5d72cf0f64
2
configure
vendored
2
configure
vendored
@ -2487,7 +2487,7 @@ decklink_outdev_extralibs="-lstdc++"
|
||||
decklink_indev_deps="decklink pthreads"
|
||||
decklink_indev_extralibs="-lstdc++"
|
||||
dshow_indev_deps="IBaseFilter"
|
||||
dshow_indev_extralibs="-lpsapi -lole32 -lstrmiids -luuid"
|
||||
dshow_indev_extralibs="-lpsapi -lole32 -lstrmiids -luuid -loleaut32"
|
||||
dv1394_indev_deps="dv1394"
|
||||
dv1394_indev_select="dv_demuxer"
|
||||
fbdev_indev_deps="linux_fb_h"
|
||||
|
@ -234,6 +234,25 @@ routed to the crossbar device's Video Decoder output pin.
|
||||
Select audio input pin number for crossbar device. This will be
|
||||
routed to the crossbar device's Audio Decoder output pin.
|
||||
|
||||
@item show_video_device_dialog
|
||||
If set to @option{true}, before capture starts, popup a display dialog
|
||||
to the end user, allowing them to change video filter properties
|
||||
and configurations manually.
|
||||
Note that for crossbar devices, this may be needed at times to toggle
|
||||
between PAL and NTSC input frame rates and sizes, etc. Possibly
|
||||
enabling different scan rates/frame rates and avoiding green bars at
|
||||
the bottom, etc.
|
||||
|
||||
@item show_audio_device_dialog
|
||||
If set to @option{true}, before capture starts, popup a display dialog
|
||||
to the end user, allowing them to change audio filter properties
|
||||
and configurations manually.
|
||||
|
||||
@item show_crossbar_connection_dialog
|
||||
If set to @option{true}, before capture starts, popup a display
|
||||
dialog to the end user, allowing them to manually
|
||||
modify crossbar pin routings.
|
||||
|
||||
@end table
|
||||
|
||||
@subsection Examples
|
||||
@ -276,6 +295,13 @@ Specify pin names to capture by name or alternative name, specify alternative de
|
||||
$ ffmpeg -f dshow -audio_pin_name "Audio Out" -video_pin_name 2 -i video=video="@device_pnp_\\?\pci#ven_1a0a&dev_6200&subsys_62021461&rev_01#4&e2c7dd6&0&00e1#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\{ca465100-deb0-4d59-818f-8c477184adf6}":audio="Microphone"
|
||||
@end example
|
||||
|
||||
@item
|
||||
Configure a crossbar device, specifying crossbar pins, allow user to adjust video capture properties at startup:
|
||||
@example
|
||||
$ ffmpeg -f dshow -show_video_device_dialog true -crossbar_video_input_pin_number 0
|
||||
-crossbar_audio_input_pin_number 3 -i video="AVerMedia BDA Analog Capture":audio="AVerMedia BDA Analog Capture"
|
||||
@end example
|
||||
|
||||
@end itemize
|
||||
|
||||
@section dv1394
|
||||
|
@ -502,6 +502,53 @@ end:
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pops up a user dialog allowing them to adjust properties for the given filter, if possible.
|
||||
*/
|
||||
void
|
||||
dshow_show_filter_properties(IBaseFilter *device_filter, AVFormatContext *avctx) {
|
||||
ISpecifyPropertyPages *property_pages = NULL;
|
||||
IUnknown *device_filter_iunknown = NULL;
|
||||
HRESULT hr;
|
||||
FILTER_INFO filter_info = {0}; /* a warning on this line is false positive GCC bug 53119 */
|
||||
CAUUID ca_guid = {0};
|
||||
|
||||
hr = IBaseFilter_QueryInterface(device_filter, &IID_ISpecifyPropertyPages, (void **)&property_pages);
|
||||
if (hr != S_OK) {
|
||||
av_log(avctx, AV_LOG_WARNING, "requested filter does not have a property page to show");
|
||||
goto end;
|
||||
}
|
||||
hr = IBaseFilter_QueryFilterInfo(device_filter, &filter_info);
|
||||
if (hr != S_OK) {
|
||||
goto fail;
|
||||
}
|
||||
hr = IBaseFilter_QueryInterface(device_filter, &IID_IUnknown, (void **)&device_filter_iunknown);
|
||||
if (hr != S_OK) {
|
||||
goto fail;
|
||||
}
|
||||
hr = ISpecifyPropertyPages_GetPages(property_pages, &ca_guid);
|
||||
if (hr != S_OK) {
|
||||
goto fail;
|
||||
}
|
||||
hr = OleCreatePropertyFrame(NULL, 0, 0, filter_info.achName, 1, &device_filter_iunknown, ca_guid.cElems,
|
||||
ca_guid.pElems, 0, 0, NULL);
|
||||
if (hr != S_OK) {
|
||||
goto fail;
|
||||
}
|
||||
goto end;
|
||||
fail:
|
||||
av_log(avctx, AV_LOG_ERROR, "Failure showing property pages for filter");
|
||||
end:
|
||||
if (property_pages)
|
||||
ISpecifyPropertyPages_Release(property_pages);
|
||||
if (device_filter_iunknown)
|
||||
IUnknown_Release(device_filter_iunknown);
|
||||
if (filter_info.pGraph)
|
||||
IFilterGraph_Release(filter_info.pGraph);
|
||||
if (ca_guid.pElems)
|
||||
CoTaskMemFree(ca_guid.pElems);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cycle through available pins using the device_filter device, of type
|
||||
* devtype, retrieve the first output pin and return the pointer to the
|
||||
@ -527,6 +574,10 @@ dshow_cycle_pins(AVFormatContext *avctx, enum dshowDeviceType devtype,
|
||||
ctx->video_codec_id != AV_CODEC_ID_RAWVIDEO))
|
||||
|| (devtype == AudioDevice && (ctx->channels || ctx->sample_rate));
|
||||
int format_set = 0;
|
||||
int should_show_properties = (devtype == VideoDevice) ? ctx->show_video_device_dialog : ctx->show_audio_device_dialog;
|
||||
|
||||
if (should_show_properties)
|
||||
dshow_show_filter_properties(device_filter, avctx);
|
||||
|
||||
r = IBaseFilter_EnumPins(device_filter, &pins);
|
||||
if (r != S_OK) {
|
||||
@ -1133,6 +1184,15 @@ static const AVOption options[] = {
|
||||
{ "audio_pin_name", "select audio capture pin by name", OFFSET(audio_pin_name),AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, AV_OPT_FLAG_ENCODING_PARAM },
|
||||
{ "crossbar_video_input_pin_number", "set video input pin number for crossbar device", OFFSET(crossbar_video_input_pin_number), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, DEC },
|
||||
{ "crossbar_audio_input_pin_number", "set audio input pin number for crossbar device", OFFSET(crossbar_audio_input_pin_number), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, DEC },
|
||||
{ "show_video_device_dialog", "display property dialog for video capture device", OFFSET(show_video_device_dialog), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, DEC, "show_video_device_dialog" },
|
||||
{ "true", "", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, DEC, "show_video_device_dialog" },
|
||||
{ "false", "", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, DEC, "show_video_device_dialog" },
|
||||
{ "show_audio_device_dialog", "display property dialog for audio capture device", OFFSET(show_audio_device_dialog), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, DEC, "show_audio_device_dialog" },
|
||||
{ "true", "", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, DEC, "show_audio_device_dialog" },
|
||||
{ "false", "", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, DEC, "show_audio_device_dialog" },
|
||||
{ "show_crossbar_connection_dialog", "display property dialog for crossbar connecting pins filter", OFFSET(show_crossbar_connection_dialog), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, DEC, "show_crossbar_connection_dialog" },
|
||||
{ "true", "", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, DEC, "show_crossbar_connection_dialog" },
|
||||
{ "false", "", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, DEC, "show_crossbar_connection_dialog" },
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
|
@ -298,6 +298,7 @@ struct dshow_ctx {
|
||||
char *audio_pin_name;
|
||||
int show_video_device_dialog;
|
||||
int show_audio_device_dialog;
|
||||
int show_crossbar_connection_dialog;
|
||||
|
||||
IBaseFilter *device_filter[2];
|
||||
IPin *device_pin[2];
|
||||
|
@ -139,6 +139,7 @@ HRESULT
|
||||
dshow_try_setup_crossbar_options(ICaptureGraphBuilder2 *graph_builder2,
|
||||
IBaseFilter *device_filter, enum dshowDeviceType devtype, AVFormatContext *avctx)
|
||||
{
|
||||
struct dshow_ctx *ctx = avctx->priv_data;
|
||||
IAMCrossbar *cross_bar = NULL;
|
||||
IBaseFilter *cross_bar_filter = NULL;
|
||||
HRESULT hr;
|
||||
@ -151,6 +152,12 @@ dshow_try_setup_crossbar_options(ICaptureGraphBuilder2 *graph_builder2,
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (ctx->show_crossbar_connection_dialog) {
|
||||
hr = IAMCrossbar_QueryInterface(cross_bar, &IID_IBaseFilter, (void **) &cross_bar_filter);
|
||||
if (hr != S_OK)
|
||||
goto end;
|
||||
dshow_show_filter_properties(cross_bar_filter, avctx);
|
||||
}
|
||||
hr = setup_crossbar_options(cross_bar, devtype, avctx);
|
||||
if (hr != S_OK)
|
||||
goto end;
|
||||
|
Loading…
Reference in New Issue
Block a user