diff options
-rw-r--r-- | doc/indevs.texi | 10 | ||||
-rw-r--r-- | libavdevice/dshow.c | 6 | ||||
-rw-r--r-- | libavdevice/dshow_capture.h | 2 | ||||
-rw-r--r-- | libavdevice/dshow_crossbar.c | 47 |
4 files changed, 59 insertions, 6 deletions
diff --git a/doc/indevs.texi b/doc/indevs.texi index 75ad76f..c3d0827 100644 --- a/doc/indevs.texi +++ b/doc/indevs.texi @@ -253,6 +253,16 @@ If set to @option{true}, before capture starts, popup a display dialog to the end user, allowing them to manually 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 @subsection Examples diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c index e34b77c..d881bfa 100644 --- a/libavdevice/dshow.c +++ b/libavdevice/dshow.c @@ -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" }, { "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" }, + { "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 }, }; diff --git a/libavdevice/dshow_capture.h b/libavdevice/dshow_capture.h index 2e64776..11ab23c 100644 --- a/libavdevice/dshow_capture.h +++ b/libavdevice/dshow_capture.h @@ -304,6 +304,8 @@ struct dshow_ctx { int show_video_device_dialog; int show_audio_device_dialog; int show_crossbar_connection_dialog; + int show_analog_tv_tuner_dialog; + int show_analog_tv_tuner_audio_dialog; IBaseFilter *device_filter[2]; IPin *device_pin[2]; diff --git a/libavdevice/dshow_crossbar.c b/libavdevice/dshow_crossbar.c index 9c63019..e3012df 100644 --- a/libavdevice/dshow_crossbar.c +++ b/libavdevice/dshow_crossbar.c @@ -142,23 +142,54 @@ dshow_try_setup_crossbar_options(ICaptureGraphBuilder2 *graph_builder2, { struct dshow_ctx *ctx = avctx->priv_data; 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; 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) { /* no crossbar found */ hr = S_OK; goto end; } + /* TODO some TV tuners apparently have multiple crossbars? */ 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) 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); if (hr != S_OK) goto end; @@ -166,7 +197,11 @@ dshow_try_setup_crossbar_options(ICaptureGraphBuilder2 *graph_builder2, end: if (cross_bar) IAMCrossbar_Release(cross_bar); - if (cross_bar_filter) - IBaseFilter_Release(cross_bar_filter); + if (cross_bar_base_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; } |