diff options
Diffstat (limited to 'libavformat/cafdec.c')
-rw-r--r-- | libavformat/cafdec.c | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c index 36c39678d1..65bdcfc1ef 100644 --- a/libavformat/cafdec.c +++ b/libavformat/cafdec.c @@ -69,29 +69,29 @@ static int read_desc_chunk(AVFormatContext *s) return AVERROR(ENOMEM); /* parse format description */ - st->codec->codec_type = AVMEDIA_TYPE_AUDIO; - st->codec->sample_rate = av_int2double(avio_rb64(pb)); - st->codec->codec_tag = avio_rb32(pb); + st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; + st->codecpar->sample_rate = av_int2double(avio_rb64(pb)); + st->codecpar->codec_tag = avio_rb32(pb); flags = avio_rb32(pb); caf->bytes_per_packet = avio_rb32(pb); - st->codec->block_align = caf->bytes_per_packet; + st->codecpar->block_align = caf->bytes_per_packet; caf->frames_per_packet = avio_rb32(pb); - st->codec->channels = avio_rb32(pb); - st->codec->bits_per_coded_sample = avio_rb32(pb); + st->codecpar->channels = avio_rb32(pb); + st->codecpar->bits_per_coded_sample = avio_rb32(pb); /* calculate bit rate for constant size packets */ if (caf->frames_per_packet > 0 && caf->bytes_per_packet > 0) { - st->codec->bit_rate = (uint64_t)st->codec->sample_rate * (uint64_t)caf->bytes_per_packet * 8 - / (uint64_t)caf->frames_per_packet; + st->codecpar->bit_rate = (uint64_t)st->codecpar->sample_rate * (uint64_t)caf->bytes_per_packet * 8 + / (uint64_t)caf->frames_per_packet; } else { - st->codec->bit_rate = 0; + st->codecpar->bit_rate = 0; } /* determine codec */ - if (st->codec->codec_tag == MKBETAG('l','p','c','m')) - st->codec->codec_id = ff_mov_get_lpcm_codec_id(st->codec->bits_per_coded_sample, (flags ^ 0x2) | 0x4); + if (st->codecpar->codec_tag == MKBETAG('l','p','c','m')) + st->codecpar->codec_id = ff_mov_get_lpcm_codec_id(st->codecpar->bits_per_coded_sample, (flags ^ 0x2) | 0x4); else - st->codec->codec_id = ff_codec_get_id(ff_codec_caf_tags, st->codec->codec_tag); + st->codecpar->codec_id = ff_codec_get_id(ff_codec_caf_tags, st->codecpar->codec_tag); return 0; } @@ -104,7 +104,7 @@ static int read_kuki_chunk(AVFormatContext *s, int64_t size) if (size < 0 || size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE) return -1; - if (st->codec->codec_id == AV_CODEC_ID_AAC) { + if (st->codecpar->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. */ @@ -113,13 +113,13 @@ static int read_kuki_chunk(AVFormatContext *s, int64_t size) strt = avio_tell(pb); ff_mov_read_esds(s, pb); skip = size - (avio_tell(pb) - strt); - if (skip < 0 || !st->codec->extradata || - st->codec->codec_id != AV_CODEC_ID_AAC) { + if (skip < 0 || !st->codecpar->extradata || + st->codecpar->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 == AV_CODEC_ID_ALAC) { + } else if (st->codecpar->codec_id == AV_CODEC_ID_ALAC) { #define ALAC_PREAMBLE 12 #define ALAC_HEADER 36 #define ALAC_NEW_KUKI 24 @@ -131,8 +131,8 @@ static int read_kuki_chunk(AVFormatContext *s, int64_t size) } avio_read(pb, preamble, ALAC_PREAMBLE); - st->codec->extradata = av_mallocz(ALAC_HEADER + AV_INPUT_BUFFER_PADDING_SIZE); - if (!st->codec->extradata) + st->codecpar->extradata = av_mallocz(ALAC_HEADER + AV_INPUT_BUFFER_PADDING_SIZE); + if (!st->codecpar->extradata) return AVERROR(ENOMEM); /* For the old style cookie, we skip 12 bytes, then read 36 bytes. @@ -142,26 +142,26 @@ static int read_kuki_chunk(AVFormatContext *s, int64_t size) if (!memcmp(&preamble[4], "frmaalac", 8)) { if (size < ALAC_PREAMBLE + ALAC_HEADER) { av_log(s, AV_LOG_ERROR, "invalid ALAC magic cookie\n"); - av_freep(&st->codec->extradata); + av_freep(&st->codecpar->extradata); return AVERROR_INVALIDDATA; } - avio_read(pb, st->codec->extradata, ALAC_HEADER); + avio_read(pb, st->codecpar->extradata, ALAC_HEADER); avio_skip(pb, size - ALAC_PREAMBLE - ALAC_HEADER); } else { - AV_WB32(st->codec->extradata, 36); - memcpy(&st->codec->extradata[4], "alac", 4); - AV_WB32(&st->codec->extradata[8], 0); - memcpy(&st->codec->extradata[12], preamble, 12); - avio_read(pb, &st->codec->extradata[24], ALAC_NEW_KUKI - 12); + AV_WB32(st->codecpar->extradata, 36); + memcpy(&st->codecpar->extradata[4], "alac", 4); + AV_WB32(&st->codecpar->extradata[8], 0); + memcpy(&st->codecpar->extradata[12], preamble, 12); + avio_read(pb, &st->codecpar->extradata[24], ALAC_NEW_KUKI - 12); avio_skip(pb, size - ALAC_NEW_KUKI); } - st->codec->extradata_size = ALAC_HEADER; + st->codecpar->extradata_size = ALAC_HEADER; } else { - st->codec->extradata = av_mallocz(size + AV_INPUT_BUFFER_PADDING_SIZE); - if (!st->codec->extradata) + st->codecpar->extradata = av_mallocz(size + AV_INPUT_BUFFER_PADDING_SIZE); + if (!st->codecpar->extradata) return AVERROR(ENOMEM); - avio_read(pb, st->codec->extradata, size); - st->codec->extradata_size = size; + avio_read(pb, st->codecpar->extradata, size); + st->codecpar->extradata_size = size; } return 0; @@ -309,7 +309,7 @@ static int read_header(AVFormatContext *s) if (caf->data_size > 0) st->nb_frames = (caf->data_size / caf->bytes_per_packet) * caf->frames_per_packet; } else if (st->nb_index_entries) { - st->codec->bit_rate = st->codec->sample_rate * caf->data_size * 8 / + st->codecpar->bit_rate = st->codecpar->sample_rate * caf->data_size * 8 / st->duration; } else { av_log(s, AV_LOG_ERROR, "Missing packet table. It is required when " @@ -317,7 +317,7 @@ static int read_header(AVFormatContext *s) return AVERROR_INVALIDDATA; } - avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate); + avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate); st->start_time = 0; /* position the stream at the start of data */ |