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;
127 int32_t audio_format, chunk_catalog_offset, number_of_chunks;
138 error |=
read_line(pb, line,
sizeof(line));
139 error |=
read_line(pb, line,
sizeof(line));
141 error |=
read_line(pb, line,
sizeof(line));
143 error |=
read_line(pb, line,
sizeof(line));
155 error |=
read_line(pb, line,
sizeof(line));
190 ast->codecpar->codec_tag = audio_format;
193 error |=
read_line(pb, line,
sizeof(line));
194 ast->codecpar->bits_per_coded_sample =
read_int(line, &endptr, &error);
195 strcpy(audio_type, endptr);
198 if (ast->codecpar->bits_per_coded_sample == 0)
199 ast->codecpar->bits_per_coded_sample = 4;
201 ast->codecpar->bit_rate = ast->codecpar->sample_rate *
202 ast->codecpar->bits_per_coded_sample *
203 ast->codecpar->channels;
206 switch (audio_format) {
208 if (ast->codecpar->bits_per_coded_sample == 16) {
212 }
else if (ast->codecpar->bits_per_coded_sample == 8) {
213 if(strstr(audio_type,
"unsigned") !=
NULL) {
216 }
else if(strstr(audio_type,
"linear") !=
NULL) {
228 if (ast->codecpar->bits_per_coded_sample == 8) {
233 }
else if (ast->codecpar->bits_per_coded_sample == 4) {
244 for (i = 0; i < 3; i++)
245 error |=
read_line(pb, line,
sizeof(line));
251 "Don't know how to split frames for video format %s. "
258 error |=
read_line(pb, line,
sizeof(line));
259 error |=
read_line(pb, line,
sizeof(line));
260 chunk_catalog_offset =
262 error |=
read_line(pb, line,
sizeof(line));
263 error |=
read_line(pb, line,
sizeof(line));
264 error |=
read_line(pb, line,
sizeof(line));
267 avio_seek(pb, chunk_catalog_offset, SEEK_SET);
268 total_audio_size = 0;
269 for (i = 0; !error && i < number_of_chunks; i++) {
270 int64_t
offset, video_size, audio_size;
271 error |=
read_line(pb, line,
sizeof(line));
272 if (3 != sscanf(line,
"%"SCNd64
" , %"SCNd64
" ; %"SCNd64,
273 &offset, &video_size, &audio_size)) {
281 audio_size, audio_size * 8, 0);
282 total_audio_size += audio_size * 8;
285 if (error)
return AVERROR(EIO);
328 if (ret != frame_size) {
345 if (ret != index_entry->
size) {
static AVRational read_fps(const char *line, int *error)
Parsing for fps, which can be a fraction.
int av_add_index_entry(AVStream *st, int64_t pos, int64_t timestamp, int size, int distance, int flags)
Add an index entry into a sorted list.
#define AV_LOG_WARNING
Something somehow does not look correct.
static int read_line(AVIOContext *pb, char *line, int bufsize)
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
AVIndexEntry * index_entries
Only used if the format does not support seeking natively.
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
void void avpriv_request_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
AVStream ** streams
A list of all streams in the file.
#define AVERROR_EOF
End of file.
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
static int rpl_read_header(AVFormatContext *s)
AVDictionary * metadata
Metadata that applies to the whole file.
unsigned int avio_rl32(AVIOContext *s)
int64_t timestamp
Timestamp in AVStream.time_base units, preferably the time from which on correctly decoded frames are...
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
#define av_fourcc2str(fourcc)
enum AVMediaType codec_type
General type of the encoded data.
static const uint8_t offset[127][2]
int flags
A combination of AV_PKT_FLAG values.
int avio_r8(AVIOContext *s)
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
static int rpl_probe(AVProbeData *p)
static int32_t read_int(const char *line, const char **endptr, int *error)
AVInputFormat ff_rpl_demuxer
static void error(const char *err)
static int read_header(FFV1Context *f)
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
AVIOContext * pb
I/O context.
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
Rational number (pair of numerator and denominator).
This structure contains the data a format has to probe a file.
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
static int32_t read_line_and_int(AVIOContext *pb, int *error)
static int rpl_read_packet(AVFormatContext *s, AVPacket *pkt)
void * priv_data
Format private data.
#define RPL_LINE_LENGTH
256 is arbitrary, but should be big enough for any reasonable file.
int bits_per_coded_sample
The number of bits per sample in the codedwords.
AVCodecParameters * codecpar
Codec parameters associated with this stream.
int avio_feof(AVIOContext *s)
feof() equivalent for AVIOContext.
uint32_t codec_tag
Additional information about the codec (corresponds to the AVI FOURCC).
This structure stores compressed data.
#define RPL_SIGNATURE_SIZE
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...