# Path: video_processing/stream_processor.py
# class Frame(collections.namedtuple('FrameSet', ['index', 'data'])):
# class StreamSet(collections.namedtuple('StreamSet', ['frame_rate_hz',
#                                                      'stream_headers'])):
# class ProcessorBase(object):
#   def __new__(cls, index=0, data=None):
#   def __new__(cls, frame_rate_hz=-1):
#   def __init__(self, configuration):
#   def open(self, stream_set):
#   def process(self, frame_set):
#   def close(self):


import atexit
import base64
import json
import os
import subprocess
import threading
import numpy
import six.moves.BaseHTTPServer
import six.moves.queue
import cv2
from video_processing import stream_processor
                                       VectorizationServerHandler)
    self._server.setup(
        image_callback=self._frame_queue.put,
        json_data=self._json_string,
        background_image=self._background_image_data,
        index_html=html_string,
        player_js=js_string)

    self._server_thread = ServerThread(server=self._server)
    self._renderer_process = None
    self._frame_index = 0

  def open(self, stream_set):
    self._renderer_process = subprocess.Popen([
        'google-chrome',
        '--headless',
        '--remote-debugging-port=9222',
        'http://127.0.0.1:%s/' % self._server_port,
        '--window-size=1300,800',  # TODO(tomwalters): Plumb in correct dimensions.
        '--autoplay-policy=no-user-gesture-required',
        '--mute-audio'
    ])
    # Ensure this process gets terminated when the program ends.
    atexit.register(self._renderer_process.terminate)

    frame_rate_hz = float(self._json_data['frames_per_second'])
    if stream_set.frame_rate_hz < 0:
      # If the frame rate wasn't set, then we can assume that we're the top
      # of the processing chain and create a new stream set object to
      # contain the video stream.

# Path: video_processing/stream_processor.py
# class Frame(collections.namedtuple('FrameSet', ['index', 'data'])):
# class StreamSet(collections.namedtuple('StreamSet', ['frame_rate_hz',
#                                                      'stream_headers'])):
# class ProcessorBase(object):
#   def __new__(cls, index=0, data=None):
#   def __new__(cls, frame_rate_hz=-1):
#   def __init__(self, configuration):
#   def open(self, stream_set):
#   def process(self, frame_set):
#   def close(self):


# Path: video_processing/processors/vectorized_video_decoder.py
import atexit
import base64
import json
import os
import subprocess
import threading
import numpy
import six.moves.BaseHTTPServer
import six.moves.queue
import cv2
from video_processing import stream_processor

                                       VectorizationServerHandler)
    self._server.setup(
        image_callback=self._frame_queue.put,
        json_data=self._json_string,
        background_image=self._background_image_data,
        index_html=html_string,
        player_js=js_string)

    self._server_thread = ServerThread(server=self._server)
    self._renderer_process = None
    self._frame_index = 0

  def open(self, stream_set):
    self._renderer_process = subprocess.Popen([
        'google-chrome',
        '--headless',
        '--remote-debugging-port=9222',
        'http://127.0.0.1:%s/' % self._server_port,
        '--window-size=1300,800',  # TODO(tomwalters): Plumb in correct dimensions.
        '--autoplay-policy=no-user-gesture-required',
        '--mute-audio'
    ])
    # Ensure this process gets terminated when the program ends.
    atexit.register(self._renderer_process.terminate)

    frame_rate_hz = float(self._json_data['frames_per_second'])
    if stream_set.frame_rate_hz < 0:
      # If the frame rate wasn't set, then we can assume that we're the top
      # of the processing chain and create a new stream set object to
      # contain the video stream.

      stream_set = stream_processor.StreamSet(frame_rate_hz=frame_rate_hz)