Mercurial > libavformat.hg
changeset 496:112057e05179 libavformat
libdts support by (Benjamin Zores <ben at geexbox dot org>)
author | michael |
---|---|
date | Wed, 14 Jul 2004 01:32:14 +0000 |
parents | d33ce0cfc81c |
children | d95e74ef39e0 |
files | matroska.c mpeg.c mpegts.c mpegts.h raw.c wav.c |
diffstat | 6 files changed, 49 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/matroska.c Wed Jul 14 00:10:06 2004 +0000 +++ b/matroska.c Wed Jul 14 01:32:14 2004 +0000 @@ -2228,6 +2228,9 @@ 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)) */
--- a/mpeg.c Wed Jul 14 00:10:06 2004 +0000 +++ b/mpeg.c Wed Jul 14 01:32:14 2004 +0000 @@ -77,6 +77,7 @@ #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 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 @@ 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 @@ 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 @@ } 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;
--- a/mpegts.c Wed Jul 14 00:10:06 2004 +0000 +++ b/mpegts.c Wed Jul 14 01:32:14 2004 +0000 @@ -431,6 +431,7 @@ 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 @@ 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;
--- a/mpegts.h Wed Jul 14 00:10:06 2004 +0000 +++ b/mpegts.h Wed Jul 14 01:32:14 2004 +0000 @@ -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;
--- a/raw.c Wed Jul 14 00:10:06 2004 +0000 +++ b/raw.c Wed Jul 14 01:32:14 2004 +0000 @@ -184,6 +184,23 @@ 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 @@ }; #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 @@ 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);