#1294 closed enhancement (fixed)
New pjmedia_codec_register_audio_codecs() API
Reported by: | bennylp | Owned by: | nanang |
---|---|---|---|
Priority: | normal | Milestone: | release-2.0-alpha |
Component: | pjmedia | Version: | 2.0-dev-branch |
Keywords: | Cc: | ||
Backport to 1.x milestone: | Backported: |
Description (last modified by bennylp)
New API to register all known codecs that are implemented in PJMEDIA-CODEC, and to automatically deregister them on shutdown:
/* file <pjmedia-codec/audio_codecs.h> */ /** * Codec configuration. Call #pjmedia_audio_codec_config_default() to initialize * this structure with the default values. */ typedef struct pjmedia_audio_codec_config { /** Speex codec settings. See #pjmedia_codec_speex_init() for more info */ struct { unsigned option; /**< Bitmask of options. */ unsigned quality; /**< Codec quality. */ unsigned complexity; /**< Codec complexity. */ } speex; /** iLBC settings */ struct { unsigned mode; /**< iLBC mode. */ } ilbc; /** Passthrough */ struct { pjmedia_codec_passthrough_setting setting; /**< Passthrough */ } passthrough; } pjmedia_audio_codec_config; /** * Initialize pjmedia_audio_codec_config structure with default values. * * @param cfg The codec config to be initialized. */ PJ_DECL(void) pjmedia_audio_codec_config_default(pjmedia_audio_codec_config *cfg); /** * Register all known audio codecs implemented in PJMEDA-CODEC library to the * specified media endpoint. * * @param endpt The media endpoint. * @param c Optional codec configuration, or NULL to use default * values. * * @return PJ_SUCCESS on success or the appropriate error code. */ PJ_DECL(pj_status_t) pjmedia_codec_register_audio_codecs(pjmedia_endpt *endpt, const pjmedia_audio_codec_config *c);
Note to codec writers:
A new mandatory destroy callback has been added to factory operation. You must implement this callback (hint: just point it to your existing function that deinitialize your codec factory).
Note to app writers:
You don't need to initialize each codec now, just use pjmedia_codec_register_audio_codecs() above. Similarly you should remove all the calls to codec deinitialization routines since that will be done automatically when the media endpoint is destroyed (leaving these calls as they are is harmless though; they will render to no-ops).
Change History (4)
comment:1 Changed 13 years ago by bennylp
- Description modified (diff)
comment:2 Changed 13 years ago by bennylp
- Description modified (diff)
- Summary changed from New pjmedia_codec_register_all() API and deregister automatically on shutdown to New pjmedia_codec_register_audio_codecs() API
comment:3 Changed 13 years ago by bennylp
- Resolution set to fixed
- Status changed from new to closed
(In [3661]) Fixed #1294: New pjmedia_codec_register_audio_codecs() API to register all known codecs, and also added implementation to deregister all codecs when the media endpoint is destroyed