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

Function tee_write_header

libavformat/tee.c:451–515  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

449}
450
451static int tee_write_header(AVFormatContext *avf)
452{
453 TeeContext *tee = avf->priv_data;
454 unsigned nb_slaves = 0;
455 const char *filename = avf->url;
456 char **slaves = NULL;
457 int ret;
458
459 while (*filename) {
460 char *slave = av_get_token(&filename, slave_delim);
461 if (!slave) {
462 ret = AVERROR(ENOMEM);
463 goto fail;
464 }
465 ret = av_dynarray_add_nofree(&slaves, &nb_slaves, slave);
466 if (ret < 0) {
467 av_free(slave);
468 goto fail;
469 }
470 if (strspn(filename, slave_delim))
471 filename++;
472 }
473
474 if (!FF_ALLOCZ_TYPED_ARRAY(tee->slaves, nb_slaves)) {
475 ret = AVERROR(ENOMEM);
476 goto fail;
477 }
478 tee->nb_slaves = tee->nb_alive = nb_slaves;
479
480 for (unsigned i = 0; i < nb_slaves; i++) {
481
482 tee->slaves[i].use_fifo = tee->use_fifo;
483 ret = av_dict_copy(&tee->slaves[i].fifo_options, tee->fifo_options, 0);
484 if (ret < 0)
485 goto fail;
486
487 if ((ret = open_slave(avf, slaves[i], &tee->slaves[i])) < 0) {
488 ret = tee_process_slave_failure(avf, i, ret);
489 if (ret < 0)
490 goto fail;
491 } else {
492 log_slave(&tee->slaves[i], avf, AV_LOG_VERBOSE);
493 }
494 av_freep(&slaves[i]);
495 }
496
497 for (unsigned i = 0; i < avf->nb_streams; i++) {
498 int mapped = 0;
499 for (unsigned j = 0; j < tee->nb_slaves; j++)
500 if (tee->slaves[j].avf)
501 mapped += tee->slaves[j].stream_map[i] >= 0;
502 if (!mapped)
503 av_log(avf, AV_LOG_WARNING, "Input stream #%d is not mapped "
504 "to any slave.\n", i);
505 }
506 av_free(slaves);
507 return 0;
508

Callers

nothing calls this directly

Calls 10

av_get_tokenFunction · 0.85
av_dynarray_add_nofreeFunction · 0.85
av_dict_copyFunction · 0.85
open_slaveFunction · 0.85
log_slaveFunction · 0.85
av_freepFunction · 0.85
av_logFunction · 0.85
close_slavesFunction · 0.85
av_freeFunction · 0.50

Tested by

no test coverage detected