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

digraph shaka2_data {
  label=<<u>Shaka 2 Data Flow Diagram (excluding Cast, Offline)</u>>
  labelloc=t
  node [ shape=rectangle ]
  edge [ fontsize=10 ]

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

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

  Player -> AbrManager [ label="Variants => Variant" dir=both arrowtail=onormal style=dashed ]
  Player -> ManifestParser [ label="URL => Manifest" dir=both arrowtail=onormal style=dashed ]
  Player -> StreamingEngine [ label=Manifest ]
  Player -> DrmEngine [ label=Manifest ]

  ManifestParser -> NetworkingEngine [ label="Request(MANIFEST) => Response" dir=both arrowtail=onormal style=dashed ]
  StreamingEngine -> NetworkingEngine [ label="Request(SEGMENT) => Response" dir=both arrowtail=onormal style=dashed ]
  DrmEngine -> NetworkingEngine [ label="Request(LICENSE) => Response" dir=both arrowtail=onormal style=dashed ]

  StreamingEngine -> MediaSourceEngine [ label="ArrayBuffer" ]
  MediaSourceEngine -> SourceBuffer [ label="ArrayBuffer" ]
  MediaSourceEngine -> TextEngine [ label="ArrayBuffer" ]
  MediaSourceEngine -> Transmuxer [ label="ArrayBuffer => ArrayBuffer" dir=both arrowtail=onormal style=dashed ]

  TextEngine -> TextParser [ label="ArrayBuffer => Cues" dir=both arrowtail=onormal ]
  TextEngine -> TextDisplayer [ label="Cues" ]
  TextDisplayer -> TextTrack [ label="TextCues" ]

  NetworkingEngine -> RequestFilter [ label="Request => Request" dir=both arrowtail=onormal style=dashed ]
  NetworkingEngine -> ResponseFilter [ label="Response => Response" dir=both arrowtail=onormal style=dashed ]
  NetworkingEngine -> HttpFetchPlugin [ label="Request => Response" dir=both arrowtail=onormal style=dashed ]

  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" fontcolor="#444444" ]

    blank1 [ label="" fixedsize=true height=0 ]
    blank2 [ label="" fixedsize=true height=0 ]
    blank3 [ label="" fixedsize=true height=0 ]
    "async request" -> blank3 [ dir=both arrowtail=onormal style=dashed ]
    "request with return value" -> blank2 [ dir=both arrowtail=onormal label="ArgType => ReturnType" ]
    "data pushed one way" -> blank1 [ label="DataType" ]

    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 ]
}
