1 /*
2 * FSB demuxer
3 * Copyright (c) 2015 Paul B Mahol
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
27
29 {
30 if (memcmp(p->
buf,
"FSB", 3) || p->
buf[3] -
'0' < 1 || p->
buf[3] -
'0' > 5)
31 return 0;
33 return 0;
35 }
36
38 {
44
47 if (version != 4 && version != 3) {
50 }
51
53
54 if (!st)
59
60 if (version == 3) {
73
74 if (format & 0x00000100) {
77 } else if (format & 0x00400000) {
81 } else if (format & 0x00800000) {
84 } else if (format & 0x02000000) {
93 for (c = 0; c < codec->
channels; c++) {
96 }
97 } else {
100 }
101 } else if (version == 4) {
105
107 switch(format) {
108 case 0x40001001:
109 case 0x00001005:
110 case 0x40001081:
111 case 0x40200001:
113 break;
114 case 0x40000802:
116 break;
117 default:
120 }
121
126
130
138 break;
146 for (c = 0; c < codec->
channels; c++) {
149 }
151 break;
152 }
153 } else {
155 }
156
159
161
162 return 0;
163 }
164
166 {
168 int64_t pos;
169 int ret;
170
173
177 int i, ch;
178
180 if (ret < 0)
181 return ret;
182 for (i = 0; i < 4; i++) {
183 for (ch = 0; ch < codec->
channels; ch++) {
186 }
187 }
188 ret = 0;
189 } else {
191 }
192
195
198
199 return ret;
200 }
201
208 .extensions = "fsb",
210 };
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
int64_t pos
byte position in stream, -1 if unknown
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
AVFormatInternal * internal
An opaque field for libavformat internal usage.
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
int block_align
number of bytes per packet if constant and known or 0 Used by some WAV based audio codecs...
#define av_assert0(cond)
assert() equivalent, that is always enabled.
void void avpriv_request_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
unsigned int avio_rb32(AVIOContext *s)
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
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.
#define AVERROR_EOF
End of file.
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).
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
unsigned int avio_rl32(AVIOContext *s)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
simple assert() macros that are a bit more flexible than ISO C assert().
static const uint8_t offset[127][2]
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.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
enum AVMediaType codec_type
int sample_rate
samples per second
AVIOContext * pb
I/O context.
main external API structure.
static const char * format
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
static int fsb_read_packet(AVFormatContext *s, AVPacket *pkt)
static int fsb_probe(AVProbeData *p)
This structure contains the data a format has to probe a file.
int64_t duration
Decoding: duration of the stream, in stream time base.
unsigned int avio_rl16(AVIOContext *s)
static int fsb_read_header(AVFormatContext *s)
int channels
number of audio channels
AVInputFormat ff_fsb_demuxer
int avio_feof(AVIOContext *s)
feof() equivalent for AVIOContext.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
This structure stores compressed data.