[FFmpeg-devel] lavf:Constify AVProbeData* in av_probe_input_format()

Submitted by Carl Eugen Hoyos on Feb. 9, 2019, 10:27 p.m.

Details

Message ID CAB0OVGoAAX2x5h1yHr5UvQOPRbiR5yhm0HdMYvAdyJQ2JiAN-g@mail.gmail.com
State Accepted
Headers show

Commit Message

Carl Eugen Hoyos Feb. 9, 2019, 10:27 p.m.
2019-02-09 23:26 GMT+01:00, Carl Eugen Hoyos <ceffmpeg@gmail.com>:
> Hi!
>
> Attached patch constifies a few pointers at the next version bump.

And the patch.

Carl Eugen

Comments

Carl Eugen Hoyos Feb. 14, 2019, 8:53 p.m.
2019-02-09 23:27 GMT+01:00, Carl Eugen Hoyos <ceffmpeg@gmail.com>:
> 2019-02-09 23:26 GMT+01:00, Carl Eugen Hoyos <ceffmpeg@gmail.com>:
>> Hi!
>>
>> Attached patch constifies a few pointers at the next version bump.
>
> And the patch.

Ping.

Carl Eugen
Carl Eugen Hoyos March 20, 2019, 6:06 p.m.
2019-02-09 23:27 GMT+01:00, Carl Eugen Hoyos <ceffmpeg@gmail.com>:
> 2019-02-09 23:26 GMT+01:00, Carl Eugen Hoyos <ceffmpeg@gmail.com>:

>> Attached patch constifies a few pointers at the next version bump.
>
> And the patch.

Patch applied.

Carl Eugen

Patch hide | download patch | download mbox

From cb2afc8b7e28b476d908daf1ae693bd007fb2abc Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Date: Sat, 9 Feb 2019 23:22:59 +0100
Subject: [PATCH] lavf: Constify AVProbeData* in av_probe_input_format().

---
 libavformat/avformat.h |   11 ++++++++---
 libavformat/format.c   |    6 +++---
 libavformat/version.h  |    3 +++
 3 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index fdaffa5..c6e1e97 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -2231,7 +2231,12 @@  AVInputFormat *av_find_input_format(const char *short_name);
  * @param is_opened Whether the file is already opened; determines whether
  *                  demuxers with or without AVFMT_NOFILE are probed.
  */
-AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened);
+#if FF_API_AVIOFORMAT
+#define av_const59
+#else
+#define av_const59 const
+#endif
+AVInputFormat *av_probe_input_format(av_const59 AVProbeData *pd, int is_opened);
 
 /**
  * Guess the file format.
@@ -2245,7 +2250,7 @@  AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened);
  *                  If the score is <= AVPROBE_SCORE_MAX / 4 it is recommended
  *                  to retry with a larger probe buffer.
  */
-AVInputFormat *av_probe_input_format2(AVProbeData *pd, int is_opened, int *score_max);
+AVInputFormat *av_probe_input_format2(av_const59 AVProbeData *pd, int is_opened, int *score_max);
 
 /**
  * Guess the file format.
@@ -2254,7 +2259,7 @@  AVInputFormat *av_probe_input_format2(AVProbeData *pd, int is_opened, int *score
  *                  demuxers with or without AVFMT_NOFILE are probed.
  * @param score_ret The score of the best detection.
  */
-AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened, int *score_ret);
+AVInputFormat *av_probe_input_format3(av_const59 AVProbeData *pd, int is_opened, int *score_ret);
 
 /**
  * Probe a bytestream to determine the input format. Each time a probe returns
diff --git a/libavformat/format.c b/libavformat/format.c
index 2c4c895..1ad8252 100644
--- a/libavformat/format.c
+++ b/libavformat/format.c
@@ -125,7 +125,7 @@  AVInputFormat *av_find_input_format(const char *short_name)
     return NULL;
 }
 
-AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened,
+AVInputFormat *av_probe_input_format3(av_const59 AVProbeData *pd, int is_opened,
                                       int *score_ret)
 {
     AVProbeData lpd = *pd;
@@ -202,7 +202,7 @@  AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened,
     return fmt;
 }
 
-AVInputFormat *av_probe_input_format2(AVProbeData *pd, int is_opened, int *score_max)
+AVInputFormat *av_probe_input_format2(av_const59 AVProbeData *pd, int is_opened, int *score_max)
 {
     int score_ret;
     AVInputFormat *fmt = av_probe_input_format3(pd, is_opened, &score_ret);
@@ -213,7 +213,7 @@  AVInputFormat *av_probe_input_format2(AVProbeData *pd, int is_opened, int *score
         return NULL;
 }
 
-AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened)
+AVInputFormat *av_probe_input_format(av_const59 AVProbeData *pd, int is_opened)
 {
     int score = 0;
     return av_probe_input_format2(pd, is_opened, &score);
diff --git a/libavformat/version.h b/libavformat/version.h
index 4408eca..f189984 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -103,6 +103,9 @@ 
 #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
-- 
1.7.10.4