| 300 | } |
| 301 | |
| 302 | void 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 | |
| 329 | AVProgram *av_find_program_from_stream(AVFormatContext *ic, AVProgram *last, int s) |
| 330 | { |
no test coverage detected