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/mem.h"
26 #include "libavutil/parseutils.h"
27 #include "avio_internal.h"
28 #include "avformat.h"
29 #include "demux.h"
30 #include "internal.h"
31 
32 typedef struct DHAVContext {
33  unsigned type;
34  unsigned subtype;
35  unsigned channel;
36  unsigned frame_subnumber;
37  unsigned frame_number;
38  unsigned date;
39  unsigned timestamp;
40  int width, height;
46  int64_t last_good_pos;
47  int64_t duration;
48 
51 } DHAVContext;
52 
53 typedef struct DHAVStream {
55  int64_t last_timestamp;
56  int64_t last_time;
57  int64_t pts;
58 } DHAVStream;
59 
60 static int dhav_probe(const AVProbeData *p)
61 {
62  if (!memcmp(p->buf, "DAHUA", 5))
63  return AVPROBE_SCORE_MAX;
64 
65  if (memcmp(p->buf, "DHAV", 4))
66  return 0;
67 
68  if (p->buf[4] == 0xf0 ||
69  p->buf[4] == 0xf1 ||
70  p->buf[4] == 0xfc ||
71  p->buf[4] == 0xfd)
72  return AVPROBE_SCORE_MAX;
73  return 0;
74 }
75 
76 static const uint32_t sample_rates[] = {
77  8000, 4000, 8000, 11025, 16000,
78  20000, 22050, 32000, 44100, 48000,
79  96000, 192000, 64000,
80 };
81 
82 static int parse_ext(AVFormatContext *s, int length)
83 {
84  DHAVContext *dhav = s->priv_data;
85  int64_t ret = 0;
86 
87  while (length > 0) {
88  int type = avio_r8(s->pb);
89  int index;
90 
91  switch (type) {
92  case 0x80:
93  ret = avio_skip(s->pb, 1);
94  dhav->width = 8 * avio_r8(s->pb);
95  dhav->height = 8 * avio_r8(s->pb);
96  length -= 4;
97  break;
98  case 0x81:
99  ret = avio_skip(s->pb, 1);
100  dhav->video_codec = avio_r8(s->pb);
101  dhav->frame_rate = avio_r8(s->pb);
102  length -= 4;
103  break;
104  case 0x82:
105  ret = avio_skip(s->pb, 3);
106  dhav->width = avio_rl16(s->pb);
107  dhav->height = avio_rl16(s->pb);
108  length -= 8;
109  break;
110  case 0x83:
111  dhav->audio_channels = avio_r8(s->pb);
112  dhav->audio_codec = avio_r8(s->pb);
113  index = avio_r8(s->pb);
115  dhav->sample_rate = sample_rates[index];
116  } else {
117  dhav->sample_rate = 8000;
118  }
119  length -= 4;
120  break;
121  case 0x88:
122  ret = avio_skip(s->pb, 7);
123  length -= 8;
124  break;
125  case 0x8c:
126  ret = avio_skip(s->pb, 1);
127  dhav->audio_channels = avio_r8(s->pb);
128  dhav->audio_codec = avio_r8(s->pb);
129  index = avio_r8(s->pb);
131  dhav->sample_rate = sample_rates[index];
132  } else {
133  dhav->sample_rate = 8000;
134  }
135  ret = avio_skip(s->pb, 3);
136  length -= 8;
137  break;
138  case 0x91:
139  case 0x92:
140  case 0x93:
141  case 0x95:
142  case 0x9a:
143  case 0x9b: // sample aspect ratio
144  case 0xb3:
145  ret = avio_skip(s->pb, 7);
146  length -= 8;
147  break;
148  case 0x84:
149  case 0x85:
150  case 0x8b:
151  case 0x94:
152  case 0x96:
153  case 0xa0:
154  case 0xb2:
155  case 0xb4:
156  ret = avio_skip(s->pb, 3);
157  length -= 4;
158  break;
159  default:
160  av_log(s, AV_LOG_INFO, "Unknown type: %X, skipping rest of header.\n", type);
161  ret = avio_skip(s->pb, length - 1);
162  length = 0;
163  }
164 
165  if (ret < 0)
166  return ret;
167  }
168 
169  return 0;
170 }
171 
173 {
174  DHAVContext *dhav = s->priv_data;
175  int frame_length, ext_length;
176  int64_t start, end, ret;
177 
178  if (avio_feof(s->pb))
179  return AVERROR_EOF;
180 
181  while (avio_r8(s->pb) != 'D' || avio_r8(s->pb) != 'H' || avio_r8(s->pb) != 'A' || avio_r8(s->pb) != 'V') {
182  if (avio_feof(s->pb))
183  return AVERROR_EOF;
184  }
185 
186  start = avio_tell(s->pb) - 4;
187  dhav->last_good_pos = start;
188  dhav->type = avio_r8(s->pb);
189  dhav->subtype = avio_r8(s->pb);
190  dhav->channel = avio_r8(s->pb);
191  dhav->frame_subnumber = avio_r8(s->pb);
192  dhav->frame_number = avio_rl32(s->pb);
193  frame_length = avio_rl32(s->pb);
194  dhav->date = avio_rl32(s->pb);
195 
196  if (frame_length < 24)
197  return AVERROR_INVALIDDATA;
198  if (dhav->type == 0xf1) {
199  ret = avio_skip(s->pb, frame_length - 20);
200  return ret < 0 ? ret : 0;
201  }
202 
203  dhav->timestamp = avio_rl16(s->pb);
204  ext_length = avio_r8(s->pb);
205  avio_skip(s->pb, 1); // checksum
206 
207  ret = parse_ext(s, ext_length);
208  if (ret < 0)
209  return ret;
210 
211  end = avio_tell(s->pb);
212 
213  return frame_length - 8 - (end - start);
214 }
215 
216 static void get_timeinfo(unsigned date, struct tm *timeinfo)
217 {
218  int year, month, day, hour, min, sec;
219 
220  sec = date & 0x3F;
221  min = (date >> 6) & 0x3F;
222  hour = (date >> 12) & 0x1F;
223  day = (date >> 17) & 0x1F;
224  month = (date >> 22) & 0x0F;
225  year = ((date >> 26) & 0x3F) + 2000;
226 
227  timeinfo->tm_year = year - 1900;
228  timeinfo->tm_mon = month - 1;
229  timeinfo->tm_mday = day;
230  timeinfo->tm_hour = hour;
231  timeinfo->tm_min = min;
232  timeinfo->tm_sec = sec;
233 }
234 
236 {
237  DHAVContext *dhav = s->priv_data;
238  int64_t start_pos = avio_tell(s->pb);
239  int64_t start = 0, end = 0;
240  struct tm timeinfo;
241  int max_interations = 100000;
242 
243  if (!s->pb->seekable)
244  return 0;
245 
246  avio_seek(s->pb, avio_size(s->pb) - 8, SEEK_SET);
247  while (avio_tell(s->pb) > 12 && max_interations--) {
248  if (avio_rl32(s->pb) == MKTAG('d','h','a','v')) {
249  int64_t seek_back = avio_rl32(s->pb);
250 
251  avio_seek(s->pb, -seek_back, SEEK_CUR);
252  read_chunk(s);
253  get_timeinfo(dhav->date, &timeinfo);
254  end = av_timegm(&timeinfo) * 1000LL;
255  break;
256  } else {
257  avio_seek(s->pb, -12, SEEK_CUR);
258  }
259  }
260 
261  avio_seek(s->pb, start_pos, SEEK_SET);
262 
263  read_chunk(s);
264  get_timeinfo(dhav->date, &timeinfo);
265  start = av_timegm(&timeinfo) * 1000LL;
266 
267  avio_seek(s->pb, start_pos, SEEK_SET);
268 
269  return end - start;
270 }
271 
273 {
274  DHAVContext *dhav = s->priv_data;
275  uint8_t signature[5];
276 
277  ffio_ensure_seekback(s->pb, 5);
278  avio_read(s->pb, signature, sizeof(signature));
279  if (!memcmp(signature, "DAHUA", 5)) {
280  avio_skip(s->pb, 0x400 - 5);
281  dhav->last_good_pos = avio_tell(s->pb);
282  } else {
283  if (!memcmp(signature, "DHAV", 4)) {
284  avio_seek(s->pb, -5, SEEK_CUR);
285  dhav->last_good_pos = avio_tell(s->pb);
286  } else if (s->pb->seekable) {
287  avio_seek(s->pb, avio_size(s->pb) - 8, SEEK_SET);
288  while (avio_rl32(s->pb) == MKTAG('d','h','a','v')) {
289  int seek_back;
290 
291  seek_back = avio_rl32(s->pb) + 8;
292  if (seek_back < 9)
293  break;
294  dhav->last_good_pos = avio_tell(s->pb);
295  avio_seek(s->pb, -seek_back, SEEK_CUR);
296  }
297  avio_seek(s->pb, dhav->last_good_pos, SEEK_SET);
298  }
299  }
300 
301  dhav->duration = get_duration(s);
302  dhav->last_good_pos = avio_tell(s->pb);
303  s->ctx_flags |= AVFMTCTX_NOHEADER;
304  dhav->video_stream_index = -1;
305  dhav->audio_stream_index = -1;
306 
307  return 0;
308 }
309 
310 static int64_t get_pts(AVFormatContext *s, int stream_index)
311 {
312  DHAVStream *dst = s->streams[stream_index]->priv_data;
313  DHAVContext *dhav = s->priv_data;
314  struct tm timeinfo;
315  time_t t;
316 
317  get_timeinfo(dhav->date, &timeinfo);
318 
319  t = av_timegm(&timeinfo);
320  if (dst->last_time == t) {
321  int64_t diff = dhav->timestamp - dst->last_timestamp;
322 
323  if (diff < 0)
324  diff += 65535;
325  if (diff == 0 && dhav->frame_rate)
326  diff = av_rescale(dhav->frame_number - dst->last_frame_number, 1000, dhav->frame_rate);
327  dst->pts += diff;
328  } else {
329  dst->pts = t * 1000LL;
330  }
331 
332  dst->last_time = t;
333  dst->last_timestamp = dhav->timestamp;
334  dst->last_frame_number = dhav->frame_number;
335 
336  return dst->pts;
337 }
338 
340 {
341  DHAVContext *dhav = s->priv_data;
342  int size, ret, stream_index;
343 
344 retry:
345  while ((ret = read_chunk(s)) == 0)
346  ;
347 
348  if (ret < 0)
349  return ret;
350 
351  if (dhav->type == 0xfd && dhav->video_stream_index == -1) {
353  DHAVStream *dst;
354 
355  if (!st)
356  return AVERROR(ENOMEM);
357 
359  switch (dhav->video_codec) {
360  case 0x1: st->codecpar->codec_id = AV_CODEC_ID_MPEG4; break;
361  case 0x3: st->codecpar->codec_id = AV_CODEC_ID_MJPEG; break;
362  case 0x2:
363  case 0x4:
364  case 0x8: st->codecpar->codec_id = AV_CODEC_ID_H264; break;
365  case 0xc: st->codecpar->codec_id = AV_CODEC_ID_HEVC; break;
366  default: avpriv_request_sample(s, "Unknown video codec %X", dhav->video_codec);
367  }
368  st->duration = dhav->duration;
369  st->codecpar->width = dhav->width;
370  st->codecpar->height = dhav->height;
371  st->avg_frame_rate.num = dhav->frame_rate;
372  st->avg_frame_rate.den = 1;
373  st->priv_data = dst = av_mallocz(sizeof(DHAVStream));
374  if (!st->priv_data)
375  return AVERROR(ENOMEM);
376  dst->last_time = AV_NOPTS_VALUE;
377  dhav->video_stream_index = st->index;
378 
379  avpriv_set_pts_info(st, 64, 1, 1000);
380  } else if (dhav->type == 0xf0 && dhav->audio_stream_index == -1) {
382  DHAVStream *dst;
383 
384  if (!st)
385  return AVERROR(ENOMEM);
386 
388  switch (dhav->audio_codec) {
389  case 0x07: st->codecpar->codec_id = AV_CODEC_ID_PCM_S8; break;
390  case 0x0c: st->codecpar->codec_id = AV_CODEC_ID_PCM_S16LE; break;
391  case 0x10: st->codecpar->codec_id = AV_CODEC_ID_PCM_S16LE; break;
392  case 0x0a: st->codecpar->codec_id = AV_CODEC_ID_PCM_MULAW; break;
393  case 0x16: st->codecpar->codec_id = AV_CODEC_ID_PCM_MULAW; break;
394  case 0x0e: st->codecpar->codec_id = AV_CODEC_ID_PCM_ALAW; break;
395  case 0x1a: st->codecpar->codec_id = AV_CODEC_ID_AAC; break;
396  case 0x1f: st->codecpar->codec_id = AV_CODEC_ID_MP2; break;
397  case 0x21: st->codecpar->codec_id = AV_CODEC_ID_MP3; break;
398  case 0x0d: st->codecpar->codec_id = AV_CODEC_ID_ADPCM_MS; break;
399  default: avpriv_request_sample(s, "Unknown audio codec %X", dhav->audio_codec);
400  }
401  st->duration = dhav->duration;
403  st->codecpar->sample_rate = dhav->sample_rate;
404  st->priv_data = dst = av_mallocz(sizeof(DHAVStream));
405  if (!st->priv_data)
406  return AVERROR(ENOMEM);
407  dst->last_time = AV_NOPTS_VALUE;
408  dhav->audio_stream_index = st->index;
409 
410  avpriv_set_pts_info(st, 64, 1, 1000);
411  }
412 
413  stream_index = dhav->type == 0xf0 ? dhav->audio_stream_index : dhav->video_stream_index;
414  if (stream_index < 0) {
415  avio_skip(s->pb, ret);
416  if (avio_rl32(s->pb) == MKTAG('d','h','a','v'))
417  avio_skip(s->pb, 4);
418  goto retry;
419  }
420 
421  size = ret;
422  ret = av_get_packet(s->pb, pkt, size);
423  if (ret < 0)
424  return ret;
425  pkt->stream_index = stream_index;
426  if (dhav->type != 0xfc)
428  pkt->duration = 1;
429  if (pkt->stream_index >= 0)
431  pkt->pos = dhav->last_good_pos;
432  if (avio_rl32(s->pb) == MKTAG('d','h','a','v'))
433  avio_skip(s->pb, 4);
434 
435  return ret;
436 }
437 
438 static int dhav_read_seek(AVFormatContext *s, int stream_index,
439  int64_t timestamp, int flags)
440 {
441  DHAVContext *dhav = s->priv_data;
442  AVStream *st = s->streams[stream_index];
443  FFStream *const sti = ffstream(st);
444  int index = av_index_search_timestamp(st, timestamp, flags);
445  int64_t pts;
446 
447  if (index < 0)
448  return -1;
450  if (pts < timestamp)
451  return AVERROR(EAGAIN);
452  if (avio_seek(s->pb, sti->index_entries[index].pos, SEEK_SET) < 0)
453  return -1;
454 
455  for (int n = 0; n < s->nb_streams; n++) {
456  AVStream *st = s->streams[n];
457  DHAVStream *dst = st->priv_data;
458 
459  dst->pts = pts;
460  dst->last_time = AV_NOPTS_VALUE;
461  }
462  dhav->last_good_pos = avio_tell(s->pb);
463 
464  return 0;
465 }
466 
468  .p.name = "dhav",
469  .p.long_name = NULL_IF_CONFIG_SMALL("Video DAV"),
470  .p.extensions = "dav",
472  .priv_data_size = sizeof(DHAVContext),
477 };
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:37
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:310
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:272
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:60
DHAVContext::timestamp
unsigned timestamp
Definition: dhav.c:39
AVStream::avg_frame_rate
AVRational avg_frame_rate
Average framerate.
Definition: avformat.h:832
DHAVStream::last_time
int64_t last_time
Definition: dhav.c:56
get_timeinfo
static void get_timeinfo(unsigned date, struct tm *timeinfo)
Definition: dhav.c:216
AVPacket::duration
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
Definition: packet.h:542
DHAVContext::audio_codec
int audio_codec
Definition: dhav.c:44
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:323
AV_PKT_FLAG_KEY
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
Definition: packet.h:579
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:57
ffstream
static av_always_inline FFStream * ffstream(AVStream *st)
Definition: internal.h:417
DHAVContext::sample_rate
int sample_rate
Definition: dhav.c:45
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:42
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:644
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:714
AVRational::num
int num
Numerator.
Definition: rational.h:59
DHAVContext::date
unsigned date
Definition: dhav.c:38
signature
static const char signature[]
Definition: ipmovie.c:591
DHAVContext::type
unsigned type
Definition: dhav.c:33
AV_CODEC_ID_PCM_S8
@ AV_CODEC_ID_PCM_S8
Definition: codec_id.h:332
pkt
AVPacket * pkt
Definition: movenc.c:60
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:42
s
#define s(width, name)
Definition: cbs_vp9.c:198
DHAVContext
Definition: dhav.c:32
ff_dhav_demuxer
const FFInputFormat ff_dhav_demuxer
Definition: dhav.c:467
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:172
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:438
DHAVContext::channel
unsigned channel
Definition: dhav.c:35
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:82
DHAVContext::audio_stream_index
int audio_stream_index
Definition: dhav.c:50
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:47
seek_back
static void seek_back(AVFormatContext *s, AVIOContext *pb, int64_t pos)
Definition: mpegts.c:3096
time.h
DHAVStream::last_timestamp
int64_t last_timestamp
Definition: dhav.c:55
DHAVContext::height
int height
Definition: dhav.c:40
AVCodecParameters::ch_layout
AVChannelLayout ch_layout
Audio only.
Definition: codec_par.h:180
index
int index
Definition: gxfenc.c:90
AVCodecParameters::sample_rate
int sample_rate
Audio only.
Definition: codec_par.h:184
DHAVContext::video_codec
int video_codec
Definition: dhav.c:41
AV_CODEC_ID_AAC
@ AV_CODEC_ID_AAC
Definition: codec_id.h:442
sample_rates
static const uint32_t sample_rates[]
Definition: dhav.c:76
avio_rl32
unsigned int avio_rl32(AVIOContext *s)
Definition: aviobuf.c:730
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
FFStream
Definition: internal.h:193
get_duration
static int64_t get_duration(AVFormatContext *s)
Definition: dhav.c:235
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:54
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:165
DHAVStream
Definition: dhav.c:53
avio_r8
int avio_r8(AVIOContext *s)
Definition: aviobuf.c:603
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:1023
AVPacket::flags
int flags
A combination of AV_PKT_FLAG values.
Definition: packet.h:530
AV_LOG_INFO
#define AV_LOG_INFO
Standard information.
Definition: log.h:191
DHAVContext::subtype
unsigned subtype
Definition: dhav.c:34
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:517
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:256
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:104
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:231
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:339
avio_read
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
Definition: aviobuf.c:612
AVIndexEntry::pos
int64_t pos
Definition: avformat.h:603
AVPacket::stream_index
int stream_index
Definition: packet.h:526
avio_skip
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
Definition: aviobuf.c:318
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:43
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
mem.h
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:501
AVPacket::pos
int64_t pos
byte position in stream, -1 if unknown
Definition: packet.h:544
FFInputFormat
Definition: demux.h:37
DHAVContext::video_stream_index
int video_stream_index
Definition: dhav.c:49
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:46
DHAVContext::width
int width
Definition: dhav.c:40
DHAVContext::frame_subnumber
unsigned frame_subnumber
Definition: dhav.c:36
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:244
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:346