aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2012-10-24 19:15:50 +0200
committerLuca Barbato <lu_zero@gentoo.org>2012-10-25 14:05:13 +0200
commit2ef4d586d6352a69c0669d53ce1035eb7d8db0e8 (patch)
treeae2d503912e1b7ba7a55b51b66b3118337616bfe
parent5f0e161dd61552ad70760bad35b869eaec7368ff (diff)
downloadffmpeg-2ef4d586d6352a69c0669d53ce1035eb7d8db0e8.tar.gz
pcmdec: remove dependency from rawdec
The code shared is not actually shared with anything else.
-rw-r--r--libavformat/Makefile40
-rw-r--r--libavformat/pcmdec.c37
2 files changed, 55 insertions, 22 deletions
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 832ea41939..acf0500de1 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -195,45 +195,45 @@ OBJS-$(CONFIG_OGG_MUXER) += oggenc.o \
vorbiscomment.o
OBJS-$(CONFIG_OMA_DEMUXER) += omadec.o pcm.o oma.o
OBJS-$(CONFIG_OMA_MUXER) += omaenc.o rawenc.o oma.o id3v2enc.o
-OBJS-$(CONFIG_PCM_ALAW_DEMUXER) += pcmdec.o pcm.o rawdec.o
+OBJS-$(CONFIG_PCM_ALAW_DEMUXER) += pcmdec.o pcm.o
OBJS-$(CONFIG_PCM_ALAW_MUXER) += pcmenc.o rawenc.o
-OBJS-$(CONFIG_PCM_F32BE_DEMUXER) += pcmdec.o pcm.o rawdec.o
+OBJS-$(CONFIG_PCM_F32BE_DEMUXER) += pcmdec.o pcm.o
OBJS-$(CONFIG_PCM_F32BE_MUXER) += pcmenc.o rawenc.o
-OBJS-$(CONFIG_PCM_F32LE_DEMUXER) += pcmdec.o pcm.o rawdec.o
+OBJS-$(CONFIG_PCM_F32LE_DEMUXER) += pcmdec.o pcm.o
OBJS-$(CONFIG_PCM_F32LE_MUXER) += pcmenc.o rawenc.o
-OBJS-$(CONFIG_PCM_F64BE_DEMUXER) += pcmdec.o pcm.o rawdec.o
+OBJS-$(CONFIG_PCM_F64BE_DEMUXER) += pcmdec.o pcm.o
OBJS-$(CONFIG_PCM_F64BE_MUXER) += pcmenc.o rawenc.o
-OBJS-$(CONFIG_PCM_F64LE_DEMUXER) += pcmdec.o pcm.o rawdec.o
+OBJS-$(CONFIG_PCM_F64LE_DEMUXER) += pcmdec.o pcm.o
OBJS-$(CONFIG_PCM_F64LE_MUXER) += pcmenc.o rawenc.o
-OBJS-$(CONFIG_PCM_MULAW_DEMUXER) += pcmdec.o pcm.o rawdec.o
+OBJS-$(CONFIG_PCM_MULAW_DEMUXER) += pcmdec.o pcm.o
OBJS-$(CONFIG_PCM_MULAW_MUXER) += pcmenc.o rawenc.o
-OBJS-$(CONFIG_PCM_S16BE_DEMUXER) += pcmdec.o pcm.o rawdec.o
+OBJS-$(CONFIG_PCM_S16BE_DEMUXER) += pcmdec.o pcm.o
OBJS-$(CONFIG_PCM_S16BE_MUXER) += pcmenc.o rawenc.o
-OBJS-$(CONFIG_PCM_S16LE_DEMUXER) += pcmdec.o pcm.o rawdec.o
+OBJS-$(CONFIG_PCM_S16LE_DEMUXER) += pcmdec.o pcm.o
OBJS-$(CONFIG_PCM_S16LE_MUXER) += pcmenc.o rawenc.o
-OBJS-$(CONFIG_PCM_S24BE_DEMUXER) += pcmdec.o pcm.o rawdec.o
+OBJS-$(CONFIG_PCM_S24BE_DEMUXER) += pcmdec.o pcm.o
OBJS-$(CONFIG_PCM_S24BE_MUXER) += pcmenc.o rawenc.o
-OBJS-$(CONFIG_PCM_S24LE_DEMUXER) += pcmdec.o pcm.o rawdec.o
+OBJS-$(CONFIG_PCM_S24LE_DEMUXER) += pcmdec.o pcm.o
OBJS-$(CONFIG_PCM_S24LE_MUXER) += pcmenc.o rawenc.o
-OBJS-$(CONFIG_PCM_S32BE_DEMUXER) += pcmdec.o pcm.o rawdec.o
+OBJS-$(CONFIG_PCM_S32BE_DEMUXER) += pcmdec.o pcm.o
OBJS-$(CONFIG_PCM_S32BE_MUXER) += pcmenc.o rawenc.o
-OBJS-$(CONFIG_PCM_S32LE_DEMUXER) += pcmdec.o pcm.o rawdec.o
+OBJS-$(CONFIG_PCM_S32LE_DEMUXER) += pcmdec.o pcm.o
OBJS-$(CONFIG_PCM_S32LE_MUXER) += pcmenc.o rawenc.o
-OBJS-$(CONFIG_PCM_S8_DEMUXER) += pcmdec.o pcm.o rawdec.o
+OBJS-$(CONFIG_PCM_S8_DEMUXER) += pcmdec.o pcm.o
OBJS-$(CONFIG_PCM_S8_MUXER) += pcmenc.o rawenc.o
-OBJS-$(CONFIG_PCM_U16BE_DEMUXER) += pcmdec.o pcm.o rawdec.o
+OBJS-$(CONFIG_PCM_U16BE_DEMUXER) += pcmdec.o pcm.o
OBJS-$(CONFIG_PCM_U16BE_MUXER) += pcmenc.o rawenc.o
-OBJS-$(CONFIG_PCM_U16LE_DEMUXER) += pcmdec.o pcm.o rawdec.o
+OBJS-$(CONFIG_PCM_U16LE_DEMUXER) += pcmdec.o pcm.o
OBJS-$(CONFIG_PCM_U16LE_MUXER) += pcmenc.o rawenc.o
-OBJS-$(CONFIG_PCM_U24BE_DEMUXER) += pcmdec.o pcm.o rawdec.o
+OBJS-$(CONFIG_PCM_U24BE_DEMUXER) += pcmdec.o pcm.o
OBJS-$(CONFIG_PCM_U24BE_MUXER) += pcmenc.o rawenc.o
-OBJS-$(CONFIG_PCM_U24LE_DEMUXER) += pcmdec.o pcm.o rawdec.o
+OBJS-$(CONFIG_PCM_U24LE_DEMUXER) += pcmdec.o pcm.o
OBJS-$(CONFIG_PCM_U24LE_MUXER) += pcmenc.o rawenc.o
-OBJS-$(CONFIG_PCM_U32BE_DEMUXER) += pcmdec.o pcm.o rawdec.o
+OBJS-$(CONFIG_PCM_U32BE_DEMUXER) += pcmdec.o pcm.o
OBJS-$(CONFIG_PCM_U32BE_MUXER) += pcmenc.o rawenc.o
-OBJS-$(CONFIG_PCM_U32LE_DEMUXER) += pcmdec.o pcm.o rawdec.o
+OBJS-$(CONFIG_PCM_U32LE_DEMUXER) += pcmdec.o pcm.o
OBJS-$(CONFIG_PCM_U32LE_MUXER) += pcmenc.o rawenc.o
-OBJS-$(CONFIG_PCM_U8_DEMUXER) += pcmdec.o pcm.o rawdec.o
+OBJS-$(CONFIG_PCM_U8_DEMUXER) += pcmdec.o pcm.o
OBJS-$(CONFIG_PCM_U8_MUXER) += pcmenc.o rawenc.o
OBJS-$(CONFIG_PMP_DEMUXER) += pmpdec.o
OBJS-$(CONFIG_PVA_DEMUXER) += pva.o
diff --git a/libavformat/pcmdec.c b/libavformat/pcmdec.c
index ad47885297..40446c29e3 100644
--- a/libavformat/pcmdec.c
+++ b/libavformat/pcmdec.c
@@ -20,13 +20,46 @@
*/
#include "avformat.h"
-#include "rawdec.h"
+#include "internal.h"
#include "pcm.h"
#include "libavutil/log.h"
#include "libavutil/opt.h"
#define RAW_SAMPLES 1024
+typedef struct RawAudioDemuxerContext {
+ AVClass *class;
+ int sample_rate;
+ int channels;
+} RawAudioDemuxerContext;
+
+static int raw_read_header(AVFormatContext *s)
+{
+ RawAudioDemuxerContext *s1 = s->priv_data;
+ AVStream *st;
+
+ st = avformat_new_stream(s, NULL);
+ if (!st)
+ return AVERROR(ENOMEM);
+
+
+ st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
+ st->codec->codec_id = s->iformat->raw_codec_id;
+ st->codec->sample_rate = s1->sample_rate;
+ st->codec->channels = s1->channels;
+
+ st->codec->bits_per_coded_sample =
+ av_get_bits_per_sample(st->codec->codec_id);
+
+ assert(st->codec->bits_per_coded_sample > 0);
+
+ st->codec->block_align =
+ st->codec->bits_per_coded_sample * st->codec->channels / 8;
+
+ avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
+ return 0;
+}
+
static int raw_read_packet(AVFormatContext *s, AVPacket *pkt)
{
int ret, size, bps;
@@ -65,7 +98,7 @@ AVInputFormat ff_pcm_ ## name_ ## _demuxer = { \
.name = #name_, \
.long_name = NULL_IF_CONFIG_SMALL(long_name_), \
.priv_data_size = sizeof(RawAudioDemuxerContext), \
- .read_header = ff_raw_read_header, \
+ .read_header = raw_read_header, \
.read_packet = raw_read_packet, \
.read_seek = ff_pcm_read_seek, \
.flags = AVFMT_GENERIC_INDEX, \