Page 1 of 1

vlc dshow tv tuner

Posted: 30 Nov 2004 10:11
by hausheer
Is there a possibility to set tv tuner options like channel and norm for dshow from the command line or through advanced options, rather than having to use the tv card's tuner properties interface?

Posted: 01 Dec 2004 01:56
by hausheer
Here is some code for vlc dshow to support channel selection from command line. Thought this might be of interest. Works very well for me with the latest vlc release (0.8.1). Add the following lines to dshow.cpp and recompile it:

Code: Select all

... static void ConfigTuner( vlc_object_t *, ICaptureGraphBuilder2 *, IBaseFilter * ); ... #define CHANNEL_TEXT N_("TV Channel selection") #define CHANNEL_LONGTEXT N_( \ "You can select the tv channel that will be used by the DirectShow plugin." ) #define COUNTRY_TEXT N_("Country selection") #define COUNTRY_LONGTEXT N_( \ "You can select the country that will be used by the DirectShow plugin." ) #define INPUT_TEXT N_("Input selection (Cable/Antenna)") #define INPUT_LONGTEXT N_( \ "You can select the input that will be used by the DirectShow plugin." ) ... add_integer( "dshow-channel", 1, NULL, CHANNEL_TEXT, CHANNEL_LONGTEXT, VLC_TRUE ); add_integer( "dshow-country", 1, NULL, COUNTRY_TEXT, COUNTRY_LONGTEXT, VLC_TRUE ); add_bool( "dshow-input", VLC_FALSE, NULL, INPUT_TEXT, INPUT_LONGTEXT, VLC_TRUE ); ... var_Create( p_this, "dshow-channel", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); var_Create( p_this, "dshow-country", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); var_Create( p_this, "dshow-input", VLC_VAR_BOOL | VLC_VAR_DOINHERIT ); ... ConfigTuner( p_this, p_sys->p_capture_graph_builder2, p_device_filter ); ... static void ConfigTuner( vlc_object_t *p_this, ICaptureGraphBuilder2 *p_capture_graph, IBaseFilter *p_device_filter ) { int i_channel, i_country; long l_modes = 0; bool b_input; HRESULT hr; i_channel = var_GetInteger( p_this, "dshow-channel" ); i_country = var_GetInteger( p_this, "dshow-country" ); b_input = var_GetBool( p_this, "dshow-input" ); msg_Dbg( p_this, "Config channel: %i, country: %i", i_channel, i_country ); if( p_capture_graph ) { IAMTVTuner *p_TV = NULL; hr = p_capture_graph->FindInterface( &PIN_CATEGORY_CAPTURE, &MEDIATYPE_Interleaved, p_device_filter, IID_IAMTVTuner, (void **)&p_TV ); if( FAILED(hr) ) { hr = p_capture_graph->FindInterface( &PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video, p_device_filter, IID_IAMTVTuner, (void **)&p_TV ); } if( SUCCEEDED(hr) ) { hr = p_TV->GetAvailableModes(&l_modes); if (SUCCEEDED(hr) && (l_modes & AMTUNER_MODE_TV)) { hr = p_TV->put_Mode(AMTUNER_MODE_TV); } if ( b_input ) p_TV->put_InputType( 0, TunerInputAntenna ); else p_TV->put_InputType( 0, TunerInputCable ); p_TV->put_CountryCode( (long)i_country ); p_TV->put_Channel( (long)i_channel, AMTUNER_SUBCHAN_NO_TUNE, AMTUNER_SUBCHAN_NO_TUNE ); p_TV->Release(); } } }

Posted: 01 Dec 2004 12:12
by Gibalou
Nice patch! thanks for that.
I just applied it to the development tree with some small cleanup. I wasn't exactly sure where to put the ConfigTuner() call so you might have to check whether my commit works.
(should be available in tomorrows nightly builds: http://www.videolan.org/~videolan/)

Posted: 02 Dec 2004 00:02
by hausheer
It seems to work very nicely. Thanks a lot. I put the ConfigTuner() call right before showing the tuner properties, exactly as you did it in Revision 9456. So the tuner properties interface always serves as a last resort.

How do I get this to work?

Posted: 06 Dec 2004 23:55
by LanderX
I used the 2004 Dec 03 snapshot, but help command on command line interfase doesn't show any instructions about how to select the channel.

Thanks a lot!

Posted: 06 Dec 2004 23:59
by markfm
--longhelp --advanced should list the commands.

Looks like:
--dshow-channel=integer (the channel number)
--dshow-country=integer (country -- I'd leave it alone if it works OK)
--dshow-input=boolean (which input TRUE = use antenna input, FALSE = use cable input [beats me how this works, I don't use a tuner card])
(the above assumes gibalou applied the patch close to as-is, retained the shortcut names)

Thank you very much..

Posted: 07 Dec 2004 07:16
by LanderX
Thank you very much... i was looking at the "CONSOLE INTERFACE", not at the "COMMAND LINE". What i was looking was a way to change channel once you are streaming... i think this is not possible at this time... thank you very much.

Posted: 12 Dec 2004 23:45
by hausheer
You can lookup your country code in Microsoft's DirectShow documentation under http://msdn.microsoft.com/library/defau ... nments.asp. The code is the same as the international telephone dialing number. Use --dshow-tuner-country to set the code. (Note, that the option names are now a bit different than in the patch above).

The country table reveals the corresponding frequency tables for cable and antenna input respectively (Set --dshow-tuner-input=1 for cable input and --dshow-tuner-input=2 for antenna input).

For example, if you live in a western european country (except France and some other countries) you would lookup the correct channel numbers in the Western Europe tables under http://msdn.microsoft.com/library/defau ... europe.asp. You may verify the channel/frequency assignments with your cable providers' program chart. Use --dshow-tuner-channel to set the channel you want.

If you don't want to use the command line interface to set the tuner options, you can set them under "advanced options". To ease channel selection you could also define a playlist with all the channels you like to watch:

Code: Select all

#EXTM3U #EXTINF:0,<Programname1> #EXTVLCOPT:dshow-vdev= #EXTVLCOPT:dshow-adev= #EXTVLCOPT:dshow-size= #EXTVLCOPT:no-dshow-config #EXTVLCOPT:no-dshow-tuner #EXTVLCOPT:dshow-caching=200 #EXTVLCOPT:dshow-chroma= #EXTVLCOPT:dshow-tuner-channel=<channel1> #EXTVLCOPT:dshow-tuner-country=<country-code> #EXTVLCOPT:dshow-tuner-input=<input> dshow:// #EXTINF:0,<Programname2> #EXTVLCOPT:dshow-vdev= #EXTVLCOPT:dshow-adev= #EXTVLCOPT:dshow-size= #EXTVLCOPT:no-dshow-config #EXTVLCOPT:no-dshow-tuner #EXTVLCOPT:dshow-caching=200 #EXTVLCOPT:dshow-chroma= #EXTVLCOPT:dshow-tuner-channel=<channel2> #EXTVLCOPT:dshow-tuner-country=<country-code> #EXTVLCOPT:dshow-tuner-input=<input> dshow://

Thank you Very much...

Posted: 17 Dec 2004 00:02
by LanderX
As you can see... i'm a newbie with VideoLan. I'm using a XBOX with MediaCenter, to se Cable Channels streamed from my PC with VideoLan. The PC with the Cable is on 2nd floor. The XBOX is on basement. I'm using a Linksys WRT54GS and a WGA11b to interconnect the PC and XBOX. So, at this time i need to go upstairs... stop streaming... change channel... start streaming, and go downstairs to see new channel.

Sad Some kind of tired... but my legs are getting stronger every day... Smile


That's why i'm asking this questions. I was thinking on buying a TV Tuner box with remote control, and a RF Remote Extender, so i could change channels without disturbing VideoLan, but first i was trying to see what are my options with the actual VideoLan Features.

Thank you very very much for your help, and greetings from Mexico.

Posted: 26 Apr 2005 18:08
by Artem Bokhan
When I configure dshow device step-by-step with gui (with dshow-config and dshow-tuner), everything is ok.
But when I'm trying to configure tuner with defaults, m3u or command-line, winxp sp2 crashes with blue screen. Tuner is pinnacle pctv usb2.

Any ideas?