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 "internal.h"
25 #include "libavutil/intreadwrite.h"
26 #include "libavutil/avassert.h"
27 #include "libavutil/internal.h"
28 #include "argo_asf.h"
29 
30 #define BRP_TAG MKTAG('B', 'R', 'P', 'P')
31 #define BRP_FILE_HEADER_SIZE 12
32 #define BRP_BLOCK_HEADER_SIZE 12
33 #define BRP_STREAM_HEADER_SIZE 20
34 #define BRP_MAX_STREAMS 32 /* Soft cap, but even this is overkill. */
35 #define BRP_BASF_LOOKAHEAD 10 /* How many blocks to search for the first BASF one. */
36 #define BVID_HEADER_SIZE 16
37 #define MASK_HEADER_SIZE 12
38 #define BRP_MIN_BUFFER_SIZE FFMAX3(FFMAX3(BRP_FILE_HEADER_SIZE, \
39  BRP_BLOCK_HEADER_SIZE, \
40  BRP_STREAM_HEADER_SIZE), \
41  BVID_HEADER_SIZE, \
42  MASK_HEADER_SIZE)
43 
44 #define BRP_CODEC_ID_BVID MKTAG('B', 'V', 'I', 'D')
45 #define BRP_CODEC_ID_BASF MKTAG('B', 'A', 'S', 'F')
46 #define BRP_CODEC_ID_MASK MKTAG('M', 'A', 'S', 'K')
47 
48 typedef struct ArgoBRPFileHeader {
49  uint32_t magic;
50  uint32_t num_streams;
51  uint32_t byte_rate;
53 
54 typedef struct ArgoBRPBlockHeader {
56  uint32_t start_ms;
57  uint32_t size;
59 
60 typedef struct ArgoBVIDHeader {
61  uint32_t num_frames;
62  uint32_t width;
63  uint32_t height;
64  uint32_t depth;
66 
67 typedef struct ArgoMASKHeader {
68  uint32_t num_frames;
69  uint32_t width;
70  uint32_t height;
72 
73 typedef struct ArgoBRPStreamHeader {
74  uint32_t codec_id;
75  uint32_t id;
76  uint32_t duration_ms;
77  uint32_t byte_rate;
78  uint32_t extradata_size;
79  union
80  {
81  /* If codec_id == BRP_CODEC_ID_BVID */
83  /* If codec_id == BRP_CODEC_ID_BASF */
85  /* If codec_id == BRP_CODEC_ID_MASK */
87  } extradata;
89 
90 typedef struct ArgoBRPDemuxContext {
93 
94  struct {
95  int index;
97  } basf;
99 
100 static int argo_brp_probe(const AVProbeData *p)
101 {
102  if (AV_RL32(p->buf) != BRP_TAG)
103  return 0;
104 
105  return AVPROBE_SCORE_EXTENSION + 1;
106 }
107 
109  void *buf, size_t bufsz)
110 {
111  const char *name;
112  uint32_t size;
113  int64_t ret;
114 
115  if (hdr->codec_id == BRP_CODEC_ID_BVID) {
116  name = "BVID";
118  } else if (hdr->codec_id == BRP_CODEC_ID_BASF) {
119  name = "BASF";
121  } else if (hdr->codec_id == BRP_CODEC_ID_MASK) {
122  name = "MASK";
124  } else {
125  avpriv_request_sample(s, "BRP codec id 0x%x", hdr->codec_id);
126 
127  if ((ret = avio_skip(s->pb, hdr->extradata_size)) < 0)
128  return ret;
129 
130  return 1;
131  }
132 
133  if (hdr->extradata_size != size) {
134  av_log(s, AV_LOG_ERROR, "Invalid %s extradata size %u, expected %u\n",
135  name, hdr->extradata_size, size);
136  return AVERROR_INVALIDDATA;
137  }
138 
139  av_assert0(bufsz >= size);
140 
141  if ((ret = avio_read(s->pb, buf, size)) < 0)
142  return ret;
143 
144  if (ret != size)
145  return AVERROR(EIO);
146 
147  return 0;
148 }
149 
151 {
152  int64_t ret;
153  AVIOContext *pb = s->pb;
154  ArgoBRPDemuxContext *brp = s->priv_data;
156 
157  if ((ret = avio_read(pb, buf, BRP_FILE_HEADER_SIZE)) < 0)
158  return ret;
159  else if (ret != BRP_FILE_HEADER_SIZE)
160  return AVERROR(EIO);
161 
162  brp->fhdr.magic = AV_RL32(buf + 0);
163  brp->fhdr.num_streams = AV_RL32(buf + 4);
164  brp->fhdr.byte_rate = AV_RL32(buf + 8);
165 
166  if (brp->fhdr.magic != BRP_TAG)
167  return AVERROR_INVALIDDATA;
168 
169  if (brp->fhdr.num_streams > BRP_MAX_STREAMS) {
170  avpriv_request_sample(s, ">%d streams", BRP_MAX_STREAMS);
171  return AVERROR_PATCHWELCOME;
172  }
173 
174  /* Build the stream info. */
175  brp->basf.index = -1;
176  for (uint32_t i = 0; i < brp->fhdr.num_streams; i++) {
177  ArgoBRPStreamHeader *hdr = brp->streams + i;
178  AVStream *st;
179 
180  if (!(st = avformat_new_stream(s, NULL)))
181  return AVERROR(ENOMEM);
182 
183  if ((ret = avio_read(pb, buf, BRP_STREAM_HEADER_SIZE)) < 0)
184  return ret;
185  else if (ret != BRP_STREAM_HEADER_SIZE)
186  return AVERROR(EIO);
187 
188  hdr->codec_id = AV_RL32(buf + 0);
189  hdr->id = AV_RL32(buf + 4);
190  hdr->duration_ms = AV_RL32(buf + 8);
191  hdr->byte_rate = AV_RL32(buf + 12);
192  hdr->extradata_size = AV_RL32(buf + 16);
193 
194  /* This should always be the case. */
195  if (hdr->id != i)
196  return AVERROR_INVALIDDATA;
197 
198  /* Timestamps are in milliseconds. */
199  avpriv_set_pts_info(st, 64, 1, 1000);
200  st->duration = hdr->duration_ms;
201  st->codecpar->bit_rate = hdr->byte_rate * 8;
202 
203  if ((ret = read_extradata(s, hdr, buf, sizeof(buf))) < 0) {
204  return ret;
205  } else if (ret > 0) {
207  continue;
208  }
209 
210  if (hdr->codec_id == BRP_CODEC_ID_BVID) {
211  ArgoBVIDHeader *bvid = &hdr->extradata.bvid;
212 
215 
216  bvid->num_frames = AV_RL32(buf + 0);
217  bvid->width = AV_RL32(buf + 4);
218  bvid->height = AV_RL32(buf + 8);
219  bvid->depth = AV_RL32(buf + 12);
220 
221  if (bvid->num_frames == 0)
222  return AVERROR_INVALIDDATA;
223 
224  /* These are from 1990's games, sanity check this. */
225  if (bvid->width >= 65536 || bvid->height >= 65536 ||
226  bvid->depth > 24 || bvid->depth % 8 != 0) {
227  return AVERROR_INVALIDDATA;
228  }
229 
230  st->codecpar->width = bvid->width;
231  st->codecpar->height = bvid->height;
232  st->nb_frames = bvid->num_frames;
233  st->codecpar->bits_per_coded_sample = bvid->depth;
234  } else if (hdr->codec_id == BRP_CODEC_ID_BASF) {
235  /*
236  * It would make the demuxer significantly more complicated
237  * to support multiple BASF streams. I've never seen a file
238  * with more than one.
239  */
240  if (brp->basf.index >= 0) {
241  avpriv_request_sample(s, "Multiple BASF streams");
242  return AVERROR_PATCHWELCOME;
243  }
244 
247  brp->basf.index = i;
249 
251  return ret;
252 
253  st->nb_frames = hdr->extradata.basf.num_chunks;
254  } else if (hdr->codec_id == BRP_CODEC_ID_MASK) {
256 
258 
259  mask->num_frames = AV_RL32(buf + 0);
260  mask->width = AV_RL32(buf + 4);
261  mask->height = AV_RL32(buf + 8);
262 
263  st->nb_frames = mask->num_frames;
264  } else {
265  av_assert0(0); /* Caught above, should never happen. */
266  }
267  }
268 
269  /* Try to find the first BASF chunk. */
270  if (brp->basf.index >= 0) {
271  AVStream *st = s->streams[brp->basf.index];
272  ArgoBRPStreamHeader *hdr = brp->streams + brp->basf.index;
274  int64_t offset;
275  int i;
276 
279 
280  if ((ret = avio_tell(s->pb)) < 0)
281  return ret;
282 
283  offset = ret;
284 
285  av_log(s, AV_LOG_TRACE, "Searching %d blocks for BASF...", BRP_BASF_LOOKAHEAD);
286 
287  for (i = 0; i < BRP_BASF_LOOKAHEAD; i++) {
288  if ((ret = avio_read(pb, buf, BRP_BLOCK_HEADER_SIZE)) < 0)
289  return ret;
290  else if (ret != BRP_BLOCK_HEADER_SIZE)
291  return AVERROR(EIO);
292 
293  blk.stream_id = AV_RL32(buf + 0);
294  blk.start_ms = AV_RL32(buf + 4);
295  blk.size = AV_RL32(buf + 8);
296 
297  if (blk.stream_id == brp->basf.index || blk.stream_id == -1)
298  break;
299 
300  if ((ret = avio_skip(pb, blk.size)) < 0)
301  return ret;
302  }
303 
304  if (i == BRP_BASF_LOOKAHEAD || blk.stream_id == -1) {
305  /* Don't error here, as there may still be a valid video stream. */
306  av_log(s, AV_LOG_TRACE, "not found\n");
307  goto done;
308  }
309 
310  av_log(s, AV_LOG_TRACE, "found at index %d\n", i);
311 
312  if (blk.size < ASF_CHUNK_HEADER_SIZE)
313  return AVERROR_INVALIDDATA;
314 
315  if ((ret = avio_read(pb, buf, ASF_CHUNK_HEADER_SIZE)) < 0)
316  return ret;
317  else if (ret != ASF_CHUNK_HEADER_SIZE)
318  return AVERROR(EIO);
319 
321 
322  /*
323  * Special Case Hack. It seems that in files where the BASF block isn't first,
324  * v1.1 streams are allowed to be non-22050...
325  * Bump the version to 1.2 so ff_argo_asf_fill_stream() doesn't "correct" it.
326  *
327  * Found in Alien Odyssey games files in:
328  * ./GRAPHICS/COMMBUNK/{{COMADD1,COMM2_{1,2,3E},COMM3_{2,3,4,5,6}},FADE{1,2}}.BRP
329  *
330  * Either this format really inconsistent, or FX Fighter and Croc just ignored the
331  * sample rate field...
332  */
333  if (i != 0 && hdr->extradata.basf.version_major == 1 && hdr->extradata.basf.version_minor == 1)
334  hdr->extradata.basf.version_minor = 2;
335 
336  if ((ret = ff_argo_asf_fill_stream(s, st, &hdr->extradata.basf, &brp->basf.ckhdr)) < 0)
337  return ret;
338 
339  /* Convert ms to samples. */
340  st->start_time = av_rescale_rnd(blk.start_ms, st->codecpar->sample_rate, 1000, AV_ROUND_UP);
342 
343 done:
344  if ((ret = avio_seek(s->pb, offset, SEEK_SET)) < 0)
345  return ret;
346  }
347  return 0;
348 }
349 
351 {
352  ArgoBRPDemuxContext *brp = s->priv_data;
354  const ArgoBRPStreamHeader *shdr;
355  AVStream *st;
356  uint8_t buf[BRP_MIN_BUFFER_SIZE];
357  ArgoASFChunkHeader ckhdr;
358  int ret;
359 
360  if ((ret = avio_read(s->pb, buf, BRP_BLOCK_HEADER_SIZE)) < 0)
361  return ret;
362  else if (ret != BRP_BLOCK_HEADER_SIZE)
363  return AVERROR(EIO);
364 
365  blk.stream_id = AV_RL32(buf + 0);
366  blk.start_ms = AV_RL32(buf + 4);
367  blk.size = AV_RL32(buf + 8);
368 
369  if (blk.stream_id == -1)
370  return AVERROR_EOF;
371 
372  if (blk.stream_id < -1 || blk.stream_id >= s->nb_streams)
373  return AVERROR_INVALIDDATA;
374 
375  st = s->streams[blk.stream_id];
376  shdr = brp->streams + blk.stream_id;
377 
378  if (blk.stream_id == brp->basf.index) {
379  if (blk.size < ASF_CHUNK_HEADER_SIZE)
380  return AVERROR_INVALIDDATA;
381 
382  if ((ret = avio_read(s->pb, buf, ASF_CHUNK_HEADER_SIZE)) < 0)
383  return ret;
384 
385  ff_argo_asf_parse_chunk_header(&ckhdr, buf);
386 
387  /* Ensure the chunk attributes are the same. */
388  if (ckhdr.sample_rate != brp->basf.ckhdr.sample_rate ||
389  ckhdr.flags != brp->basf.ckhdr.flags ||
390  ckhdr.unk1 != brp->basf.ckhdr.unk1 ||
391  ckhdr.unk2 != brp->basf.ckhdr.unk2)
392  return AVERROR_INVALIDDATA;
393 
394  blk.size -= ASF_CHUNK_HEADER_SIZE;
395  }
396 
397  if ((ret = av_get_packet(s->pb, pkt, blk.size)) < 0)
398  return ret;
399  else if (ret != blk.size)
400  return AVERROR_INVALIDDATA;
401 
402  if (blk.stream_id == brp->basf.index) {
403  pkt->duration = ckhdr.num_samples * ckhdr.num_blocks;
404  pkt->pts = av_rescale_rnd(blk.start_ms, ckhdr.sample_rate, 1000, AV_ROUND_UP);
405  } else if (shdr->codec_id == BRP_CODEC_ID_BVID) {
407  pkt->pts = blk.start_ms;
408  } else {
409  pkt->pts = blk.start_ms;
410  }
411 
412  pkt->stream_index = blk.stream_id;
413  return 0;
414 }
415 
417  .name = "argo_brp",
418  .long_name = NULL_IF_CONFIG_SMALL("Argonaut Games BRP"),
419  .priv_data_size = sizeof(ArgoBRPDemuxContext),
423 };
ArgoASFChunkHeader::sample_rate
uint16_t sample_rate
Definition: argo_asf.h:51
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
avformat_new_stream
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
Definition: options.c:237
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:57
ArgoBRPStreamHeader::extradata
union ArgoBRPStreamHeader::@247 extradata
AVERROR_EOF
#define AVERROR_EOF
End of file.
Definition: error.h:57
ArgoBRPStreamHeader::extradata_size
uint32_t extradata_size
Definition: argo_brp.c:78
ArgoBRPStreamHeader::mask
ArgoMASKHeader mask
Definition: argo_brp.c:86
ArgoBRPFileHeader::num_streams
uint32_t num_streams
Definition: argo_brp.c:50
read_extradata
static int read_extradata(AVFormatContext *s, const ArgoBRPStreamHeader *hdr, void *buf, size_t bufsz)
Definition: argo_brp.c:108
BRP_MIN_BUFFER_SIZE
#define BRP_MIN_BUFFER_SIZE
Definition: argo_brp.c:38
BRP_MAX_STREAMS
#define BRP_MAX_STREAMS
Definition: argo_brp.c:34
BRP_CODEC_ID_MASK
#define BRP_CODEC_ID_MASK
Definition: argo_brp.c:46
AVPacket::duration
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
Definition: packet.h:392
ArgoBRPStreamHeader::bvid
ArgoBVIDHeader bvid
Definition: argo_brp.c:82
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:150
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:83
ArgoBVIDHeader::width
uint32_t width
Definition: argo_brp.c:62
BRP_CODEC_ID_BASF
#define BRP_CODEC_ID_BASF
Definition: argo_brp.c:45
ArgoMASKHeader::width
uint32_t width
Definition: argo_brp.c:69
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:697
ArgoASFFileHeader::version_minor
uint16_t version_minor
Definition: argo_asf.h:41
ArgoBRPDemuxContext::streams
ArgoBRPStreamHeader streams[BRP_MAX_STREAMS]
Definition: argo_brp.c:92
argo_brp_read_packet
static int argo_brp_read_packet(AVFormatContext *s, AVPacket *pkt)
Definition: argo_brp.c:350
ArgoASFChunkHeader
Definition: argo_asf.h:47
ArgoBRPStreamHeader
Definition: argo_brp.c:73
ArgoMASKHeader::num_frames
uint32_t num_frames
Definition: argo_brp.c:68
avio_tell
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
Definition: avio.h:505
BRP_BLOCK_HEADER_SIZE
#define BRP_BLOCK_HEADER_SIZE
Definition: argo_brp.c:32
ArgoBRPBlockHeader::size
uint32_t size
Definition: argo_brp.c:57
ArgoBRPDemuxContext
Definition: argo_brp.c:90
AV_ROUND_UP
@ AV_ROUND_UP
Round toward +infinity.
Definition: mathematics.h:83
AVStream::duration
int64_t duration
Decoding: duration of the stream, in stream time base.
Definition: avformat.h:998
ArgoMASKHeader::height
uint32_t height
Definition: argo_brp.c:70
ArgoBVIDHeader::height
uint32_t height
Definition: argo_brp.c:63
ArgoBRPBlockHeader::stream_id
int32_t stream_id
Definition: argo_brp.c:55
avassert.h
AV_LOG_TRACE
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development.
Definition: log.h:206
pkt
AVPacket * pkt
Definition: movenc.c:59
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
AVInputFormat
Definition: avformat.h:656
mask
static const uint16_t mask[17]
Definition: lzw.c:38
intreadwrite.h
s
#define s(width, name)
Definition: cbs_vp9.c:256
MASK_HEADER_SIZE
#define MASK_HEADER_SIZE
Definition: argo_brp.c:37
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:661
AVProbeData::buf
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
Definition: avformat.h:455
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
AVCodecParameters::width
int width
Video only.
Definition: codec_par.h:127
AV_CODEC_ID_ARGO
@ AV_CODEC_ID_ARGO
Definition: codec_id.h:306
av_assert0
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:37
BRP_FILE_HEADER_SIZE
#define BRP_FILE_HEADER_SIZE
Definition: argo_brp.c:31
ArgoBRPStreamHeader::byte_rate
uint32_t byte_rate
Definition: argo_brp.c:77
ArgoMASKHeader
Definition: argo_brp.c:67
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:64
ArgoBRPStreamHeader::duration_ms
uint32_t duration_ms
Definition: argo_brp.c:76
AVFormatContext
Format I/O context.
Definition: avformat.h:1213
internal.h
AVStream::codecpar
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Definition: avformat.h:1108
read_header
static int read_header(FFV1Context *f)
Definition: ffv1dec.c:532
NULL
#define NULL
Definition: coverity.c:32
ArgoBRPFileHeader::magic
uint32_t magic
Definition: argo_brp.c:49
AVERROR_PATCHWELCOME
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
Definition: error.h:64
read_probe
static int read_probe(const AVProbeData *pd)
Definition: jvdec.c:55
AV_CODEC_ID_ADPCM_ARGO
@ AV_CODEC_ID_ADPCM_ARGO
Definition: codec_id.h:399
ff_argo_asf_validate_file_header
int ff_argo_asf_validate_file_header(AVFormatContext *s, const ArgoASFFileHeader *hdr)
Definition: argo_asf.c:62
ArgoBRPFileHeader
Definition: argo_brp.c:48
AVProbeData
This structure contains the data a format has to probe a file.
Definition: avformat.h:453
argo_asf.h
ArgoBRPStreamHeader::codec_id
uint32_t codec_id
Definition: argo_brp.c:74
AVPROBE_SCORE_EXTENSION
#define AVPROBE_SCORE_EXTENSION
score for file extension
Definition: avformat.h:463
AVCodecParameters::sample_rate
int sample_rate
Audio only.
Definition: codec_par.h:177
AVStream::nb_frames
int64_t nb_frames
number of frames in this stream if known or 0
Definition: avformat.h:1000
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:30
ArgoASFFileHeader::version_major
uint16_t version_major
Definition: argo_asf.h:40
AVIOContext
Bytestream IO Context.
Definition: avio.h:162
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:117
BRP_BASF_LOOKAHEAD
#define BRP_BASF_LOOKAHEAD
Definition: argo_brp.c:35
size
int size
Definition: twinvq_data.h:10344
AVMEDIA_TYPE_UNKNOWN
@ AVMEDIA_TYPE_UNKNOWN
Usually treated as AVMEDIA_TYPE_DATA.
Definition: avutil.h:200
ArgoBVIDHeader
Definition: argo_brp.c:60
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:33
ArgoBRPDemuxContext::fhdr
ArgoBRPFileHeader fhdr
Definition: argo_brp.c:91
ArgoBVIDHeader::num_frames
uint32_t num_frames
Definition: argo_brp.c:61
ArgoBRPDemuxContext::ckhdr
ArgoASFChunkHeader ckhdr
Definition: argo_brp.c:96
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:269
AVPacket::pts
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
Definition: packet.h:367
internal.h
AVCodecParameters::height
int height
Definition: codec_par.h:128
ff_argo_asf_parse_chunk_header
void ff_argo_asf_parse_chunk_header(ArgoASFChunkHeader *hdr, const uint8_t *buf)
Definition: argo_asf.c:73
argo_brp_probe
static int argo_brp_probe(const AVProbeData *p)
Definition: argo_brp.c:100
ArgoBRPFileHeader::byte_rate
uint32_t byte_rate
Definition: argo_brp.c:51
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:102
ArgoBRPBlockHeader::start_ms
uint32_t start_ms
Definition: argo_brp.c:56
ret
ret
Definition: filter_design.txt:187
read_packet
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
Definition: avio_reading.c:42
AVStream
Stream structure.
Definition: avformat.h:948
avio_seek
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
Definition: aviobuf.c:260
ArgoBRPStreamHeader::id
uint32_t id
Definition: argo_brp.c:75
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:54
ArgoASFChunkHeader::unk1
uint32_t unk1
Definition: argo_asf.h:50
ArgoBRPDemuxContext::basf
struct ArgoBRPDemuxContext::@248 basf
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:641
BRP_CODEC_ID_BVID
#define BRP_CODEC_ID_BVID
Definition: argo_brp.c:44
AVPacket::stream_index
int stream_index
Definition: packet.h:376
avio_skip
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
Definition: aviobuf.c:347
ASF_MIN_BUFFER_SIZE
#define ASF_MIN_BUFFER_SIZE
Definition: argo_asf.h:35
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AVCodecParameters::bits_per_coded_sample
int bits_per_coded_sample
The number of bits per sample in the codedwords.
Definition: codec_par.h:103
ff_argo_asf_parse_file_header
void ff_argo_asf_parse_file_header(ArgoASFFileHeader *hdr, const uint8_t *buf)
Definition: argo_asf.c:51
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:61
AVPacket
This structure stores compressed data.
Definition: packet.h:351
ArgoBRPStreamHeader::basf
ArgoASFFileHeader basf
Definition: argo_brp.c:84
BVID_HEADER_SIZE
#define BVID_HEADER_SIZE
Definition: argo_brp.c:36
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:90
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
ArgoBRPDemuxContext::index
int index
Definition: argo_brp.c:95
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:988
ff_argo_brp_demuxer
const AVInputFormat ff_argo_brp_demuxer
Definition: argo_brp.c:416