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

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

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

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

  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" ]
  TextEngine -> TextParser [ label="ArrayBuffer => TextCues" dir=both arrowtail=onormal ]
  TextEngine -> TextTrack [ label="TextCues" ]

  NetworkingEngine -> RequestFilter [ label="Request => Request" dir=both arrowtail=onormal ]
  NetworkingEngine -> ResponseFilter [ label="Response => Response" dir=both arrowtail=onormal ]
  NetworkingEngine -> HttpRequest [ 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="ArgTyp => 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:
  TextTrack -> "internal class" [ style=invisible arrowhead=none ]
}
