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

Function flv_write_header

libavformat/flvenc.c:1081–1116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1079}
1080
1081static int flv_write_header(AVFormatContext *s)
1082{
1083 int i;
1084 AVIOContext *pb = s->pb;
1085 FLVContext *flv = s->priv_data;
1086
1087 avio_write(pb, "FLV", 3);
1088 avio_w8(pb, 1);
1089 avio_w8(pb, FLV_HEADER_FLAG_HASAUDIO * !!flv->audio_par +
1090 FLV_HEADER_FLAG_HASVIDEO * !!flv->video_par);
1091 avio_wb32(pb, 9);
1092 avio_wb32(pb, 0);
1093
1094 for (i = 0; i < s->nb_streams; i++)
1095 if (s->streams[i]->codecpar->codec_tag == 5) {
1096 avio_w8(pb, 8); // message type
1097 avio_wb24(pb, 0); // include flags
1098 avio_wb24(pb, 0); // time stamp
1099 avio_wb32(pb, 0); // reserved
1100 avio_wb32(pb, 11); // size
1101 flv->reserved = 5;
1102 }
1103
1104 if (flv->flags & FLV_NO_METADATA) {
1105 pb->seekable = 0;
1106 } else {
1107 write_metadata(s, 0);
1108 }
1109
1110 for (i = 0; i < s->nb_streams; i++) {
1111 flv_write_codec_header(s, s->streams[i]->codecpar, 0, i);
1112 }
1113
1114 flv->datastart_offset = avio_tell(pb);
1115 return 0;
1116}
1117
1118static int flv_write_trailer(AVFormatContext *s)
1119{

Callers

nothing calls this directly

Calls 7

avio_writeFunction · 0.85
avio_w8Function · 0.85
avio_wb32Function · 0.85
avio_wb24Function · 0.85
flv_write_codec_headerFunction · 0.85
avio_tellFunction · 0.85
write_metadataFunction · 0.70

Tested by

no test coverage detected