avformat/wavdec: Eliminate goto for clang -O0 DCE
Clang is not able to eliminate the reference to ff_spdif_probe() when there is a goto target in the same block and optimization is disabled. This fixes the following build failure on OS X: ./configure --disable-everything --disable-doc \ --enable-decoder=pcm_s16le --enable-demuxer=wav \ --enable-protocol=file --disable-optimizations --cc=clang make ... Undefined symbols for architecture x86_64: "_ff_spdif_probe", referenced from: _set_spdif in libavformat.a(wavdec.o) ld: symbol(s) not found for architecture x86_64 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
d4c1cc2b87
commit
a5cf600ccb
@ -64,34 +64,30 @@ static void set_spdif(AVFormatContext *s, WAVDemuxContext *wav)
|
|||||||
{
|
{
|
||||||
if (CONFIG_SPDIF_DEMUXER && s->streams[0]->codecpar->codec_tag == 1) {
|
if (CONFIG_SPDIF_DEMUXER && s->streams[0]->codecpar->codec_tag == 1) {
|
||||||
enum AVCodecID codec;
|
enum AVCodecID codec;
|
||||||
uint8_t *buf = NULL;
|
|
||||||
int len = 1<<16;
|
int len = 1<<16;
|
||||||
int ret = ffio_ensure_seekback(s->pb, len);
|
int ret = ffio_ensure_seekback(s->pb, len);
|
||||||
int64_t pos = avio_tell(s->pb);
|
|
||||||
|
|
||||||
if (ret < 0)
|
if (ret >= 0) {
|
||||||
goto end;
|
uint8_t *buf = av_malloc(len);
|
||||||
|
if (!buf) {
|
||||||
buf = av_malloc(len);
|
ret = AVERROR(ENOMEM);
|
||||||
if (!buf) {
|
} else {
|
||||||
ret = AVERROR(ENOMEM);
|
int64_t pos = avio_tell(s->pb);
|
||||||
goto end;
|
len = ret = avio_read(s->pb, buf, len);
|
||||||
|
if (len >= 0) {
|
||||||
|
ret = ff_spdif_probe(buf, len, &codec);
|
||||||
|
if (ret > AVPROBE_SCORE_EXTENSION) {
|
||||||
|
s->streams[0]->codecpar->codec_id = codec;
|
||||||
|
wav->spdif = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
avio_seek(s->pb, pos, SEEK_SET);
|
||||||
|
av_free(buf);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
len = ret = avio_read(s->pb, buf, len);
|
|
||||||
if (ret < 0)
|
|
||||||
goto end;
|
|
||||||
|
|
||||||
ret = ff_spdif_probe(buf, len, &codec);
|
|
||||||
if (ret > AVPROBE_SCORE_EXTENSION) {
|
|
||||||
s->streams[0]->codecpar->codec_id = codec;
|
|
||||||
wav->spdif = 1;
|
|
||||||
}
|
|
||||||
end:
|
|
||||||
avio_seek(s->pb, pos, SEEK_SET);
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
av_log(s, AV_LOG_WARNING, "Cannot check for SPDIF\n");
|
av_log(s, AV_LOG_WARNING, "Cannot check for SPDIF\n");
|
||||||
av_free(buf);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user