@@ -7,70 +7,63 @@ import (
77)
88
99var _ = Describe ("getMotionPhoto" , func () {
10- It ("maps the current MotionPhoto XMP scheme (container item length) " , func () {
10+ It ("maps the current MotionPhoto XMP scheme" , func () {
1111 mp := Tika {}.getMotionPhoto (map [string ][]string {
12- "Camera:MotionPhotoVersion" : {"1" },
13- "Camera:MotionPhotoPresentationTimestampUs" : {"1500000" },
14- "xmp-raw:Container:Directory[2]/Container:Item/Item:Semantic" : {"MotionPhoto" },
15- "xmp-raw:Container:Directory[2]/Container:Item/Item:Length" : {"1048576" },
16- })
12+ "Camera:MotionPhoto" : {"1" },
13+ "Camera:MotionPhotoVersion" : {"1" },
14+ "Camera:MotionPhotoPresentationTimestampUs" : {"1500000" },
15+ }, map [string ][]string {"Content-Length" : {"1048576" }, "Content-Type" : {"video/mp4" }})
1716 Expect (mp ).ToNot (BeNil ())
1817 Expect (mp .Version ).To (Equal (libregraph .PtrInt32 (1 )))
1918 Expect (mp .PresentationTimestampUs ).To (Equal (libregraph .PtrInt64 (1500000 )))
2019 Expect (mp .VideoSize ).To (Equal (libregraph .PtrInt64 (1048576 )))
2120 })
2221
23- It ("maps the legacy MicroVideo XMP scheme (offset is the length) " , func () {
22+ It ("maps the legacy MicroVideo XMP scheme" , func () {
2423 mp := Tika {}.getMotionPhoto (map [string ][]string {
24+ "Camera:MicroVideo" : {"1" },
2525 "Camera:MicroVideoVersion" : {"1" },
2626 "Camera:MicroVideoPresentationTimestampUs" : {"1500000" },
27- "Camera:MicroVideoOffset" : {"2097152" },
28- })
27+ }, map [string ][]string {"Content-Length" : {"1048576" }, "Content-Type" : {"video/mp4" }})
2928 Expect (mp ).ToNot (BeNil ())
3029 Expect (mp .Version ).To (Equal (libregraph .PtrInt32 (1 )))
3130 Expect (mp .PresentationTimestampUs ).To (Equal (libregraph .PtrInt64 (1500000 )))
32- Expect (mp .VideoSize ).To (Equal (libregraph .PtrInt64 (2097152 )))
31+ Expect (mp .VideoSize ).To (Equal (libregraph .PtrInt64 (1048576 )))
3332 })
3433
35- It ("drops the facet without a video size " , func () {
34+ It ("drops the facet when the video reports no length " , func () {
3635 Expect (Tika {}.getMotionPhoto (map [string ][]string {
36+ "Camera:MotionPhoto" : {"1" },
3737 "Camera:MotionPhotoVersion" : {"1" },
38- })).To (BeNil ())
38+ }, map [ string ][] string { "Content-Type" : { "video/mp4" }} )).To (BeNil ())
3939 })
4040
41- It ("returns nil when no motion photo metadata is present " , func () {
42- Expect (Tika {}.getMotionPhoto (map [string ][]string {})).To (BeNil ())
41+ It ("returns nil without the marker, a picture may just carry a video " , func () {
42+ Expect (Tika {}.getMotionPhoto (map [string ][]string {}, map [ string ][] string { "Content-Length" : { "1048576" }, "Content-Type" : { "video/mp4" }} )).To (BeNil ())
4343 })
4444
4545 It ("treats a zero MotionPhoto marker as a still image" , func () {
4646 Expect (Tika {}.getMotionPhoto (map [string ][]string {
4747 "Camera:MotionPhoto" : {"0" },
4848 "Camera:MotionPhotoVersion" : {"1" },
49- "xmp-raw:Container:Directory[2]/Container:Item/Item:Semantic" : {"MotionPhoto" },
50- "xmp-raw:Container:Directory[2]/Container:Item/Item:Length" : {"1048576" },
51- })).To (BeNil ())
49+ }, map [string ][]string {"Content-Length" : {"1048576" }, "Content-Type" : {"video/mp4" }})).To (BeNil ())
5250 Expect (Tika {}.getMotionPhoto (map [string ][]string {
53- "Camera:MicroVideo" : {"0" },
54- "Camera:MicroVideoOffset" : {"2097152" },
55- })).To (BeNil ())
51+ "Camera:MicroVideo" : {"0" },
52+ }, map [string ][]string {"Content-Length" : {"1048576" }, "Content-Type" : {"video/mp4" }})).To (BeNil ())
5653 })
5754
5855 It ("treats undefined marker values as a still image" , func () {
5956 Expect (Tika {}.getMotionPhoto (map [string ][]string {
6057 "Camera:MotionPhoto" : {"2" },
61- "xmp-raw:Container:Directory[2]/Container:Item/Item:Semantic" : {"MotionPhoto" },
62- "xmp-raw:Container:Directory[2]/Container:Item/Item:Length" : {"1048576" },
63- })).To (BeNil ())
58+ }, map [string ][]string {"Content-Length" : {"1048576" }, "Content-Type" : {"video/mp4" }})).To (BeNil ())
6459 })
6560
6661 It ("prefers the current scheme when both are present" , func () {
6762 mp := Tika {}.getMotionPhoto (map [string ][]string {
68- "Camera:MotionPhotoVersion" : {"2" },
69- "Camera:MicroVideoVersion" : {"1" },
70- "Camera:MicroVideoOffset" : {"2097152" },
71- "xmp-raw:Container:Directory[2]/Container:Item/Item:Semantic" : {"MotionPhoto" },
72- "xmp-raw:Container:Directory[2]/Container:Item/Item:Length" : {"1048576" },
73- })
63+ "Camera:MotionPhoto" : {"1" },
64+ "Camera:MotionPhotoVersion" : {"2" },
65+ "Camera:MicroVideoVersion" : {"1" },
66+ }, map [string ][]string {"Content-Length" : {"1048576" }, "Content-Type" : {"video/mp4" }})
7467 Expect (mp ).ToNot (BeNil ())
7568 Expect (mp .Version ).To (Equal (libregraph .PtrInt32 (2 )))
7669 Expect (mp .VideoSize ).To (Equal (libregraph .PtrInt64 (1048576 )))
0 commit comments