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 08-21-2006, 10:03 AM
beelzerob beelzerob is offline
Sage Advanced User
 
Join Date: May 2006
Posts: 163
Peculiarities with GetMediaDuration and Time

I've been testing out my java-based server, and am so far pretty pleased with the results. However, I found some rather odd things which are causing me problems. They seem to deal almost exclusively with live content, including the little video "preview" in the upper right when browsing channels.

With a recorded show, when I start it up, I get it's description, title, and duration, and I only get them once since they're unlikely to change. However, with a "live" show, the duration is changing. I THINK there's a boolean api call out there somewhere that will tell me if it's a live show or recorded, and then I'll know whether to get it once or continually.

However, when it's a live show, I'm ending up with a "current media time" that exceeds the "current media duration". Both of them are incrementing, but the actual time of the media playpoint is larger than the duration of the entire show. Obviously that's not right, so I'm wondering what's going wrong. I'm using the same api calls all the time, for live tv or recorded. For recorded it works fine, the duration is large and static, and current time starts at 0 and increments up to the duration. For live...I can't tell what's going on.

Another oddity is that when I switch live shows (I think it's only live shows, not when I switch recorded shows), I'm getting a HUGE value for current media time. It seems to happen just once, when the show is changing. When I detect we've gone from Play to Pause (which is how it transitions from one live channel to another), I get the current media time, as well as all the other info I mentioned above. However, sometimes when I do this, I get a HUGE number for current time, and frequently negative also. Many times when this happens, I also get a null for show title and duration.

I included an api call at that point to ensure that loading was complete of the media file, but this still happens. This is a problem for me because the value is out of range of what my driver is expecting and causes it to go offline.

Any help is appreciated.
Reply With Quote
  #2  
Old 08-22-2006, 07:03 PM
beelzerob beelzerob is offline
Sage Advanced User
 
Join Date: May 2006
Posts: 163
Well, so perhaps I'm wrong, I can't seem to find an API call that says IsLive(), to tell me if the media playing is from a live source or from a recorded show. At this point, all I can think to do is to test 3 successive duration calls and see if it's changing. If it changes, then it must be live, if it's static, then it must be recorded and I'll only need to update it once.

I still don't know why my current media time is more than the duration of the show.... Is current media time different if the show is live vs. recorded? For recorded, maybe it's time since start of file, for live, maybe it's time of day?? The api docs say that for DVD content, it's time since start, and for others, it's "time" time. Are recorded shows considered DVD?

I also still don't know why when changing live channels, I get a really HUGE number for current time which is way out of limits. I can either come to understand it, or simply mask it.

Last edited by beelzerob; 08-22-2006 at 07:06 PM.
Reply With Quote
  #3  
Old 08-22-2006, 07:15 PM
gplasky's Avatar
gplasky gplasky is offline
SageTVaholic
 
Join Date: Jul 2003
Location: Howell, MI
Posts: 9,203
My understanding was Sage cannot tell the difference between "LiveTV" and "Recorded TV" because it is all recorded. There is no buffer used so it is all "Recorded TV". Maybe Sage doesn't know the true duration of a "LiveTV" program and makes it best guess based on the speed of the data flow. Maybe that's why it might be close but larger. Recorded TV is a known duration. Just guessing.

Gerry
__________________
Big Gerr
_______
Server - WHS 2011: Sage 7.1.9 - 1 x HD Prime and 2 x HDHomeRun - Intel Atom D525 1.6 GHz, Acer Easystore, RAM 4 GB, 4 x 2TB hotswap drives, 1 x 2TB USB ext Clients: 2 x PC Clients, 1 x HD300, 2 x HD-200, 1 x HD-100 DEV Client: Win 7 Ultimate 64 bit - AMD 64 x2 6000+, Gigabyte GA-MA790GP-DS4H MB, RAM 4GB, HD OS:500GB, DATA:1 x 500GB, Pace RGN STB.
Reply With Quote
  #4  
Old 08-22-2006, 07:34 PM
beelzerob beelzerob is offline
Sage Advanced User
 
Join Date: May 2006
Posts: 163
Well, it almost seems like "duration" is simply the total number of seconds of buffered data. Thus, as the live tv continues, the duration is growing because more data is being buffered. However, the current time is still outside of the range from 0 to duration, which makes me think it must be the get time thing listed in the api docs, which is time time.

I'll have to do some experimenting tonight to see if I can figure a rhyme or reason for it.
Reply With Quote
  #5  
Old 08-22-2006, 07:41 PM
stanger89's Avatar
stanger89 stanger89 is offline
SageTVaholic
 
Join Date: May 2003
Location: Marion, IA
Posts: 15,188
IsCurrentMediaFileRecording()

The only difference between LiveTV and a recording, is that it's currently being played, so if the CurrentMediaFile (which is the one playing) is also Recording, then it's Live.
Reply With Quote
  #6  
Old 08-22-2006, 07:49 PM
beelzerob beelzerob is offline
Sage Advanced User
 
Join Date: May 2006
Posts: 163
Dang, I looked at as many of the Is...() functions as I could for that, but I was looking for IsLive() or something similar. That sounds like it'll work.
Reply With Quote
  #7  
Old 08-22-2006, 08:32 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
If I recall correctly, current media time is calendar time, not elapsed time. So if the show started at 8:00 on August 22 and you're 10 minutes into it, current media time is 8/22/06 8:10:00.

Duration by contrast is just what it sounds like: the total number of milliseconds in the recording (which will be increasing if it's still in the process of being recorded*).

So to do an apples-to-apples comparison, you need to subtract start time from current time to get elapsed time before comparing to duration.

* EDIT: I'm assuming we're talking about the duration of the MediaFile here. If you want to know the duration of the show from the EPG, use the AiringAPI instead of the MediaFileAPI.
__________________
-- Greg

Last edited by GKusnick; 08-22-2006 at 08:35 PM.
Reply With Quote
  #8  
Old 08-22-2006, 08:45 PM
Opus4's Avatar
Opus4 Opus4 is offline
Administrator
 
Join Date: Sep 2003
Location: NJ
Posts: 19,624
Quote:
Originally Posted by beelzerob
I also still don't know why when changing live channels, I get a really HUGE number for current time which is way out of limits. I can either come to understand it, or simply mask it.
The default STV seems to get some wierd values for the current playback time when flipping channels once in a while. I'm not entirely certain why either, but it seemed to have been worse when the API calls were made multiple times during a UI update. For the playback OSD, I now try to get the current media file & its info once at the start of the UI chain. The current time in the time bar will also get masked when the value doesn't seem valid -- I think that usually means when it is hugely negative. But, this doesn't hapen very often & is for just a split second when the OSD just happens to catch the channel change in that state. (I had to flip the channel several times to see it happen once.)

Quote:
Originally Posted by stanger89
IsCurrentMediaFileRecording()
Yes, that will work.

- Andy
__________________
SageTV Open Source v9 is available.
- Read the SageTV FAQ. Older PDF User's Guides mostly still apply: SageTV V7.0 & SageTV Studio v7.1.
- Hauppauge remote help: 1) Basics/Extending it 2) Replace it 3) Use it w/o needing focus
- HD Extenders: A) FAQs B) URC MX-700 remote setup
Note: This is a users' forum; see the Rules. For official tech support fill out a Support Request.
Reply With Quote
  #9  
Old 08-22-2006, 09:58 PM
beelzerob beelzerob is offline
Sage Advanced User
 
Join Date: May 2006
Posts: 163
Thanks all for the great info!

I'm certain that when playing either an Imported Library media file, or a recorded tv show, the time starts at 0. I'll have to check this.

Time during a live show to be 8:10 makes sense....but it just doesn't seem to be the case for a recorded show.
Reply With Quote
  #10  
Old 08-23-2006, 12:18 AM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
OK, I went back and checked my code, and you're right, the current media time starts at zero. Calendar time is involved in the calculation somewhere, though, because if start time plus duration does not equal the file revision timestamp, then current media time breaks down and starts taking on nonsensical values. Maybe that's what you're seeing during those channel transitions.
__________________
-- Greg
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


All times are GMT -6. The time now is 09:39 PM.


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