| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

dvdplayer

Page history last edited by Vasile 14 years, 10 months ago

 

dvdplayer.bin

dvdplayer.bin is the main program running in the MG35.

Version: N/A

Status: trying to replace

 

 



 

Description

 

Important note: in the latest alpha versions of the firmware (1.5.2.3-a7 as of this writing) there are some patches applied to dvdplayer. The most important one extends the number of file extensions showed when browsing the disk or network share. This allows one to execute scripts (.ext, .sh or .app file extension) and to play internet radio streams specified in .url files.

 

At startup, it will initialize the device:

  • insert khwl.o and fipmodule.o modules, using minimod. As result, two new devices will appear in the system: /dev/fip and /dev/realmagichwl0. At least in firmware 1.5.2.3_a7, /minimod is a symlinkk to /bin/minimod, which is a shell script directly calling /sbin/insmod.
  • load /logontsc.jpg and display on OSD
  • insmod dm9000x_32.o (network interface)
  • mount procs to /procs
  • mount ramfs on /hosts, /net, /usb
  • run /bin/setup
  • mount hdd:
    • /sbin/insmod /kernel/drivers/ide/ide-mod.o
    • /sbin/insmod /kernel/drivers/ide/ide-probe-mod.o
    • /sbin/insmod /kernel/drivers/ide/ide-disk.o
    • mount -t ramfs ramfs /cdrom
    • /bin/hdparm -S 242 /dev/discs/disc0/disc
    • if NDAS is activated
      • /sbin/insmod /ndas/ndas_sal.o
      • /sbin/insmod /ndas/ndas_core.o
      • /sbin/insmod /ndas/ndas_emu.o
    • if only 1 partition on hdd, mount it to /cdrom
    • else mount each partition to /cdrom/Partition where n the partition number (max 10)
  • load /lib/mediabackground.jpg and display on OSD
  • display the interface on the screen
  • wait for IR codes from the remote control or key presses on the front panel and act accordingly by updating the screen and/or launching other applications.

 

The external events (device button or remote control key-press) are received using fipmodule.o. If needed, it will launch another external programs to perform specific tasks (e.g. play a file). After that, it will send the received commands (e.g. Play/Stop/FF/REW) to the player. dvdplayer also takes care of the TV screen updating.

 

Note1: If dvdplayer cannot load the IDE/network drivers, it loops and keeps retrying to load them. It freezes before even reaching the 'local mode'/'network mode' menu.

 

NOTE2: It turns out that any files with extensions starting with a recognized one will show up in the user interface (eg aaaa.mp3_etcetcetc" or "DeanCain.avidFanOfBaseball").

 

NOTE3: If find_extension() in dvdplayer can't locate the extension in a filename, it will return everything from the second character forwards. This means a file named 'David' will be considered as having 'avid' extension. Combined with the bug described in the previous Note2, 'avid' is a valid extension (it starts with 'avi') and is thus "David" file is shown in the UI.

 

Note4:since dvdplayer holds control of the FIP device, any other program that tries to use it (e.g. mp3play in fip mode) will result in a race condition. If the player is called in console or in a shell script, a possible solution is to stop dvdplayer before launching the player (using kill -STOP (dvdpid) ) and later continue it after the player is done (using kill -CONT (dvdpid) ).

 

External programs

When needed, dvdplayer will launch other programs to perform other functions:

  • fileplayer to play various files
  • mpegplayer to play MPEG 1/2 (audio-video?) files
  • mp3play to play (only?) MP3 files in the background of the photo slideshow
  • mp4play to play MPEG 4 (audio-only and audio-video) files
  • upgrader to upgrade the firmware.
  • setup to configure the device

 

Strangely enough, although the video stream is displayed by the respective external player, the subtitles are handled by dvdplayer itself. This is probably to avoid collisions to OSD, since it can also be used to display other info (e.g. subtitle menu, file info) while playing.

 

Here is the summary of the supported files and the associated players in the original firmware (we use an external dispatcher in our firmware):

 

AUDIO    
MP3 fileplayer  
OGG fileplayer  
WAV fileplayer  
WMA fileplayer  
AC3 fileplayer  
PCM fileplayer  
DTS fileplayer  
M4A mp4play  
VIDEO    
AVI fileplayer  
MPG mpegplayer  
MPEG mpegplayer  
DAT mpegplayer  
M2V mpegplayer  
MP4 mp4play  
VOB mpegplayer  
DVD directory mpegplayer  
IFO dvdplayer instead of calling an external player, dvdplayer play these files by itself, probably due to interactivity of DVD menus. IMPORTANT: To access the DVD structure as expected, use the Enter button! If you launch the file using hte Play button, MG35 will play all the VOB files, but the menus will not be available.
ISO dvdplayer Playing an ISO file over the network uses more than 80% CPU power.
IMAGE    
JPEG dvdplayer  
JPG dvdplayer  
PLAYLISTS    
M3U dvdplayer  

 

The implementation of m3u playlists is a little convoluted: when you open a .m3u file under 'playlists', dvdplayer creates a directory of symlinks (somewhere it finds convenient) based on the filenames in the playlist. Then it plays the symlinks using the respective player, usually fileplayer.bin (never tried a video playlist, not sure if it's possible).

 

Note that you can also launch the players in a telnet console. See the documentation for each player's call syntax.

 

 

 

 

Modified behavior

In order to make the transition to a new user interface, some changes were/will be made in the way dvdplayer behaves.

  • the modules which are now loaded by dvdplayer will be replaced by "dummy" modules which do nothing. The original ("real") modules will either be loaded in the boot scripts before dvdplayer, or directly compiled in the kernel. This will allow us to:
    • execute alternate UI without relying on dvdplayer to load drivers, while keeping dvdplayer happy if we choose/need to use it
    • apply skins to dvdplayer on the fly
    • fully customize the boot process using files from the harddrive. This will significantly improve the development speed, since we will not need to rebuild and flash firmware images for any small change we do. Instead, just copying the new files on the harddrive will do it.
  • the list of files shown in the on-screen browsing list was expanded (see play_file patch).
  • the built-in file dispatcher is "disabled" and replaced by our own. In order to do this, the original fileplayer.bin, mpegplayer.bin, and mp4play are replaced by copies of the new dispatcher. This in turn calls the corresponding media player from /bin/player, based on file extension. Currently, only the mp3 player was rewritten. The other ones are from the original firmware, just properly renamed and placed in /bin/player.

 

License

 

 

Proprietary

 

Todo

 

History

 

Patches

The patches are applied to the binary dvdplayer.bin by a Python script

 

No File Description
1 mount_partition

Add mount fixup.

  • Those with FAT32 HDs want them mounted read-write. We can remount the drive in phase2, but dvdplayer.bin keeps remounting read-only.
  • Unfortunately, dvdplayer doesn't use the mount command. It uses the mount system call, so replacing the command doesn't do any good
  • Binary patching dvdplayer (in a mere two places) solvse this, at the expense of stability.
2 playlist_url extended the M3U playlists to support URLs as targets
3 play_file Browse/play files with new extensions in Video, Audio, Photo modes. check_file_ext (play_file.c) determines what shows up in the browse list, and what general FTYPE_* it is. It should probably be renamed playlist_ext.c
4 play_dir Hide directory names from browse list (those starting with dot or underscore)
5 start_item Specify only non-ISO file extensions for fileplayer (???)

 

Comments

  • VB: in patch #3 (play_file), if M3U/PLS/ASX are added in the MODE_AUDIO section of the mode_extensions[], will dvdplayer try to launch fileplayer instead of processing them internally? If so, it may make sense to have the playlist processed outside dvdplayer, for greater flexibility.
    • John: Yes, yes, and yes :) Is this not the situation now?
      • VB: No, right now they are in the MODE_PLIST section, so I presume they'll be processed internally by dvdplayer. I don't know how dvdplayer selects a certain player, I guess it uses the check_file_ext() result? Or this function is only used for filtering the files to be displayed in the UI list? BTW, if you can build a test firmware with the patches, I can do some tests.
    • John: Remote M3U/PLS/ASX should be urls, which get written to .url files if they are inside a local M3U file, or manually placed there by the user for non-playlist usage. Local M3U files should be dvdplayer-handled playlists, as they are. Local PLS/ASX are not supported from within dvdplayer, since we'd have to convert them to M3U on the fly, or find some way for dvdplayer to treat a track as a playlist (not likely).
      • VB: I was hoping of doing it the other way around: dvdplayer to treat playlists as audio files and pass them to the dispatcher/players. Then we have a hook to process local M3U/PLS files ourselves. It even makes logical sense, why should one select Playlist vs Music in the UI? They're both music, after all... Separate Playlist function makes sense if you want to edit playlists in the UI, but since we cannot save them (AFAIK), it's pretty useless. As a bonus, this could leave us with a usable button in the UI, to do whatever we want with it (e.g. "Extensions"instead of "Playlists"). But this is for another day :-)
    • John: But again, that means no way to actually navigate the playlist. I've taken PLS/ASX out of MODE_PLIST, since it will likely cause problems as you point out. Check the firmware directory for an upgrade. NOTE: The GPL fip module is included, and FIP key repeating doesn't work as yet. Also, there's a memory conflict between libplay (?) and dvdplayer somehow, so playing remote URL's has a tendency to trash the dvdplayer stack. And finally... mp3play will hang if no gateway is active. Yes, dvdplayer clears the screen in video mode before starting the player.
      • VB: Thanks! I'll check what happens if I try to play a .app file, if dvdplayer knows what to do with it.

Update: The shell files are working! Interesting, if starting one of them in Audio mode, nothing happens on screen, as expected. But if started in Video mode, the screen goes blank (black), and "Playing my_script.sh" is displayed. So the mode definitely makes a difference. More testing tonight.

 


 

    • VB: what about an external playlist app creating the /tmp hierarchy from the m3u/pls file, then sending SIGSTOP to dvdplayer and firing up filebrowser? At filebrowser exit, send SIGCONT to dvdplayer and return.
  • John: Are you implying that finishing the browser would not pretty much replace dvdplayer (notwithstanding ISOs)? What's left? A new setup UI?
    • VB: IFOs? I think having a way to easily "dual boot" to use dvdplayer or filebrowse makes a lot of sense for most of the people. Or at least, some way to easily start filebrowse from the UI. This will provide a userbase for filebrowse testing, without disturbing their family life - at least for the married ones :-))).
  • John: Fair enough. I do agree that this filter improvement will likely lead to a much larger testing base, and that's really what motivated me to get it all together once it became clear. :D
    • VB: a possible strategy is to add all the new features (like radio) only through filebrowse. This will be the carrot, since we'll never have a stick :-)

 


*VB: we should probably add .divx as an accepted video extension in play_file.c? Just for convenience.

  • John: What file format is it? And will fileplayer play something with the wrong extension?

 

Comments (0)

You don't have permission to comment on this page.