Logo Search packages:      
Sourcecode: blender version File versions

AVStream* av_new_stream ( AVFormatContext *  s,
int  id 

Add a new stream to a media file.

Can only be called in the read_header() function. If the flag AVFMTCTX_NOHEADER is in the format context, then new streams can be added in read_packet too.

s media file handle
id file format dependent stream id

Definition at line 2195 of file utils.c.

References av_set_pts_info(), and avcodec_alloc_context().

    AVStream *st;

    if (s->nb_streams >= MAX_STREAMS)
        return NULL;

    st = av_mallocz(sizeof(AVStream));
    if (!st)
        return NULL;

    st->codec= avcodec_alloc_context();
    if (s->iformat) {
        /* no default bitrate if decoding */
        st->codec->bit_rate = 0;
    st->index = s->nb_streams;
    st->id = id;
    st->start_time = AV_NOPTS_VALUE;
    st->duration = AV_NOPTS_VALUE;
    st->cur_dts = AV_NOPTS_VALUE;

    /* default pts settings is MPEG like */
    av_set_pts_info(st, 33, 1, 90000);
    st->last_IP_pts = AV_NOPTS_VALUE;

    s->streams[s->nb_streams++] = st;
    return st;

Generated by  Doxygen 1.6.0   Back to index