| 431 | } |
| 432 | |
| 433 | static int dv_write_header(AVFormatContext *s) |
| 434 | { |
| 435 | AVRational rate; |
| 436 | DVMuxContext *dvc = s->priv_data; |
| 437 | AVDictionaryEntry *tcr = av_dict_get(s->metadata, "timecode", NULL, 0); |
| 438 | |
| 439 | if (dv_init_mux(s) < 0) { |
| 440 | av_log(s, AV_LOG_ERROR, "Can't initialize DV format!\n" |
| 441 | "Make sure that you supply at least two streams:\n" |
| 442 | " video: 25fps or 29.97fps, audio: 2ch/48|44.1|32kHz/PCM\n" |
| 443 | " (50Mbps allows an optional second audio stream)\n"); |
| 444 | return AVERROR_INVALIDDATA; |
| 445 | } |
| 446 | rate.num = dvc->sys->ltc_divisor; |
| 447 | rate.den = 1; |
| 448 | if (!tcr) { // no global timecode, look into the streams |
| 449 | int i; |
| 450 | for (i = 0; i < s->nb_streams; i++) { |
| 451 | tcr = av_dict_get(s->streams[i]->metadata, "timecode", NULL, 0); |
| 452 | if (tcr) |
| 453 | break; |
| 454 | } |
| 455 | } |
| 456 | if (tcr && av_timecode_init_from_string(&dvc->tc, rate, tcr->value, s) >= 0) |
| 457 | return 0; |
| 458 | return av_timecode_init(&dvc->tc, rate, 0, 0, s); |
| 459 | } |
| 460 | |
| 461 | static int dv_write_packet(struct AVFormatContext *s, AVPacket *pkt) |
| 462 | { |
nothing calls this directly
no test coverage detected