perf(lp): use MicroVideoOffset for samsung

Signed-off-by: Varun Patil <varunpatil@ucla.edu>
pull/563/head
Varun Patil 2023-03-29 17:02:22 -07:00
parent 05cbccceec
commit d8176b93c8
1 changed files with 6 additions and 6 deletions

View File

@ -34,12 +34,7 @@ class LivePhoto
return $exif['MediaGroupUUID']; return $exif['MediaGroupUUID'];
} }
// Samsung JPEG // Google MVIMG and Samsung JPEG
if (\array_key_exists('EmbeddedVideoType', $exif) && str_contains($exif['EmbeddedVideoType'], 'MotionPhoto')) {
return 'self__embeddedvideo';
}
// Google MVIMG
if (\array_key_exists('MicroVideoOffset', $exif) && ($videoLength = $exif['MicroVideoOffset']) > 0) { if (\array_key_exists('MicroVideoOffset', $exif) && ($videoLength = $exif['MicroVideoOffset']) > 0) {
// As explained in the following issue, // As explained in the following issue,
// https://github.com/pulsejet/memories/issues/468 // https://github.com/pulsejet/memories/issues/468
@ -51,6 +46,11 @@ class LivePhoto
// since exiftool can extract the video from the trailer, // since exiftool can extract the video from the trailer,
// but explicitly specifying the offset is much faster because // but explicitly specifying the offset is much faster because
// we don't need to spawn exiftool to read the video file. // we don't need to spawn exiftool to read the video file.
//
// For Samsung JPEG, we can also check for EmbeddedVideoType
// and subsequently extract the video file using the
// EmbeddedVideoFile binary prop, but setting the offset
// is faster for the same reason mentioned above.
$videoOffset = $file->getSize() - $videoLength; $videoOffset = $file->getSize() - $videoLength;
return "self__traileroffset={$videoOffset}"; return "self__traileroffset={$videoOffset}";