1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

dshow: add properties dialog for tv tuners

Signed-off-by: rogerdpack <rogerpack2005@gmail.com>
This commit is contained in:
rogerdpack 2015-01-24 19:56:02 -07:00
parent f994000dc5
commit c55fa2f09b
4 changed files with 59 additions and 6 deletions

View File

@ -253,6 +253,16 @@ If set to @option{true}, before capture starts, popup a display
dialog to the end user, allowing them to manually dialog to the end user, allowing them to manually
modify crossbar pin routings. modify crossbar pin routings.
@item show_analog_tv_tuner_dialog
If set to @option{true}, before capture starts, popup a display
dialog to the end user, allowing them to manually
modify TV channels and frequencies.
@item show_analog_tv_tuner_audio_dialog
If set to @option{true}, before capture starts, popup a display
dialog to the end user, allowing them to manually
modify TV audio (like mono vs. stereo, Language A,B or C).
@end table @end table
@subsection Examples @subsection Examples

View File

@ -1202,6 +1202,12 @@ static const AVOption options[] = {
{ "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" }, { "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" }, { "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" }, { "false", "", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, DEC, "show_crossbar_connection_dialog" },
{ "show_analog_tv_tuner_dialog", "display property dialog for analog tuner filter", OFFSET(show_analog_tv_tuner_dialog), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, DEC, "show_analog_tv_tuner_dialog" },
{ "true", "", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, DEC, "show_analog_tv_tuner_dialog" },
{ "false", "", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, DEC, "show_analog_tv_tuner_dialog" },
{ "show_analog_tv_tuner_audio_dialog", "display property dialog for analog tuner audio filter", OFFSET(show_analog_tv_tuner_audio_dialog), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, DEC, "show_analog_tv_tuner_dialog" },
{ "true", "", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, DEC, "show_analog_tv_tuner_audio_dialog" },
{ "false", "", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, DEC, "show_analog_tv_tuner_audio_dialog" },
{ NULL }, { NULL },
}; };

View File

@ -304,6 +304,8 @@ struct dshow_ctx {
int show_video_device_dialog; int show_video_device_dialog;
int show_audio_device_dialog; int show_audio_device_dialog;
int show_crossbar_connection_dialog; int show_crossbar_connection_dialog;
int show_analog_tv_tuner_dialog;
int show_analog_tv_tuner_audio_dialog;
IBaseFilter *device_filter[2]; IBaseFilter *device_filter[2];
IPin *device_pin[2]; IPin *device_pin[2];

View File

@ -142,23 +142,54 @@ dshow_try_setup_crossbar_options(ICaptureGraphBuilder2 *graph_builder2,
{ {
struct dshow_ctx *ctx = avctx->priv_data; struct dshow_ctx *ctx = avctx->priv_data;
IAMCrossbar *cross_bar = NULL; IAMCrossbar *cross_bar = NULL;
IBaseFilter *cross_bar_filter = NULL; IBaseFilter *cross_bar_base_filter = NULL;
IAMTVTuner *tv_tuner_filter = NULL;
IBaseFilter *tv_tuner_base_filter = NULL;
IAMAudioInputMixer *tv_audio_filter = NULL;
IBaseFilter *tv_audio_base_filter = NULL;
HRESULT hr; HRESULT hr;
hr = ICaptureGraphBuilder2_FindInterface(graph_builder2, &LOOK_UPSTREAM_ONLY, (const GUID *) NULL, hr = ICaptureGraphBuilder2_FindInterface(graph_builder2, &LOOK_UPSTREAM_ONLY, (const GUID *) NULL,
(IBaseFilter *) device_filter, &IID_IAMCrossbar, (void**) &cross_bar); device_filter, &IID_IAMCrossbar, (void**) &cross_bar);
if (hr != S_OK) { if (hr != S_OK) {
/* no crossbar found */ /* no crossbar found */
hr = S_OK; hr = S_OK;
goto end; goto end;
} }
/* TODO some TV tuners apparently have multiple crossbars? */
if (ctx->show_crossbar_connection_dialog) { if (ctx->show_crossbar_connection_dialog) {
hr = IAMCrossbar_QueryInterface(cross_bar, &IID_IBaseFilter, (void **) &cross_bar_filter); hr = IAMCrossbar_QueryInterface(cross_bar, &IID_IBaseFilter, (void **) &cross_bar_base_filter);
if (hr != S_OK) if (hr != S_OK)
goto end; goto end;
dshow_show_filter_properties(cross_bar_filter, avctx); dshow_show_filter_properties(cross_bar_base_filter, avctx);
} }
if (devtype == VideoDevice && ctx->show_analog_tv_tuner_dialog) {
hr = ICaptureGraphBuilder2_FindInterface(graph_builder2, &LOOK_UPSTREAM_ONLY, NULL,
device_filter, &IID_IAMTVTuner, (void**) &tv_tuner_filter);
if (hr == S_OK) {
hr = IAMCrossbar_QueryInterface(tv_tuner_filter, &IID_IBaseFilter, (void **) &tv_tuner_base_filter);
if (hr != S_OK)
goto end;
dshow_show_filter_properties(tv_tuner_base_filter, avctx);
} else {
av_log(avctx, AV_LOG_WARNING, "unable to find a tv tuner to display dialog for!");
}
}
if (devtype == AudioDevice && ctx->show_analog_tv_tuner_audio_dialog) {
hr = ICaptureGraphBuilder2_FindInterface(graph_builder2, &LOOK_UPSTREAM_ONLY, NULL,
device_filter, &IID_IAMTVAudio, (void**) &tv_audio_filter);
if (hr == S_OK) {
hr = IAMCrossbar_QueryInterface(tv_audio_filter, &IID_IBaseFilter, (void **) &tv_audio_base_filter);
if (hr != S_OK)
goto end;
dshow_show_filter_properties(tv_audio_base_filter, avctx);
} else {
av_log(avctx, AV_LOG_WARNING, "unable to find a tv audio tuner to display dialog for!");
}
}
hr = setup_crossbar_options(cross_bar, devtype, avctx); hr = setup_crossbar_options(cross_bar, devtype, avctx);
if (hr != S_OK) if (hr != S_OK)
goto end; goto end;
@ -166,7 +197,11 @@ dshow_try_setup_crossbar_options(ICaptureGraphBuilder2 *graph_builder2,
end: end:
if (cross_bar) if (cross_bar)
IAMCrossbar_Release(cross_bar); IAMCrossbar_Release(cross_bar);
if (cross_bar_filter) if (cross_bar_base_filter)
IBaseFilter_Release(cross_bar_filter); IBaseFilter_Release(cross_bar_base_filter);
if (tv_tuner_filter)
IAMTVTuner_Release(tv_tuner_filter);
if (tv_tuner_base_filter)
IBaseFilter_Release(tv_tuner_base_filter);
return hr; return hr;
} }