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

Function dv_read_timecode

libavformat/dv.c:546–574  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

544} RawDVContext;
545
546static int dv_read_timecode(AVFormatContext *s) {
547 int ret;
548 char timecode[AV_TIMECODE_STR_SIZE];
549 int64_t pos = avio_tell(s->pb);
550
551 // Read 3 DIF blocks: Header block and 2 Subcode blocks.
552#define PARTIAL_FRAME_SIZE (3 * 80)
553 uint8_t partial_frame[PARTIAL_FRAME_SIZE];
554 RawDVContext *c = s->priv_data;
555
556 ret = avio_read(s->pb, partial_frame, PARTIAL_FRAME_SIZE);
557 if (ret < 0)
558 goto finish;
559
560 if (ret < PARTIAL_FRAME_SIZE) {
561 ret = -1;
562 goto finish;
563 }
564
565 ret = dv_extract_timecode(&c->dv_demux, partial_frame, timecode);
566 if (ret)
567 av_dict_set(&s->metadata, "timecode", timecode, 0);
568 else
569 av_log(s, AV_LOG_ERROR, "Detected timecode is invalid\n");
570
571finish:
572 avio_seek(s->pb, pos, SEEK_SET);
573 return ret;
574}
575
576static int dv_read_header(AVFormatContext *s)
577{

Callers 1

dv_read_headerFunction · 0.85

Calls 6

avio_tellFunction · 0.85
avio_readFunction · 0.85
dv_extract_timecodeFunction · 0.85
av_dict_setFunction · 0.85
av_logFunction · 0.85
avio_seekFunction · 0.85

Tested by

no test coverage detected