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

Function rv10_write_header

libavformat/rmenc.c:63–273  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61}
62
63static void rv10_write_header(AVFormatContext *ctx,
64 int data_size, int index_pos)
65{
66 RMMuxContext *rm = ctx->priv_data;
67 ByteIOContext *s = ctx->pb;
68 StreamInfo *stream;
69 unsigned char *data_offset_ptr, *start_ptr;
70 const char *desc, *mimetype;
71 int nb_packets, packet_total_size, packet_max_size, size, packet_avg_size, i;
72 int bit_rate, v, duration, flags, data_pos;
73 AVMetadataTag *tag;
74
75 start_ptr = s->buf_ptr;
76
77 put_tag(s, ".RMF");
78 put_be32(s,18); /* header size */
79 put_be16(s,0);
80 put_be32(s,0);
81 put_be32(s,4 + ctx->nb_streams); /* num headers */
82
83 put_tag(s,"PROP");
84 put_be32(s, 50);
85 put_be16(s, 0);
86 packet_max_size = 0;
87 packet_total_size = 0;
88 nb_packets = 0;
89 bit_rate = 0;
90 duration = 0;
91 for(i=0;i<ctx->nb_streams;i++) {
92 StreamInfo *stream = &rm->streams[i];
93 bit_rate += stream->bit_rate;
94 if (stream->packet_max_size > packet_max_size)
95 packet_max_size = stream->packet_max_size;
96 nb_packets += stream->nb_packets;
97 packet_total_size += stream->packet_total_size;
98 /* select maximum duration */
99 v = (int) (1000.0 * (float)stream->total_frames / stream->frame_rate);
100 if (v > duration)
101 duration = v;
102 }
103 put_be32(s, bit_rate); /* max bit rate */
104 put_be32(s, bit_rate); /* avg bit rate */
105 put_be32(s, packet_max_size); /* max packet size */
106 if (nb_packets > 0)
107 packet_avg_size = packet_total_size / nb_packets;
108 else
109 packet_avg_size = 0;
110 put_be32(s, packet_avg_size); /* avg packet size */
111 put_be32(s, nb_packets); /* num packets */
112 put_be32(s, duration); /* duration */
113 put_be32(s, BUFFER_DURATION); /* preroll */
114 put_be32(s, index_pos); /* index offset */
115 /* computation of data the data offset */
116 data_offset_ptr = s->buf_ptr;
117 put_be32(s, 0); /* data offset : will be patched after */
118 put_be16(s, ctx->nb_streams); /* num streams */
119 flags = 1 | 2; /* save allowed & perfect play */
120 if (url_is_streamed(s))

Callers 2

rm_write_headerFunction · 0.85
rm_write_trailerFunction · 0.85

Calls 8

put_tagFunction · 0.85
put_be32Function · 0.85
put_be16Function · 0.85
url_is_streamedFunction · 0.85
av_metadata_getFunction · 0.85
put_str8Function · 0.85
put_byteFunction · 0.85
put_strFunction · 0.70

Tested by

no test coverage detected