Ticket #4275: add_new_stream2.diff
File add_new_stream2.diff, 1.3 KB (added by , 16 years ago) |
---|
-
libs/libavformat/utils.c
2176 2176 2177 2177 AVStream *av_new_stream(AVFormatContext *s, int id) 2178 2178 { 2179 AVStream *st = av_mallocz(sizeof(AVStream)); 2180 if (st) { 2181 st->codec = avcodec_alloc_context(); 2182 AVStream *stream = av_add_stream(s, st, id); 2183 if (!stream) 2184 av_free(st); 2185 return stream; 2179 AVStream *st; 2180 int i; 2181 2182 if (s->nb_streams >= MAX_STREAMS) 2183 return NULL; 2184 2185 st = av_mallocz(sizeof(AVStream)); 2186 if (!st) 2187 return NULL; 2188 2189 st->codec= avcodec_alloc_context(); 2190 if (s->iformat) { 2191 /* no default bitrate if decoding */ 2192 st->codec->bit_rate = 0; 2186 2193 } 2187 return NULL; 2194 st->index = s->nb_streams; 2195 st->id = id; 2196 st->start_time = AV_NOPTS_VALUE; 2197 st->duration = AV_NOPTS_VALUE; 2198 st->cur_dts = AV_NOPTS_VALUE; 2199 st->first_dts = AV_NOPTS_VALUE; 2200 2201 /* default pts settings is MPEG like */ 2202 av_set_pts_info(st, 33, 1, 90000); 2203 st->last_IP_pts = AV_NOPTS_VALUE; 2204 for(i=0; i<MAX_REORDER_DELAY+1; i++) 2205 st->pts_buffer[i]= AV_NOPTS_VALUE; 2206 2207 s->streams[s->nb_streams++] = st; 2208 return st; 2188 2209 } 2189 2210 2190 2211 /**