Opened 6 years ago

Closed 5 years ago

Last modified 4 years ago

#11713 closed Developer Task (Fixed)

add mythical bookmark at the scheduled start of programme (to automatically skip preroll)

Reported by: Karl Egly Owned by: Jim Stichnoth
Priority: minor Milestone: 0.28
Component: MythTV - Recording Version: Unspecified
Severity: medium Keywords:
Cc: Ticket locked: no

Description (last modified by Karl Egly)

As there may be or not be soft padding applied to recordings it would be nice to be able to start watching recordings at the scheduled beginning of the programme.

http://irc.mythtv.org/ircLog/channel/4/2013-07-29:18:34/2013-07-29:18:54

(I don't know that area of the code base. So if anyone else gets to it first that's fine.)

Attachments (3)

11713_v1.patch (32.9 KB) - added by Jim Stichnoth 5 years ago.
11713_v2.patch (31.3 KB) - added by Jim Stichnoth 5 years ago.
Rename preroll==>progstart, and playpos==>lastplaypos.
0001-Add-utility-function-to-clear-all-bookmarks.patch (3.1 KB) - added by Karl Egly 4 years ago.
proof of concept (compile tested) implementing the suggestion from the mailing list discussion

Download all attachments as: .zip

Change History (18)

comment:1 Changed 5 years ago by Karl Egly

Milestone: 0.27.20.27.5

comment:2 Changed 5 years ago by Karl Egly

Description: modified (diff)

comment:4 Changed 5 years ago by Jim Stichnoth

Owner: changed from Karl Egly to Jim Stichnoth
Status: newaccepted

After some more thought, here's the current plan.

Add a new value MARK_UTIL_PREROLL to MarkTypes?.

RecorderBase::SavePositionMap?() writes this mark as soon as it encounters a keyframe close to the recording's scheduled start time.

The frontend PBB starts playback from this keyframe if the user selects Play and there is no explicit bookmark (but not if the user selects one of the "Play from..." menu items).

I also want another "utility mark" mechanism:

Add a new value MARK_UTIL_PLAYPOS to MarkTypes?.

The TV class (tv_play.cpp) adds a timer event that auto-saves the current playback frame with this mark type every 30 seconds. The actual saving is done in a background thread to avoid playback glitches.

The "Play from..." menu gets a new item:

Play from last played position

If you accidentally exit playback without setting a bookmark (or mythfrontend crashes, or the OS crashes, or ...), this allows you to resume roughly where you left off.

Changed 5 years ago by Jim Stichnoth

Attachment: 11713_v1.patch added

comment:5 Changed 5 years ago by Jim Stichnoth

I'll be trying out 11713_v1.patch for several days before committing. Other testers/feedback appreciated.

Changed 5 years ago by Jim Stichnoth

Attachment: 11713_v2.patch added

Rename preroll==>progstart, and playpos==>lastplaypos.

comment:6 Changed 5 years ago by Jim Stichnoth <jstichnoth@…>

In c13b8361627f971cef10d47eb52445157f23eff6/mythtv:

Add utility marks for preroll amount and latest playback position.

Program start:

The recorder writes a mark of the new type MARK_UTIL_PROGSTART as soon
as it encounters a keyframe close to the recording's scheduled start
time. This essentially skips past the preroll region and the "start
early" region.

The frontend starts playback from this keyframe if the user selects
Play and there is no explicit bookmark (but not if the user selects
one of the "Play from..." menu items).

Playback position:

During playback, a timer event auto-saves the current playback frame
with the new MARK_UTIL_LASTPLAYPOS mark type, every 30 seconds. The
actual saving is done in a background thread to avoid playback
glitches. Saving is done only during active playback, i.e. not while
paused. The MARK_UTIL_LASTPLAYPOS mark is tidied up (cleared) if the
user saves a bookmark while exiting playback.

The "Play from..." menu gets a new item (a new translatable string):

Play from last played position

This item is added to the menu only when the recording markup actually
contains a MARK_UTIL_LASTPLAYPOS mark.

The motivation of MARK_UTIL_LASTPLAYPOS is that if you accidentally
exit playback without setting a bookmark (or the frontend crashes, or
the OS crashes, or ...), this allows you to resume roughly where you
left off. Because of the 30-second timer, if you start playing
normally and realize you've made a mistake, you have 30 seconds to
exit playback and instead "Play from last played position".

Note that different frontends can fight over setting this mark, same
as with a regular bookmark.

Still to do:

  1. Preview generator can do less guessing about preroll.
  2. Provide MythVideo? launcher with similar progstart/lastplaypos options.

Refs #11713.

comment:7 Changed 5 years ago by Jim Stichnoth

Resolution: Fixed
Status: acceptedclosed

comment:8 Changed 5 years ago by Jim Stichnoth

comment:9 Changed 5 years ago by Jim Stichnoth

comment:10 Changed 5 years ago by Jim Stichnoth <jstichnoth@…>

In 38443b8e6a306335d0dabe434ba4e983a62fd056/mythtv:

Turn off LastPlayPos? loading by default. Refs #11713.

In the way things were set up originally, by default any playback
would check for bookmark, progstart mark, or lastplaypos mark, and
start playback from there, unless any or all of these had been
explicitly disallowed. This was fine for playback from the Watch
Recordings screen, which would always explicitly set each permission.

It was not so good for other forms of playback, such as from
MythVideo?, mythavtest, or Gallery, since they would all favor
lastplaypos, which is periodically updated for all playback.

As a result, lastplaypos is changed to be disallowed by default.

This is not really relevant to the progstart mark, since it is only
present for recordings (though it could become a minor issue if a
recording and its metadata are imported into MythVideo?).

comment:11 Changed 5 years ago by Jim Stichnoth <jstichnoth@…>

In e2e9b1e1d60d5d6e851b972fd0c360844032c53a/mythtv:

Ignore the progstart mark when a cutlist is present. Refs #11713.

If the user has gone to the trouble of creating a cutlist, then they
have surely already trimmed any soft padding at the beginning, so we
shouldn't try to outguess them.

comment:12 Changed 5 years ago by Jim Stichnoth

Milestone: 0.27.50.28

comment:13 Changed 4 years ago by J.Pilk@…

I hadn't rebuilt master since the qt5 switch, so hadn't noticed this.

I cut most of my recordings with the intention of letting me see the parts I want. Now playback starts two minutes late. That is the duration of my specified pre-roll. For me the scheduled start time is rarely a good guide to reality.

My cutting script clears the cutlist and marks its output as transcoded; I believe that the 'lossless' mythtranscode does the same. If this commit is still thought useful it ought to be disabled for cases like that.

http://www.gossamer-threads.com/lists/mythtv/users/588641#588641

Changed 4 years ago by Karl Egly

proof of concept (compile tested) implementing the suggestion from the mailing list discussion

comment:14 Changed 4 years ago by J.Pilk@…

Yes, that patch and its explanation look good and likely to let me solve the late-start-of-playback effect I'm seeing with output from my current mythDVBcut script. I'm afraid I don't see my way to testing it anytime soon, though. No experience yet in *buntu builds - nor with recent master and el7 clones.

Thanks.

comment:15 Changed 4 years ago by Karl Dietz <dekarl@…>

In d231e4636908fb814a9b1d90d18c4b902e2c7f6c/mythtv:

Add utility function to clear all bookmarks.

Clears the mythical bookmark around the start of the programme,
the last playback position and manually set bookmarks.
Its intended use case is cleanup when the recording file has changed in
a way that makes the bookmarks useless.

Refs #11713

Note: See TracTickets for help on using tickets.