FFmpeg: libavformat/tiertexseq.c Source File
Go to the documentation of this file. 1 /*
2 * Tiertex Limited SEQ File Demuxer
3 * Copyright (c) 2006 Gregory Montoir (cyx@users.sourceforge.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 * Tiertex Limited SEQ file demuxer
25 */
26
31
32 #define SEQ_FRAME_SIZE 6144
33 #define SEQ_FRAME_W 256
34 #define SEQ_FRAME_H 128
35 #define SEQ_NUM_FRAME_BUFFERS 30
36 #define SEQ_AUDIO_BUFFER_SIZE 882
37 #define SEQ_SAMPLE_RATE 22050
38 #define SEQ_FRAME_RATE 25
39
40
46
62
63
65 {
67
69 return 0;
70
71 /* there's no real header in a .seq file, the only thing they have in common */
72 /* is the first 256 bytes of the file which are always filled with 0 */
73 for (
i = 0;
i < 256;
i++)
75 return 0;
76
77 if(p->
buf[256]==0 && p->
buf[257]==0)
78 return 0;
79
80 /* only one fourth of the score since the previous check is too naive */
82 }
83
85 {
88
90
93 if (sz == 0)
94 break;
95 else {
100 if (!seq_buffer->
data)
102 }
103 }
105 return 0;
106 }
107
109 {
111
114
118
122
124 return 0;
125 }
126
128 {
132
135
136 /* sound data */
140 } else {
142 }
143
144 /* palette data */
148 } else {
150 }
151
152 /* video data */
153 for (
i = 0;
i < 4;
i++)
155
156 for (
i = 0;
i < 4;
i++)
158
159 for (
i = 0;
i < 3;
i++) {
165 if (err)
166 return err;
167 }
168 }
169
170 if (buffer_num[0] != 255) {
173
178 } else {
181 }
182
183 return 0;
184 }
185
187 {
190
193
194 return 0;
195 }
196
198 {
203
204 /* init internal buffers */
206 if (rc < 0)
207 return rc;
208
210
211 /* preload (no audio data, just buffer operations related data) */
212 for (
i = 1;
i <= 100;
i++) {
214 if (rc < 0)
215 return rc;
216 }
217
219
221
222 /* initialize the video decoder stream */
224 if (!st)
226
234
235 /* initialize the audio decoder stream */
237 if (!st)
239
251
252 return 0;
253 }
254
256 {
257 int rc;
260
263 if (rc)
264 return rc;
265
266 /* video packet */
270 if (rc < 0)
271 return rc;
272
279 }
285 }
288
289 /* sound buffer will be processed on next read_packet() call */
291 return 0;
292 }
293 }
294
295 /* audio packet */
298
301 if (rc < 0)
302 return rc;
303
306
308 return 0;
309 }
310
312 .
p.
name =
"tiertexseq",
320 };
static int seq_probe(const AVProbeData *p)
Filter the word "frame" indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
static int seq_read_packet(AVFormatContext *s, AVPacket *pkt)
enum AVMediaType codec_type
General type of the encoded data.
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
uint32_t codec_tag
Additional information about the codec (corresponds to the AVI FOURCC).
int buf_size
Size of buf except extra allocated bytes.
static int seq_read_close(AVFormatContext *s)
int nb_channels
Number of channels in this layout.
unsigned int current_audio_data_offs
static av_cold int read_close(AVFormatContext *ctx)
unsigned int avio_rl16(AVIOContext *s)
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
@ AV_CODEC_ID_TIERTEXSEQVIDEO
#define FF_INFMT_FLAG_INIT_CLEANUP
For an FFInputFormat with this flag set read_close() needs to be called by the caller upon read_heade...
AVCodecParameters * codecpar
Codec parameters associated with this stream.
static int read_header(FFV1Context *f)
static int seq_read_header(AVFormatContext *s)
This structure contains the data a format has to probe a file.
AVChannelLayout ch_layout
Audio only.
int sample_rate
Audio only.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
An AVChannelLayout holds information about the channel layout of audio data.
static int seq_init_frame_buffers(SeqDemuxContext *seq, AVIOContext *pb)
#define SEQ_AUDIO_BUFFER_SIZE
int avio_r8(AVIOContext *s)
const FFInputFormat ff_tiertexseq_demuxer
static const uint8_t offset_table[]
unsigned int current_video_data_size
#define i(width, name, range_min, range_max)
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
int block_align
Audio only.
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
static int seq_parse_frame_data(SeqDemuxContext *seq, AVIOContext *pb)
#define SEQ_NUM_FRAME_BUFFERS
unsigned int current_pal_data_offs
unsigned char * current_video_data_ptr
int index
stream index in AVFormatContext
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
TiertexSeqFrameBuffer frame_buffers[SEQ_NUM_FRAME_BUFFERS]
static int read_probe(const AVProbeData *p)
int bits_per_coded_sample
The number of bits per sample in the codedwords.
#define AV_CHANNEL_LAYOUT_MONO
static int seq_fill_buffer(SeqDemuxContext *seq, AVIOContext *pb, int buffer_num, unsigned int data_offs, int data_size)
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
This structure stores compressed data.
unsigned int current_audio_data_size
int64_t bit_rate
The average bitrate of the encoded data (in bits per second).
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
int64_t start_time
Decoding: pts of the first frame of the stream in presentation order, in stream time base.
unsigned int current_pal_data_size
Generated on Thu Sep 26 2024 23:15:52 for FFmpeg by
doxygen
1.8.17