Skip to content

Even more `mlv_play` improvements

Bitbucket Importer requested to merge branch/mlv_play into branch/unified

Created originally on Bitbucket by ayshih (Albert Shih)

1) Improved performance for exact playback of large MLV files

The structure format for each entry in the MLV XREF block (used in IDX files) is revised so that it stores whether that entry points to a VIDF frame or an AUDF frame. New format, with frameType:

typedef struct {
    uint16_t    fileNumber;    /* the logical file number as specified in header */
    uint8_t     empty;    /* for future use. set to zero. */
    uint8_t     frameType;    /* MLV_FRAME_VIDF(1) for VIDF, MLV_FRAME_AUDF(2) for AUDF, MLV_FRAME_UNSPECIFIED(0) otherwise */
    uint64_t    frameOffset;    /* the file offset at which the frame is stored (VIDF/AUDF) */
} PACKED mlv_xref_t;

With this change, it becomes possible to skip VIDF frames during exact playback (in mlv_play) without needing to read the block headers again. Excessive reading of block headers was causing playback performance to slow down significantly and even stall for large MLV files. See http://www.magiclantern.fm/forum/index.php?topic=7122.msg124827#msg124827 for more details.

The size of the XREF structure is unchanged, so this change does not break old IDX files for uses other than exact playback. Exact playback, however, won't be able to recognize which frames are skippable, so on-camera IDX files will need to be deleted and re-created.

2) Black level for MLV playback

MLV playback was not using the black level stored in the MLV metadata. On the 50D, this would result in a magenta cast (until after a RAW file was opened, which would set the black level appropriately). This may be the cast referred to in 1c92c304c7c8. Of course, whether this fix will make things look right on other cameras depends on whether the correct black level is stored (cf. pull request #484 (closed)).

3) Replayed a just-played video

Previously, after playing a video, there was no convenient way to play the just-played video again (see also http://www.magiclantern.fm/forum/index.php?topic=9062.msg126664#msg126664). Now, the playback is essentially looped, but put into a paused state after the video finishes. To replay the just-played video, you select the "|>" (play) item on the OSD menu.

4) Minor improvements

  • Pausing during exact playback didn't stop the timer from increasing the number of frames to skip
  • It was possible to close the menu while the menu was waiting for delete confirmation, which put the menu in an odd state and allowed for deleting with the menu hidden.
  • PLAY button now does what "||"/"|>" in the OSD menu does
  • OSD menu defaults to play/pause when initially opened
  • Help text updated

Merge request reports