mirror of https://git.ffmpeg.org/ffmpeg.git
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>
This commit is contained in:
parent
cd4faed893
commit
a94de50ba0
|
@ -48,9 +48,11 @@ static int exif_add_metadata(AVCodecContext *avctx, int count, int type,
|
|||
{
|
||||
switch(type) {
|
||||
case TIFF_DOUBLE : return ff_tadd_doubles_metadata(count, name, sep, gb, le, metadata);
|
||||
case TIFF_SHORT : return ff_tadd_shorts_metadata(count, name, sep, gb, le, metadata);
|
||||
case TIFF_SSHORT : return ff_tadd_shorts_metadata(count, name, sep, gb, le, 1, metadata);
|
||||
case TIFF_SHORT : return ff_tadd_shorts_metadata(count, name, sep, gb, le, 0, metadata);
|
||||
case TIFF_SBYTE : return ff_tadd_bytes_metadata(count, name, sep, gb, le, 1, metadata);
|
||||
case TIFF_BYTE :
|
||||
case TIFF_UNDEFINED: return ff_tadd_bytes_metadata(count, name, sep, gb, le, metadata);
|
||||
case TIFF_UNDEFINED: return ff_tadd_bytes_metadata(count, name, sep, gb, le, 0, metadata);
|
||||
case TIFF_STRING : return ff_tadd_string_metadata(count, name, gb, le, metadata);
|
||||
case TIFF_SRATIONAL:
|
||||
case TIFF_RATIONAL : return ff_tadd_rational_metadata(count, name, sep, gb, le, metadata);
|
||||
|
|
|
@ -221,7 +221,7 @@ static int add_metadata(int count, int type,
|
|||
{
|
||||
switch(type) {
|
||||
case TIFF_DOUBLE: return ff_tadd_doubles_metadata(count, name, sep, &s->gb, s->le, avpriv_frame_get_metadatap(frame));
|
||||
case TIFF_SHORT : return ff_tadd_shorts_metadata(count, name, sep, &s->gb, s->le, avpriv_frame_get_metadatap(frame));
|
||||
case TIFF_SHORT : return ff_tadd_shorts_metadata(count, name, sep, &s->gb, s->le, 0, avpriv_frame_get_metadatap(frame));
|
||||
case TIFF_STRING: return ff_tadd_string_metadata(count, name, &s->gb, s->le, avpriv_frame_get_metadatap(frame));
|
||||
default : return AVERROR_INVALIDDATA;
|
||||
};
|
||||
|
|
|
@ -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))) {
|
||||
|
|
|
@ -121,13 +121,13 @@ int ff_tadd_doubles_metadata(int count, const char *name, const char *sep,
|
|||
* into the metadata dictionary.
|
||||
*/
|
||||
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);
|
||||
|
||||
/** Adds count bytes 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, AVDictionary **metadata);
|
||||
GetByteContext *gb, int le, int is_signed, AVDictionary **metadata);
|
||||
|
||||
/** Adds a string of count characters
|
||||
* into the metadata dictionary.
|
||||
|
|
Loading…
Reference in New Issue