31#define DSS_HEAD_OFFSET_AUTHOR 0xc
32#define DSS_AUTHOR_SIZE 16
34#define DSS_HEAD_OFFSET_START_TIME 0x26
35#define DSS_HEAD_OFFSET_END_TIME 0x32
36#define DSS_TIME_SIZE 12
38#define DSS_HEAD_OFFSET_ACODEC 0x2a4
39#define DSS_ACODEC_DSS_SP 0x0
40#define DSS_ACODEC_DSS_SP_VR 0x1
41#define DSS_ACODEC_G723_1 0x2
43#define DSS_HEAD_OFFSET_COMMENT 0x31e
44#define DSS_COMMENT_SIZE 64
46#define DSS_BLOCK_SIZE 512
47#define DSS_AUDIO_BLOCK_HEADER_SIZE 6
48#define DSS_BLOCK_KEEP_BEFORE 2
49#define DSS_FRAME_SIZE 42
50#define DSS_SP_SHORT_FRAME_SIZE 9
91 int y, month, d,
h, minute, sec;
100 if (sscanf(
string,
"%2d%2d%2d%2d%2d%2d", &y, &month, &d, &
h, &minute, &sec) != 6)
104 snprintf(datetime,
sizeof(datetime),
"%.4d-%.2d-%.2dT%.2d:%.2d:%.2d",
105 y + 2000, month, d,
h, minute, sec);
110 unsigned int size,
const char *
key)
143 ctx->frames_left = 0;
144 ctx->frames_read = 0;
145 ctx->dss_sp_swap_byte = -1;
362 if (!
ctx->frames_left)
393 ctx->block_pos = block_pos;
394 ctx->frames_left = 0;
418 for (
i = 0;
i <
size - 1;
i += 2)
421 data[1] =
ctx->dss_sp_swap_byte;
439 if (
ctx->frames_left <= 0) {
451 pkt->pts =
ctx->frames_read++ * 264;
453 pkt->stream_index = 0;
461 if (
ctx->dss_sp_swap_byte >= 0 && !(
ctx->dss_sp_swap_byte & 0x80))
468 if (!(
pkt->data[1] & 0x80))
487 if (
ctx->dss_sp_swap_byte < 0) {
501 if (
ctx->frames_left <= 0) {
523 pkt->pts =
ctx->frames_read++ * 240;
525 pkt->stream_index = 0;
552 if (
ctx->seek_pkt &&
ctx->seek_pkt->size) {
597 if (
ctx->seek_pkt->pts +
ctx->seek_pkt->duration > timestamp)
606 ctx->seek_pkt->size) {
627 .p.extensions =
"dss",
static AVFormatContext * ctx
static void chunk(Buf *b, const char type[4], const uint8_t *data, int n)
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.
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
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)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_WB24 unsigned int_TMPL AV_WB16 unsigned int_TMPL byte
#define flags(name, subs,...)
#define i(width, name, range_min, range_max)
static int read_probe(const AVProbeData *p)
Public libavutil channel layout APIs header.
#define FFERROR_REDO
Returned by demuxers to indicate that data was consumed but discarded (ignored streams or junk data).
#define DSS_BLOCK_KEEP_BEFORE
static void dss_sp_byte_swap(DSSDemuxContext *ctx, uint8_t *data, int size)
#define DSS_ACODEC_G723_1
static int dss_next_block(AVFormatContext *s)
static int64_t dss_frame_pos(AVFormatContext *s)
static int dss_sp_read_packet(AVFormatContext *s, AVPacket *pkt)
static int dss_read_metadata_string(AVFormatContext *s, unsigned int offset, unsigned int size, const char *key)
#define DSS_HEAD_OFFSET_ACODEC
static int dss_seek_to(AVIOContext *pb, int64_t pos)
static int dss_read_payload(AVFormatContext *s, uint8_t *buf, int size)
static int dss_block_frames(const uint8_t *header)
static int dss_probe(const AVProbeData *p)
static int dss_rewind(AVFormatContext *s)
#define DSS_HEAD_OFFSET_END_TIME
static int dss_read_header(AVFormatContext *s)
#define DSS_HEAD_OFFSET_COMMENT
static int dss_read_close(AVFormatContext *s)
static int dss_read_packet(AVFormatContext *s, AVPacket *pkt)
static int dss_read_next_packet(AVFormatContext *s, AVPacket *pkt)
#define DSS_HEAD_OFFSET_AUTHOR
static int dss_723_1_read_packet(AVFormatContext *s, AVPacket *pkt)
#define DSS_AUDIO_BLOCK_HEADER_SIZE
#define DSS_ACODEC_DSS_SP
static int dss_seek_block(AVFormatContext *s, int64_t pos)
static int dss_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
static int64_t dss_count_frames(AVFormatContext *s)
#define DSS_SP_SHORT_FRAME_SIZE
static int dss_read_metadata_date(AVFormatContext *s, unsigned int offset, const char *key)
#define DSS_ACODEC_DSS_SP_VR
static int read_header(FFV1Context *f, RangeCoder *c)
static const uint8_t frame_size[4]
void av_packet_free(AVPacket **pkt)
Free the packet, if the packet is reference counted, it will be unreferenced first.
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
void av_packet_move_ref(AVPacket *dst, AVPacket *src)
Move every field in src to dst and reset src.
AVPacket * av_packet_alloc(void)
Allocate an AVPacket and set its fields to default values.
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
#define AV_CHANNEL_LAYOUT_MONO
#define AV_DICT_DONT_STRDUP_VAL
Take ownership of a value that's been allocated with av_malloc() or another memory allocation functio...
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AVERROR_EOF
End of file.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static av_cold int read_close(AVFormatContext *ctx)
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
#define MKTAG(a, b, c, d)
Memory handling functions.
static const uint8_t header[24]
An AVChannelLayout holds information about the channel layout of audio data.
AVChannelLayout ch_layout
The channel layout and number of channels.
enum AVMediaType codec_type
General type of the encoded data.
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
int sample_rate
The number of audio samples per second.
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
int error
contains the error code or 0 if no error happened
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 nb_frames
number of frames in this stream if known or 0
int64_t duration
Decoding: duration of the stream, in stream time base.
#define avpriv_request_sample(...)