class_docstr: Support for pyAV as backend.
  
  Parameters
  ----------
  request : iio.Request
      A request object that represents the users intent. It provides a
      standard interface to access various the various ImageResources and
      serves them to the plugin as a file object (or file). Check the docs for
      details.
class_docstr_tok: ["Support","for","pyAV","as","backend",".","Parameters","--","--","--","--","--","request",":","iio.Request","A","request","object","that","represents","the","users","intent",".","It","provides","a","standard","interface","to","access","various","the","various","ImageResources","and","serves","them","to","the","plugin","as","a","file","object","(","or","file",")",".","Check","the","docs","for","details","."]
docstr: Initialize a new Plugin Instance.
  
  See Plugin's docstring for detailed documentation.
  
  Notes
  -----
  The implementation here stores the request as a local variable that is
  exposed using a @property below. If you inherit from PluginV3, remember
  to call ``super().__init__(request)``.
docstr_tok: ["Initialize","a","new","Plugin","Instance",".","See","Plugin","'s","docstring","for","detailed","documentation",".","Notes","--","--","-","The","implementation","here","stores","the","request","as","a","local","variable","that","is","exposed","using","a","@","property","below",".","If","you","inherit","from","PluginV3",",","remember","to","call","``","super","(",")",".__init__","(","request",")","``","."]
code: def __init__(
      self,
      request: Request,
      *,
      container: str = None,
  ) -> None:
      """Initialize a new Plugin Instance.
  
      See Plugin's docstring for detailed documentation.
  
      Notes
      -----
      The implementation here stores the request as a local variable that is
      exposed using a @property below. If you inherit from PluginV3, remember
      to call ``super().__init__(request)``.
  
      """
  
      super().__init__(request)
  
      self._container = None
      self._video_stream = None
      self._video_filter = None
  
      if request.mode.io_mode == IOMode.read:
          self._next_idx = 0
          try:
              if request._uri_type == 5:  # 5 is the value of URI_HTTP
                  # pyav should read from HTTP by itself. This enables reading
                  # HTTP-based streams like DASH. Note that solving streams
                  # like this is temporary until the new request object gets
                  # implemented.
                  self._container = av.open(request.raw_uri)
              else:
                  self._container = av.open(request.get_file())
              self._video_stream = self._container.streams.video[0]
              self._decoder = self._container.decode(video=0)
          except av.AVError:
              if isinstance(request.raw_uri, bytes):
                  msg = "PyAV does not support these `<bytes>`"
              else:
                  msg = f"PyAV does not support `{request.raw_uri}`"
              raise InitializationError(msg) from None
      else:
          self.frames_written = 0
          file_handle = self.request.get_file()
          filename = getattr(file_handle, "name", None)
          extension = self.request.extension or self.request.format_hint
          if extension is None:
              raise InitializationError(
                  "Can't determine output container to use."
              )
  
          # hacky, but beats running our own format selection logic
          # (since av_guess_format is not exposed)
          try:
              setattr(
                  file_handle, "name", filename or "tmp" + extension
              )
          except AttributeError:
              pass  # read-only, nothing we can do
  
          try:
              self._container = av.open(
                  file_handle, mode="w", format=container
              )
          except ValueError:
              raise InitializationError(
                  f"PyAV can not write to `{self.request.raw_uri}`"
              )
  
imports: from fractions import Fraction
  from math import ceil
  from typing import Any, Dict, List, Optional, Tuple, Union, Generator
  import av
  import av.filter
  import numpy
  from numpy.lib.stride_tricks import as_strided
  from ..core import Request
  from ..core.request import URI_BYTES, InitializationError, IOMode
  from ..core.v3_plugin_api import ImageProperties, PluginV3
label_desc: Use image node_id 1 to create a new PyAVPlugin object from inherited base classes: PluginV3 with example: obj = PyAVPlugin(request)