aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/tiff_common.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-04-20 02:58:02 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-04-20 17:01:46 +0200
commita94de50ba02f5c260ca7c571b43fb595c8f951b6 (patch)
tree08a113eb6a16415a16c48442fc5ff800e0664c65 /libavcodec/tiff_common.c
parentcd4faed89378dfb9ba4c985ef661d10c0d7e7b7e (diff)
downloadffmpeg-a94de50ba02f5c260ca7c571b43fb595c8f951b6.tar.gz
avcodec/exif/exif_add_metadata: add support for SSHORT & SBYTE
No working testcase, this omission was just spoted when the parser apparently went out of sync. Reviewed-by; Thilo Borgmann <thilo.borgmann@mail.de> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/tiff_common.c')
-rw-r--r--libavcodec/tiff_common.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/libavcodec/tiff_common.c b/libavcodec/tiff_common.c
index f14ecf1769..35119af558 100644
--- a/libavcodec/tiff_common.c
+++ b/libavcodec/tiff_common.c
@@ -176,7 +176,7 @@ int ff_tadd_doubles_metadata(int count, const char *name, const char *sep,
int ff_tadd_shorts_metadata(int count, const char *name, const char *sep,
- GetByteContext *gb, int le, AVDictionary **metadata)
+ GetByteContext *gb, int le, int is_signed, AVDictionary **metadata)
{
AVBPrint bp;
char *ap;
@@ -190,7 +190,8 @@ int ff_tadd_shorts_metadata(int count, const char *name, const char *sep,
av_bprint_init(&bp, 10 * count, AV_BPRINT_SIZE_UNLIMITED);
for (i = 0; i < count; i++) {
- av_bprintf(&bp, "%s%5i", auto_sep(count, sep, i, 8), ff_tget_short(gb, le));
+ int v = is_signed ? (int16_t)ff_tget_short(gb, le) : ff_tget_short(gb, le);
+ av_bprintf(&bp, "%s%5i", auto_sep(count, sep, i, 8), v);
}
if ((i = av_bprint_finalize(&bp, &ap))) {
@@ -207,7 +208,7 @@ int ff_tadd_shorts_metadata(int count, const char *name, const char *sep,
int ff_tadd_bytes_metadata(int count, const char *name, const char *sep,
- GetByteContext *gb, int le, AVDictionary **metadata)
+ GetByteContext *gb, int le, int is_signed, AVDictionary **metadata)
{
AVBPrint bp;
char *ap;
@@ -221,7 +222,8 @@ int ff_tadd_bytes_metadata(int count, const char *name, const char *sep,
av_bprint_init(&bp, 10 * count, AV_BPRINT_SIZE_UNLIMITED);
for (i = 0; i < count; i++) {
- av_bprintf(&bp, "%s%3i", auto_sep(count, sep, i, 16), bytestream2_get_byte(gb));
+ int v = is_signed ? (int8_t)bytestream2_get_byte(gb) : bytestream2_get_byte(gb);
+ av_bprintf(&bp, "%s%3i", auto_sep(count, sep, i, 16), v);
}
if ((i = av_bprint_finalize(&bp, &ap))) {