|
Rockbox mail archiveSubject: MPEG thread global struct interface defnMPEG thread global struct interface defn
From: Lion Templin <ltemplin_at_leonine.com>
Date: Fri, 31 May 2002 22:16:52 -0500 (CDT) As discussed on IRC, here is a working defn of a struct for the MPEG thread to report its status to the outside world. This is useful to allow such threads as apps/play.c to know what the MPEG thread is doing and respond accordingly. It also has a section for c&c functions, but this may be better suited by using the undocumented(!) IPC style sematics. /* mpeg_api.h MPEG thread API Rockbox Lion J Templin 20020531 This is a struct for use with communications with the MPEG thread for control purposes. It is designed to be deployed as a global var, accessable by all threads as well as the MPEG thread (of course). Threads may access all variables, though should be coded to write to only the ones designated as FOREIGN. The MPEG thread should only write variables labelled DOMESTIC. */ #define MPEG_CMD_NOOP 0 #define MPEG_CMD_PLAY 1 #define MPEG_CMD_STOP 2 #define MPEG_CMD_FFW 3 #define MPEG_CMD_REW 4 #define MPEG_CMD_KILL 5 #define MPEG_STATUS_EMPTY 0 #define MPEG_STATUS_STOP 1 #define MPEG_STATUS_PLAY 2 #define MPEG_STATUS_ERR 3 struct mpegapi { unsigned int cmd; /* FOREIGN - Deliver Command to MPEG thread policy UNIQUE INT MPEG_CMD_NOOP - no command (no effect) MPEG_CMD_PLAY - PLAY CURRENT STREAM FROM CURRENT POS (if no stream, set MPEG_STATUS_EMPTY, else (re)start play and set MPEG_STATUS_PLAY) MPEG_CMD_STOP - STOP PLAY (do not unload stream or reset vars, set MPEG_STATUS_STOP) MPEG_CMD_FFW - JUMP STREAM FORWARD n DISTANCE MPEG_CMD_REW - JUMP STREAM BACKWARD n DISTANCE (if MPEG_STATUS_PLAY jump only n, cmd will still be set to MPEG_CMD_{FFW,REV} if more jumps are required, other thread will set MPEG_CMD_PLAY when jumps need to stop) (if MPEG_STATUS_STOP, jump filepos without playing) (if MPEG_STATUS_EMPTY, do nothing) MPEG_CMD_KILL - KILL THE MPEG THREAD (reset all vars, empty MPEG buffer, set MPEG_STATUS_EMPTY) */ int status; /* DOMESTIC - Status of the MPEG thread policy UNIQUE INT MPEG_STATUS_EMPTY - no stream loaded MPEG_STATUS_STOP - stream loaded, not playing MPEG_STATUS_PLAY - stream loaded, playing MPEG_STATUS_ERR - problem with thread any number >= 32 is an error code, the lower status bits should be set to MPEG_STAUS_ERR eg: status = MPEG_STATUS_ERR + MPEG_ERROR_FOO; where MPEG_ERROR_FOO >= 16 */ int filelen; /* DOMESTIC - File length of the currently loaded stream 0 if no stream loaded */ int filepos; /* DOMESTIC - Current file position -1 if no stream loaded */ char* filename; /* DOMESTIC - Currently loaded filename Should be full path, NULL temrinated standard string, NULL if no file loaded. */ unsigned int mpeg_bitrate; /* DOMESTIC - Currently loaded MPEG bitrate 0 if no file */ unsigned int mpeg_type; /* DOMESTIC - Describes Currently loaded MPEG policy BITMASK Bit Off/On 0 single bitrate / VBR 1 stereo / mono 2 joint stereo / discrete stereo 3 OK / error 0 if no file (though not indicative of no file) */ } = lion is Lion J Templin (KB9ENE) lion_at_leonine.com = = || // ||> UNIX Systems Consulting for the = = ||=EONINE \OMPUTATIONAL ||\ESOURCES Northland FROM the Northland = = UNIX Systems Consultants http://www.leonine.com = Received on 2002-06-01 Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy |