1 /*
2 * Interplay C93 demuxer
3 * Copyright (c) 2007 Anssi Hannula <anssi.hannula@gmail.com>
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
26
32
35
38
42
45
47 {
48 int i;
51 return 0;
52 for (i = 0; i < 16; i += 4) {
54 return 0;
55 index += p->
buf[i + 2];
56 }
58 }
59
61 {
65 int i;
66 int framecount = 0;
67
68 for (i = 0; i < 512; i++) {
75 }
77 }
78
79 /* Audio streams are added if audio packets are found */
81
83 if (!video)
85
90 /* 4:3 320x200 with 8 empty lines */
96
100 return 0;
101 }
102
103 #define C93_HAS_PALETTE 0x01
104 #define C93_FIRST_FRAME 0x02
105
107 {
111 int datasize;
112 int ret, i;
113
118 if (datasize > 42) {
124 }
127 if (ret > 0) {
130 return ret;
131 }
132 }
133 }
137 br++;
140 }
141
144 for (i = 0; i < 32; i++) {
146 }
147 }
148
151 datasize =
avio_rl16(pb);
/* video frame size */
152
154 if (ret < 0)
155 return ret;
157 pkt->
size = datasize + 1;
158
160 if (ret < datasize) {
163 }
164
165 datasize =
avio_rl16(pb);
/* palette size */
166 if (datasize) {
167 if (datasize != 768) {
171 }
174 if (ret < datasize) {
177 }
179 }
182
183 /* only the first frame is guaranteed to not reference previous frames */
187 }
188 return 0;
189
192 return ret;
193 }
194
202 };
uint32_t frame_offsets[32]
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
int ff_voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size)
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
int ctx_flags
Flags signalling stream properties.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_RL16
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
#define AVERROR_EOF
End of file.
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
unsigned int avio_rl32(AVIOContext *s)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
enum AVMediaType codec_type
General type of the encoded data.
int flags
A combination of AV_PKT_FLAG values.
int avio_r8(AVIOContext *s)
int buf_size
Size of buf except extra allocated bytes.
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
C93BlockRecord block_records[512]
AVIOContext * pb
I/O context.
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
Rational number (pair of numerator and denominator).
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)
int64_t start_time
Decoding: pts of the first frame of the stream in presentation order, in stream time base...
int64_t nb_frames
number of frames in this stream if known or 0
void * priv_data
Format private data.
AVCodecParameters * codecpar
This structure stores compressed data.