aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2019-08-13 04:47:16 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2019-08-15 01:26:21 +0200
commit114775955241c2cb742a701cc9eb6462d090f560 (patch)
tree429589834f2f408fb55ca747033f12e2947ea507
parente301736862f18a449c317a47d0d60d3484e41667 (diff)
downloadffmpeg-114775955241c2cb742a701cc9eb6462d090f560.tar.gz
avformat/mux: Use const AVPacket * in compare functions
There is no reason for these functions to modify the given packets at all. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/audiointerleave.c2
-rw-r--r--libavformat/audiointerleave.h2
-rw-r--r--libavformat/gxfenc.c5
-rw-r--r--libavformat/internal.h2
-rw-r--r--libavformat/mux.c6
-rw-r--r--libavformat/mxfenc.c3
6 files changed, 11 insertions, 9 deletions
diff --git a/libavformat/audiointerleave.c b/libavformat/audiointerleave.c
index dea5d99821..b602eb7105 100644
--- a/libavformat/audiointerleave.c
+++ b/libavformat/audiointerleave.c
@@ -108,7 +108,7 @@ static int interleave_new_audio_packet(AVFormatContext *s, AVPacket *pkt,
int ff_audio_rechunk_interleave(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush,
int (*get_packet)(AVFormatContext *, AVPacket *, AVPacket *, int),
- int (*compare_ts)(AVFormatContext *, AVPacket *, AVPacket *))
+ int (*compare_ts)(AVFormatContext *, const AVPacket *, const AVPacket *))
{
int i, ret;
diff --git a/libavformat/audiointerleave.h b/libavformat/audiointerleave.h
index 4d77832fa1..f28d5fefcc 100644
--- a/libavformat/audiointerleave.h
+++ b/libavformat/audiointerleave.h
@@ -50,6 +50,6 @@ void ff_audio_interleave_close(AVFormatContext *s);
*/
int ff_audio_rechunk_interleave(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush,
int (*get_packet)(AVFormatContext *, AVPacket *, AVPacket *, int),
- int (*compare_ts)(AVFormatContext *, AVPacket *, AVPacket *));
+ int (*compare_ts)(AVFormatContext *, const AVPacket *, const AVPacket *));
#endif /* AVFORMAT_AUDIOINTERLEAVE_H */
diff --git a/libavformat/gxfenc.c b/libavformat/gxfenc.c
index 3507c00b40..ad9ddea887 100644
--- a/libavformat/gxfenc.c
+++ b/libavformat/gxfenc.c
@@ -987,10 +987,11 @@ static int gxf_write_packet(AVFormatContext *s, AVPacket *pkt)
return 0;
}
-static int gxf_compare_field_nb(AVFormatContext *s, AVPacket *next, AVPacket *cur)
+static int gxf_compare_field_nb(AVFormatContext *s, const AVPacket *next,
+ const AVPacket *cur)
{
GXFContext *gxf = s->priv_data;
- AVPacket *pkt[2] = { cur, next };
+ const AVPacket *pkt[2] = { cur, next };
int i, field_nb[2];
GXFStreamContext *sc[2];
diff --git a/libavformat/internal.h b/libavformat/internal.h
index cf8c16579c..d6a039c497 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -237,7 +237,7 @@ int ff_hex_to_data(uint8_t *data, const char *p);
* @return 0, or < 0 on error
*/
int ff_interleave_add_packet(AVFormatContext *s, AVPacket *pkt,
- int (*compare)(AVFormatContext *, AVPacket *, AVPacket *));
+ int (*compare)(AVFormatContext *, const AVPacket *, const AVPacket *));
void ff_read_frame_flush(AVFormatContext *s);
diff --git a/libavformat/mux.c b/libavformat/mux.c
index 8ab5ea8c2b..c79122160a 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -917,7 +917,7 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt)
#define CHUNK_START 0x1000
int ff_interleave_add_packet(AVFormatContext *s, AVPacket *pkt,
- int (*compare)(AVFormatContext *, AVPacket *, AVPacket *))
+ int (*compare)(AVFormatContext *, const AVPacket *, const AVPacket *))
{
int ret;
AVPacketList **next_point, *this_pktl;
@@ -994,8 +994,8 @@ next_non_null:
return 0;
}
-static int interleave_compare_dts(AVFormatContext *s, AVPacket *next,
- AVPacket *pkt)
+static int interleave_compare_dts(AVFormatContext *s, const AVPacket *next,
+ const AVPacket *pkt)
{
AVStream *st = s->streams[pkt->stream_index];
AVStream *st2 = s->streams[next->stream_index];
diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index 2e54320cf0..8b3d599a6f 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -3148,7 +3148,8 @@ static int mxf_interleave_get_packet(AVFormatContext *s, AVPacket *out, AVPacket
}
}
-static int mxf_compare_timestamps(AVFormatContext *s, AVPacket *next, AVPacket *pkt)
+static int mxf_compare_timestamps(AVFormatContext *s, const AVPacket *next,
+ const AVPacket *pkt)
{
MXFStreamContext *sc = s->streams[pkt ->stream_index]->priv_data;
MXFStreamContext *sc2 = s->streams[next->stream_index]->priv_data;