From a6733202cc6891f9feec48e33e342e657da3873d Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 15 Mar 2012 13:37:43 +0100 Subject: [PATCH] lavf: make av_interleave_packet_per_dts() private. There is no reason for it to be public, it's only meant to be used internally. --- libavformat/avformat.h | 18 +++++------------- libavformat/gxfenc.c | 2 +- libavformat/internal.h | 18 ++++++++++++++++++ libavformat/utils.c | 14 ++++++++++++-- libavformat/version.h | 3 +++ 5 files changed, 39 insertions(+), 16 deletions(-) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 4272a4f91f..073ca67afc 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -1374,23 +1374,15 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt); */ int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt); +#if FF_API_INTERLEAVE_PACKET /** - * Interleave a packet per dts in an output media file. - * - * Packets with pkt->destruct == av_destruct_packet will be freed inside this - * function, so they cannot be used after it. Note that calling av_free_packet() - * on them is still safe. - * - * @param s media file handle - * @param out the interleaved packet will be output here - * @param pkt the input packet - * @param flush 1 if no further packets are available as input and all - * remaining packets should be output - * @return 1 if a packet was output, 0 if no packet could be output, - * < 0 if an error occurred + * @deprecated this function was never meant to be called by the user + * programs. */ +attribute_deprecated int av_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush); +#endif /** * Write the stream trailer to an output media file and free the diff --git a/libavformat/gxfenc.c b/libavformat/gxfenc.c index dcd2a8c84d..5069f2f3f8 100644 --- a/libavformat/gxfenc.c +++ b/libavformat/gxfenc.c @@ -936,7 +936,7 @@ static int gxf_interleave_packet(AVFormatContext *s, AVPacket *out, AVPacket *pk if (pkt && s->streams[pkt->stream_index]->codec->codec_type == AVMEDIA_TYPE_VIDEO) pkt->duration = 2; // enforce 2 fields return ff_audio_rechunk_interleave(s, out, pkt, flush, - av_interleave_packet_per_dts, gxf_compare_field_nb); + ff_interleave_packet_per_dts, gxf_compare_field_nb); } AVOutputFormat ff_gxf_muxer = { diff --git a/libavformat/internal.h b/libavformat/internal.h index ad300325cb..a434f99633 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -327,4 +327,22 @@ int ff_framehash_write_header(AVFormatContext *s); */ int ff_read_packet(AVFormatContext *s, AVPacket *pkt); +/** + * Interleave a packet per dts in an output media file. + * + * Packets with pkt->destruct == av_destruct_packet will be freed inside this + * function, so they cannot be used after it. Note that calling av_free_packet() + * on them is still safe. + * + * @param s media file handle + * @param out the interleaved packet will be output here + * @param pkt the input packet + * @param flush 1 if no further packets are available as input and all + * remaining packets should be output + * @return 1 if a packet was output, 0 if no packet could be output, + * < 0 if an error occurred + */ +int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out, + AVPacket *pkt, int flush); + #endif /* AVFORMAT_INTERNAL_H */ diff --git a/libavformat/utils.c b/libavformat/utils.c index 4b302a9531..6c985af1a0 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -3068,7 +3068,9 @@ static int ff_interleave_compare_dts(AVFormatContext *s, AVPacket *next, AVPacke return comp > 0; } -int av_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush){ +int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out, + AVPacket *pkt, int flush) +{ AVPacketList *pktl; int stream_count=0; int i; @@ -3098,6 +3100,14 @@ int av_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out, AVPacket *pk } } +#if FF_API_INTERLEAVE_PACKET +int av_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out, + AVPacket *pkt, int flush) +{ + return ff_interleave_packet_per_dts(s, out, pkt, flush); +} +#endif + /** * Interleave an AVPacket correctly so it can be muxed. * @param out the interleaved packet will be output here @@ -3114,7 +3124,7 @@ static int interleave_packet(AVFormatContext *s, AVPacket *out, AVPacket *in, in av_free_packet(in); return ret; } else - return av_interleave_packet_per_dts(s, out, in, flush); + return ff_interleave_packet_per_dts(s, out, in, flush); } int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt){ diff --git a/libavformat/version.h b/libavformat/version.h index ac1c5473bd..91ddfd27e8 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -56,5 +56,8 @@ #ifndef FF_API_READ_PACKET #define FF_API_READ_PACKET (LIBAVFORMAT_VERSION_MAJOR < 55) #endif +#ifndef FF_API_INTERLEAVE_PACKET +#define FF_API_INTERLEAVE_PACKET (LIBAVFORMAT_VERSION_MAJOR < 55) +#endif #endif /* AVFORMAT_VERSION_H */