From 0c8f5873366e7721292007bca644ff5cc312df2b Mon Sep 17 00:00:00 2001 From: Martijn Otto Date: Thu, 15 May 2025 15:06:52 +0200 Subject: [PATCH] These functions don't need a mutable pointer to the stream, as they don't modify anything, and only return const-qualified pointers themselves. --- libavformat/avformat.h | 4 ++-- libavformat/seek.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 498c3020a5..5a0aa3f87d 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -2751,7 +2751,7 @@ int avformat_index_get_entries_count(const AVStream *st); * until any function that takes the stream or the parent AVFormatContext * as input argument is called. */ -const AVIndexEntry *avformat_index_get_entry(AVStream *st, int idx); +const AVIndexEntry *avformat_index_get_entry(const AVStream *st, int idx); /** * Get the AVIndexEntry corresponding to the given timestamp. @@ -2768,7 +2768,7 @@ const AVIndexEntry *avformat_index_get_entry(AVStream *st, int idx); * until any function that takes the stream or the parent AVFormatContext * as input argument is called. */ -const AVIndexEntry *avformat_index_get_entry_from_timestamp(AVStream *st, +const AVIndexEntry *avformat_index_get_entry_from_timestamp(const AVStream *st, int64_t wanted_timestamp, int flags); /** diff --git a/libavformat/seek.c b/libavformat/seek.c index c0d94371e6..2308660638 100644 --- a/libavformat/seek.c +++ b/libavformat/seek.c @@ -254,20 +254,20 @@ int avformat_index_get_entries_count(const AVStream *st) return cffstream(st)->nb_index_entries; } -const AVIndexEntry *avformat_index_get_entry(AVStream *st, int idx) +const AVIndexEntry *avformat_index_get_entry(const AVStream *st, int idx) { - const FFStream *const sti = ffstream(st); + const FFStream *const sti = cffstream(st); if (idx < 0 || idx >= sti->nb_index_entries) return NULL; return &sti->index_entries[idx]; } -const AVIndexEntry *avformat_index_get_entry_from_timestamp(AVStream *st, +const AVIndexEntry *avformat_index_get_entry_from_timestamp(const AVStream *st, int64_t wanted_timestamp, int flags) { - const FFStream *const sti = ffstream(st); + const FFStream *const sti = cffstream(st); int idx = ff_index_search_timestamp(sti->index_entries, sti->nb_index_entries, wanted_timestamp, flags); -- 2.47.2