They are currently non-const for reasons unknown, although avio_write() accepts a const buffer.
Unified · Split
| @@ -2,6 +2,10 @@ The last version increases of all libraries were on 2023-02-09 · 1 unmodified line | ||
| 2 | 2 | |
| 3 | 3 | API changes, most recent first: |
| 4 | 4 | |
| 5 | +2023-09-07 - xxxxxxxxxx - lavf 60.12.100 - avio.h | |
| 6 | + Constify the buffer pointees in the write_packet and write_data_type | |
| 7 | + callbacks of AVIOContext on the next major bump. | |
| 8 | + | |
| 5 | 9 | 2023-09-07 - xxxxxxxxxx - lavc 60.26.100 - defs.h |
| 6 | 10 | Add AV_PROFILE_* and AV_LEVEL_* replacements in defs.h for the |
| 7 | 11 | defines from avcodec.h. The latter are deprecated. |
| @@ -408,7 +408,11 @@ int ffurl_read_complete(URLContext *h, unsigned char *buf, int size) · 407 unmodified lines | ||
| 408 | 408 | return retry_transfer_wrapper(h, buf, size, size, h->prot->url_read); |
| 409 | 409 | } |
| 410 | 410 | |
| 411 | +#if FF_API_AVIO_WRITE_NONCONST | |
| 411 | 412 | int ffurl_write2(void *urlcontext, uint8_t *buf, int size) |
| 413 | +#else | |
| 414 | +int ffurl_write2(void *urlcontext, const uint8_t *buf, int size) | |
| 415 | +#endif | |
| 412 | 416 | { |
| 413 | 417 | URLContext *h = urlcontext; |
| 414 | 418 | |
| @@ -238,7 +238,11 @@ typedef struct AVIOContext { · 237 unmodified lines | ||
| 238 | 238 | void *opaque; /**< A private pointer, passed to the read/write/seek/... |
| 239 | 239 | functions. */ |
| 240 | 240 | int (*read_packet)(void *opaque, uint8_t *buf, int buf_size); |
| 241 | +#if FF_API_AVIO_WRITE_NONCONST | |
| 241 | 242 | int (*write_packet)(void *opaque, uint8_t *buf, int buf_size); |
| 243 | +#else | |
| 244 | + int (*write_packet)(void *opaque, const uint8_t *buf, int buf_size); | |
| 245 | +#endif | |
| 242 | 246 | int64_t (*seek)(void *opaque, int64_t offset, int whence); |
| 243 | 247 | int64_t pos; /**< position in the file of the current buffer */ |
| 244 | 248 | int eof_reached; /**< true if was unable to read due to error or eof */ |
| @@ -286,8 +290,13 @@ typedef struct AVIOContext { · 41 unmodified lines | ||
| 286 | 290 | /** |
| 287 | 291 | * A callback that is used instead of write_packet. |
| 288 | 292 | */ |
| 293 | +#if FF_API_AVIO_WRITE_NONCONST | |
| 289 | 294 | int (*write_data_type)(void *opaque, uint8_t *buf, int buf_size, |
| 290 | 295 | enum AVIODataMarkerType type, int64_t time); |
| 296 | +#else | |
| 297 | + int (*write_data_type)(void *opaque, const uint8_t *buf, int buf_size, | |
| 298 | + enum AVIODataMarkerType type, int64_t time); | |
| 299 | +#endif | |
| 291 | 300 | /** |
| 292 | 301 | * If set, don't call write_data_type separately for AVIO_DATA_MARKER_BOUNDARY_POINT, |
| 293 | 302 | * but ignore them and treat them as AVIO_DATA_MARKER_UNKNOWN (to avoid needlessly |
| @@ -407,7 +416,11 @@ AVIOContext *avio_alloc_context( · 113 unmodified lines | ||
| 407 | 416 | int write_flag, |
| 408 | 417 | void *opaque, |
| 409 | 418 | int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), |
| 419 | +#if FF_API_AVIO_WRITE_NONCONST | |
| 410 | 420 | int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), |
| 421 | +#else | |
| 422 | + int (*write_packet)(void *opaque, const uint8_t *buf, int buf_size), | |
| 423 | +#endif | |
| 411 | 424 | int64_t (*seek)(void *opaque, int64_t offset, int whence)); |
| 412 | 425 | |
| 413 | 426 | /** |
| @@ -89,7 +89,11 @@ 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 | |
| 92 | 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), | |
| 96 | +#endif | |
| 93 | 97 | int64_t (*seek)(void *opaque, int64_t offset, int whence)); |
| 94 | 98 | |
| 95 | 99 | /** |
| @@ -84,7 +84,11 @@ void ffio_init_context(FFIOContext *ctx, · 83 unmodified lines | ||
| 84 | 84 | int write_flag, |
| 85 | 85 | void *opaque, |
| 86 | 86 | int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), |
| 87 | +#if FF_API_AVIO_WRITE_NONCONST | |
| 87 | 88 | int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), |
| 89 | +#else | |
| 90 | + int (*write_packet)(void *opaque, const uint8_t *buf, int buf_size), | |
| 91 | +#endif | |
| 88 | 92 | int64_t (*seek)(void *opaque, int64_t offset, int whence)) |
| 89 | 93 | { |
| 90 | 94 | AVIOContext *const s = &ctx->pub; |
| @@ -143,7 +147,11 @@ AVIOContext *avio_alloc_context( · 52 unmodified lines | ||
| 143 | 147 | int write_flag, |
| 144 | 148 | void *opaque, |
| 145 | 149 | int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), |
| 150 | +#if FF_API_AVIO_WRITE_NONCONST | |
| 146 | 151 | int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), |
| 152 | +#else | |
| 153 | + int (*write_packet)(void *opaque, const uint8_t *buf, int buf_size), | |
| 154 | +#endif | |
| 147 | 155 | int64_t (*seek)(void *opaque, int64_t offset, int whence)) |
| 148 | 156 | { |
| 149 | 157 | FFIOContext *s = av_malloc(sizeof(*s)); |
| @@ -165,12 +173,20 @@ static void writeout(AVIOContext *s, const uint8_t *data, int len) · 15 unmodified lines | ||
| 165 | 173 | if (!s->error) { |
| 166 | 174 | int ret = 0; |
| 167 | 175 | if (s->write_data_type) |
| 176 | +#if FF_API_AVIO_WRITE_NONCONST | |
| 168 | 177 | ret = s->write_data_type(s->opaque, (uint8_t *)data, |
| 178 | +#else | |
| 179 | + ret = s->write_data_type(s->opaque, data, | |
| 180 | +#endif | |
| 169 | 181 | len, |
| 170 | 182 | ctx->current_type, |
| 171 | 183 | ctx->last_time); |
| 172 | 184 | else if (s->write_packet) |
| 185 | +#if FF_API_AVIO_WRITE_NONCONST | |
| 173 | 186 | ret = s->write_packet(s->opaque, (uint8_t *)data, len); |
| 187 | +#else | |
| 188 | + ret = s->write_packet(s->opaque, data, len); | |
| 189 | +#endif | |
| 174 | 190 | if (ret < 0) { |
| 175 | 191 | s->error = ret; |
| 176 | 192 | } else { |
| @@ -1396,7 +1412,11 @@ typedef struct DynBuffer { · 1219 unmodified lines | ||
| 1396 | 1412 | uint8_t io_buffer[1]; |
| 1397 | 1413 | } DynBuffer; |
| 1398 | 1414 | |
| 1415 | +#if FF_API_AVIO_WRITE_NONCONST | |
| 1399 | 1416 | static int dyn_buf_write(void *opaque, uint8_t *buf, int buf_size) |
| 1417 | +#else | |
| 1418 | +static int dyn_buf_write(void *opaque, const uint8_t *buf, int buf_size) | |
| 1419 | +#endif | |
| 1400 | 1420 | { |
| 1401 | 1421 | DynBuffer *d = opaque; |
| 1402 | 1422 | unsigned new_size; |
| @@ -1428,7 +1448,11 @@ static int dyn_buf_write(void *opaque, uint8_t *buf, int buf_size) · 25 unmodified lines | ||
| 1428 | 1448 | return buf_size; |
| 1429 | 1449 | } |
| 1430 | 1450 | |
| 1451 | +#if FF_API_AVIO_WRITE_NONCONST | |
| 1431 | 1452 | static int dyn_packet_buf_write(void *opaque, uint8_t *buf, int buf_size) |
| 1453 | +#else | |
| 1454 | +static int dyn_packet_buf_write(void *opaque, const uint8_t *buf, int buf_size) | |
| 1455 | +#endif | |
| 1432 | 1456 | { |
| 1433 | 1457 | unsigned char buf1[4]; |
| 1434 | 1458 | int ret; |
| @@ -1565,7 +1589,11 @@ void ffio_free_dyn_buf(AVIOContext **s) · 130 unmodified lines | ||
| 1565 | 1589 | avio_context_free(s); |
| 1566 | 1590 | } |
| 1567 | 1591 | |
| 1592 | +#if FF_API_AVIO_WRITE_NONCONST | |
| 1568 | 1593 | static int null_buf_write(void *opaque, uint8_t *buf, int buf_size) |
| 1594 | +#else | |
| 1595 | +static int null_buf_write(void *opaque, const uint8_t *buf, int buf_size) | |
| 1596 | +#endif | |
| 1569 | 1597 | { |
| 1570 | 1598 | DynBuffer *d = opaque; |
| 1571 | 1599 | |
| @@ -112,7 +112,11 @@ 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 | |
| 115 | 116 | static int hds_write(void *opaque, uint8_t *buf, int buf_size) |
| 117 | +#else | |
| 118 | +static int hds_write(void *opaque, const uint8_t *buf, int buf_size) | |
| 119 | +#endif | |
| 116 | 120 | { |
| 117 | 121 | OutputStream *os = opaque; |
| 118 | 122 | if (os->out) { |
| @@ -75,7 +75,11 @@ typedef struct SmoothStreamingContext { · 74 unmodified lines | ||
| 75 | 75 | int nb_fragments; |
| 76 | 76 | } SmoothStreamingContext; |
| 77 | 77 | |
| 78 | +#if FF_API_AVIO_WRITE_NONCONST | |
| 78 | 79 | static int ism_write(void *opaque, uint8_t *buf, int buf_size) |
| 80 | +#else | |
| 81 | +static int ism_write(void *opaque, const uint8_t *buf, int buf_size) | |
| 82 | +#endif | |
| 79 | 83 | { |
| 80 | 84 | OutputStream *os = opaque; |
| 81 | 85 | if (os->out) |
| @@ -194,7 +194,11 @@ static inline int ffurl_read(URLContext *h, uint8_t *buf, int size) · 193 unmodified lines | ||
| 194 | 194 | */ |
| 195 | 195 | int ffurl_read_complete(URLContext *h, unsigned char *buf, int size); |
| 196 | 196 | |
| 197 | +#if FF_API_AVIO_WRITE_NONCONST | |
| 197 | 198 | int ffurl_write2(void *urlcontext, uint8_t *buf, int size); |
| 199 | +#else | |
| 200 | +int ffurl_write2(void *urlcontext, const uint8_t *buf, int size); | |
| 201 | +#endif | |
| 198 | 202 | /** |
| 199 | 203 | * Write size bytes from buf to the resource accessed by h. |
| 200 | 204 | * |
| @@ -203,7 +207,11 @@ int ffurl_write2(void *urlcontext, uint8_t *buf, int size); · 2 unmodified lines | ||
| 203 | 207 | */ |
| 204 | 208 | static inline int ffurl_write(URLContext *h, const uint8_t *buf, int size) |
| 205 | 209 | { |
| 210 | +#if FF_API_AVIO_WRITE_NONCONST | |
| 206 | 211 | return ffurl_write2(h, (uint8_t*)buf, size); |
| 212 | +#else | |
| 213 | + return ffurl_write2(h, buf, size); | |
| 214 | +#endif | |
| 207 | 215 | } |
| 208 | 216 | |
| 209 | 217 | int64_t ffurl_seek2(void *urlcontext, int64_t pos, int whence); |
| @@ -31,7 +31,7 @@ · 30 unmodified lines | ||
| 31 | 31 | |
| 32 | 32 | #include "version_major.h" |
| 33 | 33 | |
| 34 | −#define LIBAVFORMAT_VERSION_MINOR 11 | |
| 34 | +#define LIBAVFORMAT_VERSION_MINOR 12 | |
| 35 | 35 | #define LIBAVFORMAT_VERSION_MICRO 100 |
| 36 | 36 | |
| 37 | 37 | #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ |
| @@ -45,6 +45,7 @@ · 44 unmodified lines | ||
| 45 | 45 | #define FF_API_GET_END_PTS (LIBAVFORMAT_VERSION_MAJOR < 61) |
| 46 | 46 | #define FF_API_AVIODIRCONTEXT (LIBAVFORMAT_VERSION_MAJOR < 61) |
| 47 | 47 | #define FF_API_AVFORMAT_IO_CLOSE (LIBAVFORMAT_VERSION_MAJOR < 61) |
| 48 | +#define FF_API_AVIO_WRITE_NONCONST (LIBAVFORMAT_VERSION_MAJOR < 61) | |
| 48 | 49 | |
| 49 | 50 | |
| 50 | 51 | #define FF_API_R_FRAME_RATE 1 |