Debian Codegraph @

tags.go

raw symbols SCIP
1 package ffprobescip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/
2
3 import (
4 "errorsscip-go gomod github.com/golang/go/src go1.13 errors/"
5 "fmtscip-go gomod github.com/golang/go/src go1.13 fmt/"
6 "strconvscip-go gomod github.com/golang/go/src go1.13 strconv/"
7 )
8
9 // ErrTagNotFound is a sentinel error used when a queried tag does not exist
10 var ErrTagNotFoundscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/ErrTagNotFound. = errorsscip-go gomod github.com/golang/go/src go1.13 errors/.Newscip-go gomod github.com/golang/go/src go1.13 errors/New().("tag not found")
11
12 // Tags is the map of tag names to values
13 type Tagsscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/Tags# map[string]interface{}
14
15 // GetInt returns a tag value as int64 and an error if one occurred.
16 // ErrTagNotFound will be returned if the key can't be found, ParseError if
17 // a parsing error occurs.
18 func (t Tagsscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/Tags#) GetIntscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/Tags#GetInt().(tag string) (int64, error) {
19 v, found := t[tag]
20 if !found || v == nil {
21 return 0, ErrTagNotFoundscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/ErrTagNotFound.
22 }
23
24 switch v := v.(type) {
25 case string:
26 return valToInt64scip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/valToInt64().(v)
27 case float64:
28 return int64(v), nil
29 case int64:
30 return v, nil
31 }
32
33 str := fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.13 fmt/Sprintf().("%v", v)
34 return valToInt64scip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/valToInt64().(str)
35 }
36
37 func valToInt64scip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/valToInt64().(str string) (int64, error) {
38 val, err := strconvscip-go gomod github.com/golang/go/src go1.13 strconv/.ParseIntscip-go gomod github.com/golang/go/src go1.13 strconv/ParseInt().(str, 10, 64)
39 if err != nil {
40 return 0, fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.13 fmt/Errorf().("int64 parsing error (%v): %w", str, err)
41 }
42 return val, nil
43 }
44
45 // GetString returns a tag value as string and an error if one occurred.
46 // ErrTagNotFound will be returned if the key can't be found
47 func (t Tagsscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/Tags#) GetStringscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/Tags#GetString().(tag string) (string, error) {
48 v, found := t[tag]
49 if !found || v == nil {
50 return "", ErrTagNotFoundscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/ErrTagNotFound.
51 }
52 return valToStringscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/valToString().(v), nil
53 }
54
55 func valToStringscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/valToString().(v interface{}) string {
56 switch v := v.(type) {
57 case string:
58 return v
59 case float64:
60 return strconvscip-go gomod github.com/golang/go/src go1.13 strconv/.FormatFloatscip-go gomod github.com/golang/go/src go1.13 strconv/FormatFloat().(v, 'f', -1, 64)
61 case int64:
62 return strconvscip-go gomod github.com/golang/go/src go1.13 strconv/.FormatIntscip-go gomod github.com/golang/go/src go1.13 strconv/FormatInt().(v, 10)
63 }
64
65 return fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.13 fmt/Sprintf().("%v", v)
66 }
67
68 // GetFloat returns a tag value as float64 and an error if one occurred.
69 // ErrTagNotFound will be returned if the key can't be found.
70 func (t Tagsscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/Tags#) GetFloatscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/Tags#GetFloat().(tag string) (float64, error) {
71 v, found := t[tag]
72 if !found || v == nil {
73 return 0, ErrTagNotFoundscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/ErrTagNotFound.
74 }
75
76 switch v := v.(type) {
77 case string:
78 return valToFloat64scip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/valToFloat64().(v)
79 case float64:
80 return v, nil
81 case int64:
82 return float64(v), nil
83 }
84
85 str := fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.13 fmt/Sprintf().("%v", v)
86 return valToFloat64scip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/valToFloat64().(str)
87 }
88
89 func valToFloat64scip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/valToFloat64().(str string) (float64, error) {
90 val, err := strconvscip-go gomod github.com/golang/go/src go1.13 strconv/.ParseFloatscip-go gomod github.com/golang/go/src go1.13 strconv/ParseFloat().(str, 64)
91 if err != nil {
92 return 0, fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.13 fmt/Errorf().("float64 parsing error (%v): %w", str, err)
93 }
94 return val, nil
95 }
96
97 // FormatTags is a json data structure to represent format tags
98 // Deprecated, use the Tags of TagList instead
99 type FormatTagsscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/FormatTags# struct {
100 MajorBrandscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/FormatTags#MajorBrand. string `json:"major_brand"`
101 MinorVersionscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/FormatTags#MinorVersion. string `json:"minor_version"`
102 CompatibleBrandsscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/FormatTags#CompatibleBrands. string `json:"compatible_brands"`
103 CreationTimescip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/FormatTags#CreationTime. string `json:"creation_time"`
104 }
105
106 func (f *FormatTagsscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/FormatTags#) setFromscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/FormatTags#setFrom().(tags Tagsscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/Tags#) {
107 f.MajorBrandscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/FormatTags#MajorBrand., _ = tags.GetStringscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/Tags#GetString().("major_brand")
108 f.MinorVersionscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/FormatTags#MinorVersion., _ = tags.GetStringscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/Tags#GetString().("minor_version")
109 f.CompatibleBrandsscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/FormatTags#CompatibleBrands., _ = tags.GetStringscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/Tags#GetString().("compatible_brands")
110 f.CreationTimescip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/FormatTags#CreationTime., _ = tags.GetStringscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/Tags#GetString().("creation_time")
111 }
112
113 // StreamTags is a json data structure to represent stream tags
114 // Deprecated, use the Tags of TagList instead
115 type StreamTagsscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/StreamTags# struct {
116 Rotatescip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/StreamTags#Rotate. int `json:"rotate,string,omitempty"`
117 CreationTimescip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/StreamTags#CreationTime. string `json:"creation_time,omitempty"`
118 Languagescip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/StreamTags#Language. string `json:"language,omitempty"`
119 Titlescip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/StreamTags#Title. string `json:"title,omitempty"`
120 Encoderscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/StreamTags#Encoder. string `json:"encoder,omitempty"`
121 Locationscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/StreamTags#Location. string `json:"location,omitempty"`
122 }
123
124 func (s *StreamTagsscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/StreamTags#) setFromscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/StreamTags#setFrom().(tags Tagsscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/Tags#) {
125 rotate, _ := tags.GetIntscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/Tags#GetInt().("rotate")
126 s.Rotatescip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/StreamTags#Rotate. = int(rotate)
127
128 s.CreationTimescip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/StreamTags#CreationTime., _ = tags.GetStringscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/Tags#GetString().("creation_time")
129 s.Languagescip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/StreamTags#Language., _ = tags.GetStringscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/Tags#GetString().("language")
130 s.Titlescip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/StreamTags#Title., _ = tags.GetStringscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/Tags#GetString().("title")
131 s.Encoderscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/StreamTags#Encoder., _ = tags.GetStringscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/Tags#GetString().("encoder")
132 s.Locationscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/StreamTags#Location., _ = tags.GetStringscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/Tags#GetString().("location")
133 }