Here is my new generic decoder API:
Code:
extern int decoder_open(void (*Alloc)(int, int),
void (*FrameComplete)(void),
void (*Error)(char *, int),
int (*Info)(const char* fmt, ...),
unsigned char **frame_store);
extern int decoder_close(void);
extern int decoder_flush(void);
extern int decoder_reset(void);
extern int decoder_decode_nalu(unsigned char *buf, int len);
extern int decoder_set_mode(int);
The decoder_open() call passes a pointer to the YV12 store for the decoded picture and pointers to callbacks as follows:
Alloc: called when a video sequence is seen to allow the app to allocate memory, also provides the frame size
FrameComplete: called when the app should receive a picture for display/serving
Error: called for a fatal error
Info: called for an info popup
The decoder_set_mode() call puts the decoder into a stepping or playing mode.