[Ffmpeg-devel] [PATCH] Re: AMR bitrate
Martin
marthi
Mon Nov 20 18:20:23 CET 2006
Hi,
Michael Niedermayer wrote:
> Hi
>
> On Mon, Nov 20, 2006 at 03:35:55PM +0100, Martin wrote:
>
>>Hi,
>>
>>Martin wrote:
>>
>>>Hi,
>>>
>>>Benjamin Larsson wrote:
>>>
>>>
>>>>Martin skrev:
>>>>
>>>>
>>>>
>>>>>Hi,
>>>>>
>>>>>gravsten at yahoo.com wrote:
>>>>>
>>>>>
>>>>>
>>>>>>>>I have a question regarding encoding and decoding of AMR using
>>>>>>>>ffmpeg. To me it seems that the bitrate mode is fixed after
>>>>>>>>avcodec_open(). Is that correct (the bitrate mode cannot be changed
>>>>>>>>on the fly)?
>>>>>>>
>>>>>>>No the bitrate can't be changed on the fly and user questions
>>>>>>>to the user list.
>>>>>>
>>>>>>
>>>>>>Actually, the standard let one negotiation a set of AMR bit rates
>>>>>>beforehand,
>>>>>>and the transmitter may arbitrarily change bitrate within the agreed
>>>>>>set on an
>>>>>>AMR frame boundary (20ms).
>>>>>>
>>>>>>I am unsure whether ffmpeg let you change the bitrate on-the-fly
>>>>>>(i.e. without
>>>>>>close/open codec), but if not, you should be able to fix this by
>>>>>>merely making
>>>>>>the AMR codec access a bitrate value in the avctx structure directly
>>>>>>(ffmpeg
>>>>>>only serves as a proxy to an external AMR library originally from the
>>>>>>ITU).
>>>>>
>>>>>
>>>>>thanks for clarifying that!
>>>>>I tested it and it worked. Would you accept a patch for that? There
>>>>>shouldn't be a downside in directly accessing the avctx structure, right?
>>>>>
>>>>>Martin
>>>>
>>>>
>>>>Send the patch for review.
>>>
>>I attached a patch for amr bitrate mode which can now be changed "on the
>>fly" through avctx->bitrate. Is the attached patch ok? I have sent it a
>>week ago but I have no reply whether it is ok and will be applied.
>>
>>Martin
>
>
>>--- amr.c_bak 2006-11-13 10:44:29.954294020 +0100
>>+++ amr.c 2006-11-13 10:44:34.345708296 +0100
>>@@ -482,6 +482,8 @@ static int amr_nb_encode_frame(AVCodecCo
>> AMRContext *s = (AMRContext*)avctx->priv_data;
>> int written;
>>
>>+ s->enc_bitrate=getBitrateMode(avctx->bit_rate);
>>+
>> written = Encoder_Interface_Encode(s->enstate,
>> s->enc_bitrate,
>> data,
>>@@ -624,6 +626,7 @@ static int amr_wb_encode_frame(AVCodecCo
>> unsigned char *frame/*out*/, int buf_size, void *data/*in*/)
>> {
>> AMRWBContext *s = (AMRWBContext*) avctx->priv_data;
>>+ s->mode=getWBBitrateMode(avctx->bit_rate);
>> int size = E_IF_encode(s->state, s->mode, data, frame, s->allow_dtx);
>
>
> mixes declaration and code -> breaks ISO C90
>
> besides this iam fine with the patch
>
> [...]
thanks for the reply. I changed that in the attached patch.
Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ffmpeg-6883-patch-amr_bitrate_mode.diff
Type: text/x-patch
Size: 819 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20061120/a7960326/attachment.bin>
More information about the ffmpeg-devel
mailing list