[FFmpeg-cvslog] r15143 - in trunk: libavcodec/aac_ac3_parser.c libavcodec/ac3_parser.c libavcodec/ac3dec.c libavcodec/ac3enc.c libavcodec/allcodecs.c libavcodec/avcodec.h libavformat/Makefile libavformat/allformats.c libavformat/raw.c
jbr
subversion
Mon Sep 1 16:33:55 CEST 2008
Author: jbr
Date: Mon Sep 1 16:33:54 2008
New Revision: 15143
Log:
create a separate codec_id for E-AC-3
Modified:
trunk/libavcodec/aac_ac3_parser.c
trunk/libavcodec/ac3_parser.c
trunk/libavcodec/ac3dec.c
trunk/libavcodec/ac3enc.c
trunk/libavcodec/allcodecs.c
trunk/libavcodec/avcodec.h
trunk/libavformat/Makefile
trunk/libavformat/allformats.c
trunk/libavformat/raw.c
Modified: trunk/libavcodec/aac_ac3_parser.c
==============================================================================
--- trunk/libavcodec/aac_ac3_parser.c (original)
+++ trunk/libavcodec/aac_ac3_parser.c Mon Sep 1 16:33:54 2008
@@ -76,7 +76,8 @@ get_next:
avctx->request_channels < s->channels &&
(avctx->request_channels <= 2 ||
(avctx->request_channels == 1 &&
- avctx->codec_id == CODEC_ID_AC3))) {
+ (avctx->codec_id == CODEC_ID_AC3 ||
+ avctx->codec_id == CODEC_ID_EAC3)))) {
avctx->channels = avctx->request_channels;
} else {
avctx->channels = s->channels;
Modified: trunk/libavcodec/ac3_parser.c
==============================================================================
--- trunk/libavcodec/ac3_parser.c (original)
+++ trunk/libavcodec/ac3_parser.c Mon Sep 1 16:33:54 2008
@@ -188,7 +188,7 @@ static av_cold int ac3_parse_init(AVCode
AVCodecParser ac3_parser = {
- { CODEC_ID_AC3 },
+ { CODEC_ID_AC3, CODEC_ID_EAC3 },
sizeof(AACAC3ParseContext),
ac3_parse_init,
ff_aac_ac3_parse,
Modified: trunk/libavcodec/ac3dec.c
==============================================================================
--- trunk/libavcodec/ac3dec.c (original)
+++ trunk/libavcodec/ac3dec.c Mon Sep 1 16:33:54 2008
@@ -1288,5 +1288,16 @@ AVCodec ac3_decoder = {
.init = ac3_decode_init,
.close = ac3_decode_end,
.decode = ac3_decode_frame,
- .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52 (AC-3, E-AC-3)"),
+ .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52A (AC-3)"),
+};
+
+AVCodec eac3_decoder = {
+ .name = "eac3",
+ .type = CODEC_TYPE_AUDIO,
+ .id = CODEC_ID_EAC3,
+ .priv_data_size = sizeof (AC3DecodeContext),
+ .init = ac3_decode_init,
+ .close = ac3_decode_end,
+ .decode = ac3_decode_frame,
+ .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52B (AC-3, E-AC-3)"),
};
Modified: trunk/libavcodec/ac3enc.c
==============================================================================
--- trunk/libavcodec/ac3enc.c (original)
+++ trunk/libavcodec/ac3enc.c Mon Sep 1 16:33:54 2008
@@ -1365,5 +1365,5 @@ AVCodec ac3_encoder = {
AC3_encode_close,
NULL,
.sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
- .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52 (AC-3, E-AC-3)"),
+ .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52A (AC-3)"),
};
Modified: trunk/libavcodec/allcodecs.c
==============================================================================
--- trunk/libavcodec/allcodecs.c (original)
+++ trunk/libavcodec/allcodecs.c Mon Sep 1 16:33:54 2008
@@ -189,6 +189,7 @@ void avcodec_register_all(void)
REGISTER_DECODER (COOK, cook);
REGISTER_DECODER (DCA, dca);
REGISTER_DECODER (DSICINAUDIO, dsicinaudio);
+ REGISTER_DECODER (EAC3, eac3);
REGISTER_ENCDEC (FLAC, flac);
REGISTER_DECODER (IMC, imc);
REGISTER_DECODER (MACE3, mace3);
Modified: trunk/libavcodec/avcodec.h
==============================================================================
--- trunk/libavcodec/avcodec.h (original)
+++ trunk/libavcodec/avcodec.h Mon Sep 1 16:33:54 2008
@@ -30,7 +30,7 @@
#include "libavutil/avutil.h"
#define LIBAVCODEC_VERSION_MAJOR 51
-#define LIBAVCODEC_VERSION_MINOR 70
+#define LIBAVCODEC_VERSION_MINOR 71
#define LIBAVCODEC_VERSION_MICRO 0
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
@@ -306,6 +306,7 @@ enum CodecID {
CODEC_ID_WMAPRO,
CODEC_ID_WMALOSSLESS,
CODEC_ID_ATRAC3P,
+ CODEC_ID_EAC3,
/* subtitle codecs */
CODEC_ID_DVD_SUBTITLE= 0x17000,
Modified: trunk/libavformat/Makefile
==============================================================================
--- trunk/libavformat/Makefile (original)
+++ trunk/libavformat/Makefile Mon Sep 1 16:33:54 2008
@@ -44,6 +44,8 @@ OBJS-$(CONFIG_DV_MUXER)
OBJS-$(CONFIG_DXA_DEMUXER) += dxa.o riff.o
OBJS-$(CONFIG_EA_CDATA_DEMUXER) += eacdata.o
OBJS-$(CONFIG_EA_DEMUXER) += electronicarts.o
+OBJS-$(CONFIG_EAC3_DEMUXER) += raw.o
+OBJS-$(CONFIG_EAC3_MUXER) += raw.o
OBJS-$(CONFIG_FFM_DEMUXER) += ffmdec.o
OBJS-$(CONFIG_FFM_MUXER) += ffmenc.o
OBJS-$(CONFIG_FLAC_DEMUXER) += raw.o
Modified: trunk/libavformat/allformats.c
==============================================================================
--- trunk/libavformat/allformats.c (original)
+++ trunk/libavformat/allformats.c Mon Sep 1 16:33:54 2008
@@ -76,6 +76,7 @@ void av_register_all(void)
REGISTER_DEMUXER (DXA, dxa);
REGISTER_DEMUXER (EA, ea);
REGISTER_DEMUXER (EA_CDATA, ea_cdata);
+ REGISTER_MUXDEMUX (EAC3, eac3);
REGISTER_MUXDEMUX (FFM, ffm);
REGISTER_MUXDEMUX (FLAC, flac);
REGISTER_DEMUXER (FLIC, flic);
Modified: trunk/libavformat/raw.c
==============================================================================
--- trunk/libavformat/raw.c (original)
+++ trunk/libavformat/raw.c Mon Sep 1 16:33:54 2008
@@ -487,8 +487,8 @@ static int dirac_probe(AVProbeData *p)
}
#endif
-#ifdef CONFIG_AC3_DEMUXER
-static int ac3_probe(AVProbeData *p)
+#if (CONFIG_AC3_DEMUXER || CONFIG_EAC3_DEMUXER)
+static int ac3_eac3_probe(AVProbeData *p, int *codec_id)
{
int max_frames, first_frames = 0, frames;
uint8_t *buf, *buf2, *end;
@@ -499,6 +499,7 @@ static int ac3_probe(AVProbeData *p)
buf = p->buf;
end = buf + p->buf_size;
+ *codec_id = CODEC_ID_AC3;
for(; buf < end; buf++) {
buf2 = buf;
@@ -509,6 +510,8 @@ static int ac3_probe(AVProbeData *p)
if(buf2 + hdr.frame_size > end ||
av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0, buf2 + 2, hdr.frame_size - 2))
break;
+ if (hdr.bitstream_id > 10)
+ *codec_id = CODEC_ID_EAC3;
buf2 += hdr.frame_size;
}
max_frames = FFMAX(max_frames, frames);
@@ -522,6 +525,28 @@ static int ac3_probe(AVProbeData *p)
}
#endif
+#ifdef CONFIG_AC3_DEMUXER
+static int ac3_probe(AVProbeData *p)
+{
+ int codec_id = CODEC_ID_NONE;
+ int score = ac3_eac3_probe(p, &codec_id);
+ if(codec_id == CODEC_ID_AC3)
+ return score;
+ return 0;
+}
+#endif
+
+#ifdef CONFIG_EAC3_DEMUXER
+static int eac3_probe(AVProbeData *p)
+{
+ int codec_id = CODEC_ID_NONE;
+ int score = ac3_eac3_probe(p, &codec_id);
+ if(codec_id == CODEC_ID_EAC3)
+ return score;
+ return 0;
+}
+#endif
+
#ifdef CONFIG_FLAC_DEMUXER
static int flac_probe(AVProbeData *p)
{
@@ -633,6 +658,35 @@ AVOutputFormat dts_muxer = {
};
#endif
+#ifdef CONFIG_EAC3_DEMUXER
+AVInputFormat eac3_demuxer = {
+ "eac3",
+ NULL_IF_CONFIG_SMALL("raw E-AC-3"),
+ 0,
+ eac3_probe,
+ audio_read_header,
+ raw_read_partial_packet,
+ .flags= AVFMT_GENERIC_INDEX,
+ .extensions = "eac3",
+ .value = CODEC_ID_EAC3,
+};
+#endif
+
+#ifdef CONFIG_EAC3_MUXER
+AVOutputFormat eac3_muxer = {
+ "eac3",
+ NULL_IF_CONFIG_SMALL("raw E-AC-3"),
+ "audio/x-eac3",
+ "eac3",
+ 0,
+ CODEC_ID_EAC3,
+ CODEC_ID_NONE,
+ NULL,
+ raw_write_packet,
+ .flags= AVFMT_NOTIMESTAMPS,
+};
+#endif
+
#ifdef CONFIG_FLAC_DEMUXER
AVInputFormat flac_demuxer = {
"flac",
More information about the ffmpeg-cvslog
mailing list