Showing the changes to libavformat (8 of 8 files). Show all
Unified · Split
| @@ -560,11 +560,7 @@ int ffurl_read_complete(URLContext *h, unsigned char *buf, int size) · 559 unmodified lines | ||
| 560 | 560 | return retry_transfer_wrapper(h, buf, NULL, size, size, 1); |
| 561 | 561 | } |
| 562 | 562 | |
| 563 | −#if FF_API_AVIO_WRITE_NONCONST | |
| 564 | −int ffurl_write2(void *urlcontext, uint8_t *buf, int size) | |
| 565 | −#else | |
| 566 | 563 | int ffurl_write2(void *urlcontext, const uint8_t *buf, int size) |
| 567 | −#endif | |
| 568 | 564 | { |
| 569 | 565 | URLContext *h = urlcontext; |
| 570 | 566 | |
| @@ -232,11 +232,7 @@ typedef struct AVIOContext { · 231 unmodified lines | ||
| 232 | 232 | void *opaque; /**< A private pointer, passed to the read/write/seek/... |
| 233 | 233 | functions. */ |
| 234 | 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 | 235 | int (*write_packet)(void *opaque, const uint8_t *buf, int buf_size); |
| 239 | −#endif | |
| 240 | 236 | int64_t (*seek)(void *opaque, int64_t offset, int whence); |
| 241 | 237 | int64_t pos; /**< position in the file of the current buffer */ |
| 242 | 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 | 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 | 283 | int (*write_data_type)(void *opaque, const uint8_t *buf, int buf_size, |
| 292 | 284 | enum AVIODataMarkerType type, int64_t time); |
| 293 | −#endif | |
| 294 | 285 | /** |
| 295 | 286 | * If set, don't call write_data_type separately for AVIO_DATA_MARKER_BOUNDARY_POINT, |
| 296 | 287 | * 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 | 401 | int write_flag, |
| 411 | 402 | void *opaque, |
| 412 | 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 | 404 | int (*write_packet)(void *opaque, const uint8_t *buf, int buf_size), |
| 417 | −#endif | |
| 418 | 405 | int64_t (*seek)(void *opaque, int64_t offset, int whence)); |
| 419 | 406 | |
| 420 | 407 | /** |
| @@ -89,11 +89,7 @@ void ffio_init_context(FFIOContext *s, · 88 unmodified lines | ||
| 89 | 89 | int write_flag, |
| 90 | 90 | void *opaque, |
| 91 | 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 | 92 | int (*write_packet)(void *opaque, const uint8_t *buf, int buf_size), |
| 96 | −#endif | |
| 97 | 93 | int64_t (*seek)(void *opaque, int64_t offset, int whence)); |
| 98 | 94 | |
| 99 | 95 | /** |
| @@ -52,11 +52,7 @@ void ffio_init_context(FFIOContext *ctx, · 51 unmodified lines | ||
| 52 | 52 | int write_flag, |
| 53 | 53 | void *opaque, |
| 54 | 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 | 55 | int (*write_packet)(void *opaque, const uint8_t *buf, int buf_size), |
| 59 | −#endif | |
| 60 | 56 | int64_t (*seek)(void *opaque, int64_t offset, int whence)) |
| 61 | 57 | { |
| 62 | 58 | AVIOContext *const s = &ctx->pub; |
| @@ -115,11 +111,7 @@ AVIOContext *avio_alloc_context( · 52 unmodified lines | ||
| 115 | 111 | int write_flag, |
| 116 | 112 | void *opaque, |
| 117 | 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 | 114 | int (*write_packet)(void *opaque, const uint8_t *buf, int buf_size), |
| 122 | −#endif | |
| 123 | 115 | int64_t (*seek)(void *opaque, int64_t offset, int whence)) |
| 124 | 116 | { |
| 125 | 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 | 133 | if (!s->error) { |
| 142 | 134 | int ret = 0; |
| 143 | 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 | 136 | ret = s->write_data_type(s->opaque, data, |
| 148 | −#endif | |
| 149 | 137 | len, |
| 150 | 138 | ctx->current_type, |
| 151 | 139 | ctx->last_time); |
| 152 | 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 | 141 | ret = s->write_packet(s->opaque, data, len); |
| 157 | −#endif | |
| 158 | 142 | if (ret < 0) { |
| 159 | 143 | s->error = ret; |
| 160 | 144 | } else { |
| @@ -1290,11 +1274,7 @@ typedef struct DynBuffer { · 1129 unmodified lines | ||
| 1290 | 1274 | uint8_t io_buffer[1]; |
| 1291 | 1275 | } DynBuffer; |
| 1292 | 1276 | |
| 1293 | −#if FF_API_AVIO_WRITE_NONCONST | |
| 1294 | −static int dyn_buf_write(void *opaque, uint8_t *buf, int buf_size) | |
| 1295 | −#else | |
| 1296 | 1277 | static int dyn_buf_write(void *opaque, const uint8_t *buf, int buf_size) |
| 1297 | −#endif | |
| 1298 | 1278 | { |
| 1299 | 1279 | DynBuffer *d = opaque; |
| 1300 | 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 | 1306 | return buf_size; |
| 1327 | 1307 | } |
| 1328 | 1308 | |
| 1329 | −#if FF_API_AVIO_WRITE_NONCONST | |
| 1330 | −static int dyn_packet_buf_write(void *opaque, uint8_t *buf, int buf_size) | |
| 1331 | −#else | |
| 1332 | 1309 | static int dyn_packet_buf_write(void *opaque, const uint8_t *buf, int buf_size) |
| 1333 | −#endif | |
| 1334 | 1310 | { |
| 1335 | 1311 | unsigned char buf1[4]; |
| 1336 | 1312 | int ret; |
| @@ -1467,11 +1443,7 @@ void ffio_free_dyn_buf(AVIOContext **s) · 130 unmodified lines | ||
| 1467 | 1443 | avio_context_free(s); |
| 1468 | 1444 | } |
| 1469 | 1445 | |
| 1470 | −#if FF_API_AVIO_WRITE_NONCONST | |
| 1471 | −static int null_buf_write(void *opaque, uint8_t *buf, int buf_size) | |
| 1472 | −#else | |
| 1473 | 1446 | static int null_buf_write(void *opaque, const uint8_t *buf, int buf_size) |
| 1474 | −#endif | |
| 1475 | 1447 | { |
| 1476 | 1448 | DynBuffer *d = opaque; |
| 1477 | 1449 | |
| @@ -112,11 +112,7 @@ static int parse_header(OutputStream *os, const uint8_t *buf, int buf_size) · 111 unmodified lines | ||
| 112 | 112 | return 0; |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | −#if FF_API_AVIO_WRITE_NONCONST | |
| 116 | −static int hds_write(void *opaque, uint8_t *buf, int buf_size) | |
| 117 | −#else | |
| 118 | 115 | static int hds_write(void *opaque, const uint8_t *buf, int buf_size) |
| 119 | −#endif | |
| 120 | 116 | { |
| 121 | 117 | OutputStream *os = opaque; |
| 122 | 118 | if (os->out) { |
| @@ -75,11 +75,7 @@ typedef struct SmoothStreamingContext { · 74 unmodified lines | ||
| 75 | 75 | int nb_fragments; |
| 76 | 76 | } SmoothStreamingContext; |
| 77 | 77 | |
| 78 | −#if FF_API_AVIO_WRITE_NONCONST | |
| 79 | −static int ism_write(void *opaque, uint8_t *buf, int buf_size) | |
| 80 | −#else | |
| 81 | 78 | static int ism_write(void *opaque, const uint8_t *buf, int buf_size) |
| 82 | −#endif | |
| 83 | 79 | { |
| 84 | 80 | OutputStream *os = opaque; |
| 85 | 81 | if (os->out) |
| @@ -192,11 +192,7 @@ static inline int ffurl_read(URLContext *h, uint8_t *buf, int size) · 191 unmodified lines | ||
| 192 | 192 | */ |
| 193 | 193 | int ffurl_read_complete(URLContext *h, unsigned char *buf, int size); |
| 194 | 194 | |
| 195 | −#if FF_API_AVIO_WRITE_NONCONST | |
| 196 | −int ffurl_write2(void *urlcontext, uint8_t *buf, int size); | |
| 197 | −#else | |
| 198 | 195 | int ffurl_write2(void *urlcontext, const uint8_t *buf, int size); |
| 199 | −#endif | |
| 200 | 196 | /** |
| 201 | 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 | */ |
| 206 | 202 | static 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 | 204 | return ffurl_write2(h, buf, size); |
| 212 | −#endif | |
| 213 | 205 | } |
| 214 | 206 | |
| 215 | 207 | int64_t ffurl_seek2(void *urlcontext, int64_t pos, int whence); |
| @@ -42,7 +42,6 @@ · 41 unmodified lines | ||
| 42 | 42 | * |
| 43 | 43 | */ |
| 44 | 44 | #define FF_API_COMPUTE_PKT_FIELDS2 (LIBAVFORMAT_VERSION_MAJOR < 61) |
| 45 | −#define FF_API_AVIO_WRITE_NONCONST (LIBAVFORMAT_VERSION_MAJOR < 61) | |
| 46 | 45 | #define FF_API_LAVF_SHORTEST (LIBAVFORMAT_VERSION_MAJOR < 61) |
| 47 | 46 | #define FF_API_ALLOW_FLUSH (LIBAVFORMAT_VERSION_MAJOR < 61) |
| 48 | 47 | #define FF_API_AVSTREAM_SIDE_DATA (LIBAVFORMAT_VERSION_MAJOR < 61) |