[FFmpeg-devel] foo -> libfoo changes

Måns Rullgård mans
Wed Jun 13 20:51:46 CEST 2007


Ismail D?nmez <ismail at pardus.org.tr> writes:

> On Wednesday 13 June 2007 20:45:05 Michael Niedermayer wrote:
> [...]
>> well, we have quite a few things sheduled for removial with the next
>> major bump so while there is no need to bump major to resolve this at
>> all it would be an option too, accumulating old trash forever isnt good
>>
>> simply providing a few dummy codecs under #if LIBAVCODEC_VERSION_INT <...
>> so avcodec_find_encoder_by_name() would work with the obsolete names
>> would likely be a simpler solution though
>
> Something like attached patch would accepted? I am not sure why it needs 
> &p->name[4] though, &p->name[3] did not work but it should as lib is 3 
> characters.

If you don't know why it works, it's probably wrong.  Besides, &foo[x]
is ugly.

> diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> index e441a6f..d889d80 100644
> --- a/libavcodec/utils.c
> +++ b/libavcodec/utils.c
> @@ -1005,7 +1005,7 @@ AVCodec *avcodec_find_encoder_by_name(const char *name)
>      AVCodec *p;
>      p = first_avcodec;
>      while (p) {
> -        if (p->encode != NULL && strcmp(name,p->name) == 0)
> +        if (p->encode != NULL && (strcmp(name,p->name) == 0 || strcmp(name,&p->name[4] == 0)))

This is definitely wrong.  The == 0 is in the wrong place for starters.

-- 
M?ns Rullg?rd
mans at mansr.com




More information about the ffmpeg-devel mailing list