github.com/boki/go-xmp@v1.0.1/models/qt/qt_userdata.go (about) 1 // Copyright (c) 2017-2018 Alexander Eichhorn 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"): you may 4 // not use this file except in compliance with the License. You may obtain 5 // a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 // License for the specific language governing permissions and limitations 13 // under the License. 14 15 package qt 16 17 import ( 18 "fmt" 19 "trimmer.io/go-xmp/xmp" 20 ) 21 22 // QuickTime User Data as written by the "udta" handler using FourCC atom names. 23 // © \251 \xA9 Tags are multi-language versions 24 // 25 // Tag ID's beginning with the copyright symbol (hex 0xa9) are multi-language text. 26 // 27 // https://developer.apple.com/library/content/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html 28 type QtUserdata struct { 29 // Quicktime tags exported on MacOS 10.11 SDK (some also used by iTunes) 30 Album string `qt:"©alb" xmp:"qt:Album"` // QT, iTunes 31 Arranger string `qt:"©arg" xmp:"qt:Arranger"` // QT, iTunes 32 Artist string `qt:"©ART" xmp:"qt:Artist"` // QT, iTunes 33 Author string `qt:"©aut" xmp:"qt:Author"` // QT, iTunes 34 Chapter string `qt:"©chp" xmp:"qt:Chapter"` // QT-only 35 Comment string `qt:"©cmt" xmp:"qt:Comment"` // QT, iTunes 36 Composer string `qt:"©com" xmp:"qt:Composer"` // QT-only 37 Copyright string `qt:"©cpy" xmp:"qt:Copyright"` // QT-only 38 ReleaseDate xmp.Date `qt:"©day" xmp:"qt:ReleaseDate"` // QT, iTunes 39 Description string `qt:"©des" xmp:"qt:Description"` // QT, iTunes 40 Director string `qt:"©dir" xmp:"qt:Director"` // QT, iTunes 41 Disclaimer string `qt:"©dis" xmp:"qt:Disclaimer"` // QT-only 42 EncodedBy string `qt:"©enc" xmp:"qt:EncodedBy"` // QT, iTunes 43 Title string `qt:"©nam" xmp:"qt:Title"` // QT, iTunes 44 GenreName string `qt:"©gen" xmp:"qt:GenreName"` // QT, iTunes 45 HostComputer string `qt:"©hst" xmp:"qt:HostComputer"` // QT-only 46 Information string `qt:"©inf" xmp:"qt:Information"` // QT-only 47 Keywords string `qt:"©key" xmp:"qt:Keywords"` // QT-only 48 FileCreator string `qt:"©mak" xmp:"qt:FileCreator"` // QT, iTunes (RecordCompany) 49 FileCreatorModel string `qt:"©mod" xmp:"qt:FileCreatorModel"` // QT-only 50 OriginalArtist string `qt:"©ope" xmp:"qt:OriginalArtist"` // iTunes 51 FileFormat string `qt:"©fmt" xmp:"qt:FileFormat"` // QT-only 52 Credits string `qt:"©src" xmp:"qt:Credits"` // QT, iTunes 53 Performer string `qt:"©prf" xmp:"qt:Performer"` // QT, iTunes 54 Producer string `qt:"©prd" xmp:"qt:Producer"` // QT, iTunes 55 Publisher string `qt:"©pub" xmp:"qt:Publisher"` // QT, iTunes 56 Product string `qt:"©PRD" xmp:"qt:Product"` // QT-only 57 FileCreatorSoftware string `qt:"©swr" xmp:"qt:FileCreatorSoftware"` // QT-only 58 PlaybackRequirements string `qt:"©req" xmp:"qt:PlaybackRequirements"` // QT-only 59 Track string `qt:"©trk" xmp:"qt:Track"` // QT-only 60 CopyWarning string `qt:"©wrn" xmp:"qt:CopyWarning"` // QT-only 61 Writer string `qt:"©wrt" xmp:"qt:Writer"` // QT, iTunes (Composer) 62 Url xmp.Url `qt:"©url" xmp:"qt:Url"` // QT, iTunes (Online Extras) 63 LocationGPS *Location `qt:"©xyz" xmp:"qt:LocationGPS"` // GPS latitude+longitude+altitude 64 TrackName string `qt:"tnam" xmp:"qt:TrackName"` // QT-only 65 PhonogramRights string `qt:"©phg" xmp:"qt:PhonogramRights"` // QT, iTunes 66 DisplayName string `qt:"name" xmp:"qt:DisplayName"` // QT-only 67 TaggedCharacteristic string `qt:"tagc" xmp:"qt:TaggedCharacteristic"` // QT, ISO 68 69 // QT only (administrative metadata) 70 AudioBookReleaseDate xmp.Date `qt:"rldt" xmp:"qt:AudioBookReleaseDate"` 71 ClipFileName string `qt:"clfn" xmp:"qt:ClipFileName"` 72 ClipID string `qt:"clid" xmp:"qt:ClipID"` 73 ContentDistributorID string `qt:"cdis" xmp:"qt:ContentDistributorID"` 74 ContentID string `qt:"ccid" xmp:"qt:ContentID"` 75 CreationDate xmp.Date `qt:"date" xmp:"qt:CreationDate"` 76 Grouping string `qt:"©grp" xmp:"qt:Grouping"` 77 GUID string `qt:"GUID" xmp:"qt:GUID"` 78 ISRCCode string `qt:"©isr" xmp:"qt:ISRCCode"` 79 80 // QT only (descriptive metadata) 81 AlbumArtist string `qt:"albr" xmp:"qt:AlbumArtist"` 82 Angle string `qt:"angl" xmp:"qt:Angle"` 83 ArrangerKeywords string `qt:"©ark" xmp:"qt:ArrangerKeywords"` 84 AudibleTags string `qt:"tags" xmp:"qt:AudibleTags"` 85 CameraID string `qt:"cmid" xmp:"qt:CameraID"` 86 CameraManufacturer string `qt:"manu" xmp:"qt:CameraManufacturer"` 87 CameraModel string `qt:"modl" xmp:"qt:CameraModel"` 88 CameraName string `qt:"cmnm" xmp:"qt:CameraName"` 89 CameraSerialNumber string `qt:"slno" xmp:"qt:CameraSerialNumber"` 90 ChapterList string `qt:"chpl" xmp:"qt:ChapterList"` 91 ComposerKeywords string `qt:"©cok" xmp:"qt:ComposerKeywords"` 92 Edit1 string `qt:"©ed1" xmp:"qt:Edit1"` 93 Edit2 string `qt:"©ed2" xmp:"qt:Edit2"` 94 Edit3 string `qt:"©ed3" xmp:"qt:Edit3"` 95 Edit4 string `qt:"©ed4" xmp:"qt:Edit4"` 96 Edit5 string `qt:"©ed5" xmp:"qt:Edit5"` 97 Edit6 string `qt:"©ed6" xmp:"qt:Edit6"` 98 Edit7 string `qt:"©ed7" xmp:"qt:Edit7"` 99 Edit8 string `qt:"©ed8" xmp:"qt:Edit8"` 100 Edit9 string `qt:"©ed9" xmp:"qt:Edit9"` 101 FileCreatorModel2 string `qt:"©mdl" xmp:"qt:FileCreatorModel2"` 102 FileCreatorUrl xmp.Url `qt:"©mal" xmp:"qt:FileCreatorUrl"` 103 Lyrics string `qt:"©lyr" xmp:"qt:Lyrics"` // QT, iTunes 104 LyricsUrl xmp.Url `qt:"lrcu" xmp:"qt:LyricsUrl"` // iTunes 105 OriginalFormat string `qt:"orif" xmp:"qt:OriginalFormat"` 106 OriginalSource string `qt:"oris" xmp:"qt:OriginalSource"` 107 PerformerKeywords string `qt:"©prk" xmp:"qt:PerformerKeywords"` 108 PerformerUrl xmp.Url `qt:"©prl" xmp:"qt:PerformerUrl"` 109 ProducerKeywords string `qt:"©pdk" xmp:"qt:ProducerKeywords"` 110 ProductVersion string `qt:"VERS" xmp:"qt:ProductVersion"` 111 RecordLabelName string `qt:"©lab" xmp:"qt:RecordLabelName"` 112 RecordLabelUrl xmp.Url `qt:"©lal" xmp:"qt:RecordLabelUrl"` 113 Reel string `qt:"reel" xmp:"qt:Reel"` 114 Scene string `qt:"scen" xmp:"qt:Scene"` 115 Shot string `qt:"shot" xmp:"qt:Shot"` 116 SongWriter string `qt:"©swf" xmp:"qt:SongWriter"` 117 SongWriterKeywords string `qt:"©swk" xmp:"qt:SongWriterKeywords"` 118 Subtitle string `qt:"©snm" xmp:"qt:Subtitle"` 119 SubtitleKeywords string `qt:"©snk" xmp:"qt:SubtitleKeywords"` 120 Synopsis string `qt:"ldes" xmp:"qt:Synopsis"` 121 TitleKeywords string `qt:"©nak" xmp:"qt:TitleKeywords"` 122 123 // QT mdta (not in official udta, but has FourCC code) 124 CoverArt string `qt:"covr" xmp:"qt:CoverArt"` 125 CollectionUser string `qt:"coll" xmp:"qt:CollectionUser"` 126 UserRating string `qt:"rtng" xmp:"qt:UserRating"` 127 RecordingYear int `qt:"yrrc" xmp:"qt:RecordingYear"` 128 129 // QT only (technical metadata) 130 ApertureMode string `qt:"apmd" xmp:"qt:ApertureMode"` 131 FlightPitch float64 `qt:"©fpt" xmp:"qt:FlightPitch"` 132 FlightRoll float64 `qt:"©frl" xmp:"qt:FlightRoll"` 133 FlightSpeedX float64 `qt:"©xsp" xmp:"qt:FlightSpeedX"` 134 FlightSpeedY float64 `qt:"©ysp" xmp:"qt:FlightSpeedY"` 135 FlightSpeedZ float64 `qt:"©zsp" xmp:"qt:FlightSpeedZ"` 136 FlightYaw float64 `qt:"©fyw" xmp:"qt:FlightYaw"` 137 GimbalPitch float64 `qt:"©gpt" xmp:"qt:GimbalPitch"` 138 GimbalRoll float64 `qt:"©grl" xmp:"qt:GimbalRoll"` 139 GimbalYaw float64 `qt:"©gyw" xmp:"qt:GimbalYaw"` 140 HintInfo string `qt:"hnti" xmp:"qt:HintInfo"` 141 HintTrackInfo string `qt:"hinf" xmp:"qt:HintTrackInfo"` 142 HintVersion string `qt:"hinv" xmp:"qt:HintVersion"` 143 PrintToVideo string `qt:"ptv " xmp:"qt:PrintToVideo"` 144 TrackType string `qt:"kgtt" xmp:"qt:TrackType"` 145 WindowLocation Point `qt:"WLOC" xmp:"qt:WindowLocation"` 146 147 // 148 // Vendor-specific tags 149 // 150 // Google transcoded videos (YouTube) 151 GoogleHostHeader string `qt:"gshh" xmp:"qt:GoogleHostHeader"` 152 GooglePingMessage string `qt:"gspm" xmp:"qt:GooglePingMessage"` 153 GooglePingURL string `qt:"gspu" xmp:"qt:GooglePingURL"` 154 GoogleSourceData string `qt:"gssd" xmp:"qt:GoogleSourceData"` 155 GoogleStartTime string `qt:"gsst" xmp:"qt:GoogleStartTime"` 156 GoogleTrackDuration string `qt:"gstd" xmp:"qt:GoogleTrackDuration"` 157 158 // Microsoft http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Microsoft.html 159 // MicrosoftExtra MicrosoftExtra `qt:"Xtra" xmp:"msft:Extra"` 160 161 // Canon Cameras 162 CanonCodec string `qt:"CNCV" xmp:"qt:CanonCodec"` // "CanonAVC0002" 163 CanonModel string `qt:"CNMN" xmp:"qt:CanonModel"` // "Canon EOS 5D Mark II" 164 CanonFirmware string `qt:"CNFV" xmp:"qt:CanonFirmware"` // "Firmware Version 2.1.1" 165 CanonThumbnail []byte `qt:"CNDA" xmp:"qt:CanonThumbnail"` 166 } 167 168 func (m *QtUserdata) Namespaces() xmp.NamespaceList { 169 return xmp.NamespaceList{NsQuicktime} 170 } 171 172 func (m *QtUserdata) Can(nsName string) bool { 173 return nsName == NsQuicktime.GetName() 174 } 175 176 func (x *QtUserdata) SyncModel(d *xmp.Document) error { 177 return nil 178 } 179 180 func (x *QtUserdata) SyncFromXMP(d *xmp.Document) error { 181 return nil 182 } 183 184 func (x QtUserdata) SyncToXMP(d *xmp.Document) error { 185 return nil 186 } 187 188 func (x *QtUserdata) CanTag(tag string) bool { 189 _, err := xmp.GetNativeField(x, tag) 190 return err == nil 191 } 192 193 func (x *QtUserdata) GetTag(tag string) (string, error) { 194 if v, err := xmp.GetNativeField(x, tag); err != nil { 195 return "", fmt.Errorf("%s: %v", NsQuicktime.GetName(), err) 196 } else { 197 return v, nil 198 } 199 } 200 201 func (x *QtUserdata) SetTag(tag, value string) error { 202 if err := xmp.SetNativeField(x, tag, value); err != nil { 203 return fmt.Errorf("%s: %v", NsQuicktime.GetName(), err) 204 } 205 return nil 206 }