[vlc-devel] [PATCH] New mpg123 audio converter
Rafaël Carré
funman at videolan.org
Tue Sep 3 14:40:41 CEST 2013
Le 03/09/2013 14:12, Ludovic Fauvet a écrit :
> On 09/03/2013 01:59 PM, Rafaël Carré wrote:
>>> +static unsigned int mpg123_refcount = 0;
>>> +static vlc_mutex_t mpg123_mutex = VLC_STATIC_MUTEX;
>>
>> Depending on what mpg123_{init,exit} are doing you could also use gcc
>> constructor/destructor function attributes so those functions are called
>> exactly once when the .so are loaded / unloaded.
>>
>> This simplifies the code, and the drawback is those functions are called
>> even if we don't use the module.
>
> I have no strong preference here. You tell me.
Let's keep refcounting then.
BTW mpg123_init does initialize a bunch of decoder tables, and detects
the CPU features, while the full mpg123_exit (in 1.14.4) is:
void attribute_align_arg mpg123_exit(void)
{
/* nothing yet, but something later perhaps */
}
So with this version we do not need refcounting, calling mpg123_init()
just once would be enough... until "later perhaps"
>>> +
>>> + /* Ignore the last 8 bytes due to a hack for libmad */
>>> + /* FIXME: This hack should be removed somehow --etix */
>>> + if ( p_in_buf->i_buffer < 8 )
>>> + return;
>>
>> Can you explain a bit more here? Is it still related to libmad?
>
> Yes, libmad requires the first bytes of the next frame to function properly.
>
> See modules/codec/mpeg_audio.c around line 454.
/* mpga packetizer appends 8 bytes of the next frame to make mad decoder
happy */ ?
> Thanks Rafaël.
No problem :)
More information about the vlc-devel
mailing list