Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion av/audio/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def _init(
self.layout.nb_channels,
cython.cast(lib.AVSampleFormat, self.ptr.format),
self._buffer,
self._buffer_size,
cython.cast(cython.int, self._buffer_size),
align,
)
)
Expand Down
8 changes: 5 additions & 3 deletions av/codec/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def extradata(self, data):
if not self.ptr.extradata:
raise MemoryError("Cannot allocate extradata")
memcpy(self.ptr.extradata, source.ptr, source.length)
self.ptr.extradata_size = source.length
self.ptr.extradata_size = cython.cast(cython.int, source.length)

@property
def extradata_size(self):
Expand Down Expand Up @@ -294,7 +294,9 @@ def parse(self, raw_input=None):
source: ByteSource = bytesource(raw_input, allow_none=True)

in_data: cython.p_uchar = source.ptr if source is not None else cython.NULL
in_size: cython.int = source.length if source is not None else 0
in_size: cython.int = (
cython.cast(cython.int, source.length) if source is not None else 0
)

out_data: cython.p_uchar
out_size: cython.int
Expand Down Expand Up @@ -642,7 +644,7 @@ def bit_rate(self):
return self.ptr.bit_rate if self.ptr.bit_rate > 0 else None

@bit_rate.setter
def bit_rate(self, value: cython.int):
def bit_rate(self, value: cython.longlong):
self.ptr.bit_rate = value

@property
Expand Down
2 changes: 1 addition & 1 deletion av/container/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ def set_chapters(self, chapters):
)
ch_array[i] = ch

self.ptr.nb_chapters = count
self.ptr.nb_chapters = cython.cast(cython.uint, count)
self.ptr.chapters = ch_array


Expand Down
2 changes: 1 addition & 1 deletion av/container/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ def add_attachment(self, name: str, mimetype: str, data: bytes):
buf[i] = data[i]
buf[payload_size] = 0
stream.codecpar.extradata = cython.cast(cython.p_uchar, buf)
stream.codecpar.extradata_size = payload_size
stream.codecpar.extradata_size = cython.cast(cython.int, payload_size)

# Wrap as user-land stream.
meta_ptr = cython.address(stream.metadata)
Expand Down
2 changes: 1 addition & 1 deletion av/container/pyio.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ cdef class PyIOFile:
# Custom IO for above.
cdef lib.AVIOContext *iocontext
cdef unsigned char *buffer
cdef long pos
cdef int64_t pos
cdef bint pos_is_valid
2 changes: 1 addition & 1 deletion av/container/pyio.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def pyio_read_gil(opaque: cython.p_void, buf: Buf, buf_size: cython.int) -> cyth
self.pos += len(res)
if not res:
return lib.AVERROR_EOF
return len(res)
return cython.cast(cython.int, len(res))
except Exception:
return stash_exception()

Expand Down
2 changes: 1 addition & 1 deletion av/filter/graph.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ cdef class Graph:
cdef _register_context(self, FilterContext)
cdef _auto_register(self)
cdef int _nb_filters_seen
cdef dict[long, FilterContext] _context_by_ptr
cdef dict[size_t, FilterContext] _context_by_ptr
cdef dict[str, list[FilterContext]] _context_by_type
cdef list[FilterContext] _video_sources
cdef list[FilterContext] _audio_sources
4 changes: 2 additions & 2 deletions av/filter/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def add(self, filter, args=None, **kwargs):
@cython.cfunc
def _register_context(self, ctx: FilterContext):
name: str = ctx.filter.ptr.name
self._context_by_ptr[cython.cast(cython.long, ctx.ptr)] = ctx
self._context_by_ptr[cython.cast(cython.size_t, ctx.ptr)] = ctx
self._context_by_type.setdefault(name, []).append(ctx)
if name == "buffer":
self._video_sources.append(ctx)
Expand All @@ -128,7 +128,7 @@ def _auto_register(self):
# point we don't expose that in the API, so we should be okay...
for i in range(self._nb_filters_seen, self.ptr.nb_filters):
c_ctx = self.ptr.filters[i]
if cython.cast(cython.long, c_ctx) in self._context_by_ptr:
if cython.cast(cython.size_t, c_ctx) in self._context_by_ptr:
continue
filter_ = wrap_filter(c_ctx.filter)
py_ctx = wrap_filter_context(self, filter_, c_ctx)
Expand Down
4 changes: 2 additions & 2 deletions av/filter/link.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def input(self):
else: # nobreak
raise RuntimeError("could not find link in context")
graph: Graph = self.graph
ctx = graph._context_by_ptr[cython.cast(cython.long, cctx)]
ctx = graph._context_by_ptr[cython.cast(cython.size_t, cctx)]
self._input = ctx.outputs[i]
return self._input

