FFmpeg
dhav.c
Go to the documentation of this file.
1 /*
2  * DHAV demuxer
3  *
4  * Copyright (c) 2018 Paul B Mahol
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 <time.h>
24 
25 #include "libavutil/parseutils.h"
26 #include "avio_internal.h"
27 #include "avformat.h"
28 #include "demux.h"
29 #include "internal.h"
30 
31 typedef struct DHAVContext {
32  unsigned type;
33  unsigned subtype;
34  unsigned channel;
35  unsigned frame_subnumber;
36  unsigned frame_number;
37  unsigned date;
38  unsigned timestamp;
39  int width, height;
45  int64_t last_good_pos;
46  int64_t duration;
47 
50 } DHAVContext;
51 
52 typedef struct DHAVStream {
54  int64_t last_timestamp;
55  int64_t last_time;
56  int64_t pts;
57 } DHAVStream;
58 
59 static int dhav_probe(const AVProbeData *p)
60 {
61  if (!memcmp(p->buf, "DAHUA", 5))
62  return AVPROBE_SCORE_MAX;
63 
64  if (memcmp(p->buf, "DHAV", 4))
65  return 0;
66 
67  if (p->buf[4] == 0xf0 ||
68  p->buf[4] == 0xf1 ||
69  p->buf[4] == 0xfc ||
70  p->buf[4] == 0xfd)
71  return AVPROBE_SCORE_MAX;
72  return 0;
73 }
74 
75 static const uint32_t sample_rates[] = {
76  8000, 4000, 8000, 11025, 16000,
77  20000, 22050, 32000, 44100, 48000,
78  96000, 192000, 64000,
79 };
80 
81 static int parse_ext(AVFormatContext *s, int length)
82 {
83  DHAVContext *dhav = s->priv_data;
84  int64_t ret = 0;
85 
86  while (length > 0) {
87  int type = avio_r8(s->pb);
88  int index;
89 
90  switch (type) {
91  case 0x80:
92  ret = avio_skip(s->pb, 1);
93  dhav->width = 8 * avio_r8(s->pb);
94  dhav->height = 8 * avio_r8(s->pb);
95  length -= 4;
96  break;
97  case 0x81:
98  ret = avio_skip(s->pb, 1);
99  dhav->video_codec = avio_r8(s->pb);
100  dhav->frame_rate = avio_r8(s->pb);
101  length -= 4;
102  break;
103  case 0x82:
104  ret = avio_skip(s->pb, 3);
105  dhav->width = avio_rl16(s->pb);
106  dhav->height = avio_rl16(s->pb);
107  length -= 8;
108  break;
109  case 0x83:
110  dhav->audio_channels = avio_r8(s->pb);
111  dhav->audio_codec = avio_r8(s->pb);
112  index = avio_r8(s->pb);
114  dhav->sample_rate = sample_rates[index];
115  } else {
116  dhav->sample_rate = 8000;
117  }
118  length -= 4;
119  break;
120  case 0x88:
121  ret = avio_skip(s->pb, 7);
122  length -= 8;
123  break;
124  case 0x8c:
125  ret = avio_skip(s->pb, 1);
126  dhav->audio_channels = avio_r8(s->pb);
127  dhav->audio_codec = avio_r8(s->pb);
128  index = avio_r8(s->pb);
130  dhav->sample_rate = sample_rates[index];
131  } else {
132  dhav->sample_rate = 8000;
133  }
134  ret = avio_skip(s->pb, 3);
135  length -= 8;
136  break;
137  case 0x91:
138  case 0x92:
139  case 0x93:
140  case 0x95:
141  case 0x9a:
142  case 0x9b: // sample aspect ratio
143  case 0xb3:
144  ret = avio_skip(s->pb, 7);
145  length -= 8;
146  break;
147  case 0x84:
148  case 0x85:
149  case 0x8b:
150  case 0x94:
151  case 0x96:
152  case 0xa0:
153  case 0xb2:
154  case 0xb4:
155  ret = avio_skip(s->pb, 3);
156  length -= 4;
157  break;
158  default:
159  av_log(s, AV_LOG_INFO, "Unknown type: %X, skipping rest of header.\n", type);
160  ret = avio_skip(s->pb, length - 1);
161  length = 0;
162  }
163 
164  if (ret < 0)
165  return ret;
166  }
167 
168  return 0;
169 }
170 
172 {
173  DHAVContext *dhav = s->priv_data;
174  int frame_length, ext_length;
175  int64_t start, end, ret;
176 
177  if (avio_feof(s->pb))
178  return AVERROR_EOF;
179 
180  while (avio_r8(s->pb) != 'D' || avio_r8(s->pb) != 'H' || avio_r8(s->pb) != 'A' || avio_r8(s->pb) != 'V') {
181  if (avio_feof(s->pb))
182  return AVERROR_EOF;
183  }
184 
185  start = avio_tell(s->pb) - 4;
186  dhav->last_good_pos = start;
187  dhav->type = avio_r8(s->pb);
188  dhav->subtype = avio_r8(s->pb);
189  dhav->channel = avio_r8(s->pb);
190  dhav->frame_subnumber = avio_r8(s->pb);
191  dhav->frame_number = avio_rl32(s->pb);
192  frame_length = avio_rl32(s->pb);
193  dhav->date = avio_rl32(s->pb);
194 
195  if (frame_length < 24)
196  return AVERROR_INVALIDDATA;
197  if (dhav->type == 0xf1) {
198  ret = avio_skip(s->pb, frame_length - 20);
199  return ret < 0 ? ret : 0;
200  }
201 
202  dhav->timestamp = avio_rl16(s->pb);
203  ext_length = avio_r8(s->pb);
204  avio_skip(s->pb, 1); // checksum
205 
206  ret = parse_ext(s, ext_length);
207  if (ret < 0)
208  return ret;
209 
210  end = avio_tell(s->pb);
211 
212  return frame_length - 8 - (end - start);
213 }
214 
215 static void get_timeinfo(unsigned date, struct tm *timeinfo)
216 {
217  int year, month, day, hour, min, sec;
218 
219  sec = date & 0x3F;
220  min = (date >> 6) & 0x3F;
221  hour = (date >> 12) & 0x1F;
222  day = (date >> 17) & 0x1F;
223  month = (date >> 22) & 0x0F;
224  year = ((date >> 26) & 0x3F) + 2000;
225 
226  timeinfo->tm_year = year - 1900;
227  timeinfo->tm_mon = month - 1;
228  timeinfo->tm_mday = day;
229  timeinfo->tm_hour = hour;
230  timeinfo->tm_min = min;
231  timeinfo->tm_sec = sec;
232 }
233 
235 {
236  DHAVContext *dhav = s->priv_data;
237  int64_t start_pos = avio_tell(s->pb);
238  int64_t start = 0, end = 0;
239  struct tm timeinfo;
240  int max_interations = 100000;
241 
242  if (!s->pb->seekable)
243  return 0;
244 
245  avio_seek(s->pb, avio_size(s->pb) - 8, SEEK_SET);
246  while (avio_tell(s->pb) > 12 && max_interations--) {
247  if (avio_rl32(s->pb) == MKTAG('d','h','a','v')) {
248  int64_t seek_back = avio_rl32(s->pb);
249 
250  avio_seek(s->pb, -seek_back, SEEK_CUR);
251  read_chunk(s);
252  get_timeinfo(dhav->date, &timeinfo);
253  end = av_timegm(&timeinfo) * 1000LL;
254  break;
255  } else {
256  avio_seek(s->pb, -12, SEEK_CUR);
257  }
258  }
259 
260  avio_seek(s->pb, start_pos, SEEK_SET);
261 
262  read_chunk(s);
263  get_timeinfo(dhav->date, &timeinfo);
264  start = av_timegm(&timeinfo) * 1000LL;
265 
266  avio_seek(s->pb, start_pos, SEEK_SET);
267 
268  return end - start;
269 }
270 
272 {
273  DHAVContext *dhav = s->priv_data;
274  uint8_t signature[5];
275 
276  ffio_ensure_seekback(s->pb, 5);
277  avio_read(s->pb, signature, sizeof(signature));
278  if (!memcmp(signature, "DAHUA", 5)) {
279  avio_skip(s->pb, 0x400 - 5);
280  dhav->last_good_pos = avio_tell(s->pb);
281  } else {
282  if (!memcmp(signature, "DHAV", 4)) {
283  avio_seek(s->pb, -5, SEEK_CUR);
284  dhav->last_good_pos = avio_tell(s->pb);
285  } else if (s->pb->seekable) {
286  avio_seek(s->pb, avio_size(s->pb) - 8, SEEK_SET);
287  while (avio_rl32(s->pb) == MKTAG('d','h','a','v')) {
288  int seek_back;
289 
290  seek_back = avio_rl32(s->pb) + 8;
291  if (seek_back < 9)
292  break;
293  dhav->last_good_pos = avio_tell(s->pb);
294  avio_seek(s->pb, -seek_back, SEEK_CUR);
295  }
296  avio_seek(s->pb, dhav->last_good_pos, SEEK_SET);
297  }
298  }
299 
300  dhav->duration = get_duration(s);
301  dhav->last_good_pos = avio_tell(s->pb);
302  s->ctx_flags |= AVFMTCTX_NOHEADER;
303  dhav->video_stream_index = -1;
304  dhav->audio_stream_index = -1;
305 
306  return 0;
307 }
308 
309 static int64_t get_pts(AVFormatContext *s, int stream_index)
310 {
311  DHAVStream *dst = s->streams[stream_index]->priv_data;
312  DHAVContext *dhav = s->priv_data;
313  struct tm timeinfo;
314  time_t t;
315 
316  get_timeinfo(dhav->date, &timeinfo);
317 
318  t = av_timegm(&timeinfo);
319  if (dst->last_time == t) {
320  int64_t diff = dhav->timestamp - dst->last_timestamp;
321 
322  if (diff < 0)
323  diff += 65535;
324  if (diff == 0 && dhav->frame_rate)
325  diff = av_rescale(dhav->frame_number - dst->last_frame_number, 1000, dhav->frame_rate);
326  dst->pts += diff;
327  } else {
328  dst->pts = t * 1000LL;
329  }
330 
331  dst->last_time = t;
332  dst->last_timestamp = dhav->timestamp;
333  dst->last_frame_number = dhav->frame_number;
334 
335  return dst->pts;
336 }
337 
339 {
340  DHAVContext *dhav = s->priv_data;
341  int size, ret, stream_index;
342 
343 retry:
344  while ((ret = read_chunk(s)) == 0)
345  ;
346 
347  if (ret < 0)
348  return ret;
349 
350  if (dhav->type == 0xfd && dhav->video_stream_index == -1) {
352  DHAVStream *dst;
353 
354  if (!st)
355  return AVERROR(ENOMEM);
356 
358  switch (dhav->video_codec) {
359  case 0x1: st->codecpar->codec_id = AV_CODEC_ID_MPEG4; break;
360  case 0x3: st->codecpar->codec_id = AV_CODEC_ID_MJPEG; break;
361  case 0x2:
362  case 0x4:
363  case 0x8: st->codecpar->codec_id = AV_CODEC_ID_H264; break;
364  case 0xc: st->codecpar->codec_id = AV_CODEC_ID_HEVC; break;
365  default: avpriv_request_sample(s, "Unknown video codec %X", dhav->video_codec);
366  }
367  st->duration = dhav->duration;
368  st->codecpar->width = dhav->width;
369  st->codecpar->height = dhav->height;
370  st->avg_frame_rate.num = dhav->frame_rate;
371  st->avg_frame_rate.den = 1;
372  st->priv_data = dst = av_mallocz(sizeof(DHAVStream));
373  if (!st->priv_data)
374  return AVERROR(ENOMEM);
375  dst->last_time = AV_NOPTS_VALUE;
376  dhav->video_stream_index = st->index;
377 
378  avpriv_set_pts_info(st, 64, 1, 1000);
379  } else if (dhav->type == 0xf0 && dhav->audio_stream_index == -1) {
381  DHAVStream *dst;
382 
383  if (!st)
384  return AVERROR(ENOMEM);
385 
387  switch (dhav->audio_codec) {
388  case 0x07: st->codecpar->codec_id = AV_CODEC_ID_PCM_S8; break;
389  case 0x0c: st->codecpar->codec_id = AV_CODEC_ID_PCM_S16LE; break;
390  case 0x10: st->codecpar->codec_id = AV_CODEC_ID_PCM_S16LE; break;
391  case 0x0a: st->codecpar->codec_id = AV_CODEC_ID_PCM_MULAW; break;
392  case 0x16: st->codecpar->codec_id = AV_CODEC_ID_PCM_MULAW; break;
393  case 0x0e: st->codecpar->codec_id = AV_CODEC_ID_PCM_ALAW; break;
394  case 0x1a: st->codecpar->codec_id = AV_CODEC_ID_AAC; break;
395  case 0x1f: st->codecpar->codec_id = AV_CODEC_ID_MP2; break;
396  case 0x21: st->codecpar->codec_id = AV_CODEC_ID_MP3; break;
397  case 0x0d: st->codecpar->codec_id = AV_CODEC_ID_ADPCM_MS; break;
398  default: avpriv_request_sample(s, "Unknown audio codec %X", dhav->audio_codec);
399  }
400  st->duration = dhav->duration;
402  st->codecpar->sample_rate = dhav->sample_rate;
403  st->priv_data = dst = av_mallocz(sizeof(DHAVStream));
404  if (!st->priv_data)
405  return AVERROR(ENOMEM);
406  dst->last_time = AV_NOPTS_VALUE;
407  dhav->audio_stream_index = st->index;
408 
409  avpriv_set_pts_info(st, 64, 1, 1000);
410  }
411 
412  stream_index = dhav->type == 0xf0 ? dhav->audio_stream_index : dhav->video_stream_index;
413  if (stream_index < 0) {
414  avio_skip(s->pb, ret);
415  if (avio_rl32(s->pb) == MKTAG('d','h','a','v'))
416  avio_skip(s->pb, 4);
417  goto retry;
418  }
419 
420  size = ret;
421  ret = av_get_packet(s->pb, pkt, size);
422  if (ret < 0)
423  return ret;
424  pkt->stream_index = stream_index;
425  if (dhav->type != 0xfc)
427  pkt->duration = 1;
428  if (pkt->stream_index >= 0)
430  pkt->pos = dhav->last_good_pos;
431  if (avio_rl32(s->pb) == MKTAG('d','h','a','v'))
432  avio_skip(s->pb, 4);
433 
434  return ret;
435 }
436 
437 static int dhav_read_seek(AVFormatContext *s, int stream_index,
438  int64_t timestamp, int flags)
439 {
440  DHAVContext *dhav = s->priv_data;
441  AVStream *st = s->streams[stream_index];
442  FFStream *const sti = ffstream(st);
443  int index = av_index_search_timestamp(st, timestamp, flags);
444  int64_t pts;
445 
446  if (index < 0)
447  return -1;
449  if (pts < timestamp)
450  return AVERROR(EAGAIN);
451  if (avio_seek(s->pb, sti->index_entries[index].pos, SEEK_SET) < 0)
452  return -1;
453 
454  for (int n = 0; n < s->nb_streams; n++) {
455  AVStream *st = s->streams[n];
456  DHAVStream *dst = st->priv_data;
457 
458  dst->pts = pts;
459  dst->last_time = AV_NOPTS_VALUE;
460  }
461  dhav->last_good_pos = avio_tell(s->pb);
462 
463  return 0;
464 }
465 
467  .p.name = "dhav",
468  .p.long_name = NULL_IF_CONFIG_SMALL("Video DAV"),
469  .p.extensions = "dav",
471  .priv_data_size = sizeof(DHAVContext),
476 };
AV_CODEC_ID_PCM_S16LE
@ AV_CODEC_ID_PCM_S16LE
Definition: codec_id.h:328
AV_CODEC_ID_ADPCM_MS
@ AV_CODEC_ID_ADPCM_MS
Definition: codec_id.h:373
AVFMT_NO_BYTE_SEEK
#define AVFMT_NO_BYTE_SEEK
Format does not allow seeking by bytes.
Definition: avformat.h:487
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
AVCodecParameters::codec_type
enum AVMediaType codec_type
General type of the encoded data.
Definition: codec_par.h:51
DHAVContext::frame_number
unsigned frame_number
Definition: dhav.c:36
avformat_new_stream
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
get_pts
static int64_t get_pts(AVFormatContext *s, int stream_index)
Definition: dhav.c:309
AVStream::priv_data
void * priv_data
Definition: avformat.h:768
AVERROR_EOF
#define AVERROR_EOF
End of file.
Definition: error.h:57
dhav_read_header
static int dhav_read_header(AVFormatContext *s)
Definition: dhav.c:271
AV_CODEC_ID_MPEG4
@ AV_CODEC_ID_MPEG4
Definition: codec_id.h:64
dhav_probe
static int dhav_probe(const AVProbeData *p)
Definition: dhav.c:59
DHAVContext::timestamp
unsigned timestamp
Definition: dhav.c:38
AVStream::avg_frame_rate
AVRational avg_frame_rate
Average framerate.
Definition: avformat.h:832
DHAVStream::last_time
int64_t last_time
Definition: dhav.c:55
get_timeinfo
static void get_timeinfo(unsigned date, struct tm *timeinfo)
Definition: dhav.c:215
AVPacket::duration
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
Definition: packet.h:540
DHAVContext::audio_codec
int audio_codec
Definition: dhav.c:43
AVChannelLayout::nb_channels
int nb_channels
Number of channels in this layout.
Definition: channel_layout.h:313
avio_size
int64_t avio_size(AVIOContext *s)
Get the filesize.
Definition: aviobuf.c:322
AV_PKT_FLAG_KEY
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
Definition: packet.h:577
AVPROBE_SCORE_MAX
#define AVPROBE_SCORE_MAX
maximum score
Definition: avformat.h:463
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:853
DHAVStream::pts
int64_t pts
Definition: dhav.c:56
ffstream
static av_always_inline FFStream * ffstream(AVStream *st)
Definition: internal.h:417
DHAVContext::sample_rate
int sample_rate
Definition: dhav.c:44
AVFMT_SEEK_TO_PTS
#define AVFMT_SEEK_TO_PTS
Seeking is based on PTS.
Definition: avformat.h:503
read_seek
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
Definition: libcdio.c:151
DHAVContext::frame_rate
int frame_rate
Definition: dhav.c:41
avio_tell
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
Definition: avio.h:494
AVFMT_GENERIC_INDEX
#define AVFMT_GENERIC_INDEX
Use generic index building code.
Definition: avformat.h:480
type
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 type
Definition: writing_filters.txt:86
pts
static int64_t pts
Definition: transcode_aac.c:643
av_timegm
time_t av_timegm(struct tm *tm)
Convert the decomposed UTC time in tm to a time_t value.
Definition: parseutils.c:570
AV_CODEC_ID_MP3
@ AV_CODEC_ID_MP3
preferred ID for decoding MPEG audio layer 1, 2 or 3
Definition: codec_id.h:441
AVStream::duration
int64_t duration
Decoding: duration of the stream, in stream time base.
Definition: avformat.h:802
avio_rl16
unsigned int avio_rl16(AVIOContext *s)
Definition: aviobuf.c:713
AVRational::num
int num
Numerator.
Definition: rational.h:59
DHAVContext::date
unsigned date
Definition: dhav.c:37
signature
static const char signature[]
Definition: ipmovie.c:591
DHAVContext::type
unsigned type
Definition: dhav.c:32
AV_CODEC_ID_PCM_S8
@ AV_CODEC_ID_PCM_S8
Definition: codec_id.h:332
pkt
AVPacket * pkt
Definition: movenc.c:59
FF_ARRAY_ELEMS
#define FF_ARRAY_ELEMS(a)
Definition: sinewin_tablegen.c:29
read_packet
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
Definition: avio_read_callback.c:41
s
#define s(width, name)
Definition: cbs_vp9.c:198
DHAVContext
Definition: dhav.c:31
ff_dhav_demuxer
const FFInputFormat ff_dhav_demuxer
Definition: dhav.c:466
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
read_chunk
static int read_chunk(AVFormatContext *s)
Definition: dhav.c:171
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
AVCodecParameters::width
int width
Video only.
Definition: codec_par.h:134
AV_CODEC_ID_MP2
@ AV_CODEC_ID_MP2
Definition: codec_id.h:440
AVIndexEntry::timestamp
int64_t timestamp
Timestamp in AVStream.time_base units, preferably the time from which on correctly decoded frames are...
Definition: avformat.h:604
dhav_read_seek
static int dhav_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
Definition: dhav.c:437
DHAVContext::channel
unsigned channel
Definition: dhav.c:34
AV_CODEC_ID_PCM_MULAW
@ AV_CODEC_ID_PCM_MULAW
Definition: codec_id.h:334
AV_CODEC_ID_H264
@ AV_CODEC_ID_H264
Definition: codec_id.h:79
AVFormatContext
Format I/O context.
Definition: avformat.h:1255
AV_CODEC_ID_PCM_ALAW
@ AV_CODEC_ID_PCM_ALAW
Definition: codec_id.h:335
internal.h
AVStream::codecpar
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Definition: avformat.h:766
read_header
static int read_header(FFV1Context *f)
Definition: ffv1dec.c:550
NULL
#define NULL
Definition: coverity.c:32
AVFMTCTX_NOHEADER
#define AVFMTCTX_NOHEADER
signal that no header is present (streams are added dynamically)
Definition: avformat.h:1206
parse_ext
static int parse_ext(AVFormatContext *s, int length)
Definition: dhav.c:81
DHAVContext::audio_stream_index
int audio_stream_index
Definition: dhav.c:49
parseutils.h
AVProbeData
This structure contains the data a format has to probe a file.
Definition: avformat.h:451
DHAVContext::duration
int64_t duration
Definition: dhav.c:46
seek_back
static void seek_back(AVFormatContext *s, AVIOContext *pb, int64_t pos)
Definition: mpegts.c:3098
time.h
DHAVStream::last_timestamp
int64_t last_timestamp
Definition: dhav.c:54
DHAVContext::height
int height
Definition: dhav.c:39
AVCodecParameters::ch_layout
AVChannelLayout ch_layout
Audio only.
Definition: codec_par.h:180
index
int index
Definition: gxfenc.c:89
AVCodecParameters::sample_rate
int sample_rate
Audio only.
Definition: codec_par.h:184
DHAVContext::video_codec
int video_codec
Definition: dhav.c:40
AV_CODEC_ID_AAC
@ AV_CODEC_ID_AAC
Definition: codec_id.h:442
sample_rates
static const uint32_t sample_rates[]
Definition: dhav.c:75
avio_rl32
unsigned int avio_rl32(AVIOContext *s)
Definition: aviobuf.c:729
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:106
FFStream
Definition: internal.h:193
get_duration
static int64_t get_duration(AVFormatContext *s)
Definition: dhav.c:234
size
int size
Definition: twinvq_data.h:10344
AV_NOPTS_VALUE
#define AV_NOPTS_VALUE
Undefined timestamp value.
Definition: avutil.h:248
DHAVStream::last_frame_number
int64_t last_frame_number
Definition: dhav.c:53
FFInputFormat::p
AVInputFormat p
The public AVInputFormat.
Definition: demux.h:41
diff
static av_always_inline int diff(const struct color_info *a, const struct color_info *b, const int trans_thresh)
Definition: vf_paletteuse.c:164
DHAVStream
Definition: dhav.c:52
avio_r8
int avio_r8(AVIOContext *s)
Definition: aviobuf.c:602
ffio_ensure_seekback
int ffio_ensure_seekback(AVIOContext *s, int64_t buf_size)
Ensures that the requested seekback buffer size will be available.
Definition: aviobuf.c:1022
AVPacket::flags
int flags
A combination of AV_PKT_FLAG values.
Definition: packet.h:528
AV_LOG_INFO
#define AV_LOG_INFO
Standard information.
Definition: log.h:191
DHAVContext::subtype
unsigned subtype
Definition: dhav.c:33
AV_CODEC_ID_MJPEG
@ AV_CODEC_ID_MJPEG
Definition: codec_id.h:59
AVPacket::pts
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
Definition: packet.h:515
avio_internal.h
AVCodecParameters::height
int height
Definition: codec_par.h:135
AV_CODEC_ID_HEVC
@ AV_CODEC_ID_HEVC
Definition: codec_id.h:226
av_mallocz
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
Definition: mem.c:254
demux.h
av_rescale
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
Definition: mathematics.c:129
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:103
AVFMT_TS_NONSTRICT
#define AVFMT_TS_NONSTRICT
Format does not require strictly increasing timestamps, but they must still be monotonic.
Definition: avformat.h:491
ret
ret
Definition: filter_design.txt:187
AVStream
Stream structure.
Definition: avformat.h:743
avio_seek
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
Definition: aviobuf.c:230
avformat.h
AVStream::index
int index
stream index in AVFormatContext
Definition: avformat.h:749
AVRational::den
int den
Denominator.
Definition: rational.h:60
dhav_read_packet
static int dhav_read_packet(AVFormatContext *s, AVPacket *pkt)
Definition: dhav.c:338
avio_read
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
Definition: aviobuf.c:611
AVIndexEntry::pos
int64_t pos
Definition: avformat.h:603
AVPacket::stream_index
int stream_index
Definition: packet.h:524
avio_skip
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
Definition: aviobuf.c:317
FFStream::index_entries
AVIndexEntry * index_entries
Only used if the format does not support seeking natively.
Definition: internal.h:249
DHAVContext::audio_channels
int audio_channels
Definition: dhav.c:42
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
read_probe
static int read_probe(const AVProbeData *p)
Definition: cdg.c:30
AVFMT_TS_DISCONT
#define AVFMT_TS_DISCONT
Format allows timestamp discontinuities.
Definition: avformat.h:481
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:499
AVPacket::pos
int64_t pos
byte position in stream, -1 if unknown
Definition: packet.h:542
FFInputFormat
Definition: demux.h:37
DHAVContext::video_stream_index
int video_stream_index
Definition: dhav.c:48
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:474
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
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
DHAVContext::last_good_pos
int64_t last_good_pos
Definition: dhav.c:45
DHAVContext::width
int width
Definition: dhav.c:39
DHAVContext::frame_subnumber
unsigned frame_subnumber
Definition: dhav.c:35
av_index_search_timestamp
int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags)
Get the index for a specific timestamp.
Definition: seek.c:243
min
float min
Definition: vorbis_enc_data.h:429
avio_feof
int avio_feof(AVIOContext *s)
Similar to feof() but also returns nonzero on read errors.
Definition: aviobuf.c:345