Compat for old ffmpeg

This commit is contained in:
Kovid Goyal 2024-10-11 22:01:09 +05:30
parent dd10d5ca52
commit ab34cc021b
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -6,6 +6,7 @@
*/
#include <libavutil/version.h>
#define UNICODE
#define PY_SSIZE_T_CLEAN
@ -63,9 +64,12 @@ read_packet(void *opaque, uint8_t *buf, int buf_size) {
return b.len;
}
static int
#if LIBAVFORMAT_VERSION_MAJOR >= 61
write_packet(void *opaque, const uint8_t *buf, int buf_size) {
#else
write_packet(void *opaque, uint8_t *buf, int buf_size) {
#endif
Transcoder *t = opaque;
PyObject *mv = PyMemoryView_FromMemory((char*)buf, buf_size, PyBUF_READ);
if (!mv) return AVERROR_EXTERNAL;