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
1 change: 0 additions & 1 deletion av/stream.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ cdef class Stream:
# Private API.
cdef _init(self, Container, lib.AVStream*, CodecContext)
cdef _finalize_for_output(self)
cdef _get_side_data(self, lib.AVStream *stream)
cdef _set_time_base(self, value)
cdef _set_id(self, value)

Expand Down
2 changes: 0 additions & 2 deletions av/stream.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ class Stream:
metadata: dict[str, str]
id: int
profile: str
nb_side_data: int
side_data: dict[str, str]
index: int
time_base: Fraction | None
average_rate: Fraction | None
Expand Down
16 changes: 0 additions & 16 deletions av/stream.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ cdef class Stream:
self.codec_context = codec_context
if self.codec_context:
self.codec_context.stream_index = stream.index

self.nb_side_data, self.side_data = self._get_side_data(stream)

self.metadata = avdict_to_dict(
stream.metadata,
Expand Down Expand Up @@ -128,20 +126,6 @@ cdef class Stream:
# Lets just copy what we want.
err_check(lib.avcodec_parameters_from_context(self.ptr.codecpar, self.codec_context.ptr))

cdef _get_side_data(self, lib.AVStream *stream):
# Get DISPLAYMATRIX SideData from a lib.AVStream object.
# Returns: tuple[int, dict[str, Any]]

nb_side_data = stream.nb_side_data
side_data = {}

for i in range(nb_side_data):
# Based on: https://www.ffmpeg.org/doxygen/trunk/dump_8c_source.html#l00430
if stream.side_data[i].type == lib.AV_PKT_DATA_DISPLAYMATRIX:
side_data["DISPLAYMATRIX"] = lib.av_display_rotation_get(<const int32_t *>stream.side_data[i].data)

return nb_side_data, side_data

@property
def id(self):
"""
Expand Down
4 changes: 0 additions & 4 deletions include/libavformat/avformat.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ cdef extern from "libavformat/avformat.h" nogil:
AVRational r_frame_rate
AVRational sample_aspect_ratio

int nb_side_data
AVPacketSideData *side_data


# http://ffmpeg.org/doxygen/trunk/structAVIOContext.html
cdef struct AVIOContext:
unsigned char* buffer
Expand Down
3 changes: 0 additions & 3 deletions include/libavutil/avutil.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ from libc.stdint cimport int64_t, uint8_t, uint64_t, int32_t
cdef extern from "libavutil/mathematics.h" nogil:
pass

cdef extern from "libavutil/display.h" nogil:
cdef double av_display_rotation_get(const int32_t matrix[9])

cdef extern from "libavutil/rational.h" nogil:
cdef int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)

Expand Down
16 changes: 5 additions & 11 deletions tests/test_streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,9 @@ def test_selection(self) -> None:
data = container.streams.data[0]
assert data == container.streams.best("data")

def test_noside_data(self) -> None:
container = av.open(fate_suite("h264/interlaced_crop.mp4"))
video = container.streams.video[0]

assert video.nb_side_data == 0

def test_side_data(self) -> None:
container = av.open(fate_suite("mov/displaymatrix.mov"))
video = container.streams.video[0]
# def test_side_data(self) -> None:
# container = av.open(fate_suite("mov/displaymatrix.mov"))
# video = container.streams.video[0]

assert video.nb_side_data == 1
assert video.side_data["DISPLAYMATRIX"] == -90.0
# assert video.nb_side_data == 1
# assert video.side_data["DISPLAYMATRIX"] == -90.0