63 if (!memcmp(p->buf,
"DAHUA", 5))
66 if (memcmp(p->buf,
"DHAV", 4))
69 if (p->buf[4] == 0xf0 ||
78 8000, 4000, 8000, 11025, 16000,
79 20000, 22050, 32000, 44100, 48000,
176 int frame_length, ext_length;
197 if (frame_length < 24)
199 if (dhav->
type == 0xf1) {
201 return ret < 0 ? ret : 0;
214 return frame_length - 8 - (end - start);
219 int year, month, day, hour,
min, sec;
222 min = (date >> 6) & 0x3F;
223 hour = (date >> 12) & 0x1F;
224 day = (date >> 17) & 0x1F;
225 month = (date >> 22) & 0x0F;
226 year = ((date >> 26) & 0x3F) + 2000;
228 timeinfo->tm_year = year - 1900;
229 timeinfo->tm_mon = month - 1;
230 timeinfo->tm_mday = day;
231 timeinfo->tm_hour = hour;
232 timeinfo->tm_min =
min;
233 timeinfo->tm_sec = sec;
236#define MAX_DURATION_BUFFER_SIZE (1024*1024)
255 if (start_pos < 0 || start_pos >
size - 20)
267 buffer_pos =
size - buffer_size;
289 ret =
av_timegm(&timeinfo) * 1000LL - start;
315 }
else if (
s->pb->seekable) {
351 if (
dst->last_time == t) {
360 dst->pts = t * 1000LL;
373 int size, ret, stream_index;
445 if (stream_index < 0) {
456 pkt->stream_index = stream_index;
457 if (dhav->
type != 0xfc)
460 if (
pkt->stream_index >= 0)
486 for (
int n = 0; n <
s->nb_streams; n++) {
500 .p.extensions =
"dav",
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
#define get_duration(index)
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
#define AVIO_SEEKABLE_NORMAL
Seeking works like for a local file.
int64_t avio_size(AVIOContext *s)
Get the filesize.
int avio_feof(AVIOContext *s)
Similar to feof() but also returns nonzero on read errors.
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
unsigned int avio_rl16(AVIOContext *s)
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
unsigned int avio_rl32(AVIOContext *s)
int avio_r8(AVIOContext *s)
int ffio_ensure_seekback(AVIOContext *s, int64_t buf_size)
Ensures that the requested seekback buffer size will be available.
int ffio_read_size(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
#define flags(name, subs,...)
static int read_probe(const AVProbeData *p)
static const int sample_rates[]
static int dhav_probe(const AVProbeData *p)
static int parse_ext(AVFormatContext *s, int length)
static int dhav_read_packet(AVFormatContext *s, AVPacket *pkt)
static int read_chunk(AVFormatContext *s)
static int dhav_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
#define MAX_DURATION_BUFFER_SIZE
static int64_t get_pts(AVFormatContext *s, int stream_index)
static int dhav_read_header(AVFormatContext *s)
static void get_timeinfo(unsigned date, struct tm *timeinfo)
static int read_header(FFV1Context *f, RangeCoder *c)
@ AV_CODEC_ID_MP3
preferred ID for decoding MPEG audio layer 1, 2 or 3
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags)
Get the index for a specific timestamp.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AVERROR_EOF
End of file.
#define AV_LOG_INFO
Standard information.
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
#define AV_NOPTS_VALUE
Undefined timestamp value.
static const char signature[]
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
#define MKTAG(a, b, c, d)
Memory handling functions.
static void seek_back(AVFormatContext *s, AVIOContext *pb, int64_t pos)
time_t av_timegm(struct tm *tm)
Convert the decomposed UTC time in tm to a time_t value.
#define FF_ARRAY_ELEMS(a)
int nb_channels
Number of channels in this layout.
int height
The height of the video frame in pixels.
AVChannelLayout ch_layout
The channel layout and number of channels.
int width
The width of the video frame in pixels.
enum AVMediaType codec_type
General type of the encoded data.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
int sample_rate
The number of audio samples per second.
int64_t timestamp
Timestamp in AVStream.time_base units, preferably the time from which on correctly decoded frames are...
This structure stores compressed data.
This structure contains the data a format has to probe a file.
AVCodecParameters * codecpar
Codec parameters associated with this stream.
int64_t duration
Decoding: duration of the stream, in stream time base.
int index
stream index in AVFormatContext
AVRational avg_frame_rate
Average framerate.
int64_t last_frame_number
AVIndexEntry * index_entries
Only used if the format does not support seeking natively.
#define avpriv_request_sample(...)
static av_always_inline int diff(const struct color_info *a, const struct color_info *b, const int trans_thresh)