MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / av_program_add_stream_index

Function av_program_add_stream_index

libavformat/avformat.c:302–327  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

300}
301
302void av_program_add_stream_index(AVFormatContext *ac, int progid, unsigned idx)
303{
304 AVProgram *program = NULL;
305 void *tmp;
306
307 if (idx >= ac->nb_streams) {
308 av_log(ac, AV_LOG_ERROR, "stream index %d is not valid\n", idx);
309 return;
310 }
311
312 for (unsigned i = 0; i < ac->nb_programs; i++) {
313 if (ac->programs[i]->id != progid)
314 continue;
315 program = ac->programs[i];
316 for (unsigned j = 0; j < program->nb_stream_indexes; j++)
317 if (program->stream_index[j] == idx)
318 return;
319
320 tmp = av_realloc_array(program->stream_index, program->nb_stream_indexes+1, sizeof(unsigned int));
321 if (!tmp)
322 return;
323 program->stream_index = tmp;
324 program->stream_index[program->nb_stream_indexes++] = idx;
325 return;
326 }
327}
328
329AVProgram *av_find_program_from_stream(AVFormatContext *ic, AVProgram *last, int s)
330{

Callers 4

dash_read_headerFunction · 0.85
pmt_cbFunction · 0.85
add_stream_to_programsFunction · 0.85
of_add_programsFunction · 0.85

Calls 2

av_logFunction · 0.85
av_realloc_arrayFunction · 0.85

Tested by

no test coverage detected