Expand All @@ -50,7 +50,7 @@ def output(self):
raise RuntimeError("could not find link in context")
try:
graph: Graph = self.graph
ctx = graph._context_by_ptr[cython.cast(cython.long, cctx)]
ctx = graph._context_by_ptr[cython.cast(cython.size_t, cctx)]
except KeyError:
raise RuntimeError(
"could not find context in graph", (cctx.name, cctx.filter.name)
Expand Down
2 changes: 1 addition & 1 deletion av/opaque.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def __cinit__(self):
@cython.cfunc
def add(self, v: object) -> cython.pointer[lib.AVBufferRef]:
# Use object's memory address as key
key: uintptr_t = cython.cast(cython.longlong, id(v))
key: uintptr_t = cython.cast(uintptr_t, id(v))
self._objects[key] = v

data: u8ptr = cython.cast(u8ptr, lib.av_malloc(sizeof(uintptr_t)))
Expand Down
4 changes: 2 additions & 2 deletions av/packet.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ def __init__(self, input=None):
if isinstance(input, int):
size = input
if size:
err_check(lib.av_new_packet(self.ptr, size))
err_check(lib.av_new_packet(self.ptr, cython.cast(cython.int, size)))
else:
source = bytesource(input)
size = source.length
Expand All @@ -256,7 +256,7 @@ def __init__(self, input=None):
raise MemoryError("Could not allocate AVBufferRef")
self.ptr.buf = buf
self.ptr.data = source.ptr
self.ptr.size = size
self.ptr.size = cython.cast(cython.int, size)

def __repr__(self):
stream = self._stream.index if self._stream else 0
Expand Down
2 changes: 1 addition & 1 deletion av/sidedata/sidedata.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def __init__(self, frame: Frame):
self._by_index: list = []
self._by_type: dict = {}

i: cython.Py_ssize_t
i: cython.int
data: SideData

for i in range(self.frame.ptr.nb_side_data):
Expand Down
2 changes: 1 addition & 1 deletion av/subtitles/codeccontext.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def subtitle_header(self, data: bytes | None) -> None:
if not self.ptr.subtitle_header:
raise MemoryError("Cannot allocate subtitle_header")
memcpy(self.ptr.subtitle_header, source.ptr, source.length)
self.ptr.subtitle_header_size = source.length
self.ptr.subtitle_header_size = cython.cast(cython.int, source.length)
self.subtitle_header_set = True

def __dealloc__(self) -> None:
Expand Down
2 changes: 1 addition & 1 deletion av/video/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def chroma_height(self, luma_height: cython.int = 0):
@cython.final
@cython.cclass
class VideoFormatComponent:
def __cinit__(self, format: VideoFormat, index: cython.size_t):
def __cinit__(self, format: VideoFormat, index: cython.uint):
self.format = format
self.index = index
self.ptr = cython.address(format.ptr.comp[index])
Expand Down
8 changes: 4 additions & 4 deletions include/avcodec.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ cdef extern from "libavcodec/avcodec.h" nogil:

void* opaque

int bit_rate
int64_t bit_rate
int flags
int flags2
uint8_t *extradata
Expand Down Expand Up @@ -269,8 +269,8 @@ cdef extern from "libavcodec/avcodec.h" nogil:
int qmin
int qmax
int rc_buffer_size
int rc_max_rate
int rc_min_rate
int64_t rc_max_rate
int64_t rc_min_rate

AVHWAccel *hwaccel
AVBufferRef *hw_device_ctx
Expand Down Expand Up @@ -338,7 +338,7 @@ cdef extern from "libavcodec/avcodec.h" nogil:
cdef struct AVFrameSideData:
AVFrameSideDataType type
uint8_t *data
int size
size_t size
AVDictionary *metadata

# See: http://ffmpeg.org/doxygen/trunk/structAVFrame.html
Expand Down
4 changes: 2 additions & 2 deletions include/avformat.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ cdef extern from "libavformat/avformat.h" nogil:
AVRational sample_aspect_ratio

cdef struct AVChapter:
int id
int64_t id
int64_t start
int64_t end
AVRational time_base
Expand Down Expand Up @@ -154,7 +154,7 @@ cdef extern from "libavformat/avformat.h" nogil:
char filename
int64_t start_time
int64_t duration
int bit_rate
int64_t bit_rate
int flags
AVCodecID audio_codec_id
AVCodecID video_codec_id
Expand Down
Loading