mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 02:27:39 -04:00
plugins: Simplify plugin/codec API versioning
Replace the minimum version bound with a check on the size of the API struct. The version only needs to be incremented for ABI breaking changes. Additions to the API won't need to touch the version number, resulting in fewer merge conflicts. Change-Id: I916a04a7bf5890dcf5d615ce30087643165f8e1f
This commit is contained in:
parent
2fb2364686
commit
d40a598970
7 changed files with 49 additions and 37 deletions
|
@ -71,13 +71,12 @@
|
|||
/* magic for encoder codecs */
|
||||
#define CODEC_ENC_MAGIC 0x52454E43 /* RENC */
|
||||
|
||||
/* increase this every time the api struct changes */
|
||||
#define CODEC_API_VERSION 49
|
||||
|
||||
/* update this to latest version if a change to the api struct breaks
|
||||
backwards compatibility (and please take the opportunity to sort in any
|
||||
new function which are "waiting" at the end of the function table) */
|
||||
#define CODEC_MIN_API_VERSION 49
|
||||
/*
|
||||
* Increment this whenever a change breaks the codec ABI,
|
||||
* when this happens please take the opportunity to sort in
|
||||
* any new functions "waiting" at the end of the list.
|
||||
*/
|
||||
#define CODEC_API_VERSION 50
|
||||
|
||||
/* reasons for calling codec main entrypoint */
|
||||
enum codec_entry_call_reason {
|
||||
|
@ -228,6 +227,7 @@ struct codec_header {
|
|||
enum codec_status(*entry_point)(enum codec_entry_call_reason reason);
|
||||
enum codec_status(*run_proc)(void);
|
||||
struct codec_api **api;
|
||||
size_t api_size;
|
||||
void * rec_extension[]; /* extension for encoders */
|
||||
};
|
||||
|
||||
|
@ -241,15 +241,16 @@ extern unsigned char plugin_end_addr[];
|
|||
const struct codec_header __header \
|
||||
__attribute__ ((section (".header")))= { \
|
||||
{ CODEC_MAGIC, TARGET_ID, CODEC_API_VERSION, \
|
||||
plugin_start_addr, plugin_end_addr }, codec_start, \
|
||||
codec_run, &ci };
|
||||
plugin_start_addr, plugin_end_addr }, \
|
||||
codec_start, codec_run, &ci, sizeof(struct codec_api) };
|
||||
/* encoders */
|
||||
#define CODEC_ENC_HEADER \
|
||||
const struct codec_header __header \
|
||||
__attribute__ ((section (".header")))= { \
|
||||
{ CODEC_ENC_MAGIC, TARGET_ID, CODEC_API_VERSION, \
|
||||
plugin_start_addr, plugin_end_addr }, codec_start, \
|
||||
codec_run, &ci, { enc_callback } };
|
||||
plugin_start_addr, plugin_end_addr }, \
|
||||
codec_start, codec_run, &ci, sizeof(struct codec_api), \
|
||||
{ enc_callback } };
|
||||
|
||||
#else /* def SIMULATOR */
|
||||
/* decoders */
|
||||
|
@ -257,13 +258,14 @@ extern unsigned char plugin_end_addr[];
|
|||
const struct codec_header __header \
|
||||
__attribute__((visibility("default"))) = { \
|
||||
{ CODEC_MAGIC, TARGET_ID, CODEC_API_VERSION, NULL, NULL }, \
|
||||
codec_start, codec_run, &ci };
|
||||
codec_start, codec_run, &ci, sizeof(struct codec_api) };
|
||||
/* encoders */
|
||||
#define CODEC_ENC_HEADER \
|
||||
const struct codec_header __header \
|
||||
__attribute__((visibility("default"))) = { \
|
||||
{ CODEC_ENC_MAGIC, TARGET_ID, CODEC_API_VERSION, NULL, NULL }, \
|
||||
codec_start, codec_run, &ci, { enc_callback } };
|
||||
codec_start, codec_run, &ci, sizeof(struct codec_api), \
|
||||
{ enc_callback } };
|
||||
#endif /* SIMULATOR */
|
||||
#endif /* CODEC */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue