FFmpeg
exif_internal.h
Go to the documentation of this file.
1 /*
2  * EXIF metadata parser - internal functions
3  * Copyright (c) 2013 Thilo Borgmann <thilo.borgmann _at_ mail.de>
4  * Copyright (c) 2024-2025 Leo Izen <leo.izen@gmail.com>
5  *
6  * This file is part of FFmpeg.
7  *
8  * FFmpeg is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * FFmpeg is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with FFmpeg; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 /**
24  * @file
25  * EXIF metadata parser - internal functions
26  * @author Thilo Borgmann <thilo.borgmann _at_ mail.de>
27  * @author Leo Izen <leo.izen@gmail.com>
28  */
29 
30 #ifndef AVCODEC_EXIF_INTERNAL_H
31 #define AVCODEC_EXIF_INTERNAL_H
32 
33 #include "libavutil/buffer.h"
34 #include "libavutil/frame.h"
35 
36 #include "exif.h"
37 #include "version_major.h"
38 
39 #if LIBAVCODEC_VERSION_MAJOR < 63
40 /* Used by the AVI demuxer */
41 int avpriv_exif_decode_ifd(void *logctx, const uint8_t *buf, int size,
42  int le, int depth, AVDictionary **metadata);
43 #endif
44 
45 /**
46  * Compares values in the IFD with data in the provided AVFrame and sets the values
47  * in that IFD to match the ones in that AVFrame. This is mostly useful for an
48  * encoder that wishes to use ff_exif_get_buffer, but would prefer to modify the
49  * IFD after it is sanitized and call av_exif_write afterward.
50  */
51 int ff_exif_sanitize_ifd(void *logctx, const AVFrame *frame, AVExifMetadata *ifd);
52 
53 /**
54  * Gets all relevant side data, collects it into an IFD, and writes it into the
55  * corresponding buffer pointer. This includes both AV_FRAME_DATA_EXIF and other
56  * side data types that are included in the frame data, such as possibly an
57  * instance of AV_FRAME_DATA_DISPLAYMATRIX. It also sets width and height tags
58  * to match those of the AVFrame if they are different.
59  *
60  * Upon error, *buffer will be NULL. The buffer becomes owned by the caller upon
61  * success. The *buffer argument must be NULL before calling. If *buffer is NULL
62  * upon return then a negative return value indicates an error, and a zero return
63  * value indicates that there was no EXIF data to write.
64  */
65 int ff_exif_get_buffer(void *logctx, const AVFrame *frame, AVBufferRef **buffer, enum AVExifHeaderMode header_mode);
66 
67 #endif /* AVCODEC_EXIF_INTERNAL_H */
AVExifMetadata
Definition: exif.h:76
metadata
Stream codec metadata
Definition: ogg-flac-chained-meta.txt:2
AVExifHeaderMode
AVExifHeaderMode
Definition: exif.h:58
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:427
ff_exif_sanitize_ifd
int ff_exif_sanitize_ifd(void *logctx, const AVFrame *frame, AVExifMetadata *ifd)
Compares values in the IFD with data in the provided AVFrame and sets the values in that IFD to match...
Definition: exif.c:1230
version_major.h
AVDictionary
Definition: dict.c:32
avpriv_exif_decode_ifd
int avpriv_exif_decode_ifd(void *logctx, const uint8_t *buf, int size, int le, int depth, AVDictionary **metadata)
Definition: exif.c:920
size
int size
Definition: twinvq_data.h:10344
frame.h
buffer.h
exif.h
frame
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
Definition: filter_design.txt:265
buffer
the frame and frame reference mechanism is intended to as much as expensive copies of that data while still allowing the filters to produce correct results The data is stored in buffers represented by AVFrame structures Several references can point to the same frame buffer
Definition: filter_design.txt:49
AVBufferRef
A reference to a data buffer.
Definition: buffer.h:82
ff_exif_get_buffer
int ff_exif_get_buffer(void *logctx, const AVFrame *frame, AVBufferRef **buffer, enum AVExifHeaderMode header_mode)
Gets all relevant side data, collects it into an IFD, and writes it into the corresponding buffer poi...
Definition: exif.c:1355