# Generate png with: dot -Tpng -O ownership.gv

digraph shaka2_ownership {
  label=<<u>Shaka 2 Ownership Diagram</u>>
  labelloc=t
  node [ shape=rectangle ]

  MediaSource [ shape=oval ]
  SourceBuffer [ shape=oval ]
  TextTrack [ shape=oval ]

  AbrManager [ shape=trapezium ]
  HttpFetchPlugin [ shape=trapezium ]
  ManifestParser [ shape=trapezium ]
  TextDisplayer [ shape=trapezium ]
  TextParser [ shape=trapezium ]

  Player -> AbrManager
  Player -> NetworkingEngine
  Player -> ManifestParser
  Player -> MediaSourceEngine
  Player -> StreamingEngine
  Player -> DrmEngine
  Player -> Manifest
  Player -> TextDisplayer

  TextDisplayer -> TextTrack

  NetworkingEngine -> HttpFetchPlugin

  ManifestParser -> NetworkingEngine [ style=dotted ]

  DrmEngine -> NetworkingEngine [ style=dotted ]

  StreamingEngine -> MediaSourceEngine [ style=dotted ]
  StreamingEngine -> Manifest [ style=dotted ]
  StreamingEngine -> NetworkingEngine [ style=dotted ]

  MediaSourceEngine -> MediaSource
  # MediaSourceEngine owns multiple SourceBuffers, so we represent that here
  # with two edges:
  MediaSourceEngine -> SourceBuffer
  MediaSourceEngine -> SourceBuffer
  MediaSourceEngine -> Transmuxer
  MediaSourceEngine -> TextEngine

  TextEngine -> TextDisplayer [ style=dotted ]
  TextEngine -> TextParser

  # Player does not own MediaSource since v2.4, but without this link, the graph
  # becomes unbalanced and harder to read.  This is a hack.
  Player -> MediaSource [ style=invisible arrowhead=none ]

  subgraph cluster_legend {
    style=rounded
    color="#444444"
    label=<<u>Legend</u>>
    fontsize=12
    fontcolor="#444444"

    node [ shape=plaintext color="#444444" fontsize=10 fontcolor="#444444" ]
    edge [ color="#444444" ]

    blank1 [ label="" fixedsize=true height=0 ]
    blank2 [ label="" fixedsize=true height=0 ]
    "weak reference" -> blank2 [ style=dotted ]
    ownership -> blank1

    plugin [ shape=trapezium ]
    "browser built-in" [ shape=oval ]
    "internal class" [ shape=rectangle ]
  }

  # Hack to move the legend beneath the main graph:
  TextParser -> "internal class" [ style=invisible arrowhead=none ]
}
