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>
This commit is contained in:
Andreas Rheinhardt 2019-08-13 04:47:16 +02:00 committed by Michael Niedermayer
parent e301736862
commit 1147759552
6 changed files with 11 additions and 9 deletions

View File

@ -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;

View File

@ -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 */

View File

@ -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];

View File

@ -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);

View File

@ -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];

View File

@ -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;