Commit cb4d05e7 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit 'a42e3a67'

* commit 'a42e3a67':
  pcm_dvd: consolidate pieces from pcm.c and mpeg.c

Conflicts:
	libavcodec/pcm.c
	libavcodec/version.h
	libavformat/mpeg.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents d7f917c3 a42e3a67
...@@ -522,7 +522,7 @@ OBJS-$(CONFIG_ZMBV_ENCODER) += zmbvenc.o ...@@ -522,7 +522,7 @@ OBJS-$(CONFIG_ZMBV_ENCODER) += zmbvenc.o
OBJS-$(CONFIG_PCM_ALAW_DECODER) += pcm.o OBJS-$(CONFIG_PCM_ALAW_DECODER) += pcm.o
OBJS-$(CONFIG_PCM_ALAW_ENCODER) += pcm.o OBJS-$(CONFIG_PCM_ALAW_ENCODER) += pcm.o
OBJS-$(CONFIG_PCM_BLURAY_DECODER) += pcm-bluray.o OBJS-$(CONFIG_PCM_BLURAY_DECODER) += pcm-bluray.o
OBJS-$(CONFIG_PCM_DVD_DECODER) += pcm.o OBJS-$(CONFIG_PCM_DVD_DECODER) += pcm-dvd.o
OBJS-$(CONFIG_PCM_F32BE_DECODER) += pcm.o OBJS-$(CONFIG_PCM_F32BE_DECODER) += pcm.o
OBJS-$(CONFIG_PCM_F32BE_ENCODER) += pcm.o OBJS-$(CONFIG_PCM_F32BE_ENCODER) += pcm.o
OBJS-$(CONFIG_PCM_F32LE_DECODER) += pcm.o OBJS-$(CONFIG_PCM_F32LE_DECODER) += pcm.o
......
This diff is collapsed.
...@@ -298,18 +298,7 @@ static int pcm_decode_frame(AVCodecContext *avctx, void *data, ...@@ -298,18 +298,7 @@ static int pcm_decode_frame(AVCodecContext *avctx, void *data,
/* av_get_bits_per_sample returns 0 for AV_CODEC_ID_PCM_DVD */ /* av_get_bits_per_sample returns 0 for AV_CODEC_ID_PCM_DVD */
samples_per_block = 1; samples_per_block = 1;
if (avctx->codec_id == AV_CODEC_ID_PCM_DVD) { if (avctx->codec_id == AV_CODEC_ID_PCM_LXF) {
if (avctx->bits_per_coded_sample != 20 &&
avctx->bits_per_coded_sample != 24) {
av_log(avctx, AV_LOG_ERROR,
"PCM DVD unsupported sample depth %i\n",
avctx->bits_per_coded_sample);
return AVERROR(EINVAL);
}
/* 2 samples are interleaved per block in PCM_DVD */
samples_per_block = 2;
sample_size = avctx->bits_per_coded_sample * 2 / 8;
} else if (avctx->codec_id == AV_CODEC_ID_PCM_LXF) {
/* we process 40-bit blocks per channel for LXF */ /* we process 40-bit blocks per channel for LXF */
samples_per_block = 2; samples_per_block = 2;
sample_size = 5; sample_size = 5;
...@@ -470,37 +459,6 @@ static int pcm_decode_frame(AVCodecContext *avctx, void *data, ...@@ -470,37 +459,6 @@ static int pcm_decode_frame(AVCodecContext *avctx, void *data,
samples += 2; samples += 2;
} }
break; break;
case AV_CODEC_ID_PCM_DVD:
{
const uint8_t *src8;
dst_int32_t = (int32_t *)frame->data[0];
n /= avctx->channels;
switch (avctx->bits_per_coded_sample) {
case 20:
while (n--) {
c = avctx->channels;
src8 = src + 4 * c;
while (c--) {
*dst_int32_t++ = (bytestream_get_be16(&src) << 16) + ((*src8 & 0xf0) << 8);
*dst_int32_t++ = (bytestream_get_be16(&src) << 16) + ((*src8++ & 0x0f) << 12);
}
src = src8;
}
break;
case 24:
while (n--) {
c = avctx->channels;
src8 = src + 4 * c;
while (c--) {
*dst_int32_t++ = (bytestream_get_be16(&src) << 16) + ((*src8++) << 8);
*dst_int32_t++ = (bytestream_get_be16(&src) << 16) + ((*src8++) << 8);
}
src = src8;
}
break;
}
break;
}
case AV_CODEC_ID_PCM_LXF: case AV_CODEC_ID_PCM_LXF:
{ {
int i; int i;
...@@ -583,7 +541,6 @@ AVCodec ff_ ## name_ ## _decoder = { \ ...@@ -583,7 +541,6 @@ AVCodec ff_ ## name_ ## _decoder = { \
/* Note: Do not forget to add new entries to the Makefile as well. */ /* Note: Do not forget to add new entries to the Makefile as well. */
PCM_CODEC (PCM_ALAW, AV_SAMPLE_FMT_S16, pcm_alaw, "PCM A-law / G.711 A-law"); PCM_CODEC (PCM_ALAW, AV_SAMPLE_FMT_S16, pcm_alaw, "PCM A-law / G.711 A-law");
PCM_DECODER(PCM_DVD, AV_SAMPLE_FMT_S32, pcm_dvd, "PCM signed 20|24-bit big-endian");
PCM_CODEC (PCM_F32BE, AV_SAMPLE_FMT_FLT, pcm_f32be, "PCM 32-bit floating point big-endian"); PCM_CODEC (PCM_F32BE, AV_SAMPLE_FMT_FLT, pcm_f32be, "PCM 32-bit floating point big-endian");
PCM_CODEC (PCM_F32LE, AV_SAMPLE_FMT_FLT, pcm_f32le, "PCM 32-bit floating point little-endian"); PCM_CODEC (PCM_F32LE, AV_SAMPLE_FMT_FLT, pcm_f32le, "PCM 32-bit floating point little-endian");
PCM_CODEC (PCM_F64BE, AV_SAMPLE_FMT_DBL, pcm_f64be, "PCM 64-bit floating point big-endian"); PCM_CODEC (PCM_F64BE, AV_SAMPLE_FMT_DBL, pcm_f64be, "PCM 64-bit floating point big-endian");
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include "libavutil/avutil.h" #include "libavutil/avutil.h"
#define LIBAVCODEC_VERSION_MAJOR 55 #define LIBAVCODEC_VERSION_MAJOR 55
#define LIBAVCODEC_VERSION_MINOR 29 #define LIBAVCODEC_VERSION_MINOR 30
#define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
......
...@@ -535,7 +535,6 @@ static int mpegps_read_packet(AVFormatContext *s, ...@@ -535,7 +535,6 @@ static int mpegps_read_packet(AVFormatContext *s,
if(lpcm_header_len == 6) { if(lpcm_header_len == 6) {
codec_id = AV_CODEC_ID_MLP; codec_id = AV_CODEC_ID_MLP;
} else { } else {
/* 16 bit form will be handled as AV_CODEC_ID_PCM_S16BE */
codec_id = AV_CODEC_ID_PCM_DVD; codec_id = AV_CODEC_ID_PCM_DVD;
} }
} else if (startcode >= 0xb0 && startcode <= 0xbf) { } else if (startcode >= 0xb0 && startcode <= 0xbf) {
...@@ -570,7 +569,6 @@ static int mpegps_read_packet(AVFormatContext *s, ...@@ -570,7 +569,6 @@ static int mpegps_read_packet(AVFormatContext *s,
st->codec->sample_rate = 8000; st->codec->sample_rate = 8000;
} }
st->request_probe = request_probe; st->request_probe = request_probe;
if (codec_id != AV_CODEC_ID_PCM_S16BE)
st->need_parsing = AVSTREAM_PARSE_FULL; st->need_parsing = AVSTREAM_PARSE_FULL;
found: found:
if(st->discard >= AVDISCARD_ALL) if(st->discard >= AVDISCARD_ALL)
...@@ -581,28 +579,6 @@ static int mpegps_read_packet(AVFormatContext *s, ...@@ -581,28 +579,6 @@ static int mpegps_read_packet(AVFormatContext *s,
goto skip; goto skip;
avio_skip(s->pb, 6); avio_skip(s->pb, 6);
len -=6; len -=6;
} else {
int b1, freq;
/* for LPCM, we just skip the header and consider it is raw
audio data */
if (len <= 3)
goto skip;
avio_r8(s->pb); /* emphasis (1), muse(1), reserved(1), frame number(5) */
b1 = avio_r8(s->pb); /* quant (2), freq(2), reserved(1), channels(3) */
avio_r8(s->pb); /* dynamic range control (0x80 = off) */
len -= 3;
freq = (b1 >> 4) & 3;
st->codec->sample_rate = lpcm_freq_tab[freq];
st->codec->channels = 1 + (b1 & 7);
st->codec->bits_per_coded_sample = 16 + ((b1 >> 6) & 3) * 4;
st->codec->bit_rate = st->codec->channels *
st->codec->sample_rate *
st->codec->bits_per_coded_sample;
if (st->codec->bits_per_coded_sample == 16)
st->codec->codec_id = AV_CODEC_ID_PCM_S16BE;
else if (st->codec->bits_per_coded_sample == 28)
return AVERROR(EINVAL);
} }
} }
ret = av_get_packet(s->pb, pkt, len); ret = av_get_packet(s->pb, pkt, len);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment