[FFmpeg-devel] [PATCH] ISS-Funcom Demuxer

Michael Niedermayer michaelni
Sun Apr 6 01:16:40 CEST 2008


On Sun, Apr 06, 2008 at 12:44:33AM +0530, Jai Menon wrote:
> Hi,
> 
> Saw this on the "small tasks" page. I think this quick patch should do it.
[...]

> +typedef struct {
> +    uint16_t packet_size;
> +    uint32_t audio_frame_count;
> +} IssDemuxContext;

These dont need fixed bitsizes thus uintXY_t is inappropriate.


> +static int iss_probe(AVProbeData *p)
> +{
> +    const uint8_t *d = p->buf;
> +
> +    if (strncmp(d, ISS_SIG, ISS_SIG_LEN))
> +        return 0;

The variable is uneeded.


[
> +    get_strz(pb, header, MAX_HEADER_SIZE);

sizeof(header)


> +    sscanf(&header[ISS_SIG_LEN + 1], "%d", &iss->packet_size);
> +
> +    get_strz(pb, header, MAX_HEADER_SIZE);
> +    sscanf(header, " %ld %d %d %d %d %s %ld ", &out_size, &stereo, &temp, &rate_divisor, &temp, tempstr, &stream_size);

buggy


> +
> +    url_fskip(pb, 4);
> +    st = av_new_stream(s, 0);
> +    if (!st)
> +        return AVERROR(ENOMEM);
> +    st->codec->codec_type = CODEC_TYPE_AUDIO;
> +    st->codec->codec_id = CODEC_ID_ADPCM_IMA_WS;

> +    st->codec->codec_tag = 0;

unneeded


> +    st->codec->channels = stereo ? 2 : 1;
> +    st->codec->sample_rate = 44100 / rate_divisor;
> +    st->codec->bits_per_sample = 8;
> +    st->codec->bit_rate = st->codec->channels * st->codec->sample_rate * st->codec->bits_per_sample;

this looks wrong


> +    st->codec->block_align = st->codec->channels * st->codec->bits_per_sample;

i doubt this is correct


[...]
> +static int iss_read_packet(AVFormatContext *s,
> +                           AVPacket *pkt)
> +{
> +    IssDemuxContext *iss = s->priv_data;
> +    ByteIOContext *pb = s->pb;

> +    int ret;
> +
> +    if((ret = av_get_packet(pb, pkt, iss->packet_size)) < 0)
> +        return AVERROR(EIO);

int ret= av_get_packet(pb, pkt, iss->packet_size);

if(ret < 0)
    return ret;


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Concerning the gods, I have no means of knowing whether they exist or not
or of what sort they may be, because of the obscurity of the subject, and
the brevity of human life -- Protagoras
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080406/1d3e27d3/attachment.pgp>



More information about the ffmpeg-devel mailing list