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
14 changes: 6 additions & 8 deletions av/stream.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ cdef class Stream:
"""
The unit of time (in fractional seconds) in which timestamps are expressed.

:type: :class:`~fractions.Fraction` or ``None``
:type: fractions.Fraction | None

"""
return avrational_to_fraction(&self.ptr.time_base)
Expand All @@ -219,7 +219,7 @@ cdef class Stream:
The presentation timestamp in :attr:`time_base` units of the first
frame in this stream.

:type: :class:`int` or ``None``
:type: int | None
"""
if self.ptr.start_time != lib.AV_NOPTS_VALUE:
return self.ptr.start_time
Expand All @@ -229,7 +229,7 @@ cdef class Stream:
"""
The duration of this stream in :attr:`time_base` units.

:type: :class:`int` or ``None``
:type: int | None

"""
if self.ptr.duration != lib.AV_NOPTS_VALUE:
Expand All @@ -242,7 +242,7 @@ cdef class Stream:

Returns ``0`` if it is not known.

:type: :class:`int`
:type: int
"""
return self.ptr.nb_frames

Expand All @@ -251,7 +251,7 @@ cdef class Stream:
"""
The language of the stream.

:type: :class:`str` or ``None``
:type: str | None
"""
return self.metadata.get("language")

Expand All @@ -264,8 +264,6 @@ cdef class Stream:
"""
The type of the stream.

Examples: ``'audio'``, ``'video'``, ``'subtitle'``.

:type: str
:type: Literal["audio", "video", "subtitle", "data", "attachment"]
"""
return lib.av_get_media_type_string(self.ptr.codecpar.codec_type)
10 changes: 5 additions & 5 deletions av/video/stream.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ cdef class VideoStream(Stream):
This is calculated when the file is opened by looking at the first
few frames and averaging their rate.

:type: :class:`~fractions.Fraction` or ``None``
:type: fractions.Fraction | None
"""
return avrational_to_fraction(&self.ptr.avg_frame_rate)

Expand All @@ -70,7 +70,7 @@ cdef class VideoStream(Stream):
frames can be represented accurately. See :ffmpeg:`AVStream.r_frame_rate`
for more.

:type: :class:`~fractions.Fraction` or ``None``
:type: fractions.Fraction | None
"""
return avrational_to_fraction(&self.ptr.r_frame_rate)

Expand All @@ -81,7 +81,7 @@ cdef class VideoStream(Stream):
This is a wrapper around :ffmpeg:`av_guess_frame_rate`, and uses multiple
heuristics to decide what is "the" frame rate.

:type: :class:`~fractions.Fraction` or ``None``
:type: fractions.Fraction | None
"""
# The two NULL arguments aren't used in FFmpeg >= 4.0
cdef lib.AVRational val = lib.av_guess_frame_rate(NULL, self.ptr, NULL)
Expand All @@ -94,7 +94,7 @@ cdef class VideoStream(Stream):
This is a wrapper around :ffmpeg:`av_guess_sample_aspect_ratio`, and uses multiple
heuristics to decide what is "the" sample aspect ratio.

:type: :class:`~fractions.Fraction` or ``None``
:type: fractions.Fraction | None
"""
cdef lib.AVRational sar = lib.av_guess_sample_aspect_ratio(self.container.ptr, self.ptr, NULL)
return avrational_to_fraction(&sar)
Expand All @@ -105,7 +105,7 @@ cdef class VideoStream(Stream):

This is calculated from :meth:`.VideoStream.guessed_sample_aspect_ratio`.

:type: :class:`~fractions.Fraction` or ``None``
:type: fractions.Fraction | None
"""
cdef lib.AVRational dar

Expand Down
7 changes: 7 additions & 0 deletions docs/_static/custom.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
body {
text-rendering: optimizeLegibility;
}

.sphinxsidebarwrapper {
overflow: scroll;
}

.ffmpeg-quicklink {
float: right;
Expand Down
7 changes: 7 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
from docutils import nodes
from sphinx.util.docutils import SphinxDirective

sys.path.insert(0, os.path.abspath(".."))


# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = [
Expand Down Expand Up @@ -58,6 +61,10 @@
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]

html_theme_options = {
"sidebarwidth": "250px",
}


doctest_global_setup = """
import errno
Expand Down
Loading