diff --git a/av/stream.pyx b/av/stream.pyx index d0ecf37ad..90f10d038 100644 --- a/av/stream.pyx +++ b/av/stream.pyx @@ -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) @@ -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 @@ -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: @@ -242,7 +242,7 @@ cdef class Stream: Returns ``0`` if it is not known. - :type: :class:`int` + :type: int """ return self.ptr.nb_frames @@ -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") @@ -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) diff --git a/av/video/stream.pyx b/av/video/stream.pyx index 6ab685167..383cc13a6 100644 --- a/av/video/stream.pyx +++ b/av/video/stream.pyx @@ -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) @@ -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) @@ -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) @@ -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) @@ -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 diff --git a/docs/_static/custom.css b/docs/_static/custom.css index b95a5f253..136af619b 100644 --- a/docs/_static/custom.css +++ b/docs/_static/custom.css @@ -1,3 +1,10 @@ +body { + text-rendering: optimizeLegibility; +} + +.sphinxsidebarwrapper { + overflow: scroll; +} .ffmpeg-quicklink { float: right; diff --git a/docs/conf.py b/docs/conf.py index b32212e97..d971572e1 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -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 = [ @@ -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