57 if (!memcmp(p->
buf,
"DAHUA", 5))
60 if (memcmp(p->
buf,
"DHAV", 4))
63 if (p->
buf[4] == 0xf0 ||
72 8000, 4000, 8000, 11025, 16000,
73 20000, 22050, 32000, 44100, 48000,
169 int frame_length, ext_length;
200 if (frame_length < 24)
202 if (dhav->
type == 0xf1) {
204 return ret < 0 ? ret : 0;
217 return frame_length - 8 - (end - start);
222 int year, month, day, hour,
min, sec;
225 min = (date >> 6) & 0x3F;
226 hour = (date >> 12) & 0x1F;
227 day = (date >> 17) & 0x1F;
228 month = (date >> 22) & 0x0F;
229 year = ((date >> 26) & 0x3F) + 2000;
231 timeinfo->tm_year = year - 1900;
232 timeinfo->tm_mon = month - 1;
233 timeinfo->tm_mday = day;
234 timeinfo->tm_hour = hour;
235 timeinfo->tm_min =
min;
236 timeinfo->tm_sec = sec;
243 int64_t start = 0,
end = 0;
280 if (!memcmp(signature,
"DAHUA", 5)) {
284 if (!memcmp(signature,
"DHAV", 4)) {
326 dst->
pts = t * 1000LL;
338 int size, ret, stream_index;
410 if (stream_index < 0) {
422 if (dhav->
type != 0xfc)
time_t av_timegm(struct tm *tm)
Convert the decomposed UTC time in tm to a time_t value.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
int64_t avio_size(AVIOContext *s)
Get the filesize.
int64_t pos
byte position in stream, -1 if unknown
#define avpriv_request_sample(...)
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
static int read_chunk(AVFormatContext *s)
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
int index
stream index in AVFormatContext
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
AVIndexEntry * index_entries
Only used if the format does not support seeking natively.
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
static const uint32_t sample_rates[]
int ctx_flags
Flags signalling stream properties.
static const char signature[]
static av_cold int end(AVCodecContext *avctx)
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
AVStream ** streams
A list of all streams in the file.
#define AVERROR_EOF
End of file.
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
static void seek_back(AVFormatContext *s, AVIOContext *pb, int64_t pos)
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
static int dhav_read_header(AVFormatContext *s)
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags)
Get the index for a specific timestamp.
unsigned int avio_rl32(AVIOContext *s)
int64_t timestamp
Timestamp in AVStream.time_base units, preferably the time from which on correctly decoded frames are...
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static int dhav_probe(const AVProbeData *p)
preferred ID for decoding MPEG audio layer 1, 2 or 3
enum AVMediaType codec_type
General type of the encoded data.
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
AVRational avg_frame_rate
Average framerate.
AVInputFormat ff_dhav_demuxer
int flags
A combination of AV_PKT_FLAG values.
int avio_r8(AVIOContext *s)
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
static void get_timeinfo(unsigned date, struct tm *timeinfo)
static int dhav_read_packet(AVFormatContext *s, AVPacket *pkt)
#define FF_ARRAY_ELEMS(a)
static int read_header(FFV1Context *f)
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
#define AV_LOG_INFO
Standard information.
AVIOContext * pb
I/O context.
static int dhav_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
This structure contains the data a format has to probe a file.
#define flags(name, subs,...)
static int64_t get_pts(AVFormatContext *s, int stream_index)
int ffio_ensure_seekback(AVIOContext *s, int64_t buf_size)
Ensures that the requested seekback buffer size will be available.
int64_t duration
Decoding: duration of the stream, in stream time base.
int sample_rate
Audio only.
unsigned int avio_rl16(AVIOContext *s)
static av_always_inline int diff(const uint32_t a, const uint32_t b)
void * priv_data
Format private data.
AVCodecParameters * codecpar
Codec parameters associated with this stream.
int avio_feof(AVIOContext *s)
Similar to feof() but also returns nonzero on read errors.
#define MKTAG(a, b, c, d)
This structure stores compressed data.
static int parse_ext(AVFormatContext *s, int length)
static int64_t get_duration(AVFormatContext *s)
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
#define AV_NOPTS_VALUE
Undefined timestamp value.