30 #define RPL_SIGNATURE "ARMovie\x0A"
31 #define RPL_SIGNATURE_SIZE 8
34 #define RPL_LINE_LENGTH 256
57 for (i = 0; i < bufsize - 1; i++) {
73 unsigned long result = 0;
74 for (; *line>=
'0' && *line<=
'9'; line++) {
75 if (result > (0x7FFFFFFF - 9) / 10)
77 result = 10 * result + *line -
'0';
87 *error |=
read_line(pb, line,
sizeof(line));
88 return read_int(line, &endptr, error);
102 for (; *line>=
'0' && *line<=
'9'; line++) {
104 if (num > (INT64_MAX - 9) / 10 || den > INT64_MAX / 10)
106 num = 10 * num + *line -
'0';
120 int total_audio_size;
125 int32_t audio_format, chunk_catalog_offset, number_of_chunks;
136 error |=
read_line(pb, line,
sizeof(line));
137 error |=
read_line(pb, line,
sizeof(line));
139 error |=
read_line(pb, line,
sizeof(line));
141 error |=
read_line(pb, line,
sizeof(line));
153 error |=
read_line(pb, line,
sizeof(line));
188 ast->codec->codec_tag = audio_format;
194 if (ast->codec->bits_per_coded_sample == 0)
195 ast->codec->bits_per_coded_sample = 4;
197 ast->codec->bit_rate = ast->codec->sample_rate *
198 ast->codec->bits_per_coded_sample *
199 ast->codec->channels;
202 switch (audio_format) {
204 if (ast->codec->bits_per_coded_sample == 16) {
213 if (ast->codec->bits_per_coded_sample == 8) {
218 }
else if (ast->codec->bits_per_coded_sample == 4) {
228 for (i = 0; i < 3; i++)
229 error |=
read_line(pb, line,
sizeof(line));
235 "Don't know how to split frames for video format %i. "
242 error |=
read_line(pb, line,
sizeof(line));
243 error |=
read_line(pb, line,
sizeof(line));
244 chunk_catalog_offset =
246 error |=
read_line(pb, line,
sizeof(line));
247 error |=
read_line(pb, line,
sizeof(line));
248 error |=
read_line(pb, line,
sizeof(line));
251 avio_seek(pb, chunk_catalog_offset, SEEK_SET);
252 total_audio_size = 0;
253 for (i = 0; !error && i < number_of_chunks; i++) {
255 error |=
read_line(pb, line,
sizeof(line));
256 if (3 != sscanf(line,
"%"SCNd64
" , %"SCNd64
" ; %"SCNd64,
257 &offset, &video_size, &audio_size)) {
265 audio_size, audio_size * 8, 0);
266 total_audio_size += audio_size * 8;
269 if (error)
return AVERROR(EIO);
310 if (ret != frame_size) {
325 if (ret != index_entry->
size) {