Giter VIP home page Giter VIP logo

ensimag-video's Introduction

Base for a multi-threaded video player

C and C++ flavors

Two versions are available in C and C++ directories

  1. C using POSIX Threads (Pthreads) or C threads version
  2. C++ using C++ threads version

References

The idea came from the excellent ffmepg + SDL tutorial http://dranger.com/ffmpeg/

This videoplayer does not use ffmpeg but libogg, libtheora and libvorbis. It uses also SDL2 for the rendering and playing sound.

The ogg/vorbis ogg/theora tutorials of https://bluishcoder.co.nz/tags/ogg/index.html are a very good material for understanding of the libraries.

The synchronization is quite different. This code uses 1 thread per stream and common real-time deadline to set up synchronization. The sound playing is mostly managed by SDL2. The displayed frame is used with an additional thread and producer/consumer algorithms to synchronize stream reading and displaying.

Compilation and unit testing

The compilation process use Cmake

To compile: sh cd build cmake .. make make test # C only make check # C only

Goal

The goal is to complete and parallelize the provided code using the hints of the subject.

Actions that threads managed

  1. reading initialization packet in ogg file; init the sdl (video and audio)
  2. initializing the theora stream
  3. initializing the vorbis stream
  4. reading packets in ogg file (twice, each stream reading thread)
  5. decoding theora
  6. decoding vorbis
  7. displaying the video stream with the sdl
  8. playing the sound with the sdl

Threads

  1. Thread 1: main thread; init the sdl
  2. Thread 2: theora stream reading and decoding video, write texture
  3. Thread 3: vorbis stream reading and decoding sound
  4. Thread 4: displaying video frame

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.