1 /*
2 * ISS (.iss) file demuxer
3 * Copyright (c) 2008 Jaikrishnan Menon <realityman@gmx.net>
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 /**
23 * @file
24 * Funcom ISS file demuxer
25 * @author Jaikrishnan Menon
26 * @see http://wiki.multimedia.cx/index.php?title=FunCom_ISS
27 */
28
33
34 #define ISS_SIG "IMA_ADPCM_Sound"
35 #define ISS_SIG_LEN 15
36 #define MAX_TOKEN_SIZE 20
37
42
44 {
45 int i = 0;
47
49 if(c == ' ')
50 break;
51 if (i < maxlen-1)
53 }
54
55 if(!c)
57
58 buf[i] = 0; /* Ensure null terminated, but may be truncated */
59 }
60
62 {
64 return 0;
65
67 }
68
70 {
75 int stereo, rate_divisor;
76
77 get_token(pb, token,
sizeof(token));
//"IMA_ADPCM_Sound"
78 get_token(pb, token,
sizeof(token));
//packet size
82 }
83 get_token(pb, token,
sizeof(token));
//File ID
84 get_token(pb, token,
sizeof(token));
//out size
85 get_token(pb, token,
sizeof(token));
//stereo
86 if (sscanf(token, "%d", &stereo) != 1) {
89 }
90 get_token(pb, token,
sizeof(token));
//Unknown1
91 get_token(pb, token,
sizeof(token));
//RateDivisor
92 if (sscanf(token, "%d", &rate_divisor) != 1) {
95 }
96 get_token(pb, token,
sizeof(token));
//Unknown2
97 get_token(pb, token,
sizeof(token));
//Version ID
98 get_token(pb, token,
sizeof(token));
//Size
99
103 }
104
106
108 if (!st)
112 if (stereo) {
115 } else {
118 }
120 if(rate_divisor > 0)
127
128 return 0;
129 }
130
132 {
135
138
143 return 0;
144 }
145
153 };
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
AVInputFormat ff_iss_demuxer
int64_t bit_rate
the average bitrate
#define AV_CH_LAYOUT_STEREO
int block_align
number of bytes per packet if constant and known or 0 Used by some WAV based audio codecs...
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
AVStream ** streams
A list of all streams in the file.
static void get_token(AVIOContext *s, char *buf, int maxlen)
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static av_cold int iss_read_header(AVFormatContext *s)
uint64_t channel_layout
Audio channel layout.
int avio_r8(AVIOContext *s)
AVCodecContext * codec
Codec context associated with this stream.
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
audio channel layout utility functions
static int read_header(FFV1Context *f)
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
enum AVMediaType codec_type
int sample_rate
samples per second
AVIOContext * pb
I/O context.
This structure contains the data a format has to probe a file.
static int iss_probe(AVProbeData *p)
int channels
number of audio channels
void * priv_data
Format private data.
#define AV_CH_LAYOUT_MONO
static int iss_read_packet(AVFormatContext *s, AVPacket *pkt)
This structure stores compressed data.
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...