% $Id$ %
\newcommand{\includeicon}{\Ifpdfoutput{\includegraphics[width=0.37cm]}{\includegraphics}}
\chapter{File formats}
\section{\label{ref:Supportedfileformats}Supported file formats}
\begin{rbtabular}{\textwidth}{cl>{\raggedright}p{7em}X}%
{\textbf{Icon} & \textbf{File Type} & \textbf{Extension}
  & \textbf{Action when selected}}{}{}
\includeicon{appendix/images/icon-directory.png}
  & Directory & \emph{none} & Enter the directory \tabularnewline
  \includeicon{appendix/images/icon-audio-file.png}
  & Audio file & \emph{various}\newline%
  (see \ref{ref:Supportedaudioformats})%
  % do NOT use \reference{} here as that will break the table.
  & Start playing the file and show the WPS\tabularnewline
  & Bookmark & \fname{.bmark} & Display all bookmarks for an audio file\tabularnewline
  & Game of Life & \fname{.cells} & Show the configuration with the
     ``Rocklife'' plugin\tabularnewline
\includeicon{appendix/images/icon-config.png}
  & Configuration File & \fname{.cfg} & Load the settings file\tabularnewline
\includeicon{appendix/images/icon-chip8.png}
  & Chip8 game & \fname{.ch8} & Play the Chip8 game \tabularnewline
\opt{lcd_color}{
  & Colours & \fname{.colours} & Open the colours file for editing.
    See \reference{ref:ChangingFiletypeColours}.\tabularnewline
}
\includeicon{appendix/images/icon-cuesheet.png}
  & Cuesheet & \fname{.cue} & View the cuesheet file \tabularnewline
\opt{radio}{
  & FM Presets & \fname{.fmr} & Load the FM Presets (previous are discarded)\tabularnewline
}
\includeicon{appendix/images/icon-font.png}
  & Font & \fname{.fnt} & Change the user interface font to this one\tabularnewline
\opt{gigabeat}{
  \includeicon{appendix/images/icon-rolo.png}
  & Rockbox firmware & \fname{.gigabeat} & Load the new firmware with ROLO \tabularnewline
}
\opt{iaudio}{
  \includeicon{appendix/images/icon-rolo.png}
  & Rockbox firmware & \fname{.iaudio} & Load the new firmware with ROLO \tabularnewline
}
\opt{ipod}{
  \includeicon{appendix/images/icon-rolo.png}
  & Rockbox firmware & \fname{.ipod} & Load the new firmware with ROLO \tabularnewline
}
\opt{iriverh100,iriverh300}{
  \includeicon{appendix/images/icon-rolo.png}
  & Rockbox firmware & \fname{.iriver} & Load the new firmware with ROLO \tabularnewline
}
\includeicon{appendix/images/icon-image-file.png}
  & Image & \fname{.jpg} & View the JPEG image \tabularnewline
  & Link & \fname{.link} & Display list of target files and directories;
    selecting one jumps to the target. See \reference{ref:Shortcutsplugin}.\tabularnewline
\includeicon{appendix/images/icon-lang.png}
  & Language File & \fname{.lng} & Load the language file \tabularnewline
\includeicon{appendix/images/icon-playlist.png}
  & Playlist & \fname{.m3u}, \fname{.m3u8} & Load the playlist and start playing
    the first file \tabularnewline
\opt{iriverh10,iriverh10_5gb,sansa,mrobe100,vibe500,samsungyh}{
  \includeicon{appendix/images/icon-rolo.png}
  & Rockbox firmware & \fname{.mi4} & Load the new firmware with ROLO \tabularnewline
}
 \includeicon{appendix/images/icon-movie-file.png}
 & Video & \fname{.mpg}, \fname{.mpeg}, \fname{.mpv}, \fname{.m2v} & Play the MPEG1/2 video \tabularnewline
\includeicon{appendix/images/icon-rock.png}
  & Plugin & \fname{.rock} & Start the plugin\tabularnewline
\opt{sansaAMS}{
  \includeicon{appendix/images/icon-rolo.png}
  & Rockbox firmware & \fname{.sansa} & Load the new firmware with ROLO \tabularnewline
}
\includeicon{appendix/images/icon-text.png}
  & Text File & \fname{.txt} & Display the text file using the text viewer plugin\tabularnewline
  & Voice file & \fname{.voice} & Allow Rockbox to speak menus\tabularnewline
\includeicon{appendix/images/icon-wps.png}
  & While Playing Screen & \fname{.wps} & Load the new WPS display configuration\tabularnewline
\end{rbtabular}

  \chapter{Audio and metadata formats}
  \section{\label{ref:Supportedaudioformats}Supported audio formats}
  \subsection{Lossy Codecs}
  \begin{rbtabular}{\textwidth}{l>{\raggedright}p{6em}X}%
  {\textbf{Format} & \textbf{Extension} & \textbf{Notes}}{}{}
    ATSC A/52 (AC3)
        & \fname{.a52}, \fname{.ac3}, \fname{.rm}, \fname{.ra}, \fname{.rmvb}
        & Supports downmixing for playback of 5.1 streams in stereo\\
    ADX
        & \fname{.adx}
        & Encrypted ADX is not supported.\\
    Advanced Audio Coding
        & \fname{.aac}, \fname{.m4a}, \fname{.m4b}, \fname{.mp4}, \fname{.rm}, \fname{.ra}, \fname{.rmvb}
        \opt{codec_aac_he}{
            & Supports AAC-LC, -HEv1, and -HEv2 profiles\\}
        \nopt{codec_aac_he}{ % low memory (CODEC_SIZE <= 512 KB) or slow cpu targets 
            & Supports AAC-LC profile\\}
    MPEG audio
        & \fname{.mpa}, \fname{.mpga}, \fname{.mp1}, \fname{.mp2}, \fname{.mp3}
        & MPEG 1/2/2.5 Layer 1/2/3\\
    Musepack
        & \fname{.mpc}
        & Supports SV7 and SV8 in mono/stereo \\
    OGG/Vorbis
        & \fname{.ogg}, \fname{.oga}
        & Playback of some old ``floor 0'' files may fail on low memory targets.
          Files with album art larger than available RAM will be skipped.
          Chained Ogg files are not supported.\\
    Sony Audio
        & \fname{.oma}, \fname{.aa3}, \fname{.rm}, \fname{.ra}, \fname{.rmvb}
        & Supports ATRAC3\\
    RealAudio
        & \fname{.rm}, \fname{.ra}, \fname{.rmvb}
        & Supports RealAudio G2 (Cook)\\
    Speex
        & \fname{.spx}
        & \\
    Dialogic telephony type
        & \fname{.vox}
        & \\
    Windows Media Audio Standard
        & \fname{.wma}, \fname{.wmv}, \fname{.asf}
        & \\
    Windows Media Audio Professional
        & \fname{.wma}, \fname{.wmv}, \fname{.asf}
        & \\
  \end{rbtabular}

  \note{AAC-HE profiles \opt{codec_aac_he}{might not play in realtime on all devices}\nopt{codec_aac_he}{are disabled on this device} due to CPU
  performance requirements.}

  \subsection{Lossless Codecs}
  \begin{rbtabular}{\textwidth}{lp{6em}X}%
  {\textbf{Format} & \textbf{Extension} & \textbf{Notes}}{}{}
    Audio Interchange File Format
        & \fname{.aif}, \fname{.aiff}
        & Linear PCM 8/16/24/32 bit, IEEE float 32/64 bit, ITU-T G.711 a-law/$\mu$-law,
          QuickTime IMA ADPCM\\
    Monkey's Audio
        & \fname{.ape}, \fname{.mac}
        &
        \opt{gigabeatf,iriverh100,iriverh300,iaudiox5,iaudiom5,iaudiom3,ipodnano2g,clipv1}{
            -c1000 to -c3000 files decode fast enough to be useful.}
        \opt{gigabeats}{}
        \opt{ipod,iriverh10,iriverh10_5gb,mrobe100,sansa,vibe500,samsungyh}{
            \nopt{ipodnano2g}{Only -c1000 files decode fast enough to be useful.}}
            \\
    Sun Audio
        & \fname{.au}, \fname{.snd}
        & Linear PCM 8/16/24/32 bit, IEEE float 32/64 bit, ITU-T G.711 a-law/$\mu$-law\\
    Free Lossless Audio
        & \fname{.flac}
        & Supports multichannel playback including downmixing to stereo.\\
    Apple Lossless
        & \fname{.m4a}, \fname{.mp4}
        & \\
    Shorten
        & \fname{.shn}
        & Seeking not supported.\\
    True Audio
        & \fname{.tta}
        & \\
    Wave64
        & \fname{.w64}
        & Supports same formats as Waveform audio format.\\
    Waveform audio format
        & \fname{.wav}
        & Linear PCM 8/16/24/32 bit, IEEE float 32/64 bit, ITU-T G.711 a-law/$\mu$-law,
          Microsoft ADPCM, Intel DVI ADPCM (IMA ADPCM) 2/3/4/5 bit, Dialogic OKI ADPCM,
          YAMAHA ADPCM, Adobe SWF ADPCM\\
    Wavpack
        & \fname{.wv}
        & \\
  \end{rbtabular}

  \note{Free Lossless Audio multichannel tracks may not play in realtime on all devices due to CPU
  performance requirements.}

  \subsection{Other Codecs}
  \begin{rbtabular}{\textwidth}{l>{\raggedright}p{6em}X}%
  {\textbf{Format} & \textbf{Extension} & \textbf{Notes}}{}{}
    Atari Sound Format
        & \fname{.cmc}, \fname{.cm3}, \fname{.cmr}, \fname{.cms}, \fname{.dmc},
          \fname{.dlt}, \fname{.mpt}, \fname{.mpd}
        & \\
    Synthetic music Mobile Application Format
        & \fname{.mmf}
        & PCM/ADPCM only \\
    Game Boy Sound Format
        & \fname{.gbs}
        & Progress bar and seek use subtracks instead of seconds.\\
    AY Sound Chip Music
        & \fname{.ay}
        & Progress bar and seek use subtracks instead of seconds for
          multitrack files.\\
    Hudson Entertainment System Sound Format
        & \fname{.hes}
        & Progress bar and seek use subtracks instead of seconds.\\
    \nopt{clipv1,c200v2}{
    MSX Konami Sound System
        & \fname{.kss}
        & Progress bar and seek use subtracks instead of seconds.\\}
    SMS/GG/CV Sound Format
        & \fname{.sgc}
        & Supports Sega Master System and Game Gear Sound Format.
          Progress bar and seek use subtracks instead of seconds.\\
    Video Game Music Format
        & \fname{.vgm}
        & \\
    Gzipped Video Game Music Format
        & \fname{.vgz}
        & \\
    MOD
        & \fname{.mod}
        & \\
    NES Sound Format
        & \fname{.nsf}, \fname{.nsfe}
        & Progress bar and seek use subtracks instead of seconds.\\
    Atari SAP
        & \fname{.sap}
        & \\
    \nopt{clipv1,c200v2}{
    Sound Interface Device
        & \fname{.sid}
        & Progress bar and seek use subtracks instead of seconds.\\}
    SPC700
        & \fname{.spc}
        & \\
  \end{rbtabular}

  \note{NSF, VGM, and SID might not play in realtime on all devices due to CPU
  performance requirements.}

  \subsection{Codec featureset}
  \begin{rbtabular}{.95\textwidth}{lXXX}%
  {\textbf{Format} & \textbf{Seek} & \textbf{Resume} & \textbf{Gapless}}{}{}
    ATSC A/52 (AC3)                             & x & x &   \\
    ADX                                         & x &   &   \\
    Advanced Audio Coding                       & x & x & x \\
    MPEG audio                                  & x & x & x \\
    Musepack                                    & x & x & x \\
    OGG/Vorbis                                  & x & x & x \\
    Sony Audio                                  & x & x &   \\
    RealAudio                                   & x & x &   \\
    Dialogic telephony type                     & x & x &   \\
    Windows Media Audio Standard                & x & x &   \\
    Windows Media Audio Professional            & x & x &   \\
    Audio Interchange File Format               & x & x & x \\
    Monkey's Audio                              & x & x & x \\
    Sun Audio                                   & x & x & x \\
    Free Lossless Audio                         & x & x & x \\
    Apple Lossless                              & x & x & x \\
    Shorten                                     &   &   & x \\
    True Audio                                  & x & x & x \\
    Wave64                                      & x & x & x \\
    Waveform audio format                       & x & x & x \\
    Wavpack                                     & x & x & x \\
    Atari Sound Format                          & x &   &   \\
    Synthetic music Mobile Application Format   & x & x &   \\
    Game Boy Sound Format                       & x &   &   \\
    AY Sound Chip Music                         & x &   &   \\
    Hudson Entertainment System Sound Format    & x &   &   \\
    MSX Konami Sound System                     & x &   &   \\
    SMS/GG/CV Sound Format                      & x &   &   \\
    Video Game Music Format                     & x & x &   \\
    Gzipped Video Game Music Format             & x & x &   \\
    MOD                                         & x &   &   \\
    NES Sound Format                            & x &   &   \\
    Atari SAP                                   & x &   &   \\
    Sound Interface Device                      & x &   &   \\
    SPC700                                      & x &   &   \\
  \end{rbtabular}

  \note{The seek implementations of NES Sound Format, Sound Interface Device,
  Game Boy Sound Format, AY Sound Chip Music, Hudson Entertainment System Sound,
  Format, MSX Konami Sound System and SMS/GG/CV Sound Format use subtracks
  instead of seconds, whereas each subtrack equals a second.}

  \section{\label{ref:SupportedMetadata}Supported metadata tags}
    Rockbox supports different metadata formats. In general those tag formats
    are ID3 (v1.0, v1.1, v2.2, v2.3 and v2.4), APE (v1 and v2), Vorbis, MP4 and
    ASF. Few codecs use codec specific tags, several codecs do not use any tags
    yet. The following table gives an overview about what tag types rockbox
    supports for which audio file extension.

    \note{There is always only \emph{one} tag type supported for each file
    extension.}

    \begin{rbtabular}{\textwidth}{lX}%
    {\textbf{Tag type} & \textbf{File extension}}{}{}
      ID3               & \fname{.mp1}, \fname{.mpa}, \fname{.mp2}, \fname{.mp3},
                          \fname{.rm}, \fname{.ra}, \fname{.rmvb}, \fname{.tta} \\
      APE               & \fname{.mpc}, \fname{.ape}, \fname{.mac}, \fname{.wv} \\
      Vorbis            & \fname{.ogg}, \fname{.oga}, \fname{.spx}, \fname{.flac} \\
      MP4               & \fname{.m4a}, \fname{.m4b}, \fname{.mp4} \\
      ASF               & \fname{.wma}, \fname{.wmv}, \fname{.asf} \\
      Codec specific    & \fname{.mmf}, \fname{.mod}, \fname{.nsf}, \fname{.nsfe},
                          \fname{.sap}, \fname{.sid}, \fname{.spc}, \fname{.gbs},
                          \fname{.ay}, \fname{.kss}, \fname{.sgc}, \fname{.vgm} \\
      None              & \fname{.a52}, \fname{.ac3}, \fname{.adx}, \fname{.oma},
                          \fname{.aa3}, \fname{.aif}, \fname{.aiff}, \fname{.au},
                          \fname{.snd}, \fname{.shn}, \fname{.vox}, \fname{.w64},
                          \fname{.wav}, \fname{.cmc}, \fname{.cm3}, \fname{.cmr},
                          \fname{.cms}, \fname{.dmc}, \fname{.dlt}, \fname{.mpt},
                          \fname{.mpd}, \fname{.hes}, \fname{.vgz} \\
    \end{rbtabular}

    \subsection{Featureset for generic metadata tags}
    \label{ref:featureset_for_generic_metadata_tags}
    \begin{rbtabular}{0.90\textwidth}{lXXXXX}%
    {\textbf{Feature} & \textbf{ID3} & \textbf{APE} & \textbf{Vorbis} &
     \textbf{MP4} & \textbf{ASF}}{}{}
     Embedded albumart \fname{.bmp}     &   & x &   &   &   \\
     Embedded albumart \fname{.jpg}     & x & x &   & x & x \\
     Embedded albumart \fname{.png}     &   & x &   &   &   \\
     Embedded cuesheet                  & x & x & x &   &   \\
     Replaygain information             & x & x & x & x & x \\
     Title (string)                     & x & x & x & x & x \\
     Artist (string)                    & x & x & x & x & x \\
     Album (string)                     & x & x & x & x & x \\
     Genre (string)                     & x & x & x & x & x \\
     Disc (string or number)            & x & x & x & x &   \\
     Track (string or number)           & x & x & x & x & x \\
     Year (string or number)            & x & x & x & x & x \\
     Composer (string)                  &   & x & x & x & x \\
     Comment (string)                   & x & x & x & x & x \\
     Albumartist (string)               & x & x & x & x & x \\
     Grouping (string)                  &   & x & x & x &   \\
    \end{rbtabular}

    \note{Embedded album art for ASF is limited to pictures of maximum 64 KB size.}

    \subsection{Featureset for codec specific metadata}
    \begin{rbtabular}{\textwidth}{lX}%
    {\textbf{Feature} & \textbf{Codec specific metadata (file extension)}}{}{}
     Embedded \fname{.bmp}  & None \\
     Embedded \fname{.jpg}  & None \\
     Embedded \fname{.png}  & None \\
     Replaygain             & \fname{.mpc}\\
     Title                  & \fname{.tta}, \fname{.spc}, \fname{.mmf}, \fname{.sid},
                              \fname{.rm}, \fname{.ra}, \fname{.rmvb}, \fname{.nsf},
                              \fname{.nsfe}, \fname{.mod}, \fname{.sap}, \fname{.gbs},
                              \fname{.ay}, \fname{.sgc}, \fname{.vgm} \\
     Artist                 & \fname{.tta}, \fname{.spc}, \fname{.mmf}, \fname{.sid},
                              \fname{.rm}, \fname{.ra}, \fname{.rmvb}, \fname{.nsf},
                              \fname{.nsfe}, \fname{.sap}, \fname{.gbs}, \fname{.ay},
                              \fname{.sgc}, \fname{.vgm} \\
     Album                  & \fname{.spc}, \fname{.sid}, \fname{.nsf}, \fname{.nsfe},
                              \fname{.gbs}, \fname{.ay}, \fname{.sgc}, \fname{.vgm} \\
     Genre                  & \fname{.tta}, \fname{.spc}, \fname{.sap} \\
     Disc                   & \fname{.tta} \\
     Track                  & \fname{.tta} \\
     Year                   & \fname{.spc}, \fname{.sid}, \fname{.sap} \\
     Composer               & \fname{.mmf} \\
     Comment                & \fname{.spc}, \fname{.rm}, \fname{.ra}, \fname{.rmvb},
                              \fname{.vgm} \\
     Albumartist            & None \\
     Grouping               & None \\
    \end{rbtabular}

    \subsection{Limitations of metadata handling}
    \begin{enumerate}
        \item Multiple tags (e.g. for Genre) are not supported. The first tag
              item of a set of multiple tags is used.
        \item Only one tag type is supported for each audio format.
    \nopt{lowmem,himem}{
        \item Overall there are 900 bytes available to load metadata strings.
        \item The maximum size of each metadata item (e.g. Artists) is limited
              to 240 bytes.
    }
    \opt{himem}{
        \item Overall there are 1800 bytes available to load metadata strings.
        \item The maximum size of each metadata item (e.g. Artists) is limited
              to 500 bytes.
    }
    \opt{lowmem}{
        \item Overall there are 300 bytes available to load metadata strings.
        \item The maximum size of each metadata item (e.g. Artists) is limited
              to 90 bytes.
    }
    \end{enumerate}
