45 return le ? bytestream2_get_le16(gb) : bytestream2_get_be16(gb);
51 return le ? bytestream2_get_le32(gb) : bytestream2_get_be32(gb);
57 av_alias64 i = { .u64 = le ? bytestream2_get_le64(gb) : bytestream2_get_be64(gb)};
65 case TIFF_BYTE:
return bytestream2_get_byte(gb);
68 default:
return UINT_MAX;
72 static const char *
auto_sep(
int count,
const char *sep,
int i,
int columns)
79 return columns < count ?
"\n" :
"";
90 if (count >= INT_MAX /
sizeof(int64_t) || count <= 0)
97 for (i = 0; i <
count; i++) {
123 if (count >= INT_MAX /
sizeof(
int32_t) || count <= 0)
130 for (i = 0; i <
count; i++) {
154 if (count >= INT_MAX /
sizeof(int64_t) || count <= 0)
161 for (i = 0; i <
count; i++) {
185 if (count >= INT_MAX /
sizeof(int16_t) || count <= 0)
192 for (i = 0; i <
count; i++) {
217 if (count >= INT_MAX /
sizeof(int8_t) || count < 0)
224 for (i = 0; i <
count; i++) {
225 int v = is_signed ? (int8_t)bytestream2_get_byte(gb) : bytestream2_get_byte(gb);
267 *le = bytestream2_get_le16u(gb);
270 }
else if (*le ==
AV_RB16(
"MM")) {
287 unsigned *
count,
int *next)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
void av_bprintf(AVBPrint *buf, const char *fmt,...)
int ff_tadd_doubles_metadata(int count, const char *name, const char *sep, GetByteContext *gb, int le, AVDictionary **metadata)
Adds count doubles converted to a string into the metadata dictionary.
int ff_tadd_rational_metadata(int count, const char *name, const char *sep, GetByteContext *gb, int le, AVDictionary **metadata)
Adds count rationals converted to a string into the metadata dictionary.
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
static av_always_inline unsigned int bytestream2_get_bufferu(GetByteContext *g, uint8_t *dst, unsigned int size)
static const uint8_t type_sizes[14]
sizes of various TIFF field types (string size = 100)
#define AV_BPRINT_SIZE_UNLIMITED
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
unsigned ff_tget_short(GetByteContext *gb, int le)
Reads a short from the bytestream using given endianness.
unsigned ff_tget(GetByteContext *gb, int type, int le)
Reads a byte from the bytestream using given endianness.
static av_always_inline unsigned int bytestream2_get_bytes_left(GetByteContext *g)
#define AV_DICT_DONT_STRDUP_VAL
Take ownership of a value that's been allocated with av_malloc() or another memory allocation functio...
unsigned ff_tget_long(GetByteContext *gb, int le)
Reads a long from the bytestream using given endianness.
static const char * auto_sep(int count, const char *sep, int i, int columns)
#define FF_ARRAY_ELEMS(a)
static const uint16_t ifd_tags[]
int ff_tis_ifd(unsigned tag)
Returns a value > 0 if the tag is a known IFD-tag.
static av_always_inline int bytestream2_tell(GetByteContext *g)
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
int ff_tadd_long_metadata(int count, const char *name, const char *sep, GetByteContext *gb, int le, AVDictionary **metadata)
Adds count longs converted to a string into the metadata dictionary.
int ff_tadd_shorts_metadata(int count, const char *name, const char *sep, GetByteContext *gb, int le, int is_signed, AVDictionary **metadata)
Adds count shorts converted to a string into the metadata dictionary.
int ff_tadd_bytes_metadata(int count, const char *name, const char *sep, GetByteContext *gb, int le, int is_signed, AVDictionary **metadata)
Adds count bytes converted to a string into the metadata dictionary.
int ff_tadd_string_metadata(int count, const char *name, GetByteContext *gb, int le, AVDictionary **metadata)
Adds a string of count characters into the metadata dictionary.
static av_always_inline int bytestream2_seek(GetByteContext *g, int offset, int whence)
int ff_tread_tag(GetByteContext *gb, int le, unsigned *tag, unsigned *type, unsigned *count, int *next)
Reads the first 3 fields of a TIFF tag, which are the tag id, the tag type and the count of values fo...
int ff_tdecode_header(GetByteContext *gb, int *le, int *ifd_offset)
Decodes a TIFF header from the input bytestream and sets the endianness in *le and the offset to the ...
double ff_tget_double(GetByteContext *gb, int le)
Reads a double from the bytestream using given endianness.