github.com/boki/go-xmp@v1.0.1/models/qt/qt_player.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  type QtPlayer struct {
    23  	AudioBalance     float32 `qt:"com.apple.quicktime.player.movie.audio.balance"     xmp:"qt:AudioBalance"`
    24  	AudioBass        float32 `qt:"com.apple.quicktime.player.movie.audio.bass"        xmp:"qt:AudioBass"`
    25  	AudioGain        float32 `qt:"com.apple.quicktime.player.movie.audio.gain"        xmp:"qt:AudioGain"`
    26  	AudioMute        Bool    `qt:"com.apple.quicktime.player.movie.audio.mute"        xmp:"qt:AudioMute"`
    27  	AudioPitchshift  float32 `qt:"com.apple.quicktime.player.movie.audio.pitchshift"  xmp:"qt:AudioPitchshift"`
    28  	AudioTreble      float32 `qt:"com.apple.quicktime.player.movie.audio.treble"      xmp:"qt:AudioTreble"`
    29  	VisualBrightness float32 `qt:"com.apple.quicktime.player.movie.visual.brightness" xmp:"qt:VisualBrightness"`
    30  	VisualColor      float32 `qt:"com.apple.quicktime.player.movie.visual.color"      xmp:"qt:VisualColor"`
    31  	VisualContrast   float32 `qt:"com.apple.quicktime.player.movie.visual.contrast"   xmp:"qt:VisualContrast"`
    32  	VisualTint       float32 `qt:"com.apple.quicktime.player.movie.visual.tint"       xmp:"qt:VisualTint"`
    33  	Version          string  `qt:"com.apple.quicktime.player.version"                 xmp:"qt:Version"`
    34  }
    35  
    36  func (m *QtPlayer) Namespaces() xmp.NamespaceList {
    37  	return xmp.NamespaceList{NsQuicktime}
    38  }
    39  
    40  func (m *QtPlayer) Can(nsName string) bool {
    41  	return nsName == NsQuicktime.GetName()
    42  }
    43  
    44  func (x *QtPlayer) SyncModel(d *xmp.Document) error {
    45  	return nil
    46  }
    47  
    48  func (x *QtPlayer) SyncFromXMP(d *xmp.Document) error {
    49  	return nil
    50  }
    51  
    52  func (x *QtPlayer) SyncToXMP(d *xmp.Document) error {
    53  	return nil
    54  }
    55  
    56  func (x *QtPlayer) CanTag(tag string) bool {
    57  	_, err := xmp.GetNativeField(x, tag)
    58  	return err == nil
    59  }
    60  
    61  func (x *QtPlayer) GetTag(tag string) (string, error) {
    62  	if v, err := xmp.GetNativeField(x, tag); err != nil {
    63  		return "", fmt.Errorf("%s: %v", NsQuicktime.GetName(), err)
    64  	} else {
    65  		return v, nil
    66  	}
    67  }
    68  
    69  func (x *QtPlayer) SetTag(tag, value string) error {
    70  	if err := xmp.SetNativeField(x, tag, value); err != nil {
    71  		return fmt.Errorf("%s: %v", NsQuicktime.GetName(), err)
    72  	}
    73  	return nil
    74  }