X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Fcafdec.c;h=4489eb26b2c982331664fa38a7a598a2f168c6d0;hb=8b2e9636c57b22582143467a8a06b509b47b92f9;hp=965ca5c91eeac557763b5eee69a5bb6cd8933439;hpb=0177b7d23aadeab218601893953f0a05209d037c;p=ffmpeg diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c index 965ca5c91ee..4489eb26b2c 100644 --- a/libavformat/cafdec.c +++ b/libavformat/cafdec.c @@ -25,9 +25,10 @@ * Core Audio Format demuxer */ +#include + #include "avformat.h" #include "internal.h" -#include "riff.h" #include "isom.h" #include "mov_chan.h" #include "libavutil/intreadwrite.h" @@ -45,7 +46,7 @@ typedef struct { int64_t data_start; ///< data start position, in bytes int64_t data_size; ///< raw data size, in bytes -} CaffContext; +} CafContext; static int probe(AVProbeData *p) { @@ -58,7 +59,7 @@ static int probe(AVProbeData *p) static int read_desc_chunk(AVFormatContext *s) { AVIOContext *pb = s->pb; - CaffContext *caf = s->priv_data; + CafContext *caf = s->priv_data; AVStream *st; int flags; @@ -103,23 +104,22 @@ static int read_kuki_chunk(AVFormatContext *s, int64_t size) if (size < 0 || size > INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE) return -1; - if (st->codec->codec_id == CODEC_ID_AAC) { + if (st->codec->codec_id == AV_CODEC_ID_AAC) { /* The magic cookie format for AAC is an mp4 esds atom. The lavc AAC decoder requires the data from the codec specific description as extradata input. */ int strt, skip; - MOVAtom atom; strt = avio_tell(pb); - ff_mov_read_esds(s, pb, atom); + ff_mov_read_esds(s, pb); skip = size - (avio_tell(pb) - strt); if (skip < 0 || !st->codec->extradata || - st->codec->codec_id != CODEC_ID_AAC) { + st->codec->codec_id != AV_CODEC_ID_AAC) { av_log(s, AV_LOG_ERROR, "invalid AAC magic cookie\n"); return AVERROR_INVALIDDATA; } avio_skip(pb, skip); - } else if (st->codec->codec_id == CODEC_ID_ALAC) { + } else if (st->codec->codec_id == AV_CODEC_ID_ALAC) { #define ALAC_PREAMBLE 12 #define ALAC_HEADER 36 #define ALAC_NEW_KUKI 24 @@ -172,7 +172,7 @@ static int read_pakt_chunk(AVFormatContext *s, int64_t size) { AVIOContext *pb = s->pb; AVStream *st = s->streams[0]; - CaffContext *caf = s->priv_data; + CafContext *caf = s->priv_data; int64_t pos = 0, ccount, num_packets; int i; @@ -221,7 +221,7 @@ static void read_info_chunk(AVFormatContext *s, int64_t size) static int read_header(AVFormatContext *s) { AVIOContext *pb = s->pb; - CaffContext *caf = s->priv_data; + CafContext *caf = s->priv_data; AVStream *st; uint32_t tag = 0; int found_data, ret; @@ -268,7 +268,7 @@ static int read_header(AVFormatContext *s) break; case MKBETAG('c','h','a','n'): - if ((ret = ff_mov_read_chan(s, st, size)) < 0) + if ((ret = ff_mov_read_chan(s, s->pb, st, size)) < 0) return ret; break; @@ -290,7 +290,8 @@ static int read_header(AVFormatContext *s) default: #define _(x) ((x) >= ' ' ? (x) : ' ') - av_log(s, AV_LOG_WARNING, "skipping CAF chunk: %08X (%c%c%c%c)\n", + av_log(s, AV_LOG_WARNING, + "skipping CAF chunk: %08"PRIX32" (%"PRIu32"%"PRIu32"%"PRIu32"%"PRIu32")\n", tag, _(tag>>24), _((tag>>16)&0xFF), _((tag>>8)&0xFF), _(tag&0xFF)); #undef _ case MKBETAG('f','r','e','e'): @@ -332,7 +333,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) { AVIOContext *pb = s->pb; AVStream *st = s->streams[0]; - CaffContext *caf = s->priv_data; + CafContext *caf = s->priv_data; int res, pkt_size = 0, pkt_frames = 0; int64_t left = CAF_MAX_PKT_SIZE; @@ -386,7 +387,7 @@ static int read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags) { AVStream *st = s->streams[0]; - CaffContext *caf = s->priv_data; + CafContext *caf = s->priv_data; int64_t pos, packet_cnt, frame_cnt; timestamp = FFMAX(timestamp, 0); @@ -418,7 +419,7 @@ static int read_seek(AVFormatContext *s, int stream_index, AVInputFormat ff_caf_demuxer = { .name = "caf", .long_name = NULL_IF_CONFIG_SMALL("Apple CAF (Core Audio Format)"), - .priv_data_size = sizeof(CaffContext), + .priv_data_size = sizeof(CafContext), .read_probe = probe, .read_header = read_header, .read_packet = read_packet,