[WiP] - Timeshifting in a single looping .ts file

Discussion in 'Submit: code patches (MediaPortal/TV-Server/etc.)' started by dvdfreak, February 6, 2011.

  1. dvdfreak

    dvdfreak Portal Pro

    Joined:
    June 13, 2006
    Messages:
    979
    Likes Received:
    178
    Ratings:
    +178 / 0
    Home Country:
    Belgium Belgium
    I want to propose a new .tshift format, similar to the existing .tsbuffer format, but with one big difference: timeshifting takes place in a single .ts file instead of a list of (by default) four files.



    The format of this .tshift file is the following:

    1. First 8 bytes: 64-bit pointer to the current live-position (where the server is writing)
    2. Next 4 bytes: a 32-bit integer counting the number of times the file has looped/wrapped (starting at 0)
    3. Rest of the file: a Unicode filepath to the .ts file used (zero terminated, any path is ignored, file is in the same directory as the .tshift file)
    As you can see: simple and straightforward.

    The server writes to the .ts file and keeps the .tshift file up to date with the current position and wrapped-counter. When the server reaches the end of the file, the counter is incremented and the writing continues at the start of the same file.

    What I'd like to upload first is the required patches to TsReader.ax and MediaPortal itself, so handle the client-side of this new format.

    Note that the only reason I had to patch MP itself is to simply make sure .tshift files were recognized as live TV files and properly forwarded to tsreader. All the real logic is in tsreader itself.

    Also note that there's still a small zapping issue, but we're look at that... Disaster123 is looking at the tswriter side of things, which he can add to this thread too I guess :)

    Finally, what I uploaded does NOT work stand-alone yet. I have an internal For The Record build that writes out the new .tshift format, and disaster123 is working on tswriter...
     

    Attached Files:

    • Like Like x 12
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. disaster123
    • Premium Supporter

    disaster123 MP Donator

    Joined:
    May 14, 2008
    Messages:
    3,546
    Likes Received:
    417
    Ratings:
    +431 / 2
    Home Country:
    Germany Germany
    AW: Timeshifting in a single looping .ts file

    I will post the tswriter / tvserver patches tonight. ATM I'm busy with family stuff.
     
    • Like Like x 4
  4. tourettes
    • Premium Supporter

    tourettes Retired Team Member

    Joined:
    January 7, 2005
    Messages:
    17,301
    Likes Received:
    4,595
    Ratings:
    +4,810 / 3
    Please provide the source code changes as patch files. It will be much easier to work with those (and it is one of the requrement :)).

    Also mpfilewriter needs to be parched as well.
     
  5. Ponyriemen
    • Premium Supporter

    Ponyriemen MP Donator

    Joined:
    July 9, 2007
    Messages:
    2,570
    Likes Received:
    111
    Gender:
    Male
    Location:
    /root/home
    Ratings:
    +111 / 0
    Home Country:
    Germany Germany
    AW: Timeshifting in a single looping .ts file

    does this work with Version 1.1.2 too?
     
  6. miroslav22
    • Premium Supporter

    miroslav22 Development Group Member

    Joined:
    September 4, 2009
    Messages:
    703
    Likes Received:
    459
    Gender:
    Male
    Location:
    Warwick
    Ratings:
    +459 / 0
    Home Country:
    United Kingdom United Kingdom
    Re: AW: Timeshifting in a single looping .ts file

    I would think it will be ok. I don't think there's been any other major changes in tsreader from 1.1.2 -> 1.2.0 Alpha

    Edit: sorry no ignore me, another version will have to be compiled as there's more changes than just in tsreader
     
    • Like Like x 1
  7. disaster123
    • Premium Supporter

    disaster123 MP Donator

    Joined:
    May 14, 2008
    Messages:
    3,546
    Likes Received:
    417
    Ratings:
    +431 / 2
    Home Country:
    Germany Germany
    AW: Timeshifting in a single looping .ts file

    At least the tvserver patched will only work with SVN. So no 1.1.2 support here.

    tourettes
    Should the patch then include miroslav patch or should it work? It won't work without.
     
  8. FreakyJ
    • Team MediaPortal

    FreakyJ Development Group

    Joined:
    July 25, 2010
    Messages:
    4,021
    Likes Received:
    839
    Gender:
    Male
    Ratings:
    +1,424 / 1
    Home Country:
    Germany Germany
    AW: Timeshifting in a single looping .ts file

    Just one question: Can you say something about the behavior with very big files? The reason is that I have a very long timeshifting period.

    Details:
    Minimum: 6 files
    Maximum: 30 files
    filesize: 600MB

    the result: ~18GB (600MB*30files) for paused live Tv and ~ 3,6GB (600MB * 6files) for normal live Tv.
    The normal live Tv should be no problem, but a file of 18GB will maybe...
    I'm using NTFS so the file size itself shouldn't be a problem (NTFS.com NTFS vs FAT32 FAT64 exFAT FAT. Comparing. Performance.), I'm more worried about things like the time which is needed to open the file or to preallocate the file.

    Another point is how you manage the current difference between "watching live Tv" and "paused live Tv" (see "Minumum" & "Maximum" in the wiki: Timeshifting - MediaPortal Wiki)

    Maybe you could give me some details on the points mentioned above, would be very kind of you =)
     
  9. miroslav22
    • Premium Supporter

    miroslav22 Development Group Member

    Joined:
    September 4, 2009
    Messages:
    703
    Likes Received:
    459
    Gender:
    Male
    Location:
    Warwick
    Ratings:
    +459 / 0
    Home Country:
    United Kingdom United Kingdom
    Hi,

    When a file is pre-allocated nothing is actually written to it, the space is only reserved on the disk. This is generally pretty quick even for a very large file.

    The drawback of a single file is you lose the flexibility of being able to leave it paused for a longer duration then the file length.
     
  10. SilentException
    • Premium Supporter

    SilentException Retired Team Member

    Joined:
    October 27, 2008
    Messages:
    2,617
    Likes Received:
    1,125
    Gender:
    Male
    Location:
    Rijeka, Croatia
    Ratings:
    +1,129 / 0
    Home Country:
    Croatia Croatia
    If I understand this correctly, currently if maximum files is reached, we loose live data instead of old data. So for example if we paused live TV on a movie and wen't away for quite some time, when we resumed, movie would resume up to the point where we started to loose live data. I don't know how important this feature is or even if it's a bug or feature but you should keep this in mind while working on single looping ts file :)
     
  11. FreakyJ
    • Team MediaPortal

    FreakyJ Development Group

    Joined:
    July 25, 2010
    Messages:
    4,021
    Likes Received:
    839
    Gender:
    Male
    Ratings:
    +1,424 / 1
    Home Country:
    Germany Germany
    AW: Timeshifting in a single looping .ts file

    SilentException
    You are right =) And due to my opinion it is a feature rather than a bug^^ Because if I pause Live Tv I *want* to watch it later on and don't care about the live program 5 hours after this point...

    And you can get another error, an short example:

    Situation:
    - The size of your timeshift buffer is big enough for 3 hours
    - you pause your live tv
    - you are away for > 3 hours (maybe 4^^)

    Now (4 hours after pauseing live tv) you press play again, what would be the behavior of MP in this situation with a single timeshift buffer file?
    My expected behavior would be that MP continuous at the old position (like it is now).
    Another one would be to jump to the latest available point (not so nice, because I had a reason to pause live tv => want to watch it later)

    The result is that you have to stop timeshifting if live tv is paused & the buffer full :p
     
Loading...

Users Viewing Thread (Users: 0, Guests: 0)

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice
  • About The Project

    The vision of the MediaPortal project is to create a free open source media centre application, which supports all advanced media centre functions, and is accessible to all Windows users.

    In reaching this goal we are working every day to make sure our software is one of the best.

             

  • Support MediaPortal!

    The team works very hard to make sure the community is running the best HTPC-software. We give away MediaPortal for free but hosting and software is not for us.

    Care to support our work with a few bucks? We'd really appreciate it!