def interpolate_video(configuration, input_queue, output_queue):
    video_interpolator = StoppableThread(
        InterpolateVideo(configuration=configuration,
                         input_queue=input_queue,
                         output_queue=output_queue))

    run(main_process=video_interpolator)
def publish_video(configuration, interprocess_queue):
    queue_1 = queue.Queue()

    storage_task = StoppableThread(
        StoreProcessedVideo(configuration=configuration,
                            input_queue=interprocess_queue,
                            output_queue=queue_1))

    notify_task = StoppableThread(
        NotifyProcessedVideo(configuration=configuration, input_queue=queue_1))

    run(processes=[storage_task, notify_task])
def fetch_video(configuration, interprocess_queue):
    queue_1 = queue.Queue()

    consumer = StoppableThread(
        ConsumeFromRabbitMQ(configuration=configuration['consumer'],
                            output_queue=queue_1))

    queue_2 = queue.Queue()

    video_data_retriever = StoppableThread(
        FetchVideoData(configuration=configuration,
                       input_queue=queue_1,
                       output_queue=queue_2))

    video_chunk_retriever = StoppableThread(
        FetchVideoChunk(configuration=configuration,
                        input_queue=queue_2,
                        output_queue=interprocess_queue))

    run(processes=[video_data_retriever, video_chunk_retriever],
        main_process=consumer)
Ejemplo n.º 4
0
        queue_2 = Queue()

        video_storer = StoppableThread(
            StoreVideoChunk(configuration=configuration,
                            input_queue=queue_1,
                            output_queue=queue_2))

        queue_3 = Queue()

        video_sampler = StoppableThread(
            SampleVideoChunk(configuration=configuration,
                             input_queue=queue_2,
                             output_queue=queue_3))

        queue_4 = Queue()

        frame_storer = StoppableThread(
            StoreFrame(configuration=configuration,
                       input_queue=queue_3,
                       output_queue=queue_4))

        publisher = StoppableThread(
            PublishToRabbitMQ(configuration=configuration['publisher'],
                              input_queue=queue_4))

        print('[*] Configuration finished. Starting big-fiubrother-sampler!')

        run([consumer, video_storer, video_sampler, frame_storer, publisher])

        print('[*] big-fiubrother-sampler stopped!')
Ejemplo n.º 5
0
from big_fiubrother_core import (SignalHandler, StoppableThread,
                                 PublishToRabbitMQ, setup, run)

if __name__ == "__main__":
    configuration = setup('Big Fiubrother Camera Application')

    print('[*] Configuring big-fiubrother-camera')

    recorder_to_builder_queue = Queue()

    recorder = StoppableThread(
        RecordVideoFromCamera(configuration=configuration['video_recorder'],
                              output_queue=recorder_to_builder_queue))

    builder_to_publisher_queue = Queue()

    message_builder = StoppableThread(
        BuildVideoChunkMessage(configuration=configuration['camera'],
                               input_queue=recorder_to_builder_queue,
                               output_queue=builder_to_publisher_queue))

    publisher = StoppableThread(
        PublishToRabbitMQ(configuration=configuration['publisher'],
                          input_queue=builder_to_publisher_queue))

    print('[*] Configuration finished. Starting big-fiubrother-camera!')

    run(processes=[message_builder, publisher], main_process=recorder)

    print('[*] big-fiubrother-camera stopped!')