/*
* Beam Software SIFF demuxer
- * Copyright (c) 2007 Konstantin Shishkov.
+ * Copyright (c) 2007 Konstantin Shishkov
*
* This file is part of FFmpeg.
*
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/intreadwrite.h"
#include "avformat.h"
-#include "riff.h"
enum SIFFTags{
TAG_SIFF = MKTAG('S', 'I', 'F', 'F'),
static int siff_probe(AVProbeData *p)
{
+ uint32_t tag = AV_RL32(p->buf + 8);
/* check file header */
- if (AV_RL32(p->buf) == TAG_SIFF)
- return AVPROBE_SCORE_MAX;
- else
+ if (AV_RL32(p->buf) != TAG_SIFF ||
+ (tag != TAG_VBV1 && tag != TAG_SOUN))
return 0;
+ return AVPROBE_SCORE_MAX;
}
static int create_audio_stream(AVFormatContext *s, SIFFContext *c)
ast->codec->codec_type = CODEC_TYPE_AUDIO;
ast->codec->codec_id = CODEC_ID_PCM_U8;
ast->codec->channels = 1;
- ast->codec->bits_per_sample = c->bits;
+ ast->codec->bits_per_coded_sample = c->bits;
ast->codec->sample_rate = c->rate;
ast->codec->frame_size = c->block_align;
av_set_pts_info(ast, 16, 1, c->rate);
static int siff_read_header(AVFormatContext *s, AVFormatParameters *ap)
{
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
SIFFContext *c = s->priv_data;
uint32_t tag;
static int siff_read_packet(AVFormatContext *s, AVPacket *pkt)
{
SIFFContext *c = s->priv_data;
- int size, size2;
- uint8_t *snddata;
+ int size;
if (c->has_video){
if (c->cur_frame >= c->frames)
return AVERROR(EIO);
if (c->curstrm == -1){
- c->pktsize = get_le32(&s->pb) - 4;
- c->flags = get_le16(&s->pb);
+ c->pktsize = get_le32(s->pb) - 4;
+ c->flags = get_le16(s->pb);
c->gmcsize = (c->flags & VB_HAS_GMC) ? 4 : 0;
if (c->gmcsize)
- get_buffer(&s->pb, c->gmc, c->gmcsize);
- c->sndsize = (c->flags & VB_HAS_AUDIO) ? get_le32(&s->pb): 0;
+ get_buffer(s->pb, c->gmc, c->gmcsize);
+ c->sndsize = (c->flags & VB_HAS_AUDIO) ? get_le32(s->pb): 0;
c->curstrm = !!(c->flags & VB_HAS_AUDIO);
}
AV_WL16(pkt->data, c->flags);
if (c->gmcsize)
memcpy(pkt->data + 2, c->gmc, c->gmcsize);
- get_buffer(&s->pb, pkt->data + 2 + c->gmcsize, size - c->gmcsize - 2);
+ get_buffer(s->pb, pkt->data + 2 + c->gmcsize, size - c->gmcsize - 2);
pkt->stream_index = 0;
c->curstrm = -1;
}else{
- if (av_get_packet(&s->pb, pkt, c->sndsize - 4) < 0)
+ if (av_get_packet(s->pb, pkt, c->sndsize - 4) < 0)
return AVERROR(EIO);
pkt->stream_index = 1;
c->curstrm = 0;
if (c->curstrm == -1)
c->cur_frame++;
}else{
- size = av_get_packet(&s->pb, pkt, c->block_align);
+ size = av_get_packet(s->pb, pkt, c->block_align);
if(size <= 0)
return AVERROR(EIO);
}
AVInputFormat siff_demuxer = {
"siff",
- "Beam Software SIFF",
+ NULL_IF_CONFIG_SMALL("Beam Software SIFF"),
sizeof(SIFFContext),
siff_probe,
siff_read_header,