Live Photos: Default to MP4 for Google HVC1 Motion Photos Playback #3814
Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
parent
6a452bcf43
commit
8975c781c5
3 changed files with 7 additions and 12 deletions
|
@ -69,32 +69,28 @@ func (info Info) VideoBitrate() float64 {
|
|||
// VideoContentType composes the video content type from its mime type and codec.
|
||||
func (info Info) VideoContentType() string {
|
||||
if info.VideoMimeType == "" {
|
||||
return ""
|
||||
return ContentTypeDefault
|
||||
}
|
||||
|
||||
return ContentType(info.VideoMimeType, info.VideoCodec)
|
||||
}
|
||||
|
||||
// VideoFileExt returns the appropriate video file extension based on the mime type, if any.
|
||||
// VideoFileExt returns the appropriate video file extension based on the mime type and defaults to fs.ExtMP4 otherwise.
|
||||
func (info Info) VideoFileExt() string {
|
||||
switch info.VideoMimeType {
|
||||
case fs.MimeTypeMP4:
|
||||
return fs.ExtMP4
|
||||
case fs.MimeTypeMOV:
|
||||
return fs.ExtMOV
|
||||
default:
|
||||
return ""
|
||||
return fs.ExtMP4
|
||||
}
|
||||
}
|
||||
|
||||
// VideoFileType returns the video type based on the mime type, if any.
|
||||
// VideoFileType returns the video type based on the mime type and defaults to fs.VideoMP4 otherwise.
|
||||
func (info Info) VideoFileType() fs.Type {
|
||||
switch info.VideoMimeType {
|
||||
case fs.MimeTypeMP4:
|
||||
return fs.VideoMP4
|
||||
case fs.MimeTypeMOV:
|
||||
return fs.VideoMOV
|
||||
default:
|
||||
return fs.TypeUnknown
|
||||
return fs.VideoMP4
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,6 +94,7 @@ func Probe(file io.ReadSeeker) (info Info, err error) {
|
|||
if CompatibleBrands.ContainsAny(video.CompatibleBrands) {
|
||||
info.Compatible = true
|
||||
info.VideoType = MP4
|
||||
info.VideoMimeType = fs.MimeTypeMP4
|
||||
info.FPS = 30.0 // TODO: Detect actual frames per second!
|
||||
|
||||
if info.VideoOffset > 0 {
|
||||
|
@ -107,8 +108,6 @@ func Probe(file io.ReadSeeker) (info Info, err error) {
|
|||
|
||||
// Check major brand.
|
||||
switch video.MajorBrand {
|
||||
case ChunkMP41.Get(), ChunkMP42.Get():
|
||||
info.VideoMimeType = fs.MimeTypeMP4
|
||||
case ChunkQT.Get():
|
||||
info.VideoType = MOV
|
||||
info.VideoMimeType = fs.MimeTypeMOV
|
||||
|
|
|
@ -119,7 +119,7 @@ func TestProbeFile(t *testing.T) {
|
|||
assert.Equal(t, int64(-1), info.ThumbOffset)
|
||||
assert.Equal(t, media.Video, info.MediaType)
|
||||
assert.Equal(t, CodecUnknown, info.VideoCodec)
|
||||
assert.Equal(t, "", info.VideoContentType())
|
||||
assert.Equal(t, ContentTypeDefault, info.VideoContentType())
|
||||
assert.Equal(t, "", info.VideoMimeType)
|
||||
assert.Equal(t, "0s", info.Duration.String())
|
||||
assert.Equal(t, 0, info.Tracks)
|
||||
|
|
Loading…
Reference in a new issue