summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHendrik Leppkes <h.leppkes@gmail.com>2016-04-01 13:13:03 +0200
committerDerek Buitenhuis <derek.buitenhuis@gmail.com>2016-04-02 22:48:15 +0100
commitce87711df563a9d2d0537a062b86bb91b15ea1a0 (patch)
tree83f98f7de933fa06473812ff8dcc6d62ff5a9c19
parent994412fb9b07dd3d012a76f480f4f5e0cfa883cc (diff)
downloadffmpeg-streaming-ce87711df563a9d2d0537a062b86bb91b15ea1a0.zip
ffmpeg-streaming-ce87711df563a9d2d0537a062b86bb91b15ea1a0.tar.gz
exif: take a generic log context
The AVCodecContext is only used for logging, so instead take any valid log context. This allows reusing the exif functions more easily in avformat. Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
-rw-r--r--libavcodec/exif.c16
-rw-r--r--libavcodec/exif.h2
2 files changed, 9 insertions, 9 deletions
diff --git a/libavcodec/exif.c b/libavcodec/exif.c
index fa30f05..07ce174 100644
--- a/libavcodec/exif.c
+++ b/libavcodec/exif.c
@@ -41,14 +41,14 @@ static const char *exif_get_tag_name(uint16_t id)
}
-static int exif_add_metadata(AVCodecContext *avctx, int count, int type,
+static int exif_add_metadata(void *logctx, int count, int type,
const char *name, const char *sep,
GetByteContext *gb, int le,
AVDictionary **metadata)
{
switch(type) {
case 0:
- av_log(avctx, AV_LOG_WARNING,
+ av_log(logctx, AV_LOG_WARNING,
"Invalid TIFF tag type 0 found for %s with size %d\n",
name, count);
return 0;
@@ -64,13 +64,13 @@ static int exif_add_metadata(AVCodecContext *avctx, int count, int type,
case TIFF_SLONG :
case TIFF_LONG : return ff_tadd_long_metadata(count, name, sep, gb, le, metadata);
default:
- avpriv_request_sample(avctx, "TIFF tag type (%u)", type);
+ avpriv_request_sample(logctx, "TIFF tag type (%u)", type);
return 0;
};
}
-static int exif_decode_tag(AVCodecContext *avctx, GetByteContext *gbytes, int le,
+static int exif_decode_tag(void *logctx, GetByteContext *gbytes, int le,
int depth, AVDictionary **metadata)
{
int ret, cur_pos;
@@ -92,7 +92,7 @@ static int exif_decode_tag(AVCodecContext *avctx, GetByteContext *gbytes, int le
// store metadata or proceed with next IFD
ret = ff_tis_ifd(id);
if (ret) {
- ret = avpriv_exif_decode_ifd(avctx, gbytes, le, depth + 1, metadata);
+ ret = avpriv_exif_decode_ifd(logctx, gbytes, le, depth + 1, metadata);
} else {
const char *name = exif_get_tag_name(id);
char *use_name = (char*) name;
@@ -105,7 +105,7 @@ static int exif_decode_tag(AVCodecContext *avctx, GetByteContext *gbytes, int le
snprintf(use_name, 7, "0x%04X", id);
}
- ret = exif_add_metadata(avctx, count, type, use_name, NULL,
+ ret = exif_add_metadata(logctx, count, type, use_name, NULL,
gbytes, le, metadata);
if (!name) {
@@ -119,7 +119,7 @@ static int exif_decode_tag(AVCodecContext *avctx, GetByteContext *gbytes, int le
}
-int avpriv_exif_decode_ifd(AVCodecContext *avctx, GetByteContext *gbytes, int le,
+int avpriv_exif_decode_ifd(void *logctx, GetByteContext *gbytes, int le,
int depth, AVDictionary **metadata)
{
int i, ret;
@@ -132,7 +132,7 @@ int avpriv_exif_decode_ifd(AVCodecContext *avctx, GetByteContext *gbytes, int le
}
for (i = 0; i < entries; i++) {
- if ((ret = exif_decode_tag(avctx, gbytes, le, depth, metadata)) < 0) {
+ if ((ret = exif_decode_tag(logctx, gbytes, le, depth, metadata)) < 0) {
return ret;
}
}
diff --git a/libavcodec/exif.h b/libavcodec/exif.h
index 2f509ba..5f09208 100644
--- a/libavcodec/exif.h
+++ b/libavcodec/exif.h
@@ -164,7 +164,7 @@ static const struct exif_tag tag_list[] = { // JEITA CP-3451 EXIF specification:
/** Recursively decodes all IFD's and
* adds included TAGS into the metadata dictionary. */
-int avpriv_exif_decode_ifd(AVCodecContext *avctx, GetByteContext *gbytes, int le,
+int avpriv_exif_decode_ifd(void *logctx, GetByteContext *gbytes, int le,
int depth, AVDictionary **metadata);
#endif /* AVCODEC_EXIF_H */
OpenPOWER on IntegriCloud