* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/avstring.h"
#include "avformat.h"
-#include "avstring.h"
#include <stdlib.h>
#define RPL_SIGNATURE "ARMovie\x0A"
// number usually isn't important.
// (The spec says that there exists some significance
// for the text in a few cases; samples needed.)
- error |= read_line(pb, line , sizeof(line )); // ARMovie
- error |= read_line(pb, s->title , sizeof(s->title )); // movie name
- error |= read_line(pb, s->copyright, sizeof(s->copyright)); // date/copyright
- error |= read_line(pb, s->author , sizeof(s->author )); // author and other
+ error |= read_line(pb, line, sizeof(line)); // ARMovie
+ error |= read_line(pb, line, sizeof(line)); // movie name
+ av_metadata_set(&s->metadata, "title" , line);
+ error |= read_line(pb, line, sizeof(line)); // date/copyright
+ av_metadata_set(&s->metadata, "copyright", line);
+ error |= read_line(pb, line, sizeof(line)); // author and other
+ av_metadata_set(&s->metadata, "author" , line);
// video headers
vst = av_new_stream(s, 0);
if (!vst)
return AVERROR(ENOMEM);
- vst->codec->codec_type = CODEC_TYPE_VIDEO;
+ vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
vst->codec->codec_tag = read_line_and_int(pb, &error); // video format
vst->codec->width = read_line_and_int(pb, &error); // video width
vst->codec->height = read_line_and_int(pb, &error); // video height
- vst->codec->bits_per_sample = read_line_and_int(pb, &error); // video bits per sample
+ vst->codec->bits_per_coded_sample = read_line_and_int(pb, &error); // video bits per sample
error |= read_line(pb, line, sizeof(line)); // video frames per second
fps = read_fps(line, &error);
av_set_pts_info(vst, 32, fps.den, fps.num);
case 124:
vst->codec->codec_id = CODEC_ID_ESCAPE124;
// The header is wrong here, at least sometimes
- vst->codec->bits_per_sample = 16;
+ vst->codec->bits_per_coded_sample = 16;
break;
#if 0
case 130:
ast = av_new_stream(s, 0);
if (!ast)
return AVERROR(ENOMEM);
- ast->codec->codec_type = CODEC_TYPE_AUDIO;
+ ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
ast->codec->codec_tag = audio_format;
ast->codec->sample_rate = read_line_and_int(pb, &error); // audio bitrate
ast->codec->channels = read_line_and_int(pb, &error); // number of audio channels
- ast->codec->bits_per_sample = read_line_and_int(pb, &error); // audio bits per sample
+ ast->codec->bits_per_coded_sample = read_line_and_int(pb, &error); // audio bits per sample
// At least one sample uses 0 for ADPCM, which is really 4 bits
// per sample.
- if (ast->codec->bits_per_sample == 0)
- ast->codec->bits_per_sample = 4;
+ if (ast->codec->bits_per_coded_sample == 0)
+ ast->codec->bits_per_coded_sample = 4;
ast->codec->bit_rate = ast->codec->sample_rate *
- ast->codec->bits_per_sample *
+ ast->codec->bits_per_coded_sample *
ast->codec->channels;
ast->codec->codec_id = CODEC_ID_NONE;
switch (audio_format) {
case 1:
- if (ast->codec->bits_per_sample == 16) {
+ if (ast->codec->bits_per_coded_sample == 16) {
// 16-bit audio is always signed
ast->codec->codec_id = CODEC_ID_PCM_S16LE;
break;
// samples needed.
break;
case 101:
- if (ast->codec->bits_per_sample == 8) {
+ if (ast->codec->bits_per_coded_sample == 8) {
// The samples with this kind of audio that I have
// are all unsigned.
ast->codec->codec_id = CODEC_ID_PCM_U8;
break;
- } else if (ast->codec->bits_per_sample == 4) {
+ } else if (ast->codec->bits_per_coded_sample == 4) {
ast->codec->codec_id = CODEC_ID_ADPCM_IMA_EA_SEAD;
break;
}
if (url_fseek(pb, index_entry->pos, SEEK_SET) < 0)
return AVERROR(EIO);
- if (stream->codec->codec_type == CODEC_TYPE_VIDEO &&
+ if (stream->codec->codec_type == AVMEDIA_TYPE_VIDEO &&
stream->codec->codec_tag == 124) {
// We have to split Escape 124 frames because there are
// multiple frames per chunk in Escape 124 samples.
return AVERROR(EIO);
}
- if (stream->codec->codec_type == CODEC_TYPE_VIDEO) {
+ if (stream->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
// frames_per_chunk should always be one here; the header
// parsing will warn if it isn't.
pkt->duration = rpl->frames_per_chunk;
// None of the Escape formats have keyframes, and the ADPCM
// format used doesn't have keyframes.
if (rpl->chunk_number == 0 && rpl->frame_in_part == 0)
- pkt->flags |= PKT_FLAG_KEY;
+ pkt->flags |= AV_PKT_FLAG_KEY;
return ret;
}
AVInputFormat rpl_demuxer = {
"rpl",
- "RPL/ARMovie format",
+ NULL_IF_CONFIG_SMALL("RPL/ARMovie format"),
sizeof(RPLContext),
rpl_probe,
rpl_read_header,