]> git.sesse.net Git - ffmpeg/commitdiff
lavf: Constify AVOutputFormat pointer.
authorCarl Eugen Hoyos <ceffmpeg@gmail.com>
Wed, 20 Mar 2019 17:38:48 +0000 (18:38 +0100)
committerCarl Eugen Hoyos <ceffmpeg@gmail.com>
Wed, 20 Mar 2019 17:38:48 +0000 (18:38 +0100)
13 files changed:
libavformat/avformat.h
libavformat/fifo.c
libavformat/format.c
libavformat/hdsenc.c
libavformat/hlsenc.c
libavformat/mux.c
libavformat/rtp.c
libavformat/rtpenc_chain.c
libavformat/rtpenc_mpegts.c
libavformat/segment.c
libavformat/smoothstreamingenc.c
libavformat/version.h
libavformat/webm_chunk.c

index fdaffa5bf41b6ed83fa4f7acebcf04ed796296fd..9ddac9d64a68cee4778b3bf8d78c94e6c47d6571 100644 (file)
@@ -532,7 +532,12 @@ typedef struct AVOutputFormat {
      * New public fields should be added right above.
      *****************************************************************
      */
-    struct AVOutputFormat *next;
+#if FF_API_AVIOFORMAT
+#define ff_const59
+#else
+#define ff_const59 const
+#endif
+    ff_const59 struct AVOutputFormat *next;
     /**
      * size of private data so that it can be allocated in the wrapper
      */
@@ -1353,7 +1358,7 @@ typedef struct AVFormatContext {
      *
      * Muxing only, must be set by the caller before avformat_write_header().
      */
-    struct AVOutputFormat *oformat;
+    ff_const59 struct AVOutputFormat *oformat;
 
     /**
      * Format private data. This is an AVOptions-enabled struct
@@ -2211,7 +2216,7 @@ AVProgram *av_new_program(AVFormatContext *s, int id);
  * @return >= 0 in case of success, a negative AVERROR code in case of
  * failure
  */
-int avformat_alloc_output_context2(AVFormatContext **ctx, AVOutputFormat *oformat,
+int avformat_alloc_output_context2(AVFormatContext **ctx, ff_const59 AVOutputFormat *oformat,
                                    const char *format_name, const char *filename);
 
 /**
@@ -2687,14 +2692,14 @@ int av_write_trailer(AVFormatContext *s);
  * @param mime_type if non-NULL checks if mime_type matches with the
  * MIME type of the registered formats
  */
-AVOutputFormat *av_guess_format(const char *short_name,
+ff_const59 AVOutputFormat *av_guess_format(const char *short_name,
                                 const char *filename,
                                 const char *mime_type);
 
 /**
  * Guess the codec ID based upon muxer and filename.
  */
-enum AVCodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name,
+enum AVCodecID av_guess_codec(ff_const59 AVOutputFormat *fmt, const char *short_name,
                             const char *filename, const char *mime_type,
                             enum AVMediaType type);
 
index 145e2e266047e47802a81e573d8fcd35a5a369ed..b403ba717b5d8ef2d43581812075ab2ae6d9488d 100644 (file)
@@ -442,7 +442,7 @@ static void *fifo_consumer_thread(void *data)
     return NULL;
 }
 
-static int fifo_mux_init(AVFormatContext *avf, AVOutputFormat *oformat,
+static int fifo_mux_init(AVFormatContext *avf, ff_const59 AVOutputFormat *oformat,
                          const char *filename)
 {
     FifoContext *fifo = avf->priv_data;
@@ -481,7 +481,7 @@ static int fifo_mux_init(AVFormatContext *avf, AVOutputFormat *oformat,
 static int fifo_init(AVFormatContext *avf)
 {
     FifoContext *fifo = avf->priv_data;
-    AVOutputFormat *oformat;
+    ff_const59 AVOutputFormat *oformat;
     int ret = 0;
 
     if (fifo->recovery_wait_streamtime && !fifo->drop_pkts_on_overflow) {
index 2c4c89553073f3649afa28abc807901436192ceb..102535ffef1990d66e4ab04cc6a04279ce328093 100644 (file)
@@ -48,7 +48,7 @@ int av_match_ext(const char *filename, const char *extensions)
     return 0;
 }
 
-AVOutputFormat *av_guess_format(const char *short_name, const char *filename,
+ff_const59 AVOutputFormat *av_guess_format(const char *short_name, const char *filename,
                                 const char *mime_type)
 {
     const AVOutputFormat *fmt = NULL;
@@ -84,12 +84,12 @@ AVOutputFormat *av_guess_format(const char *short_name, const char *filename,
     return fmt_found;
 }
 
-enum AVCodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name,
+enum AVCodecID av_guess_codec(ff_const59 AVOutputFormat *fmt, const char *short_name,
                               const char *filename, const char *mime_type,
                               enum AVMediaType type)
 {
     if (av_match_name("segment", fmt->name) || av_match_name("ssegment", fmt->name)) {
-        AVOutputFormat *fmt2 = av_guess_format(NULL, filename, NULL);
+        ff_const59 AVOutputFormat *fmt2 = av_guess_format(NULL, filename, NULL);
         if (fmt2)
             fmt = fmt2;
     }
index d82aee17b98e20ea7e117afb0dc34e84793a37f6..026530ac369cc04fa7ffd48c35b6b769625c6818 100644 (file)
@@ -315,7 +315,7 @@ static int hds_write_header(AVFormatContext *s)
 {
     HDSContext *c = s->priv_data;
     int ret = 0, i;
-    AVOutputFormat *oformat;
+    ff_const59 AVOutputFormat *oformat;
 
     if (mkdir(s->url, 0777) == -1 && errno != EEXIST) {
         ret = AVERROR(errno);
index 258d0628bab279af34f41190475f10a62a01efc7..5f9a200c6e2f0aa12107d1f79587fe1b3e338b92 100644 (file)
@@ -110,8 +110,8 @@ typedef struct VariantStream {
     unsigned var_stream_idx;
     unsigned number;
     int64_t sequence;
-    AVOutputFormat *oformat;
-    AVOutputFormat *vtt_oformat;
+    ff_const59 AVOutputFormat *oformat;
+    ff_const59 AVOutputFormat *vtt_oformat;
     AVIOContext *out;
     int packets_written;
     int init_range_length;
index 2847a02a19c15fd7c5839916ea1dba856232f4e6..83fe1de78fe32de76a599f66910d634439f6f4e1 100644 (file)
@@ -145,7 +145,7 @@ enum AVChromaLocation ff_choose_chroma_location(AVFormatContext *s, AVStream *st
 
 }
 
-int avformat_alloc_output_context2(AVFormatContext **avctx, AVOutputFormat *oformat,
+int avformat_alloc_output_context2(AVFormatContext **avctx, ff_const59 AVOutputFormat *oformat,
                                    const char *format, const char *filename)
 {
     AVFormatContext *s = avformat_alloc_context();
@@ -246,7 +246,7 @@ static int init_muxer(AVFormatContext *s, AVDictionary **options)
     AVStream *st;
     AVDictionary *tmp = NULL;
     AVCodecParameters *par = NULL;
-    AVOutputFormat *of = s->oformat;
+    const AVOutputFormat *of = s->oformat;
     const AVCodecDescriptor *desc;
     AVDictionaryEntry *e;
 
index 4745e54bb02b5b948c5dd60ddd18d624a54c5972..38e234391be5cfc886d2df2e752b45d0a1831147 100644 (file)
@@ -91,7 +91,7 @@ int ff_rtp_get_payload_type(AVFormatContext *fmt,
                             AVCodecParameters *par, int idx)
 {
     int i;
-    AVOutputFormat *ofmt = fmt ? fmt->oformat : NULL;
+    const AVOutputFormat *ofmt = fmt ? fmt->oformat : NULL;
 
     /* Was the payload type already specified for the RTP muxer? */
     if (ofmt && ofmt->priv_class && fmt->priv_data) {
index e7a4dffabac418fb650811b401b192e70dc41673..e6b603db70fdb1a86270bad4fdd107f43b436cb3 100644 (file)
@@ -31,7 +31,7 @@ int ff_rtp_chain_mux_open(AVFormatContext **out, AVFormatContext *s,
 {
     AVFormatContext *rtpctx = NULL;
     int ret;
-    AVOutputFormat *rtp_format = av_guess_format("rtp", NULL, NULL);
+    ff_const59 AVOutputFormat *rtp_format = av_guess_format("rtp", NULL, NULL);
     uint8_t *rtpflags;
     AVDictionary *opts = NULL;
 
index 5f81e1a14533ac3a8a71e9157654ebc7081d432e..969dbff3d6c6bf0c21a8f4a183b862814d82e6ca 100644 (file)
@@ -48,8 +48,8 @@ static int rtp_mpegts_write_header(AVFormatContext *s)
 {
     struct MuxChain *chain = s->priv_data;
     AVFormatContext *mpegts_ctx = NULL, *rtp_ctx = NULL;
-    AVOutputFormat *mpegts_format = av_guess_format("mpegts", NULL, NULL);
-    AVOutputFormat *rtp_format    = av_guess_format("rtp", NULL, NULL);
+    ff_const59 AVOutputFormat *mpegts_format = av_guess_format("mpegts", NULL, NULL);
+    ff_const59 AVOutputFormat *rtp_format    = av_guess_format("rtp", NULL, NULL);
     int i, ret = AVERROR(ENOMEM);
     AVStream *st;
 
index e2ac2c3a7f3d8c55f2da992cdb73494f9054fbf7..90004600bdfc40ea61116cedd6a512eec6ada899 100644 (file)
@@ -72,7 +72,7 @@ typedef struct SegmentContext {
     int segment_idx_wrap;  ///< number after which the index wraps
     int segment_idx_wrap_nb;  ///< number of time the index has wraped
     int segment_count;     ///< number of segment files already written
-    AVOutputFormat *oformat;
+    ff_const59 AVOutputFormat *oformat;
     AVFormatContext *avf;
     char *format;              ///< format to use for output segment files
     char *format_options_str;  ///< format options to use for output segment files
index bd7f841dc7225851b445c79f282d96367ae4c45d..1ed19ebb2f2e03a604ce6d60b56e02a8ce5f9122 100644 (file)
@@ -293,7 +293,7 @@ static int ism_write_header(AVFormatContext *s)
 {
     SmoothStreamingContext *c = s->priv_data;
     int ret = 0, i;
-    AVOutputFormat *oformat;
+    ff_const59 AVOutputFormat *oformat;
 
     if (mkdir(s->url, 0777) == -1 && errno != EEXIST) {
         ret = AVERROR(errno);
index 2e83eb4f239511c3ddca45d5d4bba186ff5c4f9e..69d3f691f0c28327771823a5b443f5dedaa573ce 100644 (file)
 #ifndef FF_API_LAVF_MP4A_LATM
 #define FF_API_LAVF_MP4A_LATM           (LIBAVFORMAT_VERSION_MAJOR < 59)
 #endif
+#ifndef FF_API_AVIOFORMAT
+#define FF_API_AVIOFORMAT               (LIBAVFORMAT_VERSION_MAJOR < 59)
+#endif
 
 
 #ifndef FF_API_R_FRAME_RATE
index 7ceb276fc436bede080f2d3dda6ad1415220b931..ec1ec4bf918cad32c06c949a2393bf2801de8da1 100644 (file)
@@ -53,7 +53,7 @@ typedef struct WebMChunkContext {
     char *http_method;
     uint64_t duration_written;
     int prev_pts;
-    AVOutputFormat *oformat;
+    ff_const59 AVOutputFormat *oformat;
     AVFormatContext *avf;
 } WebMChunkContext;