[Ffmpeg-devel] [PATCH] dlopen libamrnb / libamrwb instead of linking

Michael Niedermayer michaelni
Thu Apr 19 21:11:05 CEST 2007


Hi

On Thu, Apr 19, 2007 at 04:20:10PM +0400, Pavlov Konstantin wrote:
> Hi guys.
> 
> The attached patch was made by led at altlinux.ru to allow ffmpeg dlopen
> libamrnb and libamrwb instead of linking to it.
> 
> I've tested that on amr-nb files on x86-32, works fine. It would be nice
> if someone could test it with wb as well as on x86-64.
[...]
>      /* make the correspondance between bitrate and mode */
> +#ifdef CONFIG_LIBAMRNBBIN
> +    AMR_bitrates rates[]={ {4750,0},
> +                           {5150,1},
> +                           {5900,2},
> +                           {6700,3},
> +                           {7400,4},
> +                           {7950,5},
> +                           {10200,6},
> +                           {12200,7},
> +#else
>      AMR_bitrates rates[]={ {4750,MR475},
>                             {5150,MR515},
>                             {5900,MR59},
> @@ -105,6 +135,7 @@ static int getBitrateMode(int bitrate)
>                             {7950,MR795},
>                             {10200,MR102},
>                             {12200,MR122},
> +#endif

this is wrong, unneeded and code duplication


[...]
> @@ -569,9 +681,32 @@ typedef struct AMRWBContext {
>      int frameCount;
>      void *state;
>      int mode;
> +#ifdef CONFIG_LIBAMRWBBIN
> +    void* handle;
> +    void* (*amrwb_init)(void);
> +    union {
> +	void (*amrwb_decode)(void *st, uint8_t *bits, int16_t *synth, int32_t bfi);
> +	int (*amrwb_encode)(void *st, int16_t mode, int16_t *speech, uint8_t *serial, int16_t dtx);
> +    };

tabs are forbidden in svn


> +    void (*amrwb_exit)(void *state);
> +#if 0
> +    uint8_t (*amrwb_block_size)(int index);
> +#else
> +    uint8_t *amrwb_block_size;
> +#endif

#if 0 code is unacceptable


> +    int16_t allow_dtx;
> +#else
>      Word16 allow_dtx;
> +#endif

this is unacceptable

summary, i really like to have dlopen support for amr* as that allows binary
packages of ffmpeg to have amr support without strictly depending on libamr
to be installed on the end users system
but
1. it can be expected that the package maintainer building the binary
has libamr
2. the whole code is a mess this can be done much cleaner,that is with
a fraction of the #ifdef hell ...

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The greatest way to live with honor in this world is to be what we pretend
to be. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070419/80425c31/attachment.pgp>



More information about the ffmpeg-devel mailing list