int add_av_stream(FFStream *feed,

                  AVStream *st)

{

    AVStream *fst;

    AVCodecContext *av, *av1;

    int i;



    av = &st->codec;

    for(i=0;i<feed->nb_streams;i++) {

        st = feed->streams[i];

        av1 = &st->codec;

        if (av1->codec_id == av->codec_id &&

            av1->codec_type == av->codec_type &&

            av1->bit_rate == av->bit_rate) {



            switch(av->codec_type) {

            case CODEC_TYPE_AUDIO:

                if (av1->channels == av->channels &&

                    av1->sample_rate == av->sample_rate)

                    goto found;

                break;

            case CODEC_TYPE_VIDEO:

                if (av1->width == av->width &&

                    av1->height == av->height &&

                    av1->frame_rate == av->frame_rate &&

                    av1->gop_size == av->gop_size)

                    goto found;

                break;

            default:

                abort();

            }

        }

    }

    

    fst = av_mallocz(sizeof(AVStream));

    if (!fst)

        return -1;

    fst->priv_data = av_mallocz(sizeof(FeedData));

    memcpy(&fst->codec, av, sizeof(AVCodecContext));

    feed->streams[feed->nb_streams++] = fst;

    return feed->nb_streams - 1;

 found:

    return i;

}

int add_av_stream(FFStream *feed,

                  AVStream *st)

{

    AVStream *fst;

    AVCodecContext *av, *av1;

    int i;



    av = &st->codec;

    for(i=0;i<feed->nb_streams;i++) {

        st = feed->streams[i];

        av1 = &st->codec;

        if (av1->codec_id == av->codec_id &&

            av1->codec_type == av->codec_type &&

            av1->bit_rate == av->bit_rate) {



            switch(av->codec_type) {

            case CODEC_TYPE_AUDIO:

                if (av1->channels == av->channels &&

                    av1->sample_rate == av->sample_rate)

                    goto found;

                break;

            case CODEC_TYPE_VIDEO:

                if (av1->width == av->width &&

                    av1->height == av->height &&

                    av1->frame_rate == av->frame_rate &&

                    av1->gop_size == av->gop_size)

                    goto found;

                break;

            default:

                abort();

            }

        }

    }

    

    fst = av_mallocz(sizeof(AVStream));

    if (!fst)

        return -1;

    fst->priv_data = av_mallocz(sizeof(FeedData));

    memcpy(&fst->codec, av, sizeof(AVCodecContext));

    feed->streams[feed->nb_streams++] = fst;

    return feed->nb_streams - 1;

 found:

    return i;

}

                abort();                 abort();
int FUNC_0(FFStream *VAR_0,

                  AVStream *VAR_1)

{

    AVStream *fst;

    AVCodecContext *av, *av1;

    int VAR_2;



    av = &VAR_1->codec;

    for(VAR_2=0;VAR_2<VAR_0->nb_streams;VAR_2++) {

        VAR_1 = VAR_0->streams[VAR_2];

        av1 = &VAR_1->codec;

        if (av1->codec_id == av->codec_id &&

            av1->codec_type == av->codec_type &&

            av1->bit_rate == av->bit_rate) {



            switch(av->codec_type) {

            case CODEC_TYPE_AUDIO:

                if (av1->channels == av->channels &&

                    av1->sample_rate == av->sample_rate)

                    goto found;

                break;

            case CODEC_TYPE_VIDEO:

                if (av1->width == av->width &&

                    av1->height == av->height &&

                    av1->frame_rate == av->frame_rate &&

                    av1->gop_size == av->gop_size)

                    goto found;

                break;

            default:

                abort();

            }

        }

    }

    

    fst = av_mallocz(sizeof(AVStream));

    if (!fst)

        return -1;

    fst->priv_data = av_mallocz(sizeof(FeedData));

    memcpy(&fst->codec, av, sizeof(AVCodecContext));

    VAR_0->streams[VAR_0->nb_streams++] = fst;

    return VAR_0->nb_streams - 1;

 found:

    return VAR_2;

}

int FUNC_0(FFStream *VAR_0,
AVStream *VAR_1)
{ AVStream *fst; AVCodecContext *av, *av1; int VAR_2; av = &VAR_1->codec; for(VAR_2=0;VAR_2<VAR_0->nb_streams;VAR_2++) { VAR_1 = VAR_0->streams[VAR_2]; av1 = &VAR_1->codec; if (av1->codec_id == av->codec_id &&
av1->codec_type == av->codec_type &&
av1->bit_rate == av->bit_rate) { switch(av->codec_type) { case CODEC_TYPE_AUDIO:
if (av1->channels == av->channels &&
av1->sample_rate == av->sample_rate)
goto found; break; case CODEC_TYPE_VIDEO:
if (av1->width == av->width &&
av1->height == av->height &&
av1->frame_rate == av->frame_rate &&
av1->gop_size == av->gop_size)
goto found; break; default:
abort(); } } } fst = av_mallocz(sizeof(AVStream)); if (!fst)
return -1; fst->priv_data = av_mallocz(sizeof(FeedData)); memcpy(&fst->codec, av, sizeof(AVCodecContext)); VAR_0->streams[VAR_0->nb_streams++] = fst; return VAR_0->nb_streams - 1; found:
return VAR_2; }