GSoC: Improve and Extend Media Player

Blog post by engleek on Wed, 2010-04-28 19:24

As an operating system with a short boot time and a small footprint, Haiku is looking very interesting for the general public.

With WebPositive well on it's way to becomming a great browser, users will want a great media experience to go with it.

I propose to work on Media Player and the Media Kit, in order to improve it with new functionalities: DVD playback, streaming support, tray icon controls...

Personal Profile

  • Full name: Christopher Humphries
  • Email: redeye4 (at) gmail (dot) com
  • Trac/IRC Username: Engleek
Summer Education

My course requires an end of year internship, which I hope is going to be working on Haiku with the Google Summer of Code program.

Employment, Timetables and Internet Access

As this internship is full time, I will not be seeking any extra classes or employment, and as far as I know, I don't have any foreseeable schedule conflicts for this summer, and communication will not be a problem, as I have a personal internet connection, and several back-up solutions.

As stated above, this internship is a full time occupation, and I will therefore treat it like any other serious professional placement with at least a full working week, which in France means 35 hours per week.

Past Experience with GSoC

I have previously been a Summer of Code participant, but my project for the Videolan organisation was not selected by the team.

About Me

I am an English student with dual English/French nationality, and I am currently studying for a masters degree in computer science at the Université de Rennes 1. My interests include reading, writing, photography, music and films, but my main interest lies in software development, which accounts for most of my free time, and quite often my sleep too.

My experience is mainly personal, and I often have several active concurrent projects. These range from simulators to chat programs using C++/Qt, to web applications in Python and Appengine, and are often public, open source projects, hosted on Github, Google Code, or Launchpad.

Over the past couple of years, I have enjoyed working on some of these projects with Maxime Simon, a fellow student at my university, and I have therefore been able to build my collaboration and team skills.

Project Idea

Main Goals
DVD playing support

This goal implies both being able to play the video and use the in-film menus.
This seemed like a very hard task to begin with, but as libraries are already ported and available, it's more than possible.
A very simplistic development plan would be:

  • Extend Media Players media abstraction layer with a producer node which will act as an interface with libdvdnav. To start with, this node will read DVD media and output audio and video buffers.
  • Extend this producer node with user options for stream selection and navigation.
  • Extend the Media Player Video View for multiple bitmap overlays, then extend the node to produce bitmap buffers for subtitles and menus. Extend the player for subtitle options alongside the stream options (David is working on a video mixing node at this very moment).
  • Extend the node to decode navigation bytecode and add user options for menu navigation. As menu items are bitmaps, displaying them will be similar to displaying subtitles.
  • This would also mean adding extra interaction for Media Player in order to use the menus, though as they are BBitmaps, this should only be a matter of reacting to B_MOUSE_MOVED messages.
  • Adapt the node as an add-on to the Media Kit for widespread use.
Streaming support

A lot of music is being listened to and organised thanks to online services (Spotify and Last.fm for example).
Implementing support for streaming would make using these services possible, and extended to video, would also make technologies such as HTML5 video possible.
As above, I would first start by extending Media Player:

  • Extent the FFmpeg plugin so that it provides another add-on for streaming (AVStreamReader)
  • Modify the Media Kit to react to URI's and use streaming without seeking, this would also mean modifying MediaExtractor and MediaWriter in order to stop them from trying to write to the file (a kind of remote media mode maybe).
  • Create a media producer node for Media Player capable of streaming from an online source, (This is tricky, because a browser has it's own network options, but Media Player doesn't. I would have to make it use either a Socket from the Network Kit, or directly use Curl), or from a file being streamed in real time.
  • Modify Media Player to deal with lack of seeking and opening URI's.
  • Adapt the node as an add-on to the Media Kit for widespread use.
Optional Goals
Easily and accessible controls

As a musical addict, I like to listen to music while I work, while I write, while I...all the time...so it is important for me to rapidly be able to pause the music, change the volume, change tracks...but also know what track is playing for example.
Right now, these actions feel a little clunky, and I would personally love to control Media Player using a tray icon.

  • Determine a way to make a tray-icon work with the multi-threaded application
  • Implement the functionality as an option (the SoundPlayer app sounds like a good place to find inspiration)
Current track functionality

A lot of instant messaging clients now offer the possibility to advertise the currently track that's being listened to, this functionality shouldn't be more complicated than just making Media Player script accessible.

User interface

The user interface as it is right now is usable but a bit barren and could do (in my humble opinion) with a little interface pimping.
Some examples could be:

  • Improving the volume control (level label, animated icon, ease of use)
  • Turning the favorites function into a real asset for the player
  • Adding id3 tag data and album lists to the playlist window
  • Adding album art/thumbnails and tags to the file info window
  • Adding full screen overlay controls
Settings and configuration

The settings window is kind of empty, and would need extra options for new functions, but also for missing configuration possibilities.

Motivations

My first intention was to improve the Haiku media experience solely by writing a native interface for VLC, and this seemed like a good choice.

My emails on the developer mailing list led to a conversation about Media Player and some very interesting and challenging ideas.

My course will largely be based around user experience and interfaces next year, so designing such a part for Haiku, which really is a breath of fresh air compared to other operating systems, really is interesting for me.

These ideas and growing personal inspiration, combined with a love for clean C++ and interface programming, fuelled my interest in this project and I would love to have my chance at implementing them this summer.

Comments

Re: GSoC: Improve and Extend Media Player

First, welcome in, i sure am impatient to see what you will come up with.

Thing i hope won't land in mediaplayer, bloat (like winamp visualization plug-in), duplication with other OS system (for example, i don't understand why mediaplayer and showimage is not the same app). I don't put DVD full functionality in bloat.

Thing i currently don't like about mediaplayer, on my system it take 4 time more cpu than VLC, and i remember testing VLC on win98 compared to VLC on BeOS and the win98 version was a 10% faster. I can even get the mouse to skip if i use a large video in mediaplayer as if it was not skiping frame properly (that was a month ago, i would need to check that back). Lack of overlay seem to be part of the problem (VLC play fine in overlay but it still ok without it). Speaking of overlay, it would really be nice to have it on notebook because video on it will suffer without overlay (my aspire one lack it).

I want (in reality i would enjoy) the drag and drop frame back.

Some planning for 3D need to be made.

I would like a knob like in Soundplay to change the speed and allow playing backward.

In media pref, the real-time sound setting stay, but the video realtime setting is not kept (it's disabled when i re-open the media pref panel). This surely have effect on mediaplayer.

Re: GSoC: Improve and Extend Media Player

AlienSoldier wrote:

Thing i hope won't land in mediaplayer, bloat (like winamp visualization plug-in), duplication with other OS system (for example, i don't understand why mediaplayer and showimage is not the same app).

I would also like to see the video features of MediaPlayer implemented as a VideoOutputWindow media node, so any application could make use of its neat features.

Mmm, we could have a VideoProducer node that reads bitmaps (using translators), it's able to apply some effects (scaling, transitions, etc), and outputs video. Yummy.

BTW... Welcome aboard Christopher!

Re: GSoC: Improve and Extend Media Player

MediaPlayer *is* already using media nodes. It is possible to connect the producer node with another application.

Re: GSoC: Improve and Extend Media Player

Welcome aboard! I'm glad there's finally a project to improve Media Player, and I can't wait to see what becomes of this. This is one of the most important issues left for end-users. I'm also glad you ended up picking Media Player rather than VLC. While it's a nice media player and it being cross-platform is definitely handy, it cannot replace a native media player on Haiku. I hope that you will try to keep Media Player as native as possible. One of the things I like about it is that it is mostly based on Haiku's own core features, like the media_server, and those can be reused in other applications. I hope this won't change even as Media Player evolves.

Also, I hope you don't mind a few feature request:

A good way of handling multiple audio streams and subtitles. It is pretty annoying that in most media players today, you have to manually change the audio stream and subtitle setting every time you open a video that contains multiple options for this. The most annoying example has to be when you have a "dual audio" video, and the dub is chosen by default every time and you have to change it every time you open it (This happens a lot with Anime, where the English dub is often chosen by default).

The ability to choose a default aspect ratio. Widescreen monitors are becoming the norm now (And I am myself an owner of one), and I can't stand watching 4:3 videos in their original aspect ratio when my monitor is 16:10. The black bars on the sides are just too big for me. And changing the aspect ratio every time I open such a video is pretty annoying.

Now I hope this isn't outside the scope of this project, but one other thing that bothers me is bilinear filtering. In Media Player, there's an option to enable it. This is good and all and bilinear filtering should be available. But I personally doubt that it is a good choice to make this option application-specific. It'd be much better IMO if there would be an OS-wide option for this, since many users probably see this option as a must in just about every application which displays pictures or video, and by having it as an application-specific feature, several applications always seem to end up lacking it.

Re: GSoC: Improve and Extend Media Player

Some remarks on your feature requests:

1) A default setting for aspect ratio doesn't make a lot of sense, since most users would prefer the video to be in it's correct aspect ratio, and not the one of your screen. Otherwise you have stretched content!

2) The bilinear filtering is built into app_server, it is not application specific. MediaPlayer just happens to be the only application currently making use of it.

Re: GSoC: Improve and Extend Media Player

engleek wrote:

First of all, thanks for the welcome, it's gratifying to read your responses, it makes me feel like I can have fun coding and be useful!

My first motivations when I started chatting was to make VLC more native, but I quickly understood that working on Media Player, the native solution, and avoiding the bloat that VLC brings to Haiku would be more beneficial (and more interesting).

You're welcome, and thanks for contributing with code! Some of us can't do that, all we can do is suggest this and that. Thanks for taking up this project. Once again, I agree with picking Media Player, thanks.

engleek wrote:

A few of you are asking for features, and some of them could border on a kind of "smart" behaviour:
* Deciding which language to use for audio streams and subtitles
* Aspect ratio picking based on screen resolution

Yes, this would be very appreciated! :D

engleek wrote:

I don't have much experience with video filters, but I don't see why it couldn't be moved into Media Kit, along with a system wide setting.

As for video filters and effects, I wouldn't really know where to start!

Well, since filtering is already there, and as stippi later informed us of, it's also in the app_server, isn't it mostly some restructuring?

stippi wrote:

Some remarks on your feature requests:

1) A default setting for aspect ratio doesn't make a lot of sense, since most users would prefer the video to be in it's correct aspect ratio, and not the one of your screen. Otherwise you have stretched content!

I find stretched content better if the alternative has massive black lines on the sides. I don't stretch from 16:9 to 16:10 however, as the black lines are too small for it to be worth it. But with 4:3 content this is necessary for me. To me it doesn't make sense to let like 1/3 of the monitor go to waste in fullscreen mode. Of course, I don't mind if this is optional.

stippi wrote:

2) The bilinear filtering is built into app_server, it is not application specific. MediaPlayer just happens to be the only application currently making use of it.

I can't comment on the inner code in Haiku for this, but for the end-user it is application-specific as every application does not use it. I don't think it should be up to every application to enable it, because this doesn't work as some app developers will always see this as a non-needed feature and so users who can't stand using an application without bilinear filtering will be left out from many applications. Basically, if an application does not implement it, I think users should be able to let Haiku force-enable it.

Re: GSoC: Improve and Extend Media Player

Talking about VLC: what about VLMC port (or integration with ClockWerk) too ?

http://www.vlmc.org/

Re: GSoC: Improve and Extend Media Player

The best media player in the world is media player classic

only lacks of gamma control..

Re: GSoC: Improve and Extend Media Player

That, my friend, is debatable.

oh, and welcome aboard! (not that I'm a coder... )

Re: GSoC: Improve and Extend Media Player

First of all, thanks for the welcome, it's gratifying to read your responses, it makes me feel like I can have fun coding and be useful!

My first motivations when I started chatting was to make VLC more native, but I quickly understood that working on Media Player, the native solution, and avoiding the bloat that VLC brings to Haiku would be more beneficial (and more interesting).

The title of the project is actually a little misleading, because most of my time will be spent implementing DVD and streaming support, and if all goes to plan, then move that support into Media Kit.
After that, if I have time, comes the Media Player centric work, starting with those controls and interface improvements, and of course taking your remarks into account.

Improving performance isn't really one of the goals, and I'm not much of an optimizer, but I'm going to be knee deep in media related code, so maybe I'll notice something and be able to help a little.

A few of you are asking for features, and some of them could border on a kind of "smart" behaviour:
* Deciding which language to use for audio streams and subtitles
* Aspect ratio picking based on screen resolution
* Setting volume levels based on a volume attributes and other attributes (same album, same series...)
That last one is actually an enhancement request posted on the Haiku Trac.

The generalised video frame node isn't much of an issue IMHO. The code media player really isn't too complicated as far as Media Kit programming is concerned.

I don't have much experience with video filters, but I don't see why it couldn't be moved into Media Kit, along with a system wide setting.

As for video filters and effects, I wouldn't really know where to start!

Re: GSoC: Improve and Extend Media Player

I've ported libmms for Haiku

Why not add mms:// address support for media player?

http://ports.haiku-files.org/ticket/279

Re: GSoC: Improve and Extend Media Player

"2) The bilinear filtering is built into app_server, it is not application specific. MediaPlayer just happens to be the only application currently making use of it."

Could this be the cause of mediaplayer running so badly on my test PC (600Mhz/matrox G200)? A simple gametrailers.com "ipod" video can't play without lot of skipping and screen garbage. If i put a video with even more resolution i can slow the whole circus to having the mouse move 2cm each 5 sec. Could it be that not having the video directly in overlay like in my VLC result in the post-processing (filtering) monopolizing the app-server?

Also Stippi, any idea why the media pref "X" for real-time video is never recorded (it work for the real-time audio part)?

Re: GSoC: Improve and Extend Media Player

AlienSoldier: You can try disabling it in Media Player and see how it affects performance for you.

Re: GSoC: Improve and Extend Media Player

I have no idea how to do that. Another thing i just noticed, VLC and mediaplayer contrast is not the same (mediaplayer is a bit darker). This is not related to overlay as both in overlay and bitmap the VLC shot are the same.

Re: GSoC: Improve and Extend Media Player

For my (future) Haiku usage the media part is very important so I'm looking to Mediaplayer
with attention...

For now it doesn't work very well, sadly!
I hope your efforts can make it better :-)

MKV playing is very problematic (blocking and slow motion for very high CPU usage), and sometimes the application simply hangs (and seems impossible kill it, the only solution is to reboot the system!).

One very important thing for the DVD playing is AC3/DTS SPDIF passthrought (now Haiku transform multichannel audio in stereo using SPDIF).

I've collected some bugs on trak:

http://dev.haiku-os.org/ticket/4600
http://dev.haiku-os.org/ticket/4601
http://dev.haiku-os.org/ticket/5611

The last maybe is not totlly Mediaplayer related, maybe is systemwide... I've to try to reproduce this with other application...

This is instead an enanchement request: after SPDIF passtrough is reached to have the possibility to transcode the multichannel audio when multichannel is used and is not AC3 or DTS.
For example a lot of MKV uses AAC 5.1 to save space, this audio must be transcoded on AC3 (or better DTS).