SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV Studio
Forum Rules FAQs Community Downloads Today's Posts Search

Notices

SageTV Studio Discussion related to the SageTV Studio application produced by SageTV. Questions, issues, problems, suggestions, etc. relating to the Studio software application should be posted here.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 05-01-2013, 09:59 AM
routerunner's Avatar
routerunner routerunner is offline
Sage Icon
 
Join Date: May 2008
Location: Wiltshire, UK
Posts: 1,384
Help on detecting physical channel selection...

Hi,

I'm currently looking for the best way to know which physical channel and tuner is being used when watching/recording a TV channel.

In a plugin you can register to a system event to know when a recording is started and then from the filename you can get the tuner input capture used, but what about the physical channel number? Alternatively, does any one know about an undocumented system event I can register for this purpose?

I was wondering whether there is some way in Studio to know that?

Thanks
Eddy
__________________

Automatic Power Off | Squeezeslave | DVB-S Importer | DVB Decrypter & Card Client | Tuner Preroll


Every man is a damn fool for at least five minutes every day; wisdom consists in not exceeding the limit. ~ Elbert Hubbard

Last edited by routerunner; 05-01-2013 at 10:13 AM.
Reply With Quote
  #2  
Old 07-28-2013, 06:16 AM
routerunner's Avatar
routerunner routerunner is offline
Sage Icon
 
Join Date: May 2008
Location: Wiltshire, UK
Posts: 1,384
Nobody knows?

Bump...just in case it has been forgotten, I'm still looking for a good way to do this please? Any info from studio developers appreciated.

Thanks
Eddy
__________________

Automatic Power Off | Squeezeslave | DVB-S Importer | DVB Decrypter & Card Client | Tuner Preroll


Every man is a damn fool for at least five minutes every day; wisdom consists in not exceeding the limit. ~ Elbert Hubbard
Reply With Quote
  #3  
Old 07-28-2013, 09:17 PM
Slugger Slugger is offline
SageTVaholic
 
Join Date: Mar 2007
Location: Kingston, ON
Posts: 4,008
Why do you need the physical channel number? Wouldn't a logical channel number be enough? No one's replied probably because to get the physical channel number for a specific recording is painful, to say the least. I just looked at the API quickly and it appears it's possible, but you have to jump thru all kinds of hoops to get it.

And there's no other event to listen for. You'd need to listen for recording started events then do something like the following:

Take the MediaFile object you receive in the event and determine which encoder is being used to record it via MediaFileAPI.GetMediaFileEncoding().

Take that data and use it to find out which capture device is being used using something like CaptureDeviceAPI.GetActiveCaptureDevices().

Once you know which capture device is being used to record, you need to figure out which input on that device is being used using something from CaptureDeviceInputAPI. This is where it starts to get tricky b/c I couldn't find an easy/obvious way to determine exactly which input on the device is being used. Mind you I didn't dig too deep into it, but let's assume the answer is in there somewhere.

From there, you need to get the lineup associated with that capture device input.

Then once you know which lineup is being used the rest is trivial. Use the ChannelAPI to get the physical channel number based on the channel + the lineup you figured out is being used.

Good luck!

Now, to just get the a channel object that can be used to tell Sage to tune to or whatever, well, that's easy: Just grab the channel from the MediaFile via the AiringAPI:

AiringAPI.GetChannel(MediaFile). Pass in the MediaFile object you receive in your event. You can then just use that Channel object to tell Sage to tune to that channel, if that's what you're trying to do. Nice and simple. I think the Sage API makes it difficult to find the physical channel for a recording because one should rarely care about the physical channel, only the core needs to worry about how to find physical channel numbers when needed.
__________________
Twitter: @ddb_db
Server: Intel i5-4570 Quad Core, 16GB RAM, 1 x 128GB OS SSD (Win7 Pro x64 SP1), 1 x 2TB media drive
Capture: 2 x Colossus
STB Controller: 1 x USB-UIRT
Software:Java 1.7.0_71; SageTV 7.1.9
Clients: 1 x HD300, 2 x HD200, 1 x SageClient, 1 x PlaceShifter
Plugins: Too many to list now...
Reply With Quote
  #4  
Old 07-29-2013, 02:51 AM
routerunner's Avatar
routerunner routerunner is offline
Sage Icon
 
Join Date: May 2008
Location: Wiltshire, UK
Posts: 1,384
Quote:
Originally Posted by Slugger View Post
From there, you need to get the lineup associated with that capture device input.

Then once you know which lineup is being used the rest is trivial. Use the ChannelAPI to get the physical channel number based on the channel + the lineup you figured out is being used.

Good luck!

Now, to just get the a channel object that can be used to tell Sage to tune to or whatever, well, that's easy: Just grab the channel from the MediaFile via the AiringAPI:

AiringAPI.GetChannel(MediaFile). Pass in the MediaFile object you receive in your event. You can then just use that Channel object to tell Sage to tune to that channel, if that's what you're trying to do. Nice and simple. I think the Sage API makes it difficult to find the physical channel for a recording because one should rarely care about the physical channel, only the core needs to worry about how to find physical channel numbers when needed.
Hi,

thanks for the info...

I knew how to get the input capture device from a mediafile, however the confusing part is that I completely missed that a AiringAPI.GetChannel() wants the media file name as input, I thought you need to retrieve the airing object via the MediaFileAPI.GetMediaFileAiring() first ?

So my plan is:

- Register for the recording event to get the mediafile.
- Use GetCaptureDeviceInputRecordingMediaFile(mediafile) to get the input capture name which maps the .FRQ filename.
- Use GetLineupForCaptureDeviceInput(capture device input) to get the lineup for the device.
- Use GetMediaFileAiring(mediafile) to get the channel object.
- Use GetPhysicalChannelNumberForLineup(channel object, lineup).
- Read the correspondent capture device .FRQ file and look for the tuning parameters associated with the physical channel.
- Send the parameters to my DVBDCC DirectShow filter to select the channel to descramble.

This solution is not the best but it should work. Unfortunately SageTV developers did take a custom approach on designing their DirectShow capture filter graph, whereby instead of using the standard MPEG2 Demultiplexer which have the separate Audio/Video pins exposing the interface that hold which PID are currently decoded, they decided to implement their own TS demuxer which unfortunately doesn't expose that interface otherwise my job would have been dead easy.

Another problem is the fact that is difficult from the filter point of view to know which tuner is associated with and therefore to which filter send the channel tuning information to, however not that difficult for tuners recording from different transponders as the filter will decide whether accepting the tuning parameters or not based on the information gathered from the TS, but what about two or more tuners recording two or more channel at the same time from the same transponder? It is not that unusual and that will confuse things unless I'll include some form of timestamp to understand who started first, hoping that SageTV execution isn't that "parallel"

That should keep me going...

Thanks again
Eddy
__________________

Automatic Power Off | Squeezeslave | DVB-S Importer | DVB Decrypter & Card Client | Tuner Preroll


Every man is a damn fool for at least five minutes every day; wisdom consists in not exceeding the limit. ~ Elbert Hubbard

Last edited by routerunner; 07-29-2013 at 06:46 AM.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
physical channel remap ripplingj SageTV EPG Service 3 12-15-2011 01:24 PM
SageTV ignores physical channel # gizmo3141 SageTV Software 10 08-15-2011 02:18 PM
Can't Map Different Stations to Physical Channel dinki SageTV Beta Test Software 2 08-03-2008 07:13 PM
HDR-1800 not detecting a channel in SageMC crasch Hardware Support 3 08-01-2008 11:04 PM
Syntax for Remap Physical Channel Kimper SageTV Beta Test Software 1 11-24-2006 10:38 PM


All times are GMT -6. The time now is 12:56 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.