# Path: vocto/transitions.py
# V = 2  # distance (velocity) index
# class Transitions:
# class Transition:
#     def __init__(self, targets=[], fps=25):
#     def __str__(self):
#     def __len__(self):
#     def count(self):
#     def add(self,transition,frames):
#     def configure(cfg, composites, targets=None, fps=25):
#         def index(composite):
#     def solve(self, begin, end, flip):
#     def travel(composites, previous=None):
#     def __init__(self, name, a=None, b=None):
#     def __str__(self):
#         def hidden( x, hidden ):
#     def phi(self):
#     def name(self):
#     def append(self, composite):
#     def frames(self): return len(self.composites)
#     def A(self, n=None):
#     def B(self, n=None):
#     def Az(self, z0, z1):
#     def Bz(self, z0, z1):
#     def begin(self): return self.composites[0]
#     def end(self): return self.composites[-1]
#     def reversed(self):
#     def swapped(self):
#     def calculate_flip(self):
#             def overlap(a, b):
#     def calculate(self, frames, a_corner=(R, T), b_corner=(L, T)):
#     def keys(self):
# def parse_asterisk(sequence, composites):
# def frange(x, y, jump):
# def bspline(points):
# def find_nearest(spline, points):
# def measure(points):
# def smooth(x):
# def distribute(points, positions, begin, end, x0, x1, n):
# def fade(begin, end, factor):
# def morph(begin, end, pt, corner, factor):
# def interpolate(key_frames, num_frames, corner):
# def is_in(sequence, part):
# def fade_alpha(frame,alpha,frames):


import logging
import gi
from gi.repository import Gst, GstController
from vocto.transitions import Frame, L, T, R, B
        self.log.debug("Commit %d frame(s) to source %s", len(frames), source)
        self.frames[source] = frames
        self.dirty = True

    def set(self, source, frame):
        ''' commit single frame to the current gstreamer scene '''
        self.log.debug("Set frame to source %s", source)
        self.frames[source] = [frame]
        self.dirty = True

    def push(self, at_time=0):
        ''' apply all committed frames to GStreamer pipeline '''
        # get pad for given source
        for source, frames in self.frames.items():
            if not frames:
                frames = [Frame(zorder=-1,alpha=0)]
            self.log.info("Pushing %d frame(s) to source '%s' at time %dms", len(
                frames), source, at_time / Gst.MSECOND)
            # reset time
            time = at_time
            # get GStreamer property pad for this source
            pad = self.pads[source]
            cpad = self.cpads[source] if self.cpads else None
            self.log.debug("    %s", Frame.str_title())
            # apply all frames of this source to GStreamer pipeline
            for idx, frame in enumerate(frames):
                self.log.debug("%2d: %s", idx, frame)
                cropped = frame.cropped()
                alpha = frame.float_alpha()
                # transmit frame properties into mixing pipeline

# Path: vocto/transitions.py
# V = 2  # distance (velocity) index
# class Transitions:
# class Transition:
#     def __init__(self, targets=[], fps=25):
#     def __str__(self):
#     def __len__(self):
#     def count(self):
#     def add(self,transition,frames):
#     def configure(cfg, composites, targets=None, fps=25):
#         def index(composite):
#     def solve(self, begin, end, flip):
#     def travel(composites, previous=None):
#     def __init__(self, name, a=None, b=None):
#     def __str__(self):
#         def hidden( x, hidden ):
#     def phi(self):
#     def name(self):
#     def append(self, composite):
#     def frames(self): return len(self.composites)
#     def A(self, n=None):
#     def B(self, n=None):
#     def Az(self, z0, z1):
#     def Bz(self, z0, z1):
#     def begin(self): return self.composites[0]
#     def end(self): return self.composites[-1]
#     def reversed(self):
#     def swapped(self):
#     def calculate_flip(self):
#             def overlap(a, b):
#     def calculate(self, frames, a_corner=(R, T), b_corner=(L, T)):
#     def keys(self):
# def parse_asterisk(sequence, composites):
# def frange(x, y, jump):
# def bspline(points):
# def find_nearest(spline, points):
# def measure(points):
# def smooth(x):
# def distribute(points, positions, begin, end, x0, x1, n):
# def fade(begin, end, factor):
# def morph(begin, end, pt, corner, factor):
# def interpolate(key_frames, num_frames, corner):
# def is_in(sequence, part):
# def fade_alpha(frame,alpha,frames):


# Path: voctocore/lib/scene.py
import logging
import gi
from gi.repository import Gst, GstController
from vocto.transitions import Frame, L, T, R, B

        self.log.debug("Commit %d frame(s) to source %s", len(frames), source)
        self.frames[source] = frames
        self.dirty = True

    def set(self, source, frame):
        ''' commit single frame to the current gstreamer scene '''
        self.log.debug("Set frame to source %s", source)
        self.frames[source] = [frame]
        self.dirty = True

    def push(self, at_time=0):
        ''' apply all committed frames to GStreamer pipeline '''
        # get pad for given source
        for source, frames in self.frames.items():
            if not frames:
                frames = [Frame(zorder=-1,alpha=0)]
            self.log.info("Pushing %d frame(s) to source '%s' at time %dms", len(
                frames), source, at_time / Gst.MSECOND)
            # reset time
            time = at_time
            # get GStreamer property pad for this source
            pad = self.pads[source]
            cpad = self.cpads[source] if self.cpads else None
            self.log.debug("    %s", Frame.str_title())
            # apply all frames of this source to GStreamer pipeline
            for idx, frame in enumerate(frames):
                self.log.debug("%2d: %s", idx, frame)
                cropped = frame.cropped()
                alpha = frame.float_alpha()
                # transmit frame properties into mixing pipeline

                pad['xpos'].set(time, cropped[L])