[FFmpeg-devel] [PATCH] Obey configure updates for OGG, Matroska, and MOV parsers.
dalecurtis at chromium.org
dalecurtis at chromium.org
Tue Apr 10 03:49:18 CEST 2012
From: Dale Curtis <dalecurtis at chromium.org>
Uses #if checks to remove code paths which are invalid or unused
depending on configure options.
Signed-off-by: Dale Curtis <dalecurtis at chromium.org>
---
libavformat/matroskadec.c | 33 ++++++++++++++++++++++++++-------
libavformat/mov.c | 4 ++++
libavformat/oggdec.c | 10 ++++++++++
3 files changed, 40 insertions(+), 7 deletions(-)
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 6d7401b..5fd6307 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -35,13 +35,17 @@
/* For ff_codec_get_id(). */
#include "riff.h"
#include "isom.h"
+#if CONFIG_SIPR_DECODER
#include "rm.h"
+#endif
#include "matroska.h"
#include "libavcodec/mpeg4audio.h"
#include "libavutil/intfloat.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/avstring.h"
+#if HAVE_LZO1X_999_COMPRESS
#include "libavutil/lzo.h"
+#endif
#include "libavutil/dict.h"
#if CONFIG_ZLIB
#include <zlib.h>
@@ -1012,6 +1016,7 @@ static int matroska_decode_buffer(uint8_t** buf, int* buf_size,
switch (encodings[0].compression.algo) {
case MATROSKA_TRACK_ENCODING_COMP_HEADERSTRIP:
return encodings[0].compression.settings.size;
+#if HAVE_LZO1X_999_COMPRESS
case MATROSKA_TRACK_ENCODING_COMP_LZO:
do {
olen = pkt_size *= 3;
@@ -1022,6 +1027,7 @@ static int matroska_decode_buffer(uint8_t** buf, int* buf_size,
goto failed;
pkt_size -= olen;
break;
+#endif
#if CONFIG_ZLIB
case MATROSKA_TRACK_ENCODING_COMP_ZLIB: {
z_stream zstream = {0};
@@ -1463,14 +1469,17 @@ static int matroska_read_header(AVFormatContext *s)
"Multiple combined encodings not supported");
} else if (encodings_list->nb_elem == 1) {
if (encodings[0].type ||
- (encodings[0].compression.algo != MATROSKA_TRACK_ENCODING_COMP_HEADERSTRIP &&
+ (encodings[0].compression.algo != MATROSKA_TRACK_ENCODING_COMP_HEADERSTRIP
#if CONFIG_ZLIB
- encodings[0].compression.algo != MATROSKA_TRACK_ENCODING_COMP_ZLIB &&
+ && encodings[0].compression.algo != MATROSKA_TRACK_ENCODING_COMP_ZLIB
#endif
#if CONFIG_BZLIB
- encodings[0].compression.algo != MATROSKA_TRACK_ENCODING_COMP_BZLIB &&
+ && encodings[0].compression.algo != MATROSKA_TRACK_ENCODING_COMP_BZLIB
#endif
- encodings[0].compression.algo != MATROSKA_TRACK_ENCODING_COMP_LZO)) {
+#if HAVE_LZO1X_999_COMPRESS
+ && encodings[0].compression.algo != MATROSKA_TRACK_ENCODING_COMP_LZO
+#endif
+ )) {
encodings[0].scope = 0;
av_log(matroska->ctx, AV_LOG_ERROR,
"Unsupported encoding type");
@@ -1581,8 +1590,10 @@ static int matroska_read_header(AVFormatContext *s)
} else if (codec_id == CODEC_ID_RA_144) {
track->audio.out_samplerate = 8000;
track->audio.channels = 1;
- } else if (codec_id == CODEC_ID_RA_288 || codec_id == CODEC_ID_COOK ||
- codec_id == CODEC_ID_ATRAC3 || codec_id == CODEC_ID_SIPR) {
+ }
+#if CONFIG_RA_288_DECODER || CONFIG_COOK_DECODER || CONFIG_ATRAC3_DECODER || CONFIG_SIPR_DECODER
+ else if (codec_id == CODEC_ID_RA_288 || codec_id == CODEC_ID_COOK ||
+ codec_id == CODEC_ID_ATRAC3 || codec_id == CODEC_ID_SIPR) {
int flavor;
ffio_init_context(&b, track->codec_priv.data,track->codec_priv.size,
0, NULL, NULL, NULL, NULL);
@@ -1598,15 +1609,18 @@ static int matroska_read_header(AVFormatContext *s)
st->codec->block_align = track->audio.coded_framesize;
track->codec_priv.size = 0;
} else {
+#if CONFIG_SIPR_DECODER
if (codec_id == CODEC_ID_SIPR && flavor < 4) {
const int sipr_bit_rate[4] = { 6504, 8496, 5000, 16000 };
track->audio.sub_packet_size = ff_sipr_subpk_size[flavor];
st->codec->bit_rate = sipr_bit_rate[flavor];
}
+#endif
st->codec->block_align = track->audio.sub_packet_size;
extradata_offset = 78;
}
}
+#endif
track->codec_priv.size -= extradata_offset;
if (codec_id == CODEC_ID_NONE)
@@ -1920,6 +1934,7 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data,
if (res == 0) {
for (n = 0; n < laces; n++) {
+#if CONFIG_RA_288_DECODER || CONFIG_COOK_DECODER || CONFIG_ATRAC3_DECODER || CONFIG_SIPR_DECODER
if ((st->codec->codec_id == CODEC_ID_RA_288 ||
st->codec->codec_id == CODEC_ID_COOK ||
st->codec->codec_id == CODEC_ID_SIPR ||
@@ -1963,8 +1978,10 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data,
}
if (++track->audio.sub_packet_cnt >= h) {
+#if CONFIG_SIPR_DECODER
if (st->codec->codec_id == CODEC_ID_SIPR)
ff_rm_reorder_sipr_data(track->audio.buf, h, w);
+#endif
track->audio.sub_packet_cnt = 0;
track->audio.pkt_cnt = h*w / a;
}
@@ -1980,7 +1997,9 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data,
pkt->stream_index = st->index;
dynarray_add(&matroska->packets,&matroska->num_packets,pkt);
}
- } else {
+ } else
+#endif
+ {
MatroskaTrackEncoding *encodings = track->encodings.elem;
int offset = 0, pkt_size = lace_size[n];
uint8_t *pkt_data = data;
diff --git a/libavformat/mov.c b/libavformat/mov.c
index b4ff1df..81ce03f 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -570,6 +570,7 @@ static int mov_read_esds(MOVContext *c, AVIOContext *pb, MOVAtom atom)
return ff_mov_read_esds(c->fc, pb, atom);
}
+#if CONFIG_AC3_DEMUXER
static int mov_read_dac3(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{
AVStream *st;
@@ -593,6 +594,7 @@ static int mov_read_dac3(MOVContext *c, AVIOContext *pb, MOVAtom atom)
return 0;
}
+#endif
static int mov_read_chan(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{
@@ -2594,7 +2596,9 @@ static const MOVParseTableEntry mov_default_parse_table[] = {
{ MKTAG('u','d','t','a'), mov_read_default },
{ MKTAG('w','a','v','e'), mov_read_wave },
{ MKTAG('e','s','d','s'), mov_read_esds },
+#if CONFIG_AC3_DEMUXER
{ MKTAG('d','a','c','3'), mov_read_dac3 }, /* AC-3 info */
+#endif
{ MKTAG('w','i','d','e'), mov_read_wide }, /* place holder */
{ MKTAG('w','f','e','x'), mov_read_wfex },
{ MKTAG('c','m','o','v'), mov_read_cmov },
diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
index bdd2c5b..731d7f2 100644
--- a/libavformat/oggdec.c
+++ b/libavformat/oggdec.c
@@ -39,14 +39,24 @@
static const struct ogg_codec * const ogg_codecs[] = {
&ff_skeleton_codec,
+#if CONFIG_DIRAC_DEMUXER
&ff_dirac_codec,
+#endif
+#if CONFIG_LIBSPEEX
&ff_speex_codec,
+#endif
&ff_vorbis_codec,
&ff_theora_codec,
+#if CONFIG_FLAC_DEMUXER
&ff_flac_codec,
+#endif
&ff_celt_codec,
+#if CONFIG_DIRAC_DEMUXER
&ff_old_dirac_codec,
+#endif
+#if CONFIG_FLAC_DEMUXER
&ff_old_flac_codec,
+#endif
&ff_ogm_video_codec,
&ff_ogm_audio_codec,
&ff_ogm_text_codec,
--
1.7.7.3
More information about the ffmpeg-devel
mailing list