# Generate png with: dot -Tpng -O dataflow.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 ]

  HttpRequest [ shape=trapezium ]
  ManifestParser [ shape=trapezium ]
  TextParser [ shape=trapezium ]

  Player -> NetworkingEngine
  Player -> ManifestParser
  Player -> MediaSourceEngine
  Player -> StreamingEngine
  Player -> DrmEngine
  Player -> Manifest
  Player -> MediaSource
  Player -> TextTrack

  NetworkingEngine -> HttpRequest

  ManifestParser -> NetworkingEngine [ style=dotted ]

  DrmEngine -> NetworkingEngine [ style=dotted ]

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

  MediaSourceEngine -> MediaSource [ style=dotted ]
  # MediaSourceEngine owns multiple SourceBuffers, so we represent that here
  # with two edges:
  MediaSourceEngine -> SourceBuffer
  MediaSourceEngine -> SourceBuffer
  MediaSourceEngine -> TextEngine

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

  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:
  TextTrack -> "internal class" [ style=invisible arrowhead=none ]
}
