Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
3071af6c
Commit
3071af6c
authored
Jul 16, 2012
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tiff: read more tags of type string
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
292850b6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
0 deletions
+63
-0
tiff.c
libavcodec/tiff.c
+53
-0
tiff.h
libavcodec/tiff.h
+10
-0
No files found.
libavcodec/tiff.c
View file @
3071af6c
...
@@ -291,12 +291,32 @@ static int add_shorts_metadata(int count, const char *name,
...
@@ -291,12 +291,32 @@ static int add_shorts_metadata(int count, const char *name,
return
0
;
return
0
;
}
}
static
int
add_string_metadata
(
int
count
,
const
char
*
name
,
TiffContext
*
s
)
{
char
*
value
;
if
(
bytestream2_get_bytes_left
(
&
s
->
gb
)
<
count
)
return
AVERROR_INVALIDDATA
;
value
=
av_malloc
(
count
+
1
);
if
(
!
value
)
return
AVERROR
(
ENOMEM
);
bytestream2_get_bufferu
(
&
s
->
gb
,
value
,
count
);
value
[
count
]
=
0
;
av_dict_set
(
&
s
->
picture
.
metadata
,
name
,
value
,
AV_DICT_DONT_STRDUP_VAL
);
return
0
;
}
static
int
add_metadata
(
int
count
,
int
type
,
static
int
add_metadata
(
int
count
,
int
type
,
const
char
*
name
,
const
char
*
sep
,
TiffContext
*
s
)
const
char
*
name
,
const
char
*
sep
,
TiffContext
*
s
)
{
{
switch
(
type
)
{
switch
(
type
)
{
case
TIFF_DOUBLE
:
return
add_doubles_metadata
(
count
,
name
,
sep
,
s
);
case
TIFF_DOUBLE
:
return
add_doubles_metadata
(
count
,
name
,
sep
,
s
);
case
TIFF_SHORT
:
return
add_shorts_metadata
(
count
,
name
,
sep
,
s
);
case
TIFF_SHORT
:
return
add_shorts_metadata
(
count
,
name
,
sep
,
s
);
case
TIFF_STRING
:
return
add_string_metadata
(
count
,
name
,
s
);
default
:
return
AVERROR_INVALIDDATA
;
default
:
return
AVERROR_INVALIDDATA
;
};
};
}
}
...
@@ -913,6 +933,39 @@ static int tiff_decode_tag(TiffContext *s)
...
@@ -913,6 +933,39 @@ static int tiff_decode_tag(TiffContext *s)
}
}
}
}
break
;
break
;
case
TIFF_ARTIST
:
ADD_METADATA
(
count
,
"artist"
,
NULL
);
break
;
case
TIFF_COPYRIGHT
:
ADD_METADATA
(
count
,
"copyright"
,
NULL
);
break
;
case
TIFF_DATE
:
ADD_METADATA
(
count
,
"date"
,
NULL
);
break
;
case
TIFF_DOCUMENT_NAME
:
ADD_METADATA
(
count
,
"document_name"
,
NULL
);
break
;
case
TIFF_HOST_COMPUTER
:
ADD_METADATA
(
count
,
"computer"
,
NULL
);
break
;
case
TIFF_IMAGE_DESCRIPTION
:
ADD_METADATA
(
count
,
"description"
,
NULL
);
break
;
case
TIFF_MAKE
:
ADD_METADATA
(
count
,
"make"
,
NULL
);
break
;
case
TIFF_MODEL
:
ADD_METADATA
(
count
,
"model"
,
NULL
);
break
;
case
TIFF_PAGE_NAME
:
ADD_METADATA
(
count
,
"page_name"
,
NULL
);
break
;
case
TIFF_PAGE_NUMBER
:
ADD_METADATA
(
count
,
"page_number"
,
" / "
);
break
;
case
TIFF_SOFTWARE_NAME
:
ADD_METADATA
(
count
,
"software"
,
NULL
);
break
;
default:
default:
av_log
(
s
->
avctx
,
AV_LOG_DEBUG
,
"Unknown or unsupported tag %d/0X%0X
\n
"
,
av_log
(
s
->
avctx
,
AV_LOG_DEBUG
,
"Unknown or unsupported tag %d/0X%0X
\n
"
,
tag
,
tag
);
tag
,
tag
);
...
...
libavcodec/tiff.h
View file @
3071af6c
...
@@ -41,6 +41,10 @@ enum TiffTags{
...
@@ -41,6 +41,10 @@ enum TiffTags{
TIFF_COMPR
,
TIFF_COMPR
,
TIFF_INVERT
=
0x106
,
TIFF_INVERT
=
0x106
,
TIFF_FILL_ORDER
=
0x10A
,
TIFF_FILL_ORDER
=
0x10A
,
TIFF_DOCUMENT_NAME
=
0x10D
,
TIFF_IMAGE_DESCRIPTION
=
0x10E
,
TIFF_MAKE
=
0x10F
,
TIFF_MODEL
=
0x110
,
TIFF_STRIP_OFFS
=
0x111
,
TIFF_STRIP_OFFS
=
0x111
,
TIFF_SAMPLES_PER_PIXEL
=
0x115
,
TIFF_SAMPLES_PER_PIXEL
=
0x115
,
TIFF_ROWSPERSTRIP
=
0x116
,
TIFF_ROWSPERSTRIP
=
0x116
,
...
@@ -48,12 +52,17 @@ enum TiffTags{
...
@@ -48,12 +52,17 @@ enum TiffTags{
TIFF_XRES
=
0x11A
,
TIFF_XRES
=
0x11A
,
TIFF_YRES
=
0x11B
,
TIFF_YRES
=
0x11B
,
TIFF_PLANAR
=
0x11C
,
TIFF_PLANAR
=
0x11C
,
TIFF_PAGE_NAME
=
0x11D
,
TIFF_XPOS
=
0x11E
,
TIFF_XPOS
=
0x11E
,
TIFF_YPOS
=
0x11F
,
TIFF_YPOS
=
0x11F
,
TIFF_T4OPTIONS
=
0x124
,
TIFF_T4OPTIONS
=
0x124
,
TIFF_T6OPTIONS
,
TIFF_T6OPTIONS
,
TIFF_RES_UNIT
=
0x128
,
TIFF_RES_UNIT
=
0x128
,
TIFF_PAGE_NUMBER
=
0x129
,
TIFF_SOFTWARE_NAME
=
0x131
,
TIFF_SOFTWARE_NAME
=
0x131
,
TIFF_DATE
=
0x132
,
TIFF_ARTIST
=
0x13B
,
TIFF_HOST_COMPUTER
=
0x13C
,
TIFF_PREDICTOR
=
0x13D
,
TIFF_PREDICTOR
=
0x13D
,
TIFF_PAL
=
0x140
,
TIFF_PAL
=
0x140
,
TIFF_TILE_WIDTH
=
0x142
,
TIFF_TILE_WIDTH
=
0x142
,
...
@@ -64,6 +73,7 @@ enum TiffTags{
...
@@ -64,6 +73,7 @@ enum TiffTags{
TIFF_YCBCR_SUBSAMPLING
=
0x212
,
TIFF_YCBCR_SUBSAMPLING
=
0x212
,
TIFF_YCBCR_POSITIONING
=
0x213
,
TIFF_YCBCR_POSITIONING
=
0x213
,
TIFF_REFERENCE_BW
=
0x214
,
TIFF_REFERENCE_BW
=
0x214
,
TIFF_COPYRIGHT
=
0x8298
,
TIFF_MODEL_TIEPOINT
=
0x8482
,
TIFF_MODEL_TIEPOINT
=
0x8482
,
TIFF_MODEL_PIXEL_SCALE
=
0x830E
,
TIFF_MODEL_PIXEL_SCALE
=
0x830E
,
TIFF_MODEL_TRANSFORMATION
=
0x8480
,
TIFF_MODEL_TRANSFORMATION
=
0x8480
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment