Screen Layouts

Screen Layouts

The "layout" command is used to list and select screen layouts. The basic command simply generates a list of available layouts:

http://server/layout/en_UK/index

/layout/en_UK/all_info=All Info
/layout/en_UK/remaining=Remaining Time
/layout/en_UK/big_title=Big Title
/layout/en_UK/scope=Scope
/layout/en_UK/inverse_scope=Inverse Scope
/layout/en_UK/with_volume=All, With Volume
/layout/en_UK/test=Test

Everything to the right of the = sign in the response is listed as a layout in the Rio "Change Layout" menu. The items to the left are the URLs for each layout's actual
file, which, when selected, are provided as a binary list of fields and formatting commands. This is described in detail in the Screen Layout section, below.

Favourites


The "favourites" command is used to list or select favorite search strings. The Rio supports 100 of these, numbered 00-99. This is a bit more complicated. Essentially, the user can, after selecting a top-level query (like "artist=Genesis"), hit the "List" button on the remote. The Rio then displays a list of all the current playlists, and the user can then enter a playlist number on the remote keypad, then hit "Enter", and the favourite setting is stored on the server.



For some reason which I have not yet figured out, the Rio doesn't send this "add to favourite" command over HTTP. It instead sends a UDP packet to the server, on the server's status port (typically 18678), saying "Favourite (I like it.) Index: ## <string>". The "##" is replaced by the 2-digit list number, and <string> is replaced by the query command used, like "artist=Genesis".



When the user selects a favourite list to play, however, it's again transmitted over HTTP. To retrieve a list of favourites:

http://server/favourites/all

00:artist=Pink%20Floyd
01:genre=Classical
02:album=Tweekend

When the user selects one of these, by number or by paging down with the remote and hitting enter, the Rio uses the string given as the argument to a "results" call: "http://server/results?album=Tweekend". From there, everything proceeds as if the user had simply selected the given album (or genre, or artist) from the top-level menu. It's basically a mechanism to do quick shortcuts to favorite selections of music. Note, also, that none of the open-source servers seem to support this yet. (I'll be trying to get it added to JRec, eventually).

Player Status


The Rio Receiver periodically sends (or responds to a server-initiated request) a status packet, over UDP, typically to port 18678 on the server. The server says
"State? (What's going down?)" The receiver responds with something like:

State! (The word on the street is)
MAC: 00:90:00:11:23:7d
Playing: 10f7
State: Playing
Timecode: 124000

Other Commands?


It's quite possible that we haven't figured out everything that the Rio can do. For example, if one looks at strings in /empeg/bin/player, right around where the UDP status stuff is, we find this:

MercuryProtocol
Reboot
Reload
State?
State!
Goodbye
The word on the street is
Favourite
I like it.
Index

Now, obviously we've already found uses for "Favourite (I like it.)", and "State!." But we haven't seen anything where Reboot, Reload, or Goodbye is used. Other intriguing strings:

  • It appears that it's possible for the server to return a number in the "matches=" string ('casue I found "matches=%d" in the player binary), but we don't know what that would do (if anything).
  • In the query results -- why "5,0,0" to represent 5 tracks, if the ',0,0' isn't used? It may be that certain features were designed into the protocol, but never made it into the server or firmware.
  • The string "10.1.1.31" is in there, but it's not apparent if the Rio listens on that port as a "back door" for certain features, or if it's just a placeholder until the Rio can get a valid address from the server.
  • The "Audio Receiver" logo (above "searching for music" when the receiver powers on) is stored as an ASCII art string, so it might even be possible to change that, if you were so inclined.
  • There are strings related to saving playlists ("PlaylistSave", "Saving playlist %s=%s with name %s", etc.), but the Rio doesn't support any kind of remote playlist generation.

  • Command Quick Reference


    http://server/content

    Three functions: Play music, provide a playlist, and give a list of all playlists.


    Request

    Response

    /<id>

    Returns music data for track identified by <id> (a hexadecimal number), assuming that the id points to a music file.

    /<id>?_extended=1

    Returns an ASCII Playlist for the list identified by the hex number <id>, assuming it points to a playlist. Without the _extended=1, returns a binary list.

    /100

    Returns an ASCII list of all playlists on system.



    http://server/favourites

    Returns a list of all favourites defined on the server.


    Request

    Response

    /all

    ASCII list of format: xx:string, like "05:artist=Genesis"



    http://layout

    Returns a list of available layouts for the given language, and also retrieves the selected layout file.


    Request

    Response

    /en_UK/index

    ASCII list of all layouts on system, as URL=Name pairs, one per line.

    /en_UK/<filename>

    Retrieves the binary layout file given by the <filename>.



    http://server/list

    Returns binary data representing track ID, filesie, and MPEG offset within file, for all tracks on a given playlist, or for a given track.


    Request

    Response

    /<id>?shuffle=1&_extended=2

    Returns a (File ID, File Size, MPEG Offset) DWORD triplet for each track listed in playlist <id>. If the ID points to a track, rather
    than a playlist, returns the information for that track alone. _extended=2 is required. Shuffle is optional, and if present, causes the
    list of triplets to be randomized prior to returning it to the receiver.

    /100?shuffle=0

    Returns a special list of tracks, from the first available album on the system. (I'm not sure if this is a JRec thing, or if this matches the
    standard Windows server's behavior.)



    http://server/query

    Looks up albums, titles, artists, and genres. Can be extended with regular expressions and row limiting options.


    Request

    Response

    ?artist=

    Returns a list of all artists on the system, of format "#=#,0,0:name." "title=" returns a list of track titles, "source=" returns
    album names, and "genre=" returns a list of genres present on system.

    ?artist=AL&_begin=3&end=15

    Performs query, restricting to all items beginning with "AL". Only displays results numbered 3 through 15 (the 4th through 16th
    lines in the response, since they're numbered begninning with zero).

    ?artist=[4ghi][3def]

    Restricts query to those beginning with the regular expression [4ghi][3def]. Will match, for example, artists beginning with "ge", "he", "id", "4f", etc.



    http://server/results

    Returns an ASCII or Binary list of songs matching a given criteria.


    Request

    Response

    ?title=Time&_extended=1

    Returns an ASCII list of songs matching "Time" (must be an exact match).

    ?artist=Genesis

    Returns a binary list of songs for artist "Genesis," as (File ID, File Size) DWORD pairs.

    ?artist=Genesis

    Returns a binary list of songs, but as (File ID, File Size, MPEG Offset) triplets.



    http://server/tags

    Returns a list of available tags, or actual tag data for a given song.


    Request

    Response

    (no arguments)

    Returns an ASCII list of all valid tags available from the server. It is not known if order is important.

    /100

    Returns binary tag information for the "All Tracks" playlist.

    /<id>

    Returns binary tag information for the song identified by <id>.


    Screen Layout Hacking


    The Rio receives all of its configuration, and even binary code, from the
    server, mostly at boot-time. When the user chooses to change the display
    layout, the Rio sends a request to the server for a list of available
    layouts. These layouts (their names, anyway) are displayed to the user in
    the Rio screen, and when one is selected, that layout is requested from the
    server. It's a simple binary file, mostly a bunch of double-words (4-byte
    long integers), describing what to put on the screen and where to put it.



    Update - 22 January 2002 An engineer from empeg has partially
    validated what's presented here, and I'm working to incorporate some of his
    revelations into the page, as well as to polish a perl script for generating
    layouts. I was right in guessing that type 5 was a bitmap, but I still don't
    know how to make one. Anyway, you can find Roger's information
    here.

    Layout Format

    The layout is described as a series of field definitions, applied one
    at a time in the order in which they're found in the layout file. So, a
    later field may overwrite a previous field, which might be nice if you want
    to superimpose a track title on top of a full-screen oscilloscope visual.



    Each field to be described requires two pieces of information: the field
    type, and where to put it. Most fields require additional information, such
    as what font to put the data in, whether to align the field left, right, or
    centered, and what kind of data to put in the field.



    Most fields, then, look something like this:



    Type


    Left


    Top


    Right


    Bottom


    Payload Length


    Payload (optional)

    What goes in the field

    Distance from left/top edge of screen to top / left / right / or bottom edge of field

    Length, in bytes, of Payload

    Tag, font, and so forth




    The screen, I should mention, is 128 x 64 pixels. For example, "(0x00, 0x00,
    0x80, 0x40) would define a 128x16 pixel rectangle
    that starts in the top left corner of the screen and stretches to the
    right edge of the screen, 16 pixels down from the top.

    The Field Type


    Code


    Explanation

    0x00

    Blank

    0x01

    Text label.

    0x02

    tag display (selected in the Content-Information field)

    0x03

    time display of current location within track

    0x04

    player status (play, pause, etc.) - uses font 2

    0x05

    garbage (shows some sort of diagonally repeating and progressing
    bit-junk. looks a lot like it's a bitmap, or maybe
    the content-information is supposed to contain a bitmap,
    or maybe an arbitrary string, but I haven't gotten this
    to work yet, either.)

    0x06

    draw box (see Content-Information for type, color, and border)

    0x07

    volume display (diagonal wedge)

    0x08

    'scope display

    0x09

    Mute indicator (when font=0), repeat icons (font=1) or
    shuffle setting (font=2)


    Definitions for All Field Types

    Not all field types use the same parameters. Here's an attempt at showing them all at once -- also check out Roger's pages for
    a more C-centric way of looking at this. For each type, read downwards -- all fields are INT32 (double-words, 4-byte integers, whatever),
    except those in the payload. All the payload fields are one byte wide, except for the bits-per-pixel, width, and height fields for bitmaps, and the color field for rectangles (which
    are all INT32).




    Field Type

    0 - Blank

    1 - Text

    2 - Info

    3 - Time

    4 - Play State

    5 - Bitmap

    6 - Rectangle

    7 - Volume

    8 - Scope

    9 - Status

    Location

    Left

    Top

    Right

    Bottom

    Payload Length

    0

    4 + string length

    4

    4

    4

    12 + pixels / 2

    8

    0

    0

    4

    Playload (bytes, exept bitmap)

    string length

    Tag

    Type

    0

    4 (bits / pixel)

    0

    0

    Font

    width

    0

    Type

    Style

    height

    0

    Style

    Justify

    byte data

    Type

    Justify

    char data

    Color


    Payload Details



    Information Tag


    Tag Code


    Explanation

    0x00

    Track Name

    0x01

    Artist Name

    0x02

    Album Name

    0x03

    Album Name, with Year

    0x04

    Year

    0x05

    Bitrate

    0x06

    Current Playlist Name

    0x07

    CODEC

    0x08

    Duration



    Font Code


    Font Code


    Explanation

    0x00

    default (medium.bf)

    0x01

    small (small.bf)

    0x02

    icons (graphics.bf)

    0x03

    timecode (timecode.bf) (big, bold, monospace font)

    0x04

    large (large.bf)




    Style Code


    Style Code


    Explanation

    0x00

    Normal

    0x01

    Inverse

    0x02

    Background

    0x03

    Transparent



    Justify Code


    Alignment Code


    Explanation

    0x00

    Align left

    0x01

    Center text

    0x02

    Align right

    0x03

    n/a


    Other Field Details

    Value

    Time Type

    Rectangle Type

    Status Type

    Rectangle Color

    0x00

    Elapsed

    Solid Fill (using Color field)

    Mute

    White (pixels off)

    0x01

    Remaining

    Grey

    Repeat

    Black (pixels on)

    0x02

    Invert

    Random

    0x03

    Border Only (using Color field)





    Example - My "With Volume" Layout


    Here's an example, where I built a modified "all info" layout with an added
    volume level indicator. Remember, all values are double-word longs, that is,
    four bytes, so "0x02" is really "0x00000002". And, also, everything's stored in the file (and transmitted to the receiver)
    in little-endian format, that is, the least significant bytes first. So, "0x02" is transmitted as "02 00 00 00".



    Type


    Left


    Top


    Right


    Bottom


    Length


    Content


    Description

    0x02

    0x0c

    0x00

    0x80

    0x09

    0x04

    0x06000002

    Playlist Name

    0x02

    0x00

    0x09

    0x80

    0x34

    0x04

    0x00000000

    Track Name

    0x06

    0x00

    0x13

    0x80

    0x14

    0x08

    0x00 0x0f

    Horizontal Bar

    0x02

    0x00

    0x15

    0x80

    0x20

    0x04

    0x01000000

    Artist Name

    0x02

    0x00

    0x20

    0x80

    0x2a

    0x04

    0x03000000

    Album Name

    0x03

    0x3e

    0x2a

    0x80

    0x40

    0x04

    0x00030002

    Big Time Display

    0x07

    0x00

    0x33

    0x40

    0x40

    0x04

    0x00000000

    Volume Indicator

    0x09

    0x1f

    0x29

    0x3e

    0x31

    0x04

    0x00010000

    Repeat indicator

    0x09

    0x00

    0x2b

    0x1a

    0x31

    0x04

    0x00020000

    Shuffle indicator

    0x04

    0x00

    0x00

    0x0c

    0x08

    0x04

    0x00020000

    Play Status Icon




    And here's what it looks like: