FFmpeg
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
Examples
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
libavcodec
tiff_common.h
Go to the documentation of this file.
1
/*
2
* TIFF Common Routines
3
* Copyright (c) 2013 Thilo Borgmann <thilo.borgmann _at_ mail.de>
4
*
5
* This file is part of FFmpeg.
6
*
7
* FFmpeg is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU Lesser General Public
9
* License as published by the Free Software Foundation; either
10
* version 2.1 of the License, or (at your option) any later version.
11
*
12
* FFmpeg is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
* Lesser General Public License for more details.
16
*
17
* You should have received a copy of the GNU Lesser General Public
18
* License along with FFmpeg; if not, write to the Free Software
19
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
*/
21
22
/**
23
* @file
24
* TIFF Common Routines
25
* @author Thilo Borgmann <thilo.borgmann _at_ mail.de>
26
*/
27
28
#ifndef AVCODEC_TIFF_COMMON_H
29
#define AVCODEC_TIFF_COMMON_H
30
31
#include "
avcodec.h
"
32
#include "
tiff.h
"
33
#include "
bytestream.h
"
34
#include "
libavutil/bprint.h
"
35
36
/** data type identifiers for TIFF tags */
37
enum
TiffTypes
{
38
TIFF_BYTE
= 1,
39
TIFF_STRING
,
40
TIFF_SHORT
,
41
TIFF_LONG
,
42
TIFF_RATIONAL
,
43
TIFF_SBYTE
,
44
TIFF_UNDEFINED
,
45
TIFF_SSHORT
,
46
TIFF_SLONG
,
47
TIFF_SRATIONAL
,
48
TIFF_FLOAT
,
49
TIFF_DOUBLE
,
50
TIFF_IFD
51
};
52
53
/** sizes of various TIFF field types (string size = 100)*/
54
static
const
uint8_t
type_sizes
[14] = {
55
0, 1, 100, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8, 4
56
};
57
58
static
const
uint16_t
ifd_tags
[] = {
59
0x8769,
// EXIF IFD
60
0x8825,
// GPS IFD
61
0xA005
// Interoperability IFD
62
};
63
64
65
/** Returns a value > 0 if the tag is a known IFD-tag.
66
* The return value is the array index + 1 within ifd_tags[].
67
*/
68
int
ff_tis_ifd
(
unsigned
tag
);
69
70
/** Reads a short from the bytestream using given endianness. */
71
unsigned
ff_tget_short
(
GetByteContext
*gb,
int
le
);
72
73
/** Reads a long from the bytestream using given endianness. */
74
unsigned
ff_tget_long
(
GetByteContext
*gb,
int
le
);
75
76
/** Reads a double from the bytestream using given endianness. */
77
double
ff_tget_double
(
GetByteContext
*gb,
int
le
);
78
79
/** Reads a byte from the bytestream using given endianness. */
80
unsigned
ff_tget
(
GetByteContext
*gb,
int
type
,
int
le
);
81
82
/** Returns an allocated string containing count
83
* rational values using the given separator.
84
*/
85
char
*
ff_trationals2str
(
int
*rp,
int
count
,
const
char
*sep);
86
87
/** Returns an allocated string containing count
88
* long values using the given separator.
89
*/
90
char
*
ff_tlongs2str
(
int32_t
*lp,
int
count
,
const
char
*sep);
91
92
/** Returns an allocated string containing count
93
* double values using the given separator.
94
*/
95
char
*
ff_tdoubles2str
(
double
*dp,
int
count
,
const
char
*sep);
96
97
/** Returns an allocated string containing count
98
* short values using the given separator.
99
*/
100
char
*
ff_tshorts2str
(int16_t *
sp
,
int
count
,
const
char
*sep);
101
102
/** Adds count rationals converted to a string
103
* into the metadata dictionary.
104
*/
105
int
ff_tadd_rational_metadata
(
int
count
,
const
char
*
name
,
const
char
*sep,
106
GetByteContext
*gb,
int
le
,
AVDictionary
**metadata);
107
108
/** Adds count longs converted to a string
109
* into the metadata dictionary.
110
*/
111
int
ff_tadd_long_metadata
(
int
count
,
const
char
*
name
,
const
char
*sep,
112
GetByteContext
*gb,
int
le
,
AVDictionary
**metadata);
113
114
/** Adds count doubles converted to a string
115
* into the metadata dictionary.
116
*/
117
int
ff_tadd_doubles_metadata
(
int
count
,
const
char
*
name
,
const
char
*sep,
118
GetByteContext
*gb,
int
le
,
AVDictionary
**metadata);
119
120
/** Adds count shorts converted to a string
121
* into the metadata dictionary.
122
*/
123
int
ff_tadd_shorts_metadata
(
int
count
,
const
char
*
name
,
const
char
*sep,
124
GetByteContext
*gb,
int
le
,
int
is_signed,
AVDictionary
**metadata);
125
126
/** Adds count bytes converted to a string
127
* into the metadata dictionary.
128
*/
129
int
ff_tadd_bytes_metadata
(
int
count
,
const
char
*
name
,
const
char
*sep,
130
GetByteContext
*gb,
int
le
,
int
is_signed,
AVDictionary
**metadata);
131
132
/** Adds a string of count characters
133
* into the metadata dictionary.
134
*/
135
int
ff_tadd_string_metadata
(
int
count
,
const
char
*
name
,
136
GetByteContext
*gb,
int
le
,
AVDictionary
**metadata);
137
138
/** Decodes a TIFF header from the input bytestream
139
* and sets the endianness in *le and the offset to
140
* the first IFD in *ifd_offset accordingly.
141
*/
142
int
ff_tdecode_header
(
GetByteContext
*gb,
int
*
le
,
int
*ifd_offset);
143
144
/** Reads the first 3 fields of a TIFF tag, which are
145
* the tag id, the tag type and the count of values for that tag.
146
* Afterwards the bytestream is located at the first value to read and
147
* *next holds the bytestream offset of the following tag.
148
*/
149
int
ff_tread_tag
(
GetByteContext
*gb,
int
le
,
unsigned
*
tag
,
unsigned
*
type
,
150
unsigned
*
count
,
int
*next);
151
152
#endif
/* AVCODEC_TIFF_COMMON_H */
Generated on Sun Sep 14 2014 18:56:04 for FFmpeg by
1.8.2