FFmpeg
bintext.c
Go to the documentation of this file.
1 /*
2  * Binary text demuxer
3  * eXtended BINary text (XBIN) demuxer
4  * Artworx Data Format demuxer
5  * iCEDraw File demuxer
6  * Copyright (c) 2010 Peter Ross <pross@xvid.org>
7  *
8  * This file is part of FFmpeg.
9  *
10  * FFmpeg is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free Software Foundation; either
13  * version 2.1 of the License, or (at your option) any later version.
14  *
15  * FFmpeg is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with FFmpeg; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23  */
24 
25 /**
26  * @file
27  * Binary text demuxer
28  * eXtended BINary text (XBIN) demuxer
29  * Artworx Data Format demuxer
30  * iCEDraw File demuxer
31  */
32 
33 #include "config_components.h"
34 
35 #include "libavutil/intreadwrite.h"
36 #include "libavutil/opt.h"
37 #include "libavutil/parseutils.h"
38 #include "avformat.h"
39 #include "demux.h"
40 #include "internal.h"
41 #include "sauce.h"
42 #include "libavcodec/bintext.h"
43 
44 typedef struct {
45  const AVClass *class;
46  int chars_per_frame; /**< characters to send decoder per frame;
47  set by private options as characters per second, and then
48  converted to characters per frame at runtime */
49  int width, height; /**< video size (WxH pixels) (private option) */
50  AVRational framerate; /**< frames per second (private option) */
51  uint64_t fsize; /**< file size less metadata buffer */
53 
55 {
56  BinDemuxContext *bin = s->priv_data;
58  if (!st)
59  return NULL;
60  st->codecpar->codec_tag = 0;
62 
63  if (!bin->width) {
64  st->codecpar->width = (80<<3);
65  st->codecpar->height = (25<<4);
66  }
67 
68  avpriv_set_pts_info(st, 60, bin->framerate.den, bin->framerate.num);
69 
70  /* simulate tty display speed */
71  bin->chars_per_frame = av_clip(av_q2d(st->time_base) * bin->chars_per_frame, 1, INT_MAX);
72 
73  return st;
74 }
75 
76 #if CONFIG_BINTEXT_DEMUXER | CONFIG_ADF_DEMUXER | CONFIG_IDF_DEMUXER
77 /**
78  * Given filesize and width, calculate height (assume font_height of 16)
79  */
80 static void calculate_height(AVCodecParameters *par, uint64_t fsize)
81 {
82  par->height = (fsize / ((par->width>>3)*2)) << 4;
83 }
84 #endif
85 
86 #if CONFIG_BINTEXT_DEMUXER
87 static const uint8_t next_magic[]={
88  0x1A, 0x1B, '[', '0', ';', '3', '0', ';', '4', '0', 'm', 'N', 'E', 'X', 'T', 0x00
89 };
90 
91 static int next_tag_read(AVFormatContext *avctx, uint64_t *fsize)
92 {
93  AVIOContext *pb = avctx->pb;
94  char buf[36];
95  int len;
96  int64_t start_pos = avio_size(pb);
97 
98  if (start_pos < 256)
99  return AVERROR_INVALIDDATA;
100 
101  avio_seek(pb, start_pos - 256, SEEK_SET);
102  if (avio_read(pb, buf, sizeof(next_magic)) != sizeof(next_magic))
103  return -1;
104  if (memcmp(buf, next_magic, sizeof(next_magic)))
105  return -1;
106  if (avio_r8(pb) != 0x01)
107  return -1;
108 
109  *fsize -= 256;
110 
111 #define GET_EFI2_META(name,size) \
112  len = avio_r8(pb); \
113  if (len < 1 || len > size) \
114  return -1; \
115  if (avio_read(pb, buf, size) == size && *buf) { \
116  buf[len] = 0; \
117  av_dict_set(&avctx->metadata, name, buf, 0); \
118  }
119 
120  GET_EFI2_META("filename", 12)
121  GET_EFI2_META("author", 20)
122  GET_EFI2_META("publisher", 20)
123  GET_EFI2_META("title", 35)
124 
125  return 0;
126 }
127 
128 static void predict_width(AVCodecParameters *par, uint64_t fsize, int got_width)
129 {
130  /** attempt to guess width */
131  if (!got_width)
132  par->width = fsize > 4000 ? (160<<3) : (80<<3);
133 }
134 
135 static int bin_probe(const AVProbeData *p)
136 {
137  const uint8_t *d = p->buf;
138  int magic = 0, sauce = 0;
139 
140  if (p->buf_size > 256)
141  magic = !memcmp(d + p->buf_size - 256, next_magic, sizeof(next_magic));
142  if (p->buf_size > 128)
143  sauce = !memcmp(d + p->buf_size - 128, "SAUCE00", 7);
144 
145  if (magic)
146  return AVPROBE_SCORE_EXTENSION + 1;
147 
148  if (av_match_ext(p->filename, "bin")) {
149  AVCodecParameters par;
150  int got_width = 0;
151  par.width = par.height = 0;
152  if (sauce)
153  return AVPROBE_SCORE_EXTENSION + 1;
154 
155  predict_width(&par, p->buf_size, got_width);
156  if (par.width < 8)
157  return 0;
158  calculate_height(&par, p->buf_size);
159  if (par.height <= 0)
160  return 0;
161 
162  if (par.width * par.height * 2 / (8*16) == p->buf_size)
163  return AVPROBE_SCORE_MAX / 2;
164  return 0;
165  }
166 
167  if (sauce)
168  return 1;
169 
170  return 0;
171 }
172 
173 
174 static int bintext_read_header(AVFormatContext *s)
175 {
176  BinDemuxContext *bin = s->priv_data;
177  AVIOContext *pb = s->pb;
178  int ret;
179  AVStream *st = init_stream(s);
180  if (!st)
181  return AVERROR(ENOMEM);
183 
184  if ((ret = ff_alloc_extradata(st->codecpar, 2)) < 0)
185  return ret;
186  st->codecpar->extradata[0] = 16;
187  st->codecpar->extradata[1] = 0;
188 
189  if (pb->seekable & AVIO_SEEKABLE_NORMAL) {
190  int got_width = 0;
191  bin->fsize = avio_size(pb);
192  if (ff_sauce_read(s, &bin->fsize, &got_width, 0) < 0)
193  next_tag_read(s, &bin->fsize);
194  if (!bin->width) {
195  predict_width(st->codecpar, bin->fsize, got_width);
196  if (st->codecpar->width < 8)
197  return AVERROR_INVALIDDATA;
198  calculate_height(st->codecpar, bin->fsize);
199  }
200  avio_seek(pb, 0, SEEK_SET);
201  }
202  return 0;
203 }
204 #endif /* CONFIG_BINTEXT_DEMUXER */
205 
206 #if CONFIG_XBIN_DEMUXER
207 static int xbin_probe(const AVProbeData *p)
208 {
209  const uint8_t *d = p->buf;
210 
211  if (AV_RL32(d) == MKTAG('X','B','I','N') && d[4] == 0x1A &&
212  AV_RL16(d+5) > 0 && AV_RL16(d+5) <= 160 &&
213  d[9] > 0 && d[9] <= 32)
214  return AVPROBE_SCORE_MAX;
215  return 0;
216 }
217 
218 static int xbin_read_header(AVFormatContext *s)
219 {
220  BinDemuxContext *bin = s->priv_data;
221  AVIOContext *pb = s->pb;
222  char fontheight, flags;
223  int ret;
224  AVStream *st = init_stream(s);
225  if (!st)
226  return AVERROR(ENOMEM);
227 
228  avio_skip(pb, 5);
229  st->codecpar->width = avio_rl16(pb)<<3;
230  st->codecpar->height = avio_rl16(pb);
231  fontheight = avio_r8(pb);
232  st->codecpar->height *= fontheight;
233  flags = avio_r8(pb);
234 
235  st->codecpar->extradata_size = 2;
236  if ((flags & BINTEXT_PALETTE))
237  st->codecpar->extradata_size += 48;
238  if ((flags & BINTEXT_FONT))
239  st->codecpar->extradata_size += fontheight * (flags & 0x10 ? 512 : 256);
241 
243  if (ret < 0)
244  return ret;
245  st->codecpar->extradata[0] = fontheight;
246  st->codecpar->extradata[1] = flags;
247  if (avio_read(pb, st->codecpar->extradata + 2, st->codecpar->extradata_size - 2) < 0)
248  return AVERROR(EIO);
249 
250  if (pb->seekable & AVIO_SEEKABLE_NORMAL) {
251  int64_t fsize = avio_size(pb);
252  if (fsize < 9 + st->codecpar->extradata_size)
253  return 0;
254  bin->fsize = fsize - 9 - st->codecpar->extradata_size;
255  ff_sauce_read(s, &bin->fsize, NULL, 0);
256  avio_seek(pb, 9 + st->codecpar->extradata_size, SEEK_SET);
257  }
258 
259  return 0;
260 }
261 #endif /* CONFIG_XBIN_DEMUXER */
262 
263 #if CONFIG_ADF_DEMUXER
264 static int adf_read_header(AVFormatContext *s)
265 {
266  BinDemuxContext *bin = s->priv_data;
267  AVIOContext *pb = s->pb;
268  AVStream *st;
269  int ret;
270 
271  if (avio_r8(pb) != 1)
272  return AVERROR_INVALIDDATA;
273 
274  st = init_stream(s);
275  if (!st)
276  return AVERROR(ENOMEM);
278 
279  if ((ret = ff_alloc_extradata(st->codecpar, 2 + 48 + 4096)) < 0)
280  return ret;
281  st->codecpar->extradata[0] = 16;
283 
284  if (avio_read(pb, st->codecpar->extradata + 2, 24) < 0)
285  return AVERROR(EIO);
286  avio_skip(pb, 144);
287  if (avio_read(pb, st->codecpar->extradata + 2 + 24, 24) < 0)
288  return AVERROR(EIO);
289  if (avio_read(pb, st->codecpar->extradata + 2 + 48, 4096) < 0)
290  return AVERROR(EIO);
291 
292  if (pb->seekable & AVIO_SEEKABLE_NORMAL) {
293  int got_width = 0;
294  int64_t fsize = avio_size(pb);
295  if (fsize < 1 + 192 + 4096)
296  return 0;
297  bin->fsize = fsize - 1 - 192 - 4096;
298  st->codecpar->width = 80<<3;
299  ff_sauce_read(s, &bin->fsize, &got_width, 0);
300  if (st->codecpar->width < 8)
301  return AVERROR_INVALIDDATA;
302  if (!bin->width)
303  calculate_height(st->codecpar, bin->fsize);
304  avio_seek(pb, 1 + 192 + 4096, SEEK_SET);
305  }
306  return 0;
307 }
308 #endif /* CONFIG_ADF_DEMUXER */
309 
310 #if CONFIG_IDF_DEMUXER
311 static const uint8_t idf_magic[] = {
312  0x04, 0x31, 0x2e, 0x34, 0x00, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x15, 0x00
313 };
314 
315 static int idf_probe(const AVProbeData *p)
316 {
317  if (p->buf_size < sizeof(idf_magic))
318  return 0;
319  if (!memcmp(p->buf, idf_magic, sizeof(idf_magic)))
320  return AVPROBE_SCORE_MAX;
321  return 0;
322 }
323 
324 static int idf_read_header(AVFormatContext *s)
325 {
326  BinDemuxContext *bin = s->priv_data;
327  AVIOContext *pb = s->pb;
328  AVStream *st;
329  int got_width = 0, ret;
330  int64_t fsize;
331 
332  if (!(pb->seekable & AVIO_SEEKABLE_NORMAL))
333  return AVERROR(EIO);
334 
335  st = init_stream(s);
336  if (!st)
337  return AVERROR(ENOMEM);
339 
340  if ((ret = ff_alloc_extradata(st->codecpar, 2 + 48 + 4096)) < 0)
341  return ret;
342  st->codecpar->extradata[0] = 16;
344 
345  fsize = avio_size(pb);
346  if (fsize < 12 + 4096 + 48)
347  return AVERROR_INVALIDDATA;
348  bin->fsize = fsize - 12 - 4096 - 48;
349 
350  avio_seek(pb, bin->fsize + 12, SEEK_SET);
351 
352  if (avio_read(pb, st->codecpar->extradata + 2 + 48, 4096) < 0)
353  return AVERROR(EIO);
354  if (avio_read(pb, st->codecpar->extradata + 2, 48) < 0)
355  return AVERROR(EIO);
356 
357  ff_sauce_read(s, &bin->fsize, &got_width, 0);
358  if (st->codecpar->width < 8)
359  return AVERROR_INVALIDDATA;
360  if (!bin->width)
361  calculate_height(st->codecpar, bin->fsize);
362  avio_seek(pb, 12, SEEK_SET);
363  return 0;
364 }
365 #endif /* CONFIG_IDF_DEMUXER */
366 
368  AVPacket *pkt)
369 {
370  BinDemuxContext *bin = s->priv_data;
371 
372  if (bin->fsize > 0) {
373  if (av_get_packet(s->pb, pkt, bin->fsize) < 0)
374  return AVERROR(EIO);
375  bin->fsize = -1; /* done */
376  } else if (!bin->fsize) {
377  if (avio_feof(s->pb))
378  return AVERROR(EIO);
379  if (av_get_packet(s->pb, pkt, bin->chars_per_frame) < 0)
380  return AVERROR(EIO);
381  } else {
382  return AVERROR(EIO);
383  }
384 
386  return 0;
387 }
388 
389 #define OFFSET(x) offsetof(BinDemuxContext, x)
390 static const AVOption options[] = {
391  { "linespeed", "set simulated line speed (bytes per second)", OFFSET(chars_per_frame), AV_OPT_TYPE_INT, {.i64 = 6000}, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM},
392  { "video_size", "set video size, such as 640x480 or hd720.", OFFSET(width), AV_OPT_TYPE_IMAGE_SIZE, {.str = NULL}, 0, 0, AV_OPT_FLAG_DECODING_PARAM },
393  { "framerate", "set framerate (frames per second)", OFFSET(framerate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
394  { NULL },
395 };
396 
397 #define CLASS(name) \
398 (const AVClass[1]){{ \
399  .class_name = name, \
400  .item_name = av_default_item_name, \
401  .option = options, \
402  .version = LIBAVUTIL_VERSION_INT, \
403 }}
404 
405 #if CONFIG_BINTEXT_DEMUXER
407  .p.name = "bin",
408  .p.long_name = NULL_IF_CONFIG_SMALL("Binary text"),
409  .p.priv_class = CLASS("Binary text demuxer"),
410  .priv_data_size = sizeof(BinDemuxContext),
411  .read_probe = bin_probe,
412  .read_header = bintext_read_header,
414 };
415 #endif
416 
417 #if CONFIG_XBIN_DEMUXER
419  .p.name = "xbin",
420  .p.long_name = NULL_IF_CONFIG_SMALL("eXtended BINary text (XBIN)"),
421  .p.priv_class = CLASS("eXtended BINary text (XBIN) demuxer"),
422  .priv_data_size = sizeof(BinDemuxContext),
423  .read_probe = xbin_probe,
424  .read_header = xbin_read_header,
426 };
427 #endif
428 
429 #if CONFIG_ADF_DEMUXER
431  .p.name = "adf",
432  .p.long_name = NULL_IF_CONFIG_SMALL("Artworx Data Format"),
433  .p.extensions = "adf",
434  .p.priv_class = CLASS("Artworx Data Format demuxer"),
435  .priv_data_size = sizeof(BinDemuxContext),
436  .read_header = adf_read_header,
438 };
439 #endif
440 
441 #if CONFIG_IDF_DEMUXER
443  .p.name = "idf",
444  .p.long_name = NULL_IF_CONFIG_SMALL("iCE Draw File"),
445  .p.extensions = "idf",
446  .p.priv_class = CLASS("iCE Draw File demuxer"),
447  .priv_data_size = sizeof(BinDemuxContext),
448  .read_probe = idf_probe,
449  .read_header = idf_read_header,
451 };
452 #endif
AVCodecParameters::extradata
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
Definition: codec_par.h:69
av_clip
#define av_clip
Definition: common.h:100
AVERROR
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
opt.h
AVCodecParameters::codec_type
enum AVMediaType codec_type
General type of the encoded data.
Definition: codec_par.h:51
AVCodecParameters
This struct describes the properties of an encoded stream.
Definition: codec_par.h:47
OFFSET
#define OFFSET(x)
Definition: bintext.c:389
avformat_new_stream
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
AV_OPT_TYPE_VIDEO_RATE
@ AV_OPT_TYPE_VIDEO_RATE
Underlying C type is AVRational.
Definition: opt.h:315
int64_t
long long int64_t
Definition: coverity.c:34
AVOption
AVOption.
Definition: opt.h:429
AVCodecParameters::codec_tag
uint32_t codec_tag
Additional information about the codec (corresponds to the AVI FOURCC).
Definition: codec_par.h:59
AVProbeData::buf_size
int buf_size
Size of buf except extra allocated bytes.
Definition: avformat.h:454
avio_size
int64_t avio_size(AVIOContext *s)
Get the filesize.
Definition: aviobuf.c:323
AV_PKT_FLAG_KEY
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
Definition: packet.h:594
AVPROBE_SCORE_MAX
#define AVPROBE_SCORE_MAX
maximum score
Definition: avformat.h:463
return
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a it should return
Definition: filter_design.txt:264
avpriv_set_pts_info
void avpriv_set_pts_info(AVStream *st, int pts_wrap_bits, unsigned int pts_num, unsigned int pts_den)
Set the time base and wrapping info for a given stream.
Definition: avformat.c:862
BinDemuxContext::chars_per_frame
int chars_per_frame
characters to send decoder per frame; set by private options as characters per second,...
Definition: bintext.c:46
avio_rl16
unsigned int avio_rl16(AVIOContext *s)
Definition: aviobuf.c:714
AVRational::num
int num
Numerator.
Definition: rational.h:59
pkt
AVPacket * pkt
Definition: movenc.c:60
intreadwrite.h
s
#define s(width, name)
Definition: cbs_vp9.c:198
AVInputFormat::name
const char * name
A comma separated list of short names for the format.
Definition: avformat.h:553
AVProbeData::buf
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
Definition: avformat.h:453
AVCodecParameters::width
int width
Video only.
Definition: codec_par.h:134
av_q2d
static double av_q2d(AVRational a)
Convert an AVRational to a double.
Definition: rational.h:104
ff_idf_demuxer
const FFInputFormat ff_idf_demuxer
AVProbeData::filename
const char * filename
Definition: avformat.h:452
av_match_ext
int av_match_ext(const char *filename, const char *extensions)
Return a positive value if the given filename has one of the given extensions, 0 otherwise.
Definition: format.c:41
AV_RL16
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_RL16
Definition: bytestream.h:94
fsize
static int64_t fsize(FILE *f)
Definition: audiomatch.c:29
BinDemuxContext::width
int width
Definition: bintext.c:49
AVFormatContext
Format I/O context.
Definition: avformat.h:1300
internal.h
AVStream::codecpar
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Definition: avformat.h:771
framerate
float framerate
Definition: av1_levels.c:29
read_header
static int read_header(FFV1Context *f)
Definition: ffv1dec.c:540
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:75
AVStream::time_base
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
Definition: avformat.h:787
NULL
#define NULL
Definition: coverity.c:32
ff_xbin_demuxer
const FFInputFormat ff_xbin_demuxer
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
BinDemuxContext::framerate
AVRational framerate
frames per second (private option)
Definition: bintext.c:50
AV_OPT_TYPE_IMAGE_SIZE
@ AV_OPT_TYPE_IMAGE_SIZE
Underlying C type is two consecutive integers.
Definition: opt.h:303
CLASS
#define CLASS(name)
Definition: bintext.c:397
AVFormatContext::pb
AVIOContext * pb
I/O context.
Definition: avformat.h:1342
parseutils.h
AVProbeData
This structure contains the data a format has to probe a file.
Definition: avformat.h:451
BinDemuxContext::fsize
uint64_t fsize
file size less metadata buffer
Definition: bintext.c:51
BINTEXT_PALETTE
#define BINTEXT_PALETTE
Definition: bintext.h:34
AVPROBE_SCORE_EXTENSION
#define AVPROBE_SCORE_EXTENSION
score for file extension
Definition: avformat.h:461
AVCodecParameters::extradata_size
int extradata_size
Size of the extradata content in bytes.
Definition: codec_par.h:73
AVIOContext
Bytestream IO Context.
Definition: avio.h:160
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:94
AV_CODEC_ID_IDF
@ AV_CODEC_ID_IDF
Definition: codec_id.h:590
AVIOContext::seekable
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
Definition: avio.h:261
height
#define height
Definition: dsp.h:85
ff_sauce_read
int ff_sauce_read(AVFormatContext *avctx, uint64_t *fsize, int *got_width, int get_height)
Definition: sauce.c:32
ff_adf_demuxer
const FFInputFormat ff_adf_demuxer
AV_CODEC_ID_BINTEXT
@ AV_CODEC_ID_BINTEXT
Definition: codec_id.h:588
FFInputFormat::p
AVInputFormat p
The public AVInputFormat.
Definition: demux.h:41
avio_r8
int avio_r8(AVIOContext *s)
Definition: aviobuf.c:603
AVPacket::flags
int flags
A combination of AV_PKT_FLAG values.
Definition: packet.h:545
read_packet
static int read_packet(AVFormatContext *s, AVPacket *pkt)
Definition: bintext.c:367
AVCodecParameters::height
int height
Definition: codec_par.h:135
bintext.h
options
static const AVOption options[]
Definition: bintext.c:390
demux.h
len
int len
Definition: vorbis_enc_data.h:426
av_get_packet
int av_get_packet(AVIOContext *s, AVPacket *pkt, int size)
Allocate and read the payload of a packet and initialize its fields with default values.
Definition: utils.c:91
init_stream
static AVStream * init_stream(AVFormatContext *s)
Definition: bintext.c:54
ret
ret
Definition: filter_design.txt:187
AVStream
Stream structure.
Definition: avformat.h:748
avio_seek
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
Definition: aviobuf.c:231
avformat.h
AV_RL32
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
Definition: bytestream.h:92
BINTEXT_FONT
#define BINTEXT_FONT
Definition: bintext.h:35
AVIO_SEEKABLE_NORMAL
#define AVIO_SEEKABLE_NORMAL
Seeking works like for a local file.
Definition: avio.h:41
AVRational::den
int den
Denominator.
Definition: rational.h:60
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
avio_read
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
Definition: aviobuf.c:612
avio_skip
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
Definition: aviobuf.c:318
AV_CODEC_ID_XBIN
@ AV_CODEC_ID_XBIN
Definition: codec_id.h:589
AV_OPT_FLAG_DECODING_PARAM
#define AV_OPT_FLAG_DECODING_PARAM
A generic parameter which can be set by the user for demuxing or decoding.
Definition: opt.h:356
BinDemuxContext
Definition: bintext.c:44
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
read_probe
static int read_probe(const AVProbeData *p)
Definition: cdg.c:30
AVCodecParameters::codec_id
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
Definition: codec_par.h:55
AVPacket
This structure stores compressed data.
Definition: packet.h:516
sauce.h
FFInputFormat
Definition: demux.h:37
ff_bintext_demuxer
const FFInputFormat ff_bintext_demuxer
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:482
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61
MKTAG
#define MKTAG(a, b, c, d)
Definition: macros.h:55
width
#define width
Definition: dsp.h:85
ff_alloc_extradata
int ff_alloc_extradata(AVCodecParameters *par, int size)
Allocate extradata with additional AV_INPUT_BUFFER_PADDING_SIZE at end which is always set to 0.
Definition: utils.c:227
avio_feof
int avio_feof(AVIOContext *s)
Similar to feof() but also returns nonzero on read errors.
Definition: aviobuf.c:346