| 269 | } |
| 270 | |
| 271 | AVProgram *av_new_program(AVFormatContext *ac, int id) |
| 272 | { |
| 273 | AVProgram *program = NULL; |
| 274 | int ret; |
| 275 | |
| 276 | av_log(ac, AV_LOG_TRACE, "new_program: id=0x%04x\n", id); |
| 277 | |
| 278 | for (unsigned i = 0; i < ac->nb_programs; i++) |
| 279 | if (ac->programs[i]->id == id) |
| 280 | program = ac->programs[i]; |
| 281 | |
| 282 | if (!program) { |
| 283 | program = av_mallocz(sizeof(*program)); |
| 284 | if (!program) |
| 285 | return NULL; |
| 286 | ret = av_dynarray_add_nofree(&ac->programs, &ac->nb_programs, program); |
| 287 | if (ret < 0) { |
| 288 | av_free(program); |
| 289 | return NULL; |
| 290 | } |
| 291 | program->discard = AVDISCARD_NONE; |
| 292 | program->pmt_version = -1; |
| 293 | program->id = id; |
| 294 | program->pts_wrap_reference = AV_NOPTS_VALUE; |
| 295 | program->pts_wrap_behavior = AV_PTS_WRAP_IGNORE; |
| 296 | program->start_time = |
| 297 | program->end_time = AV_NOPTS_VALUE; |
| 298 | } |
| 299 | return program; |
| 300 | } |
| 301 | |
| 302 | void av_program_add_stream_index(AVFormatContext *ac, int progid, unsigned idx) |
| 303 | { |
no test coverage detected