28 #define RPL_SIGNATURE "ARMovie\x0A"
29 #define RPL_SIGNATURE_SIZE 8
32 #define RPL_LINE_LENGTH 256
55 for (i = 0; i < bufsize - 1; i++) {
71 unsigned long result = 0;
72 for (; *line>=
'0' && *line<=
'9'; line++) {
73 if (result > (0x7FFFFFFF - 9) / 10)
75 result = 10 * result + *line -
'0';
85 *error |=
read_line(pb, line,
sizeof(line));
86 return read_int(line, &endptr, error);
100 for (; *line>=
'0' && *line<=
'9'; line++) {
102 if (num > (INT64_MAX - 9) / 10 || den > INT64_MAX / 10)
104 num = 10 * num + *line -
'0';
118 int total_audio_size;
123 int32_t audio_format, chunk_catalog_offset, number_of_chunks;
134 error |=
read_line(pb, line,
sizeof(line));
135 error |=
read_line(pb, line,
sizeof(line));
137 error |=
read_line(pb, line,
sizeof(line));
139 error |=
read_line(pb, line,
sizeof(line));
151 error |=
read_line(pb, line,
sizeof(line));
172 "RPL video format %i not supported yet!\n",
187 ast->codec->codec_tag = audio_format;
193 if (ast->codec->bits_per_coded_sample == 0)
194 ast->codec->bits_per_coded_sample = 4;
196 ast->codec->bit_rate = ast->codec->sample_rate *
197 ast->codec->bits_per_coded_sample *
198 ast->codec->channels;
201 switch (audio_format) {
203 if (ast->codec->bits_per_coded_sample == 16) {
212 if (ast->codec->bits_per_coded_sample == 8) {
217 }
else if (ast->codec->bits_per_coded_sample == 4) {
225 "RPL audio format %i not supported yet!\n",
230 for (i = 0; i < 3; i++)
231 error |=
read_line(pb, line,
sizeof(line));
237 "Don't know how to split frames for video format %i. "
244 error |=
read_line(pb, line,
sizeof(line));
245 error |=
read_line(pb, line,
sizeof(line));
246 chunk_catalog_offset =
248 error |=
read_line(pb, line,
sizeof(line));
249 error |=
read_line(pb, line,
sizeof(line));
250 error |=
read_line(pb, line,
sizeof(line));
253 avio_seek(pb, chunk_catalog_offset, SEEK_SET);
254 total_audio_size = 0;
255 for (i = 0; !error && i < number_of_chunks; i++) {
257 error |=
read_line(pb, line,
sizeof(line));
258 if (3 != sscanf(line,
"%"SCNd64
" , %"SCNd64
" ; %"SCNd64,
259 &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) {