Commit 16ddc58b authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '70daeacd'

* commit '70daeacd':
  PAF demuxer and decoder

Conflicts:
	Changelog
	doc/general.texi
	libavcodec/avcodec.h
	libavcodec/codec_desc.c
	libavcodec/paf.c
	libavcodec/version.h
	libavformat/Makefile
	libavformat/allformats.c
	libavformat/paf.c
	libavformat/version.h

See: 7de4a165, and others
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 03e4c2d8 70daeacd
......@@ -205,7 +205,7 @@ library:
@item American Laser Games MM @tab @tab X
@tab Multimedia format used in games like Mad Dog McCree.
@item 3GPP AMR @tab X @tab X
@item Amazing Studio Packed Animation File @tab @tab X
@item Amazing Studio Packed Animation File @tab @tab X
@tab Multimedia format used in game Heart Of Darkness.
@item Apple HTTP Live Streaming @tab @tab X
@item Artworx Data Format @tab @tab X
......
......@@ -288,6 +288,7 @@ enum AVCodecID {
AV_CODEC_ID_FIC,
AV_CODEC_ID_ALIAS_PIX,
AV_CODEC_ID_BRENDER_PIX_DEPRECATED,
AV_CODEC_ID_PAF_VIDEO_DEPRECATED,
AV_CODEC_ID_BRENDER_PIX= MKBETAG('B','P','I','X'),
AV_CODEC_ID_Y41P = MKBETAG('Y','4','1','P'),
......@@ -474,6 +475,7 @@ enum AVCodecID {
AV_CODEC_ID_COMFORT_NOISE,
AV_CODEC_ID_TAK_DEPRECATED,
AV_CODEC_ID_METASOUND,
AV_CODEC_ID_PAF_AUDIO_DEPRECATED,
AV_CODEC_ID_FFWAVESYNTH = MKBETAG('F','F','W','S'),
AV_CODEC_ID_SONIC = MKBETAG('S','O','N','C'),
AV_CODEC_ID_SONIC_LS = MKBETAG('S','O','N','L'),
......
......@@ -1173,13 +1173,6 @@ static const AVCodecDescriptor codec_descriptors[] = {
.long_name = NULL_IF_CONFIG_SMALL("LucasArts SMUSH video"),
.props = AV_CODEC_PROP_LOSSY,
},
{
.id = AV_CODEC_ID_PAF_VIDEO,
.type = AVMEDIA_TYPE_VIDEO,
.name = "paf_video",
.long_name = NULL_IF_CONFIG_SMALL("Amazing Studio Packed Animation File Video"),
.props = AV_CODEC_PROP_LOSSY,
},
{
.id = AV_CODEC_ID_AVRN,
.type = AVMEDIA_TYPE_VIDEO,
......@@ -1234,6 +1227,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
.long_name = NULL_IF_CONFIG_SMALL("Mirillis FIC"),
.props = AV_CODEC_PROP_LOSSY,
},
{
.id = AV_CODEC_ID_PAF_VIDEO,
.type = AVMEDIA_TYPE_VIDEO,
.name = "paf_video",
.long_name = NULL_IF_CONFIG_SMALL("Amazing Studio Packed Animation File Video"),
.props = AV_CODEC_PROP_LOSSY,
},
{
.id = AV_CODEC_ID_VP7,
.type = AVMEDIA_TYPE_VIDEO,
......@@ -2411,13 +2411,6 @@ static const AVCodecDescriptor codec_descriptors[] = {
.name = "sonicls",
.long_name = NULL_IF_CONFIG_SMALL("Sonic lossless"),
},
{
.id = AV_CODEC_ID_PAF_AUDIO,
.type = AVMEDIA_TYPE_AUDIO,
.name = "paf_audio",
.long_name = NULL_IF_CONFIG_SMALL("Amazing Studio Packed Animation File Audio"),
.props = AV_CODEC_PROP_LOSSY,
},
{
.id = AV_CODEC_ID_OPUS,
.type = AVMEDIA_TYPE_AUDIO,
......@@ -2446,6 +2439,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
.long_name = NULL_IF_CONFIG_SMALL("Voxware MetaSound"),
.props = AV_CODEC_PROP_LOSSY,
},
{
.id = AV_CODEC_ID_PAF_AUDIO,
.type = AVMEDIA_TYPE_AUDIO,
.name = "paf_audio",
.long_name = NULL_IF_CONFIG_SMALL("Amazing Studio Packed Animation File Audio"),
.props = AV_CODEC_PROP_LOSSY,
},
{
.id = AV_CODEC_ID_EVRC,
.type = AVMEDIA_TYPE_AUDIO,
......
This diff is collapsed.
......@@ -2678,10 +2678,12 @@ static enum AVCodecID remap_deprecated_codec_id(enum AVCodecID id)
case AV_CODEC_ID_BRENDER_PIX_DEPRECATED: return AV_CODEC_ID_BRENDER_PIX;
case AV_CODEC_ID_OPUS_DEPRECATED: return AV_CODEC_ID_OPUS;
case AV_CODEC_ID_TAK_DEPRECATED : return AV_CODEC_ID_TAK;
case AV_CODEC_ID_PAF_AUDIO_DEPRECATED : return AV_CODEC_ID_PAF_AUDIO;
case AV_CODEC_ID_PCM_S24LE_PLANAR_DEPRECATED : return AV_CODEC_ID_PCM_S24LE_PLANAR;
case AV_CODEC_ID_PCM_S32LE_PLANAR_DEPRECATED : return AV_CODEC_ID_PCM_S32LE_PLANAR;
case AV_CODEC_ID_ESCAPE130_DEPRECATED : return AV_CODEC_ID_ESCAPE130;
case AV_CODEC_ID_G2M_DEPRECATED : return AV_CODEC_ID_G2M;
case AV_CODEC_ID_PAF_VIDEO_DEPRECATED : return AV_CODEC_ID_PAF_VIDEO;
case AV_CODEC_ID_WEBP_DEPRECATED: return AV_CODEC_ID_WEBP;
case AV_CODEC_ID_HEVC_DEPRECATED: return AV_CODEC_ID_HEVC;
default : return id;
......
......@@ -30,7 +30,7 @@
#define LIBAVCODEC_VERSION_MAJOR 55
#define LIBAVCODEC_VERSION_MINOR 55
#define LIBAVCODEC_VERSION_MICRO 101
#define LIBAVCODEC_VERSION_MICRO 102
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
......
......@@ -44,13 +44,13 @@ typedef struct {
uint32_t *blocks_offset_table;
uint8_t *video_frame;
int video_size;
int video_size;
uint8_t *audio_frame;
uint8_t *temp_audio_frame;
int audio_size;
int audio_size;
int got_audio;
int got_audio;
} PAFDemuxContext;
static int read_probe(AVProbeData *p)
......@@ -87,10 +87,10 @@ static void read_table(AVFormatContext *s, uint32_t *table, uint32_t count)
static int read_header(AVFormatContext *s)
{
PAFDemuxContext *p = s->priv_data;
PAFDemuxContext *p = s->priv_data;
AVIOContext *pb = s->pb;
AVStream *ast, *vst;
int ret = 0;
int ret = 0;
avio_skip(pb, 132);
......@@ -101,11 +101,13 @@ static int read_header(AVFormatContext *s)
vst->start_time = 0;
vst->nb_frames =
vst->duration =
p->nb_frames = avio_rl32(pb);
p->nb_frames = avio_rl32(pb);
avio_skip(pb, 4);
vst->codec->width = avio_rl32(pb);
vst->codec->height = avio_rl32(pb);
avio_skip(pb, 4);
vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
vst->codec->codec_tag = 0;
vst->codec->codec_id = AV_CODEC_ID_PAF_VIDEO;
......@@ -115,13 +117,13 @@ static int read_header(AVFormatContext *s)
if (!ast)
return AVERROR(ENOMEM);
ast->start_time = 0;
ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
ast->codec->codec_tag = 0;
ast->codec->codec_id = AV_CODEC_ID_PAF_AUDIO;
ast->codec->channels = 2;
ast->start_time = 0;
ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
ast->codec->codec_tag = 0;
ast->codec->codec_id = AV_CODEC_ID_PAF_AUDIO;
ast->codec->channels = 2;
ast->codec->channel_layout = AV_CH_LAYOUT_STEREO;
ast->codec->sample_rate = 22050;
ast->codec->sample_rate = 22050;
avpriv_set_pts_info(ast, 64, 1, 22050);
p->buffer_size = avio_rl32(pb);
......@@ -143,16 +145,19 @@ static int read_header(AVFormatContext *s)
p->frame_blks > INT_MAX / sizeof(uint32_t))
return AVERROR_INVALIDDATA;
p->blocks_count_table = av_mallocz(p->nb_frames * sizeof(uint32_t));
p->frames_offset_table = av_mallocz(p->nb_frames * sizeof(uint32_t));
p->blocks_offset_table = av_mallocz(p->frame_blks * sizeof(uint32_t));
p->blocks_count_table = av_mallocz(p->nb_frames *
sizeof(*p->blocks_count_table));
p->frames_offset_table = av_mallocz(p->nb_frames *
sizeof(*p->frames_offset_table));
p->blocks_offset_table = av_mallocz(p->frame_blks *
sizeof(*p->blocks_offset_table));
p->video_size = p->max_video_blks * p->buffer_size;
p->video_frame = av_mallocz(p->video_size);
p->video_size = p->max_video_blks * p->buffer_size;
p->video_frame = av_mallocz(p->video_size);
p->audio_size = p->max_audio_blks * p->buffer_size;
p->audio_frame = av_mallocz(p->audio_size);
p->temp_audio_frame = av_mallocz(p->audio_size);
p->audio_size = p->max_audio_blks * p->buffer_size;
p->audio_frame = av_mallocz(p->audio_size);
p->temp_audio_frame = av_mallocz(p->audio_size);
if (!p->blocks_count_table ||
!p->frames_offset_table ||
......@@ -186,7 +191,7 @@ fail:
static int read_packet(AVFormatContext *s, AVPacket *pkt)
{
PAFDemuxContext *p = s->priv_data;
PAFDemuxContext *p = s->priv_data;
AVIOContext *pb = s->pb;
uint32_t count, offset;
int size, i;
......@@ -209,7 +214,8 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
return pkt->size;
}
count = (p->current_frame == 0) ? p->preload_count : p->blocks_count_table[p->current_frame - 1];
count = (p->current_frame == 0) ? p->preload_count
: p->blocks_count_table[p->current_frame - 1];
for (i = 0; i < count; i++) {
if (p->current_frame_block >= p->frame_blks)
return AVERROR_INVALIDDATA;
......@@ -245,7 +251,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
pkt->duration = 1;
memcpy(pkt->data, p->video_frame + p->frames_offset_table[p->current_frame], size);
if (pkt->data[0] & 0x20)
pkt->flags |= AV_PKT_FLAG_KEY;
pkt->flags |= AV_PKT_FLAG_KEY;
p->current_frame++;
return pkt->size;
......
......@@ -31,7 +31,7 @@
#define LIBAVFORMAT_VERSION_MAJOR 55
#define LIBAVFORMAT_VERSION_MINOR 35
#define LIBAVFORMAT_VERSION_MICRO 101
#define LIBAVFORMAT_VERSION_MICRO 102
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment