1 /*
2 * Tele-typewriter demuxer
3 * Copyright (c) 2010 Peter Ross <pross@xvid.org>
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 * Tele-typewriter demuxer
25 */
26
36
40 uint64_t
fsize;
/**< file size less metadata buffer */
44
45 /**
46 * Parse EFI header
47 */
49 {
54
57 return -1;
58
59 #define GET_EFI_META(name,size) \
60 len = avio_r8(pb); \
61 if (len < 1 || len > size) \
62 return -1; \
63 if (avio_read(pb, buf, size) == size) { \
64 buf[len] = 0; \
65 av_dict_set(&avctx->metadata, name, buf, 0); \
66 }
67
70
72 return 0;
73 }
74
76 {
78 int ret = 0;
80
81 if (!st) {
84 }
88
93
94 /* simulate tty display speed */
96
100
103
105 }
106
108 return ret;
109 }
110
112 {
115
118
121 // ignore metadata buffer
127 }
128
133 return 0;
134 }
135
136 #define OFFSET(x) offsetof(TtyDemuxContext, x)
137 #define DEC AV_OPT_FLAG_DECODING_PARAM
143 };
144
150 };
151
158 .extensions = "ans,art,asc,diz,ice,nfo,txt,vt",
159 .priv_class = &tty_demuxer_class,
160 };
int64_t avio_size(AVIOContext *s)
Get the filesize.
#define LIBAVUTIL_VERSION_INT
uint64_t fsize
file size less metadata buffer
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
AVRational framerate
Set by a private option.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
static double av_q2d(AVRational a)
Convert an AVRational to a double.
#define AVERROR_EOF
End of file.
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
#define GET_EFI_META(name, size)
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
int height
Set by a private option.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
int ff_sauce_read(AVFormatContext *avctx, uint64_t *fsize, int *got_width, int get_height)
enum AVMediaType codec_type
General type of the encoded data.
static const AVOption options[]
AVRational avg_frame_rate
Average framerate.
int flags
A combination of AV_PKT_FLAG values.
int avio_r8(AVIOContext *s)
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
static int read_header(AVFormatContext *avctx)
#define AVIO_SEEKABLE_NORMAL
Seeking works like for a local file.
static const AVClass tty_demuxer_class
AVIOContext * pb
I/O context.
AVInputFormat ff_tty_demuxer
Describe the class of an AVClass context structure.
Rational number (pair of numerator and denominator).
#define AV_OPT_FLAG_DECODING_PARAM
a generic parameter which can be set by the user for demuxing or decoding
offset must point to AVRational
offset must point to two consecutive integers
int64_t duration
Decoding: duration of the stream, in stream time base.
static int efi_read(AVFormatContext *avctx, uint64_t start_pos)
Parse EFI header.
void * priv_data
Format private data.
AVCodecParameters * codecpar
int avio_feof(AVIOContext *s)
feof() equivalent for AVIOContext.
uint32_t codec_tag
Additional information about the codec (corresponds to the AVI FOURCC).
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
This structure stores compressed data.
static int read_packet(AVFormatContext *avctx, AVPacket *pkt)