mirror of https://git.videolan.org/git/ffmpeg.git
avformat/mov: factorize setting little endian PCM streams
Signed-off-by: Marton Balint <cus@passwd.hu>
This commit is contained in:
parent
2a3640de84
commit
cd83383f4d
|
@ -1544,35 +1544,38 @@ static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mov_read_enda(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
static void set_last_stream_little_endian(AVFormatContext *fc)
|
||||||
{
|
{
|
||||||
AVStream *st;
|
AVStream *st;
|
||||||
int little_endian;
|
|
||||||
|
|
||||||
if (c->fc->nb_streams < 1)
|
if (fc->nb_streams < 1)
|
||||||
return 0;
|
return;
|
||||||
st = c->fc->streams[c->fc->nb_streams-1];
|
st = fc->streams[fc->nb_streams-1];
|
||||||
|
|
||||||
little_endian = avio_rb16(pb) & 0xFF;
|
switch (st->codecpar->codec_id) {
|
||||||
av_log(c->fc, AV_LOG_TRACE, "enda %d\n", little_endian);
|
case AV_CODEC_ID_PCM_S24BE:
|
||||||
if (little_endian == 1) {
|
st->codecpar->codec_id = AV_CODEC_ID_PCM_S24LE;
|
||||||
switch (st->codecpar->codec_id) {
|
break;
|
||||||
case AV_CODEC_ID_PCM_S24BE:
|
case AV_CODEC_ID_PCM_S32BE:
|
||||||
st->codecpar->codec_id = AV_CODEC_ID_PCM_S24LE;
|
st->codecpar->codec_id = AV_CODEC_ID_PCM_S32LE;
|
||||||
break;
|
break;
|
||||||
case AV_CODEC_ID_PCM_S32BE:
|
case AV_CODEC_ID_PCM_F32BE:
|
||||||
st->codecpar->codec_id = AV_CODEC_ID_PCM_S32LE;
|
st->codecpar->codec_id = AV_CODEC_ID_PCM_F32LE;
|
||||||
break;
|
break;
|
||||||
case AV_CODEC_ID_PCM_F32BE:
|
case AV_CODEC_ID_PCM_F64BE:
|
||||||
st->codecpar->codec_id = AV_CODEC_ID_PCM_F32LE;
|
st->codecpar->codec_id = AV_CODEC_ID_PCM_F64LE;
|
||||||
break;
|
break;
|
||||||
case AV_CODEC_ID_PCM_F64BE:
|
default:
|
||||||
st->codecpar->codec_id = AV_CODEC_ID_PCM_F64LE;
|
break;
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static int mov_read_enda(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||||
|
{
|
||||||
|
int little_endian = avio_rb16(pb) & 0xFF;
|
||||||
|
av_log(c->fc, AV_LOG_TRACE, "enda %d\n", little_endian);
|
||||||
|
if (little_endian == 1)
|
||||||
|
set_last_stream_little_endian(c->fc);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue