Browse code

avformat: deprecate getters and setters for AVFormatContext and AVStream fields

The fields can be accessed directly, so these are not needed anymore.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>

James Almer authored on 2017/10/23 23:39:08
Showing 3 changed files
... ...
@@ -1209,11 +1209,22 @@ typedef struct AVStream {
1209 1209
     AVStreamInternal *internal;
1210 1210
 } AVStream;
1211 1211
 
1212
+#if FF_API_FORMAT_GET_SET
1213
+/**
1214
+ * Accessors for some AVStream fields. These used to be provided for ABI
1215
+ * compatibility, and do not need to be used anymore.
1216
+ */
1217
+attribute_deprecated
1212 1218
 AVRational av_stream_get_r_frame_rate(const AVStream *s);
1219
+attribute_deprecated
1213 1220
 void       av_stream_set_r_frame_rate(AVStream *s, AVRational r);
1214
-struct AVCodecParserContext *av_stream_get_parser(const AVStream *s);
1221
+attribute_deprecated
1215 1222
 char* av_stream_get_recommended_encoder_configuration(const AVStream *s);
1223
+attribute_deprecated
1216 1224
 void  av_stream_set_recommended_encoder_configuration(AVStream *s, char *configuration);
1225
+#endif
1226
+
1227
+struct AVCodecParserContext *av_stream_get_parser(const AVStream *s);
1217 1228
 
1218 1229
 /**
1219 1230
  * Returns the pts of the last muxed packet + its duration
... ...
@@ -1885,29 +1896,46 @@ typedef struct AVFormatContext {
1885 1885
     int max_streams;
1886 1886
 } AVFormatContext;
1887 1887
 
1888
+#if FF_API_FORMAT_GET_SET
1888 1889
 /**
1889 1890
  * Accessors for some AVFormatContext fields. These used to be provided for ABI
1890 1891
  * compatibility, and do not need to be used anymore.
1891 1892
  */
1893
+attribute_deprecated
1892 1894
 int av_format_get_probe_score(const AVFormatContext *s);
1895
+attribute_deprecated
1893 1896
 AVCodec * av_format_get_video_codec(const AVFormatContext *s);
1897
+attribute_deprecated
1894 1898
 void      av_format_set_video_codec(AVFormatContext *s, AVCodec *c);
1899
+attribute_deprecated
1895 1900
 AVCodec * av_format_get_audio_codec(const AVFormatContext *s);
1901
+attribute_deprecated
1896 1902
 void      av_format_set_audio_codec(AVFormatContext *s, AVCodec *c);
1903
+attribute_deprecated
1897 1904
 AVCodec * av_format_get_subtitle_codec(const AVFormatContext *s);
1905
+attribute_deprecated
1898 1906
 void      av_format_set_subtitle_codec(AVFormatContext *s, AVCodec *c);
1907
+attribute_deprecated
1899 1908
 AVCodec * av_format_get_data_codec(const AVFormatContext *s);
1909
+attribute_deprecated
1900 1910
 void      av_format_set_data_codec(AVFormatContext *s, AVCodec *c);
1911
+attribute_deprecated
1901 1912
 int       av_format_get_metadata_header_padding(const AVFormatContext *s);
1913
+attribute_deprecated
1902 1914
 void      av_format_set_metadata_header_padding(AVFormatContext *s, int c);
1915
+attribute_deprecated
1903 1916
 void *    av_format_get_opaque(const AVFormatContext *s);
1917
+attribute_deprecated
1904 1918
 void      av_format_set_opaque(AVFormatContext *s, void *opaque);
1919
+attribute_deprecated
1905 1920
 av_format_control_message av_format_get_control_message_cb(const AVFormatContext *s);
1921
+attribute_deprecated
1906 1922
 void      av_format_set_control_message_cb(AVFormatContext *s, av_format_control_message callback);
1907 1923
 #if FF_API_OLD_OPEN_CALLBACKS
1908 1924
 attribute_deprecated AVOpenCallback av_format_get_open_cb(const AVFormatContext *s);
1909 1925
 attribute_deprecated void av_format_set_open_cb(AVFormatContext *s, AVOpenCallback callback);
1910 1926
 #endif
1927
+#endif
1911 1928
 
1912 1929
 /**
1913 1930
  * This function will cause global side data to be injected in the next packet
... ...
@@ -104,6 +104,7 @@ static int64_t wrap_timestamp(const AVStream *st, int64_t timestamp)
104 104
     return timestamp;
105 105
 }
106 106
 
107
+#if FF_API_FORMAT_GET_SET
107 108
 MAKE_ACCESSORS(AVStream, stream, AVRational, r_frame_rate)
108 109
 MAKE_ACCESSORS(AVStream, stream, char *, recommended_encoder_configuration)
109 110
 MAKE_ACCESSORS(AVFormatContext, format, AVCodec *, video_codec)
... ...
@@ -118,6 +119,7 @@ FF_DISABLE_DEPRECATION_WARNINGS
118 118
 MAKE_ACCESSORS(AVFormatContext, format, AVOpenCallback, open_cb)
119 119
 FF_ENABLE_DEPRECATION_WARNINGS
120 120
 #endif
121
+#endif
121 122
 
122 123
 int64_t av_stream_get_end_pts(const AVStream *st)
123 124
 {
... ...
@@ -215,10 +217,12 @@ static const AVCodec *find_probe_decoder(AVFormatContext *s, const AVStream *st,
215 215
     return codec;
216 216
 }
217 217
 
218
+#if FF_API_FORMAT_GET_SET
218 219
 int av_format_get_probe_score(const AVFormatContext *s)
219 220
 {
220 221
     return s->probe_score;
221 222
 }
223
+#endif
222 224
 
223 225
 /* an arbitrarily chosen "sane" max packet size -- 50M */
224 226
 #define SANE_CHUNK_SIZE (50000000)
... ...
@@ -76,6 +76,9 @@
76 76
 #ifndef FF_API_OLD_ROTATE_API
77 77
 #define FF_API_OLD_ROTATE_API           (LIBAVFORMAT_VERSION_MAJOR < 59)
78 78
 #endif
79
+#ifndef FF_API_FORMAT_GET_SET
80
+#define FF_API_FORMAT_GET_SET           (LIBAVFORMAT_VERSION_MAJOR < 59)
81
+#endif
79 82
 
80 83
 
81 84
 #ifndef FF_API_R_FRAME_RATE