[FFmpeg-devel] [PATCH] Codec lookup: do not use codec_id

Michael Niedermayer michaelni
Thu Jul 26 02:34:46 CEST 2007


Hi

On Thu, Jul 19, 2007 at 09:47:55PM +0200, Nicolas George wrote:
> Hi.
> 
> Le septidi 17 messidor, an CCXV, Michael Niedermayer a ?crit?:
> > your suggestion is better then the last patch
> 
> After some lapse, it is implemented in the attached patch.
> 
> I ran the same battery of tests as last time. It works.
> 
> > still pleas keep in mind that not every string has a corresponding AVCodec
> > and thus the code must not depend on the existance of a AVCodec unless
> > one is really actually used for encoding/decoding that is for stream copy
> > it has to work with neither encoder nor decoder
> > and yes its very well possibe that this doesnt work currently either
> > 
> > but it should be possible to override the input codec and do stream copy
> > even if decoder or encoder AVCodec is missing
> 
> Do you have an example of how it would be useful? With the current code, as
> far as I understand, the input codec is simply ignored.
> 
> Anyway, I do not believe that my code makes things worse with that regard,
> and it probably makes it easier to change.
[...]
> Index: ffmpeg.c
> ===================================================================
> --- ffmpeg.c	(revision 9755)
> +++ ffmpeg.c	(working copy)
> @@ -128,7 +128,7 @@
>  static char *video_rc_eq="tex^qComp";
>  static int video_disable = 0;
>  static int video_discard = 0;
> -static int video_codec_id = CODEC_ID_NONE;
> +static char *video_codec_name = NULL;
>  static int video_codec_tag = 0;
>  static int same_quality = 0;
>  static int do_deinterlace = 0;
> @@ -146,11 +146,11 @@
>  static float audio_qscale = QSCALE_NONE;
>  static int audio_disable = 0;
>  static int audio_channels = 1;
> -static int audio_codec_id = CODEC_ID_NONE;
> +static char  *audio_codec_name = NULL;
>  static int audio_codec_tag = 0;
>  static char *audio_language = NULL;
>  
> -static int subtitle_codec_id = CODEC_ID_NONE;
> +static char *subtitle_codec_name = NULL;
>  static char *subtitle_language = NULL;
>  
>  static float mux_preload= 0.5;
> @@ -1718,7 +1718,11 @@
>          ost = ost_table[i];
>          if (ost->encoding_needed) {
>              AVCodec *codec;
> -            codec = avcodec_find_encoder(ost->st->codec->codec_id);
> +            codec = ost->st->codec->codec;
> +            /* until here, ost->st->codec was used to store future codec
> +             * parameters; now, it will be properly used as an
> +             * AVCodecContext; it must therefore be reset */
> +            ost->st->codec->codec = NULL;

first part changes the global codec_id to strings, the second part changes
ost->st->codec->codec_id to ost->st->codec->codec, these are 2 seperate
changes and belong in seperate patches


[...]

> +    if(*pcodec_name != NULL)
> +        /*av_free(*pcodec_name)*/;

whatever this is supposed to do, it doesnt do it so it is wrong

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Thouse who are best at talking, realize last or never when they are wrong.
-------------- 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/20070726/a03a9e63/attachment.pgp>



More information about the ffmpeg-devel mailing list