Revision 15afa396 libavformat/utils.c

View differences:

libavformat/utils.c
2067 2067
        av_free(st->codec);
2068 2068
        av_free(st);
2069 2069
    }
2070
    for(i=s->nb_programs-1; i>=0; i--) {
2071
        av_freep(&s->programs[i]->provider_name);
2072
        av_freep(&s->programs[i]->name);
2073
        av_freep(&s->programs[i]);
2074
    }
2070 2075
    flush_packet_queue(s);
2071 2076
    must_open_file = 1;
2072 2077
    if (s->iformat->flags & AVFMT_NOFILE) {
......
2113 2118
    return st;
2114 2119
}
2115 2120

  
2121
AVProgram *av_new_program(AVFormatContext *ac, int id)
2122
{
2123
    AVProgram *program=NULL;
2124
    int i;
2125

  
2126
#ifdef DEBUG_SI
2127
    av_log(ac, AV_LOG_DEBUG, "new_program: id=0x%04x\n", id);
2128
#endif
2129

  
2130
    for(i=0; i<ac->nb_programs; i++)
2131
        if(ac->programs[i]->id == id)
2132
            program = ac->programs[i];
2133

  
2134
    if(!program){
2135
        program = av_mallocz(sizeof(AVProgram));
2136
        if (!program)
2137
            return NULL;
2138
        dynarray_add(&ac->programs, &ac->nb_programs, program);
2139
        program->discard = AVDISCARD_NONE;
2140
    }
2141
    program->id = id;
2142

  
2143
    return program;
2144
}
2145

  
2146
void av_set_program_name(AVProgram *program, char *provider_name, char *name)
2147
{
2148
    assert(!provider_name == !name);
2149
    if(name){
2150
        av_free(program->provider_name);
2151
        av_free(program->         name);
2152
        program->provider_name = av_strdup(provider_name);
2153
        program->         name = av_strdup(         name);
2154
    }
2155
}
2156

  
2157

  
2116 2158
/************************************************************/
2117 2159
/* output media file */
2118 2160

  

Also available in: Unified diff