aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2004-07-14 01:32:14 +0000
committerMichael Niedermayer <michaelni@gmx.at>2004-07-14 01:32:14 +0000
commit23c992532927afa9d3a00677ff40cd071e21dc8f (patch)
tree232b97558b925172d4c6372c10a5c7e156469f27 /libavformat
parenteb507b21c410515b179c0ca85b3db3d83fc296bd (diff)
downloadffmpeg-23c992532927afa9d3a00677ff40cd071e21dc8f.tar.gz
libdts support by (Benjamin Zores <ben at geexbox dot org>)
Originally committed as revision 3310 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/matroska.c3
-rw-r--r--libavformat/mpeg.c11
-rw-r--r--libavformat/mpegts.c5
-rw-r--r--libavformat/mpegts.h1
-rw-r--r--libavformat/raw.c30
-rw-r--r--libavformat/wav.c1
6 files changed, 49 insertions, 2 deletions
diff --git a/libavformat/matroska.c b/libavformat/matroska.c
index edd5342816..9d80302f2c 100644
--- a/libavformat/matroska.c
+++ b/libavformat/matroska.c
@@ -2228,6 +2228,9 @@ matroska_read_header (AVFormatContext *s,
else if (!strcmp(track->codec_id,
MATROSKA_CODEC_ID_AUDIO_AC3))
codec_id = CODEC_ID_AC3;
+ else if (!strcmp(track->codec_id,
+ MATROSKA_CODEC_ID_AUDIO_DTS))
+ codec_id = CODEC_ID_DTS;
/* No such codec id so far. */
/* else if (!strcmp(track->codec_id, */
/* MATROSKA_CODEC_ID_AUDIO_DTS)) */
diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c
index dd4e524111..adf871a669 100644
--- a/libavformat/mpeg.c
+++ b/libavformat/mpeg.c
@@ -77,6 +77,7 @@ typedef struct {
#define AUDIO_ID 0xc0
#define VIDEO_ID 0xe0
#define AC3_ID 0x80
+#define DTS_ID 0x8a
#define LPCM_ID 0xa0
static const int lpcm_freq_tab[4] = { 48000, 96000, 44100, 32000 };
@@ -235,7 +236,7 @@ static int get_system_header_size(AVFormatContext *ctx)
static int mpeg_mux_init(AVFormatContext *ctx)
{
MpegMuxContext *s = ctx->priv_data;
- int bitrate, i, mpa_id, mpv_id, ac3_id, lpcm_id, j;
+ int bitrate, i, mpa_id, mpv_id, ac3_id, dts_id, lpcm_id, j;
AVStream *st;
StreamInfo *stream;
int audio_bitrate;
@@ -258,6 +259,7 @@ static int mpeg_mux_init(AVFormatContext *ctx)
s->video_bound = 0;
mpa_id = AUDIO_ID;
ac3_id = AC3_ID;
+ dts_id = DTS_ID;
mpv_id = VIDEO_ID;
lpcm_id = LPCM_ID;
s->scr_stream_index = -1;
@@ -272,6 +274,8 @@ static int mpeg_mux_init(AVFormatContext *ctx)
case CODEC_TYPE_AUDIO:
if (st->codec.codec_id == CODEC_ID_AC3) {
stream->id = ac3_id++;
+ } else if (st->codec.codec_id == CODEC_ID_DTS) {
+ stream->id = dts_id++;
} else if (st->codec.codec_id == CODEC_ID_PCM_S16BE) {
stream->id = lpcm_id++;
for(j = 0; j < 4; j++) {
@@ -1304,9 +1308,12 @@ static int mpegps_read_packet(AVFormatContext *s,
} else if (startcode >= 0x1c0 && startcode <= 0x1df) {
type = CODEC_TYPE_AUDIO;
codec_id = CODEC_ID_MP2;
- } else if (startcode >= 0x80 && startcode <= 0x9f) {
+ } else if (startcode >= 0x80 && startcode <= 0x89) {
type = CODEC_TYPE_AUDIO;
codec_id = CODEC_ID_AC3;
+ } else if (startcode >= 0x8a && startcode <= 0x9f) {
+ type = CODEC_TYPE_AUDIO;
+ codec_id = CODEC_ID_DTS;
} else if (startcode >= 0xa0 && startcode <= 0xbf) {
type = CODEC_TYPE_AUDIO;
codec_id = CODEC_ID_PCM_S16BE;
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 7da6aed9e6..3dbd9478e2 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -431,6 +431,7 @@ static void pmt_cb(void *opaque, const uint8_t *section, int section_len)
case STREAM_TYPE_VIDEO_H264:
case STREAM_TYPE_AUDIO_AAC:
case STREAM_TYPE_AUDIO_AC3:
+ case STREAM_TYPE_AUDIO_DTS:
add_pes_stream(ts, pid, stream_type);
break;
default:
@@ -753,6 +754,10 @@ static void mpegts_push_data(void *opaque,
codec_type = CODEC_TYPE_AUDIO;
codec_id = CODEC_ID_AC3;
break;
+ case STREAM_TYPE_AUDIO_DTS:
+ codec_type = CODEC_TYPE_AUDIO;
+ codec_id = CODEC_ID_DTS;
+ break;
default:
if (code >= 0x1c0 && code <= 0x1df) {
codec_type = CODEC_TYPE_AUDIO;
diff --git a/libavformat/mpegts.h b/libavformat/mpegts.h
index e0bfd4f004..5dfa7b20cc 100644
--- a/libavformat/mpegts.h
+++ b/libavformat/mpegts.h
@@ -42,6 +42,7 @@
#define STREAM_TYPE_VIDEO_H264 0x1b
#define STREAM_TYPE_AUDIO_AC3 0x81
+#define STREAM_TYPE_AUDIO_DTS 0x8a
unsigned int mpegts_crc32(const uint8_t *data, int len);
extern AVOutputFormat mpegts_mux;
diff --git a/libavformat/raw.c b/libavformat/raw.c
index 9a79ac7b06..9c1bd929c9 100644
--- a/libavformat/raw.c
+++ b/libavformat/raw.c
@@ -184,6 +184,23 @@ static int ac3_read_header(AVFormatContext *s,
return 0;
}
+/* dts read */
+static int dts_read_header(AVFormatContext *s,
+ AVFormatParameters *ap)
+{
+ AVStream *st;
+
+ st = av_new_stream(s, 0);
+ if (!st)
+ return AVERROR_NOMEM;
+
+ st->codec.codec_type = CODEC_TYPE_AUDIO;
+ st->codec.codec_id = CODEC_ID_DTS;
+ st->need_parsing = 1;
+ /* the parameters will be extracted from the compressed bitstream */
+ return 0;
+}
+
/* mpeg1/h263 input */
static int video_read_header(AVFormatContext *s,
AVFormatParameters *ap)
@@ -300,6 +317,17 @@ AVOutputFormat ac3_oformat = {
};
#endif //CONFIG_ENCODERS
+AVInputFormat dts_iformat = {
+ "dts",
+ "raw dts",
+ 0,
+ NULL,
+ dts_read_header,
+ raw_read_partial_packet,
+ raw_read_close,
+ .extensions = "dts",
+};
+
AVInputFormat h261_iformat = {
"h261",
"raw h261",
@@ -613,6 +641,8 @@ int raw_init(void)
av_register_input_format(&ac3_iformat);
av_register_output_format(&ac3_oformat);
+ av_register_input_format(&dts_iformat);
+
av_register_input_format(&h261_iformat);
av_register_input_format(&h263_iformat);
diff --git a/libavformat/wav.c b/libavformat/wav.c
index 474799a519..1030cb8809 100644
--- a/libavformat/wav.c
+++ b/libavformat/wav.c
@@ -348,6 +348,7 @@ static int wav_read_seek(AVFormatContext *s,
case CODEC_ID_MP2:
case CODEC_ID_MP3:
case CODEC_ID_AC3:
+ case CODEC_ID_DTS:
/* use generic seeking with dynamically generated indexes */
return -1;
default: