Older blog entries for pycage (starting at number 89)

19 May 2009 (updated 20 May 2009 at 08:08 UTC) »

Mer plays videos with MediaBox



Another milestone has been reached in the Mer project on its way to eventually replace Maemo on the N8x0 devices. It will be possible to play videos with Mer 0.13. The current SVN version of MediaBox supports Mer and uses the libxine backend for video playback.

After installing libxine and MediaBox SVN version on Mer, you will need to install the D-Bus-Xine service. D-Bus-Xine is a simple D-Bus service for embedding libxine in applications. It was originally written for enabling DVD playback
with MediaBox on PCs.

A version compiled for Mer-ARMEL can be found here. If you want to compile D-Bus-Xine yourself, you can also download its source code.

I haven't built deb packages for D-Bus-Xine yet, so you'll have to manually extract the tarball in the root directory (/) on Mer.

After having started MediaBox, you should enter its preferences view
and set the media backends to Xine for all filetypes that you want to be able play.
However, there is no sound support yet in Mer 0.13, so don't expect too much.

EDIT: see the comments for how to get sound

Syndicated 2009-05-19 20:06:00 (Updated 2009-05-20 07:50:41) from Martin Grimme

MediaBox Media Center 0.96.4 released

Hilights of the new MediaBox release:

The overall performance of the user interface has been improved again and the lists now feature transition effects and remember the position where you where standing in the parent folder when you go back. This is especially handy when browsing UPnP/DLNA servers.



The mplayer backend has been optimized and mplayer now plays videos generally a lot smoother than before. Playback of higher resolution videos (e.g. 640 x 480) is now also smoother by automatic downscaling.

Media indexing has been improved and runs faster. And if you don't like indexing of ID tags, you can always browse the filesystem to play your media, of course.



Music can now also be browsed by genre, additional to browsing by artist, by album, and by folder.



MediaBox can now be told to keep the display lit while playing media. Stop playing, and the device may enter powersaving mode again.

If you use the Nokia headset that came with the device, you can now use the headset button to pause/play and skip to the next or previous track. Do this by pushing the button once, twice, or three times, respectively. Do not press the button to quickly because the headset is bad at detecting consecutive actions, though. Half a second between clicks is just right.

Syndicated 2009-03-06 21:46:00 (Updated 2009-03-06 21:48:14) from Martin Grimme

Extending MediaBox: Creating a Simple Component

Note: If you're reading this article in a feed aggregator like planet.maemo.org, it might be truncated. Please click the link to the original feed to read the full article. Get your text editor ready because this time I'm showing you the basics of plugin development for MediaBox. Last time, I have explained the component system of MediaBox. If you haven't read this article yet, please do so as

Syndicated 2009-01-22 17:13:00 (Updated 2009-01-22 17:18:38) from Martin Grimme

Extending MediaBox: The Component System Explained

I am going to write a bit about extending MediaBox with new plugins. Let's start with the basics of the component system first. I will show you some code examples in a later article.

Since version 0.96 MediaBox uses a component system for extensions. It is essential to understand this system when implementing plugins.

Components in MediaBox are independent objects connected to a message bus, where they can send messages or listen to messages from other components. Every component gets connected to the bus automatically when created. You don't have to take care about this step.

A plugin is a collection of one or more components grouped into a directory. The YouTube plugin, for instance, consists of a YouTube device component and a component for the preferences dialog.

Plugins can also add new messages to the vocabulary of messages that can be sent across the message bus.

Here's a little ASCII-art to summarize this all.


consist of connect to
Plugins -------------> Components ---------------> Message Bus
| | | |
| emit | | listen for |
| | | |
| | | |
| define v v transports |
+------------------> Messages


Let's take a closer look at the message stuff now.
As explained above, the vocabulary of messages that can be sent across the message bus is defined by the plugins. Most of the messages are defined by the "core" plugin (which is not really a plugin but contains many of the core components of MediaBox).

Some messages are of type event. They are used to notify other components about something that has just happened, e.g. that a new UPnP device has been discovered.
Some messages are of type action. They are used by components to trigger actions in other components.
There are also messages of type service call. While events and messages may be handled by any component that listents for these messages, a service call is only sent to one component and not visible to others. The message bus remembers which component can handle a particular service call and will route all subsequent calls for the same service to the same component again.

To sum it up with ASCII-art:

+------> Event
is either of type |
Message -------------------+------> Action
|
+------> Service Call


When a plugin defines a new message, it has to give it a name. The name is all uppercase and consists of a domain name, the message type, and some descriptive name.
The domain name helps to avoid name clashes of messages defined by different plugins. It should be the name of your plugin.
The message type tells programmers about the type of message. It is one of EV for events, ACT for actions, and SVC for service calls.

These are some examples of actual messages defined by components belonging to MediaBox:

  • CORE_EV_APP_IDLE_BEGIN (event: MediaBox is announcing to go idle in order to save battery)

  • CORE_EV_APP_IDLE_END (event: MediaBox is announcing to wake up from idle state)

  • NOTIFY_SVC_SHOW_MESSAGE (service call: show a short message)

  • HWKEY_EV_UP (event: user pressed up on the d-pad)

  • HWKEY_EV_DOWN (event: user pressed down on the d-pad)

  • HWKEY_EV_LEFT (event: user pressed left on the d-pad)

  • HWKEY_EV_RIGHT (event: user pressed right on the d-pad)

  • UI_ACT_SELECT_VIEWER (action: select a viewer)


Some messages take parameters. NOTIFY_SVC_SHOW_MESSAGE, for instance, takes as parameter the text of the message to show. Some service calls even have a return value.

These are the basics of the component system. Next time I will show you how components are integrated in MediaBox, and how to create a simple plugin.

Syndicated 2009-01-17 09:42:00 (Updated 2009-01-17 09:46:47) from Martin Grimme

Making Themes for MediaBox

Today I'm showing you how to make new themes for MediaBox.

Every theme is a subdirectory in /usr/lib/mediabox/theme or in ~/.mediabox/themes (MediaBox 0.96.2 or higher).
You can test your themes in ~/.mediabox/themes and when distributing the theme as an installer package, it will install into /usr/lib/mediabox/theme.

There are a two files that are absolutely necessary for a theme to work, and every theme must include them.

The one is PREVIEW.png, which is a PNG image of size 112 x 67 pixels, showing a preview image of your theme. This is the icon that the users will see in the theme selector.

The other file that is necessary is a simple text file called info. This file describes the theme and looks like this:

name:        MyTheme
description: My example theme for MediaBox
author: Your Name




Of course, with only these two files, your theme will be pretty empty. Actually, MediaBox will load everything that it doesn't find in the current theme from the default theme. Thus, every theme inherits from default.

When you look into the directory of the default theme (/usr/lib/mediabox/theme/default), you will see a lot of images in PNG format. These are the theme elements. Your theme can override any of these images by providing a PNG image of the same name and the same size. I have to stress that it is absolutely necessary that the theme elements provided by your theme are exactly the same size as the ones in the default theme! For instance, the element mb_panel.png is of size 64 x 64 pixels. If your theme provides mb_panel.png, it must be of size 64 x 64 pixels, too.

A theme can have a bunch of .def files, which are text files containing font and color definitions. The name and number of the .def files is not important. Below are example entries of a .def file:
#
# Virtual Keyboard
#
color_mb_vkb_background: #000000
color_mb_vkb_text: #dddddd
font_mb_vkb: Nokia Sans Cn bold 20


Empty lines and lines starting with a # symbol are ignored by MediaBox and can be used for adding comments and making the file better readable.
The other lines contain key-value pairs, where key and value are separated by a : symbol. If the key name starts with color_, then MediaBox treats it as a color definition. If the key name starts with font_, then MediaBox treats it as a font definition.

Color values are given in hexadecimal RGB (6 digits) or RGBA (8 digits) notation, prepended by a # symbol. Most color keys take RGB values only.

Font definitions are given in Pango syntax, containing the font name, optionally a style (bold or italic), and the font size in points. Although the Nokia internet tablets have a screen resolution of 225 dpi, the system renders fonts with 96 dpi.

Any keys defined in the .def files of the default theme can be overriden by your theme in .def files.

Once your theme is ready, you may want to distribute it as a installer package for the application manager. I have created a build script for this task. If you have upload permission for the maemo-extras repository, you can then upload your theme with the Maemo Extras Assistant web site and promote it to the extras repository, so that other users can enjoy it, too.

Theme packages always depend on mediabox-compat-theme with a certain version number. For MediaBox 0.96 and some following releases, this version number will be 1.0. So as long as MediaBox provides mediabox-compat-theme, version 1.0, your theme will remain compatible. At a later point some minor changes or extensions to your theme may be necessary to fully restore compatibility again.

Syndicated 2009-01-10 14:43:00 (Updated 2009-01-10 14:49:11) from Martin Grimme

A New Version of MediaBox Media Center

Finally, after several months of work I have now released MediaBox 0.96, which was really overdue... ;)

A lot of people were very helpful and regularly tried out the code fresh from SVN during the last few months and provided lots of feedback. Thanks to you all!
Special thanks also go to Hugo Baldasano for his work on asynchronous networking and for good help with UPnP event handling!

The long wait is now over and MediaBox 0.96 is available in the maemo-extras repository for Chinook and Diablo. The .deb packages for users of OS 2006 (yes, that's Nokia 770) and OS 2007 will be made available soon on the MediaBox homepage.

UPnP Streaming



UPnP/DLNA is a great technology for streaming music, videos, and photos to your
tablet. Simply put an UPnP media server in your home network and MediaBox
will discover it automatically for browsing and streaming its contents.

Playlists and media bookmarks

Playlists can be created and edited and are saved automatically. You can reorder the items at any time, and you can mix audio, videos, and images in a playlist.

You can now also set media bookmarks in any (seekable) file to mark the best spots and to find the place where you stopped listening to your audio book or podcast the last time. Simply click on the star-button to set a media bookmark for the current position.

Shuffle and Repeat

I don't think I need to say much about these features anymore, except that MediaBox can do it now, too.

Car-Mode


Car-mode is what I call the fullscreen mode of the music player because it's very handy to use while driving a car. Big buttons for previous, next, and play/pause, along with big cover-art and a big title label make MediaBox perfect for this situation. I use this mode frequently with a shuffled playlist when driving.

Themes



It seems like every media center these days needs to be themable. MediaBox follows this fad so you can give it a new skin by downloading themes from the maemo-extras repository.
The first extra theme available is called "DarkBox", and hopefully others and betters will follow. I'm going to give more details on theming and building theme packages later. It's really easy, so get your GIMP or Photoshop ready! :)

Plugins



MediaBox can be extended with plugins, and I'm going to cover plugin development later. Some plugins are already available for download:


  • a FM radio (for the N800),

  • a YouTube browser

  • and internet radio with SHOUTcast directory.

Syndicated 2008-12-28 14:23:00 (Updated 2008-12-28 14:28:13) from Martin Grimme

Bluetooth-PAN fixed for Diablo

Yesterday I uploaded version 1.0.1 of maemo-pan to the Diablo extras repository. This new version finally fixes Bluetooth-PAN on Diablo.

Nokia recently uploaded a fix for handling DUMMY network connections in Diablo, which is needed for getting Bluetooth-PAN integrated into the connection dialog. If you install maemo-pan 1.0.1, the dummy-network package from Nokia will be installed as a dependency automatically.

Nokia's networking fix uses a hardcoded name for dummy connections, so you'll have to connect to "Dummy network" instead of "Bluetooth-PAN" (as it was on Chinook).

Apart from fixing the networking issue on Diablo, maemo-pan 1.0.1 is the same as maemo-pan 1.0. New features will be added in a later release.

maemo-pan 1.0.1 is only interesting to Diablo users. If you're running Chinook, maemo-pan 1.0 is fine. There is no version 1.0.1 in the Chinook extras repository because of that.

Syndicated 2008-08-19 06:03:00 (Updated 2008-08-19 06:17:57) from Martin Grimme

Tablet Python #4 - Sources of Memory Leaks

Marius Gedminas blogged an interesting article about memory leaks in Python. On the tablet you don't have much memory available, so memory leaks will annoy the users very quickly.

Python is a garbage-collected language (like Java or C#), so memory leaking is normally not an issue, but there are situations where you should be careful.

Bindings to C libraries

Many modules are bindings to C or C++ libraries, and memory leaking is unfortunately quite common in those languages, esp. in complex libraries. A hot candidate for memory leaking on the maemo platform are the GdkPixbuf operations.

GdkPixbufs get not automatically garbage collected by Python. Always use del on a GdkPixbuf explicitly when you don't need it any longer.


The __del__ destructor method

Classes can have some sort of destructor method in Python.


def __del__(self):

...

This is called when you use del on the last reference you are holding. But be very careful! Classes overriding this destructor method are not eligible for breaking reference cycles by the garbage collector anymore! They have to be released manually. It's normally not necessary to override the __del__ method, so you better stay away from it.

Always take special care when dealing with classes overriding the __del__ method. Cyclic references involving such classes cannot be resolved by the garbage collector automatically.

Syndicated 2008-06-12 14:32:00 (Updated 2008-06-12 16:21:29) from Martin Grimme

MediaBox 0.95 released

The new version 0.95 of the MediaBox Media Center is finally available. Thanks to all users who reported bugs and made suggestions for new features. Thanks to lot of feedback, many things have improved since the last release.



With the new MediaBox you can finally compose playlists and rearrange them on the fly. If your internet tablet has a keyboard connected, you can also search for tracks in long playlists or albums by just typing a few letters of the title.



The new version has an improved easy and finger-friendly user interface and reduces memory consumption, especially when dealing with large collections of media.



You can view the release notes at http://mediabox.garage.maemo.org/data/release-notes.

MediaBox 0.95 is available in the Maemo Extras repository. Click the arrow below for quick install.



Have fun!

Syndicated 2008-05-09 19:06:00 (Updated 2008-05-09 19:15:03) from Martin Grimme

MediaBox Walkthrough: Search as You Type

Today I'm showing you another new feature of the upcoming version 0.95 of the MediaBox Media Center. Search-as-You-Type works on any internet tablet with a keyboard, either built-in or connected via Bluetooth or USB.

Find a track
If you have many tracks in an album or the playlist and want to quickly scroll to a particular track, just type some letters from its title.

While typing, MediaBox searches your tracks for a match and scrolls the list to bring the track into view. You can see your search term displayed in the title bar while typing.



You don't have to type the full title as it's sufficient to type just a few subsequent letters from anywhere in the title.

Make a new search
The search text field clears automatically after a few seconds.

In order to make a new search, wait for the search text to disappear in the title bar, and enter your new search term.

Syndicated 2008-05-02 20:10:00 (Updated 2008-05-02 20:15:22) from Martin Grimme

80 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!