1 /*
2 * Copyright (c) 2009 Michael Niedermayer
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
23
24
26 {
27 // the single file I have starts with that, I do not know if others do, too
34 )
36
37 return 0;
38 }
39
41 {
43
45 if (!st)
47
52
53 return 0;
54
55 }
56
58 {
60 int first_pkt = 0;
61 int frame_complete = 0;
62
63 while (!frame_complete) {
64
67 flags =
avio_rb16(s->
pb);
//some flags, 0x80 indicates end of frame
71
72 frame_complete = flags & 0x80;
73
74 size -= 12;
75 if (size < 1)
76 return -1;
77
78 if (type == 258) {
80 frame_complete = 0;
81 continue;
82 }
83
84 if (!first_pkt) {
86 if (ret < 0)
87 return ret;
88 first_pkt = 1;
91 } else {
93 if (ret < 0) {
96 return ret;
97 }
98 }
99 if (ret < size) {
101 ret, size);
103 break;
104 }
105 }
107
108 return 0;
109 }
110
118 };
int64_t pos
byte position in stream, -1 if unknown
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
unsigned int avio_rb16(AVIOContext *s)
static int read_packet(AVFormatContext *s, AVPacket *pkt)
static int read_header(AVFormatContext *s)
unsigned int avio_rb32(AVIOContext *s)
enum AVStreamParseType need_parsing
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
#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. ...
enum AVMediaType codec_type
General type of the encoded data.
int flags
A combination of AV_PKT_FLAG values.
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
AVIOContext * pb
I/O context.
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
AVInputFormat ff_iv8_demuxer
This structure contains the data a format has to probe a file.
#define AV_PKT_FLAG_CORRUPT
The packet content is corrupted.
static int probe(AVProbeData *p)
AVCodecParameters * codecpar
Codec parameters associated with this stream.
This structure stores compressed data.
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...