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

Michael Niedermayer michaelni
Mon Jun 18 21:23:50 CEST 2007


Hi

On Mon, Jun 18, 2007 at 06:19:07PM +0200, Nicolas George wrote:
> Hi.
> 
> Here is a patch to avoid using the codec_id in the command line tool.
> 
> It works on the tests I have run, but since it changes several things in
> ffmpeg, it needs more careful testing.
> 
> Suggested log: Use directly the codec instead of the codec_id whenever
> possible.
> 
> Regards,
> 
> -- 
>   Nicolas George
> 
> 
> Index: ffmpeg.c
> ===================================================================
> --- ffmpeg.c	(revision 9361)
> +++ ffmpeg.c	(working copy)
> @@ -123,7 +123,7 @@
>  static int me_method = ME_EPZS;
>  static int video_disable = 0;
>  static int video_discard = 0;
> -static int video_codec_id = CODEC_ID_NONE;
> +static AVCodec *video_codec = NULL;
>  static int video_codec_tag = 0;
>  static int same_quality = 0;
>  static int do_deinterlace = 0;
> @@ -141,11 +141,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 AVCodec *audio_codec = NULL;
>  static int audio_codec_tag = 0;
>  static char *audio_language = NULL;
>  
> -static int subtitle_codec_id = CODEC_ID_NONE;
> +static AVCodec *subtitle_codec = NULL;
>  static char *subtitle_language = NULL;

why dont you replace the int *codec_id by a char * ?


>  
>  static float mux_preload= 0.5;
> @@ -1716,7 +1716,8 @@
>          ost = ost_table[i];
>          if (ost->encoding_needed) {
>              AVCodec *codec;
> -            codec = avcodec_find_encoder(ost->st->codec->codec_id);
> +            codec = ost->st->codec->codec;
> +            ost->st->codec->codec = NULL;

this looks like an ugly hack


[...]
> Index: libavcodec/utils.c
> ===================================================================
> --- libavcodec/utils.c	(revision 9361)
> +++ libavcodec/utils.c	(working copy)
> @@ -1044,7 +1044,9 @@
>      char channels_str[100];
>      int bitrate;
>  
> -    if (encode)
> +    if (enc->codec != NULL)

the != NULL is unneeded
and this change belongs to a seperate patch


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

I count him braver who overcomes his desires than him who conquers his
enemies for the hardest victory is over self. -- Aristotle
-------------- 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/20070618/658eaa6d/attachment.pgp>



More information about the ffmpeg-devel mailing list