summaryrefslogtreecommitdiff
path: root/vendor/github.com/dsoprea/go-iptc/standard.go
blob: 307aa5a87cea42518386f5f52accdbb9dc4b7fe4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
package iptc

import (
	"errors"
)

// StreamTagInfo encapsulates the properties of each tag.
type StreamTagInfo struct {
	// Description is the human-readable description of the tag.
	Description string
}

var (
	standardTags = map[StreamTagKey]StreamTagInfo{
		{1, 120}: {"ARM Identifier"},

		{1, 122}: {"ARM Version"},
		{2, 0}:   {"Record Version"},
		{2, 3}:   {"Object Type Reference"},
		{2, 4}:   {"Object Attribute Reference"},
		{2, 5}:   {"Object Name"},
		{2, 7}:   {"Edit Status"},
		{2, 8}:   {"Editorial Update"},
		{2, 10}:  {"Urgency"},
		{2, 12}:  {"Subject Reference"},
		{2, 15}:  {"Category"},
		{2, 20}:  {"Supplemental Category"},
		{2, 22}:  {"Fixture Identifier"},
		{2, 25}:  {"Keywords"},
		{2, 26}:  {"Content Location Code"},
		{2, 27}:  {"Content Location Name"},
		{2, 30}:  {"Release Date"},
		{2, 35}:  {"Release Time"},
		{2, 37}:  {"Expiration Date"},
		{2, 38}:  {"Expiration Time"},
		{2, 40}:  {"Special Instructions"},
		{2, 42}:  {"Action Advised"},
		{2, 45}:  {"Reference Service"},
		{2, 47}:  {"Reference Date"},
		{2, 50}:  {"Reference Number"},
		{2, 55}:  {"Date Created"},
		{2, 60}:  {"Time Created"},
		{2, 62}:  {"Digital Creation Date"},
		{2, 63}:  {"Digital Creation Time"},
		{2, 65}:  {"Originating Program"},
		{2, 70}:  {"Program Version"},
		{2, 75}:  {"Object Cycle"},
		{2, 80}:  {"By-line"},
		{2, 85}:  {"By-line Title"},
		{2, 90}:  {"City"},
		{2, 92}:  {"Sublocation"},
		{2, 95}:  {"Province/State"},
		{2, 100}: {"Country/Primary Location Code"},
		{2, 101}: {"Country/Primary Location Name"},
		{2, 103}: {"Original Transmission Reference"},
		{2, 105}: {"Headline"},
		{2, 110}: {"Credit"},
		{2, 115}: {"Source"},
		{2, 116}: {"Copyright Notice"},
		{2, 118}: {"Contact"},
		{2, 120}: {"Caption/Abstract"},
		{2, 122}: {"Writer/Editor"},
		{2, 125}: {"Rasterized Caption"},
		{2, 130}: {"Image Type"},
		{2, 131}: {"Image Orientation"},
		{2, 135}: {"Language Identifier"},
		{2, 150}: {"Audio Type"},
		{2, 151}: {"Audio Sampling Rate"},
		{2, 152}: {"Audio Sampling Resolution"},
		{2, 153}: {"Audio Duration"},
		{2, 154}: {"Audio Outcue"},
		{2, 200}: {"ObjectData Preview File Format"},
		{2, 201}: {"ObjectData Preview File Format Version"},
		{2, 202}: {"ObjectData Preview Data"},
		{7, 10}:  {"Size Mode"},
		{7, 20}:  {"Max Subfile Size"},
		{7, 90}:  {"ObjectData Size Announced"},
		{7, 95}:  {"Maximum ObjectData Size"},
		{8, 10}:  {"Subfile"},
		{9, 10}:  {"Confirmed ObjectData Size"},
	}
)

var (
	// ErrTagNotStandard indicates that the given tag is not known among the
	// documented standard set.
	ErrTagNotStandard = errors.New("not a standard tag")
)

// GetTagInfo return the info for the given tag. Returns ErrTagNotStandard if
// not known.
func GetTagInfo(recordNumber, datasetNumber int) (sti StreamTagInfo, err error) {
	stk := StreamTagKey{uint8(recordNumber), uint8(datasetNumber)}

	sti, found := standardTags[stk]
	if found == false {
		return sti, ErrTagNotStandard
	}

	return sti, nil
}