On 07/08/2011 02:42 PM, Anton Khirnov wrote:

> -        AVStream *st;
> +        OutputStream *ost;
>          AVCodec *codec;
>  
> -        s->nb_streams++;
> +        codec = avcodec_find_encoder(ic->streams[i]->codec->codec_id);
> +        ost   = new_output_stream(s, nb_output_files, codec);
>  
>          // FIXME: a more elegant solution is needed
> -        st = av_mallocz(sizeof(AVStream));
> -        memcpy(st, ic->streams[i], sizeof(AVStream));
> -        st->info = NULL;
> -        st->codec = avcodec_alloc_context();
> -        if (!st->codec) {
> -            print_error(filename, AVERROR(ENOMEM));
> -            ffmpeg_exit(1);
> -        }
> -        avcodec_copy_context(st->codec, ic->streams[i]->codec);
> -        s->streams[i] = st;
> +        memcpy(ost->st, ic->streams[i], sizeof(AVStream));
> +        ost->st->info = NULL;
> +        avcodec_copy_context(ost->st->codec, ic->streams[i]->codec);
>  
> -        codec = avcodec_find_encoder(st->codec->codec_id);
> -        if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
> +        if (ost->st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
>              if (audio_stream_copy) {
> -                st->stream_copy = 1;
> +                ost->st->stream_copy = 1;
>              } else
> -                choose_sample_fmt(st, codec);
> -        } else if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
> +                choose_sample_fmt(ost->st, codec);
> +        } else if (ost->st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
>              if (video_stream_copy) {
> -                st->stream_copy = 1;
> +                ost->st->stream_copy = 1;
>              } else
> -                choose_pixel_fmt(st, codec);
> +                choose_pixel_fmt(ost->st, codec);
>          }
>  
> -        if(st->codec->flags & CODEC_FLAG_BITEXACT)
> +        if(ost->st->codec->flags & CODEC_FLAG_BITEXACT)
>              nopts = 1;
> -
> -        new_output_stream(s, nb_output_files);


A lot of these changes seem unrelated. Why not just keep AVStream *st,
set it to ost->st and avoid a lot of the changes?

-Justin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to