Skip to content

desjare/grumpyplayer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

grumpyplayer

Experimental linux & windows video player video player based on glfw, OpenGL, ALSA, XAudio2, ffmpeg, boost and curl. It supports full screen mode (double click), drag & drop, bicubic gpu resizing & ssa/ass and srt subtitles. It is also possible to launch it with a URL and the video will be streamed.

This is a proof of concept of how to design a player with modules having very little coupling together. It is written in C++ but with the Go language approach in mind. While the implementation uses encapsulation & structure, data definitions are public and accessible. It relies heavily on C++ standard library or boost but it uses a more a C style design approach in the implementation and APIs. PEP-20 states that explicit is better than implicit and beautiful is better than ugly. These principles should apply to C++ as well and I often see overly complicated class hirarchies that are difficult to maintain. The player was written with that in mind.

The player uses a consumer and producer pattern to play and decode and fetch the media. It is multithreaded and uses lock free queue as IPC. It has no locks.

Main modules are:

  • player
  • audiodevice (ALSA or XAudio2)
  • videodevice (OpenGL)
  • mediadecoder (ffmpeg)
  • gui (glfw3)
  • streamer (curl)
  • subtitle (ssa/ass,srt)

Overall I think it is a good example of how to use ffmpeg to decode a video from file or stream and use the video and audio media for playback.

Credits

I used and inspired myself of several projects writing the player so here are some credits. Sometimes I took things as his but most of the time I modified them to add some features or rewritten them partially. Licensing of all those projects are sometimes unclear.

Requirements

  • ffmpeg libs version 4 or higher (ffmpeg --version)
  • ALSA asound dev lib (linux)
  • swsscale lib
  • glfw3 lib
  • curl lib
  • freetype2 lib
  • boost libs
  • cmake

Ubuntu 18.04

To install ffmpeg 4: See: http://ubuntuhandbook.org/index.php/2018/10/install-ffmpeg-4-0-2-ubuntu-18-0416-04/

Ubuntu 19.04

Install dependencies:

sudo apt install libavcodec-dev libavformat-dev libcurl4-openssl-dev libasound2-dev libboost-all-dev libglfw3-dev libfreetype6-dev libswscale-dev libglm-dev libglu1-mesa-dev

Windows

All 3rdparty libs are included in 3rdparty folder fox x64 architecture. Binary files are on git-lfs. It links statically with everything

Build

  • cmake CMakeLists.txt
  • make

Bugs

  • Below two audio channels, the audio channel mapping has not been tested. It is currently configured according to pulse and XAudio2 configuration but no tests has been done beside the stereo mix. The player is able to play 5.1 audio on stereo on linux but has not been tested beyond that.
  • The player pre-buffer a lot of frames and is consuming a lot of memory.

About

grumpyplayer is a ffmpeg based media player

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages