On Tue, Aug 19, 2025 at 06:33:03PM +0300, [email protected] wrote:
> The branch, master has been updated
>        via  4c3f94f2651ce4d6834fbef10e5c287f25720ac9 (commit)
>        via  fe496b0308f1911138698b92bbafac582fa455d7 (commit)
>        via  535a07d14e16eb2930d2b1e16605eafa95959139 (commit)
>        via  8132ee046d1a03c5913759c50fce7beda8d3d627 (commit)
>        via  5d4f873ff31f86f9ae1927f37ca0fcb78da70512 (commit)
>        via  1e816ebefee0ef479fa76bd2a1fb9ec5d5e807df (commit)
>        via  93a8091015978c44462626409af71789080bbef4 (commit)
>        via  303f60684f25ce63951480ef0f759acf41aac938 (commit) <------ we are 
> here
>        via  5caaadee7954f2014d9e0a17d1edfb961893bcf1 (commit)
>        via  d3190a64c366a79091fe47fddf93c09a7d988802 (commit)
>        via  44af3829796427b89c4b76b56652cc5932ada616 (commit)
>        via  f5ad1c910c168d05cb01315773ab0bd094c9372f (commit)
>        via  e3aa1154aab2656c91ce61915f79516d9b563b61 (commit)
>        via  c6cc2115f45ac26ae42442f8796996eb410f4028 (commit)
>        via  52dba25661305e3c4a6209d46aea43cd327c960e (commit)
>        via  bfb17d26306592c85cf0c4e909099c621177b062 (commit)
>        via  ba2ea285e0f270a0a885b414cafaace6a89b9a91 (commit)
>        via  ad77345a5d14862f4701e5ad422b03b14934a5b9 (commit)
>        via  bb90b262d6d23f1bca3587a48abc15b951cbbf05 (commit)
>        via  a99fff4e2d4058c57599ba0b968862af82bdad5b (commit)
>       from  a6b5a382dd7ecdd27c5d0ebba688e1db409d18fd (commit)
> 

> commit 303f60684f25ce63951480ef0f759acf41aac938
> Author:     Leo Izen <[email protected]>
> AuthorDate: Tue Mar 25 17:25:40 2025 -0400
> Commit:     Leo Izen <[email protected]>
> CommitDate: Tue Aug 19 11:26:48 2025 -0400
> 
>     avcodec/exif: add av_exif_remove_entry
>     
>     Add an API function that allows popping an exif entry out of the struct
>     entirely rather than requiring it be replaced with a default value.
>     
>     Signed-off-by: Leo Izen <[email protected]>
> 

> diff --git a/libavcodec/exif.c b/libavcodec/exif.c
> index d174d16ddc..993a931d42 100644
> --- a/libavcodec/exif.c
> +++ b/libavcodec/exif.c
> @@ -1132,6 +1132,46 @@ int av_exif_set_entry(void *logctx, AVExifMetadata 
> *ifd, uint16_t id, enum AVTif
>      return ret;
>  }
>  
> +static int exif_remove_entry(void *logctx, AVExifMetadata *ifd, uint16_t id, 
> int depth)
> +{
> +    int32_t index = -1;
> +    int ret = 0;
> +
> +    if (!ifd || ifd->entries && !ifd->count || ifd->count && !ifd->entries)
> +        return AVERROR(EINVAL);
> +
> +    for (size_t i = 0; i < ifd->count; i++) {
> +        if (ifd->entries[i].id == id) {
> +            index = i;
> +            break;
> +        }
> +        if (ifd->entries[i].type == AV_TIFF_IFD && depth < 3) {
> +            ret = exif_remove_entry(logctx, &ifd->entries[i].value.ifd, id, 
> depth + 1);
> +            if (ret)
> +                return ret;
> +        }
> +    }
> +
> +    if (index < 0)
> +        return 0;
> +    exif_free_entry(&ifd->entries[index]);
> +
> +    if (index == --ifd->count) {
> +        if (!index)
> +            av_freep(&ifd->entries);
> +        return 1;

this frees the array but does not reset ifd->size which is whats used to
keep track of the allocated size


[...]
> diff --git a/libavcodec/exif.h b/libavcodec/exif.h
> index 23c1b37c5d..9f9f707495 100644
> --- a/libavcodec/exif.h
> +++ b/libavcodec/exif.h
> @@ -144,6 +144,16 @@ int32_t av_exif_get_tag_id(const char *name);
>  int av_exif_set_entry(void *logctx, AVExifMetadata *ifd, uint16_t id, enum 
> AVTiffDataType type,
>                        uint32_t count, const uint8_t *ifd_lead, uint32_t 
> ifd_offset, const void *value);
>  
> +/**
> + * Remove an entry from the provided EXIF metadata struct. If the recursive 
> flag is set
> + * to true, then this function will check subdirectories as well.
> + *
> + * If the entry was present and removed successfully, a positive number is 
> returned.
> + * If the entry was not found, zero is returned.

> + * If an error occurred, a negative number is returned.

a negative AVERROR not any number


> + */
> +int av_exif_remove_entry(void *logctx, AVExifMetadata *ifd, uint16_t id, int 
> recursive);

The API depends on id to be globally unique, which IIUC is not true


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Nations do behave wisely once they have exhausted all other alternatives. 
-- Abba Eban

Attachment: signature.asc
Description: PGP signature

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to