FFmpeg
argo_brp.c
Go to the documentation of this file.
1 /*
2  * Argonaut Games BRP Demuxer
3  *
4  * Copyright (C) 2020 Zane van Iperen (zane@zanevaniperen.com)
5  *
6  * This file is part of FFmpeg.
7  *
8  * FFmpeg is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * FFmpeg is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with FFmpeg; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 #include "avformat.h"
24 #include "demux.h"
25 #include "internal.h"
26 #include "libavutil/intreadwrite.h"
27 #include "libavutil/avassert.h"
28 #include "libavutil/internal.h"
29 #include "argo_asf.h"
30 
31 #define BRP_TAG MKTAG('B', 'R', 'P', 'P')
32 #define BRP_FILE_HEADER_SIZE 12
33 #define BRP_BLOCK_HEADER_SIZE 12
34 #define BRP_STREAM_HEADER_SIZE 20
35 #define BRP_MAX_STREAMS 32 /* Soft cap, but even this is overkill. */
36 #define BRP_BASF_LOOKAHEAD 10 /* How many blocks to search for the first BASF one. */
37 #define BVID_HEADER_SIZE 16
38 #define MASK_HEADER_SIZE 12
39 #define BRP_MIN_BUFFER_SIZE FFMAX3(FFMAX3(BRP_FILE_HEADER_SIZE, \
40  BRP_BLOCK_HEADER_SIZE, \
41  BRP_STREAM_HEADER_SIZE), \
42  BVID_HEADER_SIZE, \
43  MASK_HEADER_SIZE)
44 
45 #define BRP_CODEC_ID_BVID MKTAG('B', 'V', 'I', 'D')
46 #define BRP_CODEC_ID_BASF MKTAG('B', 'A', 'S', 'F')
47 #define BRP_CODEC_ID_MASK MKTAG('M', 'A', 'S', 'K')
48 
49 typedef struct ArgoBRPFileHeader {
50  uint32_t magic;
51  uint32_t num_streams;
52  uint32_t byte_rate;
54 
55 typedef struct ArgoBRPBlockHeader {
57  uint32_t start_ms;
58  uint32_t size;
60 
61 typedef struct ArgoBVIDHeader {
62  uint32_t num_frames;
63  uint32_t width;
64  uint32_t height;
65  uint32_t depth;
67 
68 typedef struct ArgoMASKHeader {
69  uint32_t num_frames;
70  uint32_t width;
71  uint32_t height;
73 
74 typedef struct ArgoBRPStreamHeader {
75  uint32_t codec_id;
76  uint32_t id;
77  uint32_t duration_ms;
78  uint32_t byte_rate;
79  uint32_t extradata_size;
80  union
81  {
82  /* If codec_id == BRP_CODEC_ID_BVID */
84  /* If codec_id == BRP_CODEC_ID_BASF */
86  /* If codec_id == BRP_CODEC_ID_MASK */
88  } extradata;
90 
91 typedef struct ArgoBRPDemuxContext {
94 
95  struct {
96  int index;
98  } basf;
100 
101 static int argo_brp_probe(const AVProbeData *p)
102 {
103  if (AV_RL32(p->buf) != BRP_TAG)
104  return 0;
105 
106  return AVPROBE_SCORE_EXTENSION + 1;
107 }
108 
110  void *buf, size_t bufsz)
111 {
112  const char *name;
113  uint32_t size;
114  int64_t ret;
115 
116  if (hdr->codec_id == BRP_CODEC_ID_BVID) {
117  name = "BVID";
119  } else if (hdr->codec_id == BRP_CODEC_ID_BASF) {
120  name = "BASF";
122  } else if (hdr->codec_id == BRP_CODEC_ID_MASK) {
123  name = "MASK";
125  } else {
126  avpriv_request_sample(s, "BRP codec id 0x%x", hdr->codec_id);
127 
128  if ((ret = avio_skip(s->pb, hdr->extradata_size)) < 0)
129  return ret;
130 
131  return 1;
132  }
133 
134  if (hdr->extradata_size != size) {
135  av_log(s, AV_LOG_ERROR, "Invalid %s extradata size %u, expected %u\n",
136  name, hdr->extradata_size, size);
137  return AVERROR_INVALIDDATA;
138  }
139 
140  av_assert0(bufsz >= size);
141 
142  if ((ret = avio_read(s->pb, buf, size)) < 0)
143  return ret;
144 
145  if (ret != size)
146  return AVERROR(EIO);
147 
148  return 0;
149 }
150 
152 {
153  int64_t ret;
154  AVIOContext *pb = s->pb;
155  ArgoBRPDemuxContext *brp = s->priv_data;
157 
158  if ((ret = avio_read(pb, buf, BRP_FILE_HEADER_SIZE)) < 0)
159  return ret;
160  else if (ret != BRP_FILE_HEADER_SIZE)
161  return AVERROR(EIO);
162 
163  brp->fhdr.magic = AV_RL32(buf + 0);
164  brp->fhdr.num_streams = AV_RL32(buf + 4);
165  brp->fhdr.byte_rate = AV_RL32(buf + 8);
166 
167  if (brp->fhdr.magic != BRP_TAG)
168  return AVERROR_INVALIDDATA;
169 
170  if (brp->fhdr.num_streams > BRP_MAX_STREAMS) {
171  avpriv_request_sample(s, ">%d streams", BRP_MAX_STREAMS);
172  return AVERROR_PATCHWELCOME;
173  }
174 
175  /* Build the stream info. */
176  brp->basf.index = -1;
177  for (uint32_t i = 0; i < brp->fhdr.num_streams; i++) {
178  ArgoBRPStreamHeader *hdr = brp->streams + i;
179  AVStream *st;
180 
181  if (!(st = avformat_new_stream(s, NULL)))
182  return AVERROR(ENOMEM);
183 
184  if ((ret = avio_read(pb, buf, BRP_STREAM_HEADER_SIZE)) < 0)
185  return ret;
186  else if (ret != BRP_STREAM_HEADER_SIZE)
187  return AVERROR(EIO);
188 
189  hdr->codec_id = AV_RL32(buf + 0);
190  hdr->id = AV_RL32(buf + 4);
191  hdr->duration_ms = AV_RL32(buf + 8);
192  hdr->byte_rate = AV_RL32(buf + 12);
193  hdr->extradata_size = AV_RL32(buf + 16);
194 
195  /* This should always be the case. */
196  if (hdr->id != i)
197  return AVERROR_INVALIDDATA;
198 
199  /* Timestamps are in milliseconds. */
200  avpriv_set_pts_info(st, 64, 1, 1000);
201  st->duration = hdr->duration_ms;
202  st->codecpar->bit_rate = hdr->byte_rate * 8;
203 
204  if ((ret = read_extradata(s, hdr, buf, sizeof(buf))) < 0) {
205  return ret;
206  } else if (ret > 0) {
208  continue;
209  }
210 
211  if (hdr->codec_id == BRP_CODEC_ID_BVID) {
212  ArgoBVIDHeader *bvid = &hdr->extradata.bvid;
213 
216 
217  bvid->num_frames = AV_RL32(buf + 0);
218  bvid->width = AV_RL32(buf + 4);
219  bvid->height = AV_RL32(buf + 8);
220  bvid->depth = AV_RL32(buf + 12);
221 
222  if (bvid->num_frames == 0)
223  return AVERROR_INVALIDDATA;
224 
225  /* These are from 1990's games, sanity check this. */
226  if (bvid->width >= 65536 || bvid->height >= 65536 ||
227  bvid->depth > 24 || bvid->depth % 8 != 0) {
228  return AVERROR_INVALIDDATA;
229  }
230 
231  st->codecpar->width = bvid->width;
232  st->codecpar->height = bvid->height;
233  st->nb_frames = bvid->num_frames;
234  st->codecpar->bits_per_coded_sample = bvid->depth;
235  } else if (hdr->codec_id == BRP_CODEC_ID_BASF) {
236  /*
237  * It would make the demuxer significantly more complicated
238  * to support multiple BASF streams. I've never seen a file
239  * with more than one.
240  */
241  if (brp->basf.index >= 0) {
242  avpriv_request_sample(s, "Multiple BASF streams");
243  return AVERROR_PATCHWELCOME;
244  }
245 
248  brp->basf.index = i;
250 
252  return ret;
253 
254  st->nb_frames = hdr->extradata.basf.num_chunks;
255  } else if (hdr->codec_id == BRP_CODEC_ID_MASK) {
257 
259 
260  mask->num_frames = AV_RL32(buf + 0);
261  mask->width = AV_RL32(buf + 4);
262  mask->height = AV_RL32(buf + 8);
263 
264  st->nb_frames = mask->num_frames;
265  } else {
266  av_assert0(0); /* Caught above, should never happen. */
267  }
268  }
269 
270  /* Try to find the first BASF chunk. */
271  if (brp->basf.index >= 0) {
272  AVStream *st = s->streams[brp->basf.index];
273  ArgoBRPStreamHeader *hdr = brp->streams + brp->basf.index;
275  int64_t offset;
276  int i;
277 
280 
281  if ((ret = avio_tell(s->pb)) < 0)
282  return ret;
283 
284  offset = ret;
285 
286  av_log(s, AV_LOG_TRACE, "Searching %d blocks for BASF...", BRP_BASF_LOOKAHEAD);
287 
288  for (i = 0; i < BRP_BASF_LOOKAHEAD; i++) {
289  if ((ret = avio_read(pb, buf, BRP_BLOCK_HEADER_SIZE)) < 0)
290  return ret;
291  else if (ret != BRP_BLOCK_HEADER_SIZE)
292  return AVERROR(EIO);
293 
294  blk.stream_id = AV_RL32(buf + 0);
295  blk.start_ms = AV_RL32(buf + 4);
296  blk.size = AV_RL32(buf + 8);
297 
298  if (blk.stream_id == brp->basf.index || blk.stream_id == -1)
299  break;
300 
301  if ((ret = avio_skip(pb, blk.size)) < 0)
302  return ret;
303  }
304 
305  if (i == BRP_BASF_LOOKAHEAD || blk.stream_id == -1) {
306  /* Don't error here, as there may still be a valid video stream. */
307  av_log(s, AV_LOG_TRACE, "not found\n");
308  goto done;
309  }
310 
311  av_log(s, AV_LOG_TRACE, "found at index %d\n", i);
312 
313  if (blk.size < ASF_CHUNK_HEADER_SIZE)
314  return AVERROR_INVALIDDATA;
315 
316  if ((ret = avio_read(pb, buf, ASF_CHUNK_HEADER_SIZE)) < 0)
317  return ret;
318  else if (ret != ASF_CHUNK_HEADER_SIZE)
319  return AVERROR(EIO);
320 
322 
323  /*
324  * Special Case Hack. It seems that in files where the BASF block isn't first,
325  * v1.1 streams are allowed to be non-22050...
326  * Bump the version to 1.2 so ff_argo_asf_fill_stream() doesn't "correct" it.
327  *
328  * Found in Alien Odyssey games files in:
329  * ./GRAPHICS/COMMBUNK/{{COMADD1,COMM2_{1,2,3E},COMM3_{2,3,4,5,6}},FADE{1,2}}.BRP
330  *
331  * Either this format really inconsistent, or FX Fighter and Croc just ignored the
332  * sample rate field...
333  */
334  if (i != 0 && hdr->extradata.basf.version_major == 1 && hdr->extradata.basf.version_minor == 1)
335  hdr->extradata.basf.version_minor = 2;
336 
337  if ((ret = ff_argo_asf_fill_stream(s, st, &hdr->extradata.basf, &brp->basf.ckhdr)) < 0)
338  return ret;
339 
340  /* Convert ms to samples. */
341  st->start_time = av_rescale_rnd(blk.start_ms, st->codecpar->sample_rate, 1000, AV_ROUND_UP);
343 
344 done:
345  if ((ret = avio_seek(s->pb, offset, SEEK_SET)) < 0)
346  return ret;
347  }
348  return 0;
349 }
350 
352 {
353  ArgoBRPDemuxContext *brp = s->priv_data;
355  const ArgoBRPStreamHeader *shdr;
356  AVStream *st;
357  uint8_t buf[BRP_MIN_BUFFER_SIZE];
358  ArgoASFChunkHeader ckhdr;
359  int ret;
360 
361  if ((ret = avio_read(s->pb, buf, BRP_BLOCK_HEADER_SIZE)) < 0)
362  return ret;
363  else if (ret != BRP_BLOCK_HEADER_SIZE)
364  return AVERROR(EIO);
365 
366  blk.stream_id = AV_RL32(buf + 0);
367  blk.start_ms = AV_RL32(buf + 4);
368  blk.size = AV_RL32(buf + 8);
369 
370  if (blk.stream_id == -1)
371  return AVERROR_EOF;
372 
373  if (blk.stream_id < -1 || blk.stream_id >= s->nb_streams)
374  return AVERROR_INVALIDDATA;
375 
376  st = s->streams[blk.stream_id];
377  shdr = brp->streams + blk.stream_id;
378 
379  if (blk.stream_id == brp->basf.index) {
380  if (blk.size < ASF_CHUNK_HEADER_SIZE)
381  return AVERROR_INVALIDDATA;
382 
384  return AVERROR_INVALIDDATA;
385 
386  ff_argo_asf_parse_chunk_header(&ckhdr, buf);
387 
388  /* Ensure the chunk attributes are the same. */
389  if (ckhdr.sample_rate != brp->basf.ckhdr.sample_rate ||
390  ckhdr.flags != brp->basf.ckhdr.flags ||
391  ckhdr.unk1 != brp->basf.ckhdr.unk1 ||
392  ckhdr.unk2 != brp->basf.ckhdr.unk2)
393  return AVERROR_INVALIDDATA;
394 
395  blk.size -= ASF_CHUNK_HEADER_SIZE;
396  }
397 
398  if ((ret = av_get_packet(s->pb, pkt, blk.size)) < 0)
399  return ret;
400  else if (ret != blk.size)
401  return AVERROR_INVALIDDATA;
402 
403  if (blk.stream_id == brp->basf.index) {
404  pkt->duration = ckhdr.num_samples * ckhdr.num_blocks;
405  pkt->pts = av_rescale_rnd(blk.start_ms, ckhdr.sample_rate, 1000, AV_ROUND_UP);
406  } else if (shdr->codec_id == BRP_CODEC_ID_BVID) {
408  pkt->pts = blk.start_ms;
409  } else {
410  pkt->pts = blk.start_ms;
411  }
412 
413  pkt->stream_index = blk.stream_id;
414  return 0;
415 }
416 
418  .p.name = "argo_brp",
419  .p.long_name = NULL_IF_CONFIG_SMALL("Argonaut Games BRP"),
420  .priv_data_size = sizeof(ArgoBRPDemuxContext),
424 };
ArgoASFChunkHeader::sample_rate
uint16_t sample_rate
Definition: argo_asf.h:51
AV_ROUND_UP
@ AV_ROUND_UP
Round toward +infinity.
Definition: mathematics.h:134
ArgoASFChunkHeader::num_samples
uint32_t num_samples
Definition: argo_asf.h:49
ArgoASFChunkHeader::flags
uint32_t flags
Definition: argo_asf.h:53
name
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
Definition: writing_filters.txt:88
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
ff_argo_brp_demuxer
const FFInputFormat ff_argo_brp_demuxer
Definition: argo_brp.c:417
ArgoASFChunkHeader::unk2
uint16_t unk2
Definition: argo_asf.h:52
AVCodecParameters::codec_type
enum AVMediaType codec_type
General type of the encoded data.
Definition: codec_par.h:51
avformat_new_stream
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
AVERROR_EOF
#define AVERROR_EOF
End of file.
Definition: error.h:57
ArgoBRPStreamHeader::extradata_size
uint32_t extradata_size
Definition: argo_brp.c:79
int64_t
long long int64_t
Definition: coverity.c:34
ArgoBRPStreamHeader::mask
ArgoMASKHeader mask
Definition: argo_brp.c:87
mask
int mask
Definition: mediacodecdec_common.c:154
ArgoBRPFileHeader::num_streams
uint32_t num_streams
Definition: argo_brp.c:51
read_extradata
static int read_extradata(AVFormatContext *s, const ArgoBRPStreamHeader *hdr, void *buf, size_t bufsz)
Definition: argo_brp.c:109
BRP_MIN_BUFFER_SIZE
#define BRP_MIN_BUFFER_SIZE
Definition: argo_brp.c:39
BRP_MAX_STREAMS
#define BRP_MAX_STREAMS
Definition: argo_brp.c:35
BRP_CODEC_ID_MASK
#define BRP_CODEC_ID_MASK
Definition: argo_brp.c:47
AVPacket::duration
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
Definition: packet.h:557
ArgoBRPStreamHeader::bvid
ArgoBVIDHeader bvid
Definition: argo_brp.c:83
FFMAX
#define FFMAX(a, b)
Definition: macros.h:47
argo_brp_read_header
static int argo_brp_read_header(AVFormatContext *s)
Definition: argo_brp.c:151
ff_argo_asf_fill_stream
int ff_argo_asf_fill_stream(AVFormatContext *s, AVStream *st, const ArgoASFFileHeader *fhdr, const ArgoASFChunkHeader *ckhdr)
Definition: argo_asf.c:85
ArgoBVIDHeader::width
uint32_t width
Definition: argo_brp.c:63
BRP_CODEC_ID_BASF
#define BRP_CODEC_ID_BASF
Definition: argo_brp.c:46
ArgoMASKHeader::width
uint32_t width
Definition: argo_brp.c:70
ASF_FILE_HEADER_SIZE
#define ASF_FILE_HEADER_SIZE
Definition: argo_asf.h:32
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
ArgoASFFileHeader::version_minor
uint16_t version_minor
Definition: argo_asf.h:41
ArgoBRPDemuxContext::streams
ArgoBRPStreamHeader streams[BRP_MAX_STREAMS]
Definition: argo_brp.c:93
argo_brp_read_packet
static int argo_brp_read_packet(AVFormatContext *s, AVPacket *pkt)
Definition: argo_brp.c:351
ArgoASFChunkHeader
Definition: argo_asf.h:47
ArgoBRPStreamHeader
Definition: argo_brp.c:74
ArgoMASKHeader::num_frames
uint32_t num_frames
Definition: argo_brp.c:69
avio_tell
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
Definition: avio.h:494
BRP_BLOCK_HEADER_SIZE
#define BRP_BLOCK_HEADER_SIZE
Definition: argo_brp.c:33
ArgoBRPBlockHeader::size
uint32_t size
Definition: argo_brp.c:58
ArgoBRPDemuxContext
Definition: argo_brp.c:91
AVStream::duration
int64_t duration
Decoding: duration of the stream, in stream time base.
Definition: avformat.h:807
ArgoMASKHeader::height
uint32_t height
Definition: argo_brp.c:71
ArgoBVIDHeader::height
uint32_t height
Definition: argo_brp.c:64
ArgoBRPBlockHeader::stream_id
int32_t stream_id
Definition: argo_brp.c:56
avassert.h
AV_LOG_TRACE
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development.
Definition: log.h:235
pkt
AVPacket * pkt
Definition: movenc.c:60
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:209
read_packet
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
Definition: avio_read_callback.c:42
intreadwrite.h
s
#define s(width, name)
Definition: cbs_vp9.c:198
MASK_HEADER_SIZE
#define MASK_HEADER_SIZE
Definition: argo_brp.c:38
ArgoASFFileHeader::num_chunks
uint32_t num_chunks
Definition: argo_asf.h:42
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
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
AVCodecParameters::width
int width
Video only.
Definition: codec_par.h:134
AV_CODEC_ID_ARGO
@ AV_CODEC_ID_ARGO
Definition: codec_id.h:307
av_assert0
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:40
BRP_FILE_HEADER_SIZE
#define BRP_FILE_HEADER_SIZE
Definition: argo_brp.c:32
ArgoBRPStreamHeader::byte_rate
uint32_t byte_rate
Definition: argo_brp.c:78
ArgoMASKHeader
Definition: argo_brp.c:68
blk
#define blk(i)
Definition: sha.c:186
AVMEDIA_TYPE_DATA
@ AVMEDIA_TYPE_DATA
Opaque data information usually continuous.
Definition: avutil.h:203
ArgoBVIDHeader::depth
uint32_t depth
Definition: argo_brp.c:65
ArgoBRPStreamHeader::duration_ms
uint32_t duration_ms
Definition: argo_brp.c:77
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
read_header
static int read_header(FFV1Context *f)
Definition: ffv1dec.c:538
NULL
#define NULL
Definition: coverity.c:32
ArgoBRPFileHeader::magic
uint32_t magic
Definition: argo_brp.c:50
AVERROR_PATCHWELCOME
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
Definition: error.h:64
AV_CODEC_ID_ADPCM_ARGO
@ AV_CODEC_ID_ADPCM_ARGO
Definition: codec_id.h:409
ff_argo_asf_validate_file_header
int ff_argo_asf_validate_file_header(AVFormatContext *s, const ArgoASFFileHeader *hdr)
Definition: argo_asf.c:64
ArgoBRPFileHeader
Definition: argo_brp.c:49
AVProbeData
This structure contains the data a format has to probe a file.
Definition: avformat.h:451
argo_asf.h
ArgoBRPStreamHeader::codec_id
uint32_t codec_id
Definition: argo_brp.c:75
AVPROBE_SCORE_EXTENSION
#define AVPROBE_SCORE_EXTENSION
score for file extension
Definition: avformat.h:461
AVCodecParameters::sample_rate
int sample_rate
Audio only.
Definition: codec_par.h:184
AVStream::nb_frames
int64_t nb_frames
number of frames in this stream if known or 0
Definition: avformat.h:809
av_rescale_rnd
int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding rnd)
Rescale a 64-bit integer with specified rounding.
Definition: mathematics.c:58
BRP_TAG
#define BRP_TAG
Definition: argo_brp.c:31
ArgoASFFileHeader::version_major
uint16_t version_major
Definition: argo_asf.h:40
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
BRP_BASF_LOOKAHEAD
#define BRP_BASF_LOOKAHEAD
Definition: argo_brp.c:36
size
int size
Definition: twinvq_data.h:10344
AVMEDIA_TYPE_UNKNOWN
@ AVMEDIA_TYPE_UNKNOWN
Usually treated as AVMEDIA_TYPE_DATA.
Definition: avutil.h:200
ArgoBRPDemuxContext::basf
struct ArgoBRPDemuxContext::@361 basf
FFInputFormat::p
AVInputFormat p
The public AVInputFormat.
Definition: demux.h:41
ArgoBVIDHeader
Definition: argo_brp.c:61
offset
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
Definition: writing_filters.txt:86
BRP_STREAM_HEADER_SIZE
#define BRP_STREAM_HEADER_SIZE
Definition: argo_brp.c:34
ArgoBRPStreamHeader::extradata
union ArgoBRPStreamHeader::@360 extradata
ArgoBRPDemuxContext::fhdr
ArgoBRPFileHeader fhdr
Definition: argo_brp.c:92
ArgoBVIDHeader::num_frames
uint32_t num_frames
Definition: argo_brp.c:62
ArgoBRPDemuxContext::ckhdr
ArgoASFChunkHeader ckhdr
Definition: argo_brp.c:97
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
AVPacket::pts
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
Definition: packet.h:532
internal.h
AVCodecParameters::height
int height
Definition: codec_par.h:135
ff_argo_asf_parse_chunk_header
void ff_argo_asf_parse_chunk_header(ArgoASFChunkHeader *hdr, const uint8_t *buf)
Definition: argo_asf.c:75
argo_brp_probe
static int argo_brp_probe(const AVProbeData *p)
Definition: argo_brp.c:101
demux.h
ArgoBRPFileHeader::byte_rate
uint32_t byte_rate
Definition: argo_brp.c:52
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
ArgoBRPBlockHeader::start_ms
uint32_t start_ms
Definition: argo_brp.c:57
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
ArgoBRPStreamHeader::id
uint32_t id
Definition: argo_brp.c:76
ArgoASFChunkHeader::num_blocks
uint32_t num_blocks
Definition: argo_asf.h:48
avformat.h
AV_RL32
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
Definition: bytestream.h:92
ArgoASFFileHeader
Definition: argo_asf.h:38
ArgoBRPBlockHeader
Definition: argo_brp.c:55
ArgoASFChunkHeader::unk1
uint32_t unk1
Definition: argo_asf.h:50
ASF_CHUNK_HEADER_SIZE
#define ASF_CHUNK_HEADER_SIZE
Definition: argo_asf.h:33
avio_read
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
Definition: aviobuf.c:612
BRP_CODEC_ID_BVID
#define BRP_CODEC_ID_BVID
Definition: argo_brp.c:45
AVPacket::stream_index
int stream_index
Definition: packet.h:541
avio_skip
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
Definition: aviobuf.c:318
ASF_MIN_BUFFER_SIZE
#define ASF_MIN_BUFFER_SIZE
Definition: argo_asf.h:35
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
read_probe
static int read_probe(const AVProbeData *p)
Definition: cdg.c:30
AVCodecParameters::bits_per_coded_sample
int bits_per_coded_sample
The number of bits per sample in the codedwords.
Definition: codec_par.h:110
ff_argo_asf_parse_file_header
void ff_argo_asf_parse_file_header(ArgoASFFileHeader *hdr, const uint8_t *buf)
Definition: argo_asf.c:53
avpriv_request_sample
#define avpriv_request_sample(...)
Definition: tableprint_vlc.h:36
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
FFInputFormat
Definition: demux.h:37
ArgoBRPStreamHeader::basf
ArgoASFFileHeader basf
Definition: argo_brp.c:85
BVID_HEADER_SIZE
#define BVID_HEADER_SIZE
Definition: argo_brp.c:37
int32_t
int32_t
Definition: audioconvert.c:56
AVCodecParameters::bit_rate
int64_t bit_rate
The average bitrate of the encoded data (in bits per second).
Definition: codec_par.h:97
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
ArgoBRPDemuxContext::index
int index
Definition: argo_brp.c:96
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61
AVStream::start_time
int64_t start_time
Decoding: pts of the first frame of the stream in presentation order, in stream time base.
Definition: avformat.h:797