History

avformat: remove deprecated FF_API_AVIO_WRITE_NONCONST

James Almer committed 2 years ago

Commit 02aea611 parent d6799ee8 files · +0 −66Browse files

Showing the changes to libavformat (8 of 8 files). Show all

Unified · Split

8 files
  1. libavformat/avio.c +0 −4
  2. libavformat/avio.h +0 −13
  3. libavformat/avio_internal.h +0 −4
  4. libavformat/aviobuf.c +0 −28
  5. libavformat/hdsenc.c +0 −4
  6. libavformat/smoothstreamingenc.c +0 −4
  7. libavformat/url.h +0 −8
  8. libavformat/version_major.h +0 −1
libavformat/avio.c+0−4
@@ -560,11 +560,7 @@ int ffurl_read_complete(URLContext *h, unsigned char *buf, int size) · 559 unmodified lines
560 return retry_transfer_wrapper(h, buf, NULL, size, size, 1);560 return retry_transfer_wrapper(h, buf, NULL, size, size, 1);
561}561}
562 562
563#if FF_API_AVIO_WRITE_NONCONST
564int ffurl_write2(void *urlcontext, uint8_t *buf, int size)
565#else
566int ffurl_write2(void *urlcontext, const uint8_t *buf, int size)563int ffurl_write2(void *urlcontext, const uint8_t *buf, int size)
567#endif
568{564{
569 URLContext *h = urlcontext;565 URLContext *h = urlcontext;
570 566
libavformat/avio.h+0−13
@@ -232,11 +232,7 @@ typedef struct AVIOContext { · 231 unmodified lines
232 void *opaque; /**< A private pointer, passed to the read/write/seek/...232 void *opaque; /**< A private pointer, passed to the read/write/seek/...
233 functions. */233 functions. */
234 int (*read_packet)(void *opaque, uint8_t *buf, int buf_size);234 int (*read_packet)(void *opaque, uint8_t *buf, int buf_size);
235#if FF_API_AVIO_WRITE_NONCONST
236 int (*write_packet)(void *opaque, uint8_t *buf, int buf_size);
237#else
238 int (*write_packet)(void *opaque, const uint8_t *buf, int buf_size);235 int (*write_packet)(void *opaque, const uint8_t *buf, int buf_size);
239#endif
240 int64_t (*seek)(void *opaque, int64_t offset, int whence);236 int64_t (*seek)(void *opaque, int64_t offset, int whence);
241 int64_t pos; /**< position in the file of the current buffer */237 int64_t pos; /**< position in the file of the current buffer */
242 int eof_reached; /**< true if was unable to read due to error or eof */238 int eof_reached; /**< true if was unable to read due to error or eof */
@@ -284,13 +280,8 @@ typedef struct AVIOContext { · 41 unmodified lines
284 /**280 /**
285 * A callback that is used instead of write_packet.281 * A callback that is used instead of write_packet.
286 */282 */
287#if FF_API_AVIO_WRITE_NONCONST
288 int (*write_data_type)(void *opaque, uint8_t *buf, int buf_size,
289 enum AVIODataMarkerType type, int64_t time);
290#else
291 int (*write_data_type)(void *opaque, const uint8_t *buf, int buf_size,283 int (*write_data_type)(void *opaque, const uint8_t *buf, int buf_size,
292 enum AVIODataMarkerType type, int64_t time);284 enum AVIODataMarkerType type, int64_t time);
293#endif
294 /**285 /**
295 * If set, don't call write_data_type separately for AVIO_DATA_MARKER_BOUNDARY_POINT,286 * If set, don't call write_data_type separately for AVIO_DATA_MARKER_BOUNDARY_POINT,
296 * but ignore them and treat them as AVIO_DATA_MARKER_UNKNOWN (to avoid needlessly287 * but ignore them and treat them as AVIO_DATA_MARKER_UNKNOWN (to avoid needlessly
@@ -410,11 +401,7 @@ AVIOContext *avio_alloc_context( · 113 unmodified lines
410 int write_flag,401 int write_flag,
411 void *opaque,402 void *opaque,
412 int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),403 int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
413#if FF_API_AVIO_WRITE_NONCONST
414 int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
415#else
416 int (*write_packet)(void *opaque, const uint8_t *buf, int buf_size),404 int (*write_packet)(void *opaque, const uint8_t *buf, int buf_size),
417#endif
418 int64_t (*seek)(void *opaque, int64_t offset, int whence));405 int64_t (*seek)(void *opaque, int64_t offset, int whence));
419 406
420/**407/**
libavformat/avio_internal.h+0−4
@@ -89,11 +89,7 @@ void ffio_init_context(FFIOContext *s, · 88 unmodified lines
89 int write_flag,89 int write_flag,
90 void *opaque,90 void *opaque,
91 int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),91 int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
92#if FF_API_AVIO_WRITE_NONCONST
93 int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
94#else
95 int (*write_packet)(void *opaque, const uint8_t *buf, int buf_size),92 int (*write_packet)(void *opaque, const uint8_t *buf, int buf_size),
96#endif
97 int64_t (*seek)(void *opaque, int64_t offset, int whence));93 int64_t (*seek)(void *opaque, int64_t offset, int whence));
98 94
99/**95/**
libavformat/aviobuf.c+0−28
@@ -52,11 +52,7 @@ void ffio_init_context(FFIOContext *ctx, · 51 unmodified lines
52 int write_flag,52 int write_flag,
53 void *opaque,53 void *opaque,
54 int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),54 int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
55#if FF_API_AVIO_WRITE_NONCONST
56 int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
57#else
58 int (*write_packet)(void *opaque, const uint8_t *buf, int buf_size),55 int (*write_packet)(void *opaque, const uint8_t *buf, int buf_size),
59#endif
60 int64_t (*seek)(void *opaque, int64_t offset, int whence))56 int64_t (*seek)(void *opaque, int64_t offset, int whence))
61{57{
62 AVIOContext *const s = &ctx->pub;58 AVIOContext *const s = &ctx->pub;
@@ -115,11 +111,7 @@ AVIOContext *avio_alloc_context( · 52 unmodified lines
115 int write_flag,111 int write_flag,
116 void *opaque,112 void *opaque,
117 int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),113 int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
118#if FF_API_AVIO_WRITE_NONCONST
119 int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
120#else
121 int (*write_packet)(void *opaque, const uint8_t *buf, int buf_size),114 int (*write_packet)(void *opaque, const uint8_t *buf, int buf_size),
122#endif
123 int64_t (*seek)(void *opaque, int64_t offset, int whence))115 int64_t (*seek)(void *opaque, int64_t offset, int whence))
124{116{
125 FFIOContext *s = av_malloc(sizeof(*s));117 FFIOContext *s = av_malloc(sizeof(*s));
@@ -141,20 +133,12 @@ static void writeout(AVIOContext *s, const uint8_t *data, int len) · 15 unmodified lines
141 if (!s->error) {133 if (!s->error) {
142 int ret = 0;134 int ret = 0;
143 if (s->write_data_type)135 if (s->write_data_type)
144#if FF_API_AVIO_WRITE_NONCONST
145 ret = s->write_data_type(s->opaque, (uint8_t *)data,
146#else
147 ret = s->write_data_type(s->opaque, data,136 ret = s->write_data_type(s->opaque, data,
148#endif
149 len,137 len,
150 ctx->current_type,138 ctx->current_type,
151 ctx->last_time);139 ctx->last_time);
152 else if (s->write_packet)140 else if (s->write_packet)
153#if FF_API_AVIO_WRITE_NONCONST
154 ret = s->write_packet(s->opaque, (uint8_t *)data, len);
155#else
156 ret = s->write_packet(s->opaque, data, len);141 ret = s->write_packet(s->opaque, data, len);
157#endif
158 if (ret < 0) {142 if (ret < 0) {
159 s->error = ret;143 s->error = ret;
160 } else {144 } else {
@@ -1290,11 +1274,7 @@ typedef struct DynBuffer { · 1129 unmodified lines
1290 uint8_t io_buffer[1];1274 uint8_t io_buffer[1];
1291} DynBuffer;1275} DynBuffer;
1292 1276
1293#if FF_API_AVIO_WRITE_NONCONST
1294static int dyn_buf_write(void *opaque, uint8_t *buf, int buf_size)
1295#else
1296static int dyn_buf_write(void *opaque, const uint8_t *buf, int buf_size)1277static int dyn_buf_write(void *opaque, const uint8_t *buf, int buf_size)
1297#endif
1298{1278{
1299 DynBuffer *d = opaque;1279 DynBuffer *d = opaque;
1300 unsigned new_size;1280 unsigned new_size;
@@ -1326,11 +1306,7 @@ static int dyn_buf_write(void *opaque, const uint8_t *buf, int buf_size) · 25 unmodified lines
1326 return buf_size;1306 return buf_size;
1327}1307}
1328 1308
1329#if FF_API_AVIO_WRITE_NONCONST
1330static int dyn_packet_buf_write(void *opaque, uint8_t *buf, int buf_size)
1331#else
1332static int dyn_packet_buf_write(void *opaque, const uint8_t *buf, int buf_size)1309static int dyn_packet_buf_write(void *opaque, const uint8_t *buf, int buf_size)
1333#endif
1334{1310{
1335 unsigned char buf1[4];1311 unsigned char buf1[4];
1336 int ret;1312 int ret;
@@ -1467,11 +1443,7 @@ void ffio_free_dyn_buf(AVIOContext **s) · 130 unmodified lines
1467 avio_context_free(s);1443 avio_context_free(s);
1468}1444}
1469 1445
1470#if FF_API_AVIO_WRITE_NONCONST
1471static int null_buf_write(void *opaque, uint8_t *buf, int buf_size)
1472#else
1473static int null_buf_write(void *opaque, const uint8_t *buf, int buf_size)1446static int null_buf_write(void *opaque, const uint8_t *buf, int buf_size)
1474#endif
1475{1447{
1476 DynBuffer *d = opaque;1448 DynBuffer *d = opaque;
1477 1449
libavformat/hdsenc.c+0−4
@@ -112,11 +112,7 @@ static int parse_header(OutputStream *os, const uint8_t *buf, int buf_size) · 111 unmodified lines
112 return 0;112 return 0;
113}113}
114 114
115#if FF_API_AVIO_WRITE_NONCONST
116static int hds_write(void *opaque, uint8_t *buf, int buf_size)
117#else
118static int hds_write(void *opaque, const uint8_t *buf, int buf_size)115static int hds_write(void *opaque, const uint8_t *buf, int buf_size)
119#endif
120{116{
121 OutputStream *os = opaque;117 OutputStream *os = opaque;
122 if (os->out) {118 if (os->out) {
libavformat/smoothstreamingenc.c+0−4
@@ -75,11 +75,7 @@ typedef struct SmoothStreamingContext { · 74 unmodified lines
75 int nb_fragments;75 int nb_fragments;
76} SmoothStreamingContext;76} SmoothStreamingContext;
77 77
78#if FF_API_AVIO_WRITE_NONCONST
79static int ism_write(void *opaque, uint8_t *buf, int buf_size)
80#else
81static int ism_write(void *opaque, const uint8_t *buf, int buf_size)78static int ism_write(void *opaque, const uint8_t *buf, int buf_size)
82#endif
83{79{
84 OutputStream *os = opaque;80 OutputStream *os = opaque;
85 if (os->out)81 if (os->out)
libavformat/url.h+0−8
@@ -192,11 +192,7 @@ static inline int ffurl_read(URLContext *h, uint8_t *buf, int size) · 191 unmodified lines
192 */192 */
193int ffurl_read_complete(URLContext *h, unsigned char *buf, int size);193int ffurl_read_complete(URLContext *h, unsigned char *buf, int size);
194 194
195#if FF_API_AVIO_WRITE_NONCONST
196int ffurl_write2(void *urlcontext, uint8_t *buf, int size);
197#else
198int ffurl_write2(void *urlcontext, const uint8_t *buf, int size);195int ffurl_write2(void *urlcontext, const uint8_t *buf, int size);
199#endif
200/**196/**
201 * Write size bytes from buf to the resource accessed by h.197 * Write size bytes from buf to the resource accessed by h.
202 *198 *
@@ -205,11 +201,7 @@ int ffurl_write2(void *urlcontext, const uint8_t *buf, int size); · 2 unmodified lines
205 */201 */
206static inline int ffurl_write(URLContext *h, const uint8_t *buf, int size)202static inline int ffurl_write(URLContext *h, const uint8_t *buf, int size)
207{203{
208#if FF_API_AVIO_WRITE_NONCONST
209 return ffurl_write2(h, (uint8_t*)buf, size);
210#else
211 return ffurl_write2(h, buf, size);204 return ffurl_write2(h, buf, size);
212#endif
213}205}
214 206
215int64_t ffurl_seek2(void *urlcontext, int64_t pos, int whence);207int64_t ffurl_seek2(void *urlcontext, int64_t pos, int whence);
libavformat/version_major.h+0−1
@@ -42,7 +42,6 @@ · 41 unmodified lines
42 *42 *
43 */43 */
44#define FF_API_COMPUTE_PKT_FIELDS2 (LIBAVFORMAT_VERSION_MAJOR < 61)44#define FF_API_COMPUTE_PKT_FIELDS2 (LIBAVFORMAT_VERSION_MAJOR < 61)
45#define FF_API_AVIO_WRITE_NONCONST (LIBAVFORMAT_VERSION_MAJOR < 61)
46#define FF_API_LAVF_SHORTEST (LIBAVFORMAT_VERSION_MAJOR < 61)45#define FF_API_LAVF_SHORTEST (LIBAVFORMAT_VERSION_MAJOR < 61)
47#define FF_API_ALLOW_FLUSH (LIBAVFORMAT_VERSION_MAJOR < 61)46#define FF_API_ALLOW_FLUSH (LIBAVFORMAT_VERSION_MAJOR < 61)
48#define FF_API_AVSTREAM_SIDE_DATA (LIBAVFORMAT_VERSION_MAJOR < 61)47#define FF_API_AVSTREAM_SIDE_DATA (LIBAVFORMAT_VERSION_MAJOR < 61)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t