[FFmpeg-devel] [PATCH] avcodec: add ATRAC Advanced Lossless decoders
Paul B Mahol
onemda at gmail.com
Tue Jan 31 17:17:19 EET 2017
On 1/31/17, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Sun, Jan 29, 2017 at 06:39:21PM +0100, Paul B Mahol wrote:
>> Only lossy part is decoded for now.
>>
>> Signed-off-by: Paul B Mahol <onemda at gmail.com>
>> ---
> [...]
>> static int oma_read_packet(AVFormatContext *s, AVPacket *pkt)
>> {
>> OMAContext *oc = s->priv_data;
>> - AVStream *st = s->streams[0];
>> - int packet_size = st->codecpar->block_align;
>> - int byte_rate = st->codecpar->bit_rate >> 3;
>> - int64_t pos = avio_tell(s->pb);
>> - int ret = av_get_packet(s->pb, pkt, packet_size);
>> -
>> - if (ret < packet_size)
>> - pkt->flags |= AV_PKT_FLAG_CORRUPT;
>> -
>> - if (ret < 0)
>> - return ret;
>> - if (!ret)
>> - return AVERROR_EOF;
>> -
>> - pkt->stream_index = 0;
>> -
>> - if (pos >= oc->content_start && byte_rate > 0) {
>> - pkt->pts =
>> - pkt->dts = av_rescale(pos - oc->content_start,
>> st->time_base.den,
>> - byte_rate * (int64_t)st->time_base.num);
>> - }
>> -
>> - if (oc->encrypted) {
>> - /* previous unencrypted block saved in IV for
>> - * the next packet (CBC mode) */
>> - if (ret == packet_size)
>> - av_des_crypt(oc->av_des, pkt->data, pkt->data,
>> - (packet_size >> 3), oc->iv, 1);
>> - else
>> - memset(oc->iv, 0, 8);
>> - }
>> -
>> - return ret;
>> + return oc->read_packet(s, pkt);
>> }
>
> moving this into read_packet() could be done in a seperate patch
>
>
>>
>> static int oma_read_probe(AVProbeData *p)
>> @@ -491,8 +571,14 @@ static int oma_read_seek(struct AVFormatContext *s,
>> int stream_index, int64_t timestamp, int flags)
>> {
>> OMAContext *oc = s->priv_data;
>> - int64_t err = ff_pcm_read_seek(s, stream_index, timestamp, flags);
>> + AVStream *st = s->streams[0];
>> + int64_t err;
>> +
>> + if (st->codecpar->codec_id == AV_CODEC_ID_ATRAC3PAL ||
>> + st->codecpar->codec_id == AV_CODEC_ID_ATRAC3AL)
>
>> + return -1;
>
> should be a AVERROR code
This is not error, it makes seeking possible, using other error codes
is bad idea.
>
>
> thanks
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Those who would give up essential Liberty, to purchase a little
> temporary Safety, deserve neither Liberty nor Safety -- Benjamin Franklin
>
More information about the ffmpeg-devel
mailing list