
#ifndef __INTERFACE_BIFS_CODEC_H_
#define __INTERFACE_BIFS_CODEC_H_

#ifdef __cplusplus
extern "C" {
#endif

#include <gpac/m4_author.h>
#include <gpac/m4_bifs.h>
#include <gpac/m4_scenegraph.h>

/**
 * @calling_object is the calling object on which call back will be called
 * @inputContext is the name of a scene file (bt, xmt or mp4) to initialize the coding context
 * @extension for future extensions, NULL for now
 *
 * must be called only one time (by process calling the DLL) before other calls
 */
void* BENC_Init(void *calling_object, char *inputContext, void *extension);

/**
 * @codec, pointer to the structure returned by BENC_Init
 * @auFile, name of a file containing a description for an access unit (BT or XMT)
 * @AUCallback, pointer on a callback function to get the result of the coding the AU using the current context
 * @extension for future extensions, NULL for now
 *
 */
M4Err BENC_EncodeAUFromFile(void *codec, char *auFile, M4Err (*AUCallback)(void *, M4Sample *), void *extension);

/**
 * @codec, pointer to the structure returned by BENC_Init
 * @auString, a char string to encode (must one or several complete nodes in BT
 * @AUCallback, pointer on a callback function to get the result of the coding the AU using the current context
 * @extension for future extensions, NULL for now
 *
 */
M4Err BENC_EncodeAUFromString(void *codec, char *auString, M4Err (*AUCallback)(void *, M4Sample *), void *extension);

/**
 * @codec, pointer to the structure returned by BENC_Init
 * @ctxFileName, name of the file to save the current state of the BIFS scene to
 * @extension for future extensions, NULL for now
 *
 * save the current context of the codec.
 * if you want to save an aggregate context, use BENC_AggregateCurrentContext before
 *
 */
M4Err BENC_SaveCurrentContext(void *codec, char *ctxFileName, void *extension);

/**
 * @codec, pointer to the structure returned by BENC_Init
 * @extension for future extensions, NULL for now
 *
 * aggregates the current context of the codec, creates a scene replace
 *
 */
M4Err BENC_AggregateCurrentContext(void *codec, void *extension);

/**
 * @codec, pointer to the structure returned by BENC_Init to be terminated
 *
 * release the memory used by this codec, no more call on the codec should happen after this
 *
 */
M4Err BENC_Terminate(void *codec);



#ifdef __cplusplus
}
#endif // __cplusplus


#endif 

