Browse code

move pcm demuxers to their own file

Originally committed as revision 24993 to svn://svn.ffmpeg.org/ffmpeg/trunk

Aurelien Jacobs authored on 2010/08/31 06:17:34
Showing 15 changed files
... ...
@@ -21,8 +21,8 @@ OBJS-$(CONFIG_AAC_DEMUXER)               += aacdec.o id3v1.o id3v2.o raw.o
21 21
 OBJS-$(CONFIG_AC3_DEMUXER)               += ac3dec.o raw.o
22 22
 OBJS-$(CONFIG_AC3_MUXER)                 += raw.o
23 23
 OBJS-$(CONFIG_ADTS_MUXER)                += adtsenc.o
24
-OBJS-$(CONFIG_AEA_DEMUXER)               += aea.o raw.o
25
-OBJS-$(CONFIG_AIFF_DEMUXER)              += aiffdec.o riff.o raw.o
24
+OBJS-$(CONFIG_AEA_DEMUXER)               += aea.o pcm.o
25
+OBJS-$(CONFIG_AIFF_DEMUXER)              += aiffdec.o riff.o pcm.o
26 26
 OBJS-$(CONFIG_AIFF_MUXER)                += aiffenc.o riff.o
27 27
 OBJS-$(CONFIG_AMR_DEMUXER)               += amr.o
28 28
 OBJS-$(CONFIG_AMR_MUXER)                 += amr.o
... ...
@@ -35,7 +35,7 @@ OBJS-$(CONFIG_ASF_DEMUXER)               += asfdec.o asf.o asfcrypt.o \
35 35
 OBJS-$(CONFIG_ASF_MUXER)                 += asfenc.o asf.o riff.o
36 36
 OBJS-$(CONFIG_ASS_DEMUXER)               += assdec.o
37 37
 OBJS-$(CONFIG_ASS_MUXER)                 += assenc.o
38
-OBJS-$(CONFIG_AU_DEMUXER)                += au.o raw.o
38
+OBJS-$(CONFIG_AU_DEMUXER)                += au.o pcm.o
39 39
 OBJS-$(CONFIG_AU_MUXER)                  += au.o
40 40
 OBJS-$(CONFIG_AVI_DEMUXER)               += avidec.o riff.o avi.o
41 41
 OBJS-$(CONFIG_AVI_MUXER)                 += avienc.o riff.o avi.o
... ...
@@ -116,7 +116,7 @@ OBJS-$(CONFIG_MJPEG_MUXER)               += raw.o
116 116
 OBJS-$(CONFIG_MLP_DEMUXER)               += raw.o
117 117
 OBJS-$(CONFIG_MLP_MUXER)                 += raw.o
118 118
 OBJS-$(CONFIG_MM_DEMUXER)                += mm.o
119
-OBJS-$(CONFIG_MMF_DEMUXER)               += mmf.o raw.o
119
+OBJS-$(CONFIG_MMF_DEMUXER)               += mmf.o pcm.o
120 120
 OBJS-$(CONFIG_MMF_MUXER)                 += mmf.o riff.o
121 121
 OBJS-$(CONFIG_MOV_DEMUXER)               += mov.o riff.o isom.o
122 122
 OBJS-$(CONFIG_MOV_MUXER)                 += movenc.o riff.o isom.o avc.o movenchint.o
... ...
@@ -160,46 +160,46 @@ OBJS-$(CONFIG_OGG_DEMUXER)               += oggdec.o         \
160 160
                                             vorbiscomment.o
161 161
 OBJS-$(CONFIG_OGG_MUXER)                 += oggenc.o \
162 162
                                             vorbiscomment.o
163
-OBJS-$(CONFIG_OMA_DEMUXER)               += oma.o raw.o id3v2.o id3v1.o
164
-OBJS-$(CONFIG_PCM_ALAW_DEMUXER)          += raw.o
163
+OBJS-$(CONFIG_OMA_DEMUXER)               += oma.o pcm.o id3v2.o id3v1.o
164
+OBJS-$(CONFIG_PCM_ALAW_DEMUXER)          += pcmdec.o pcm.o raw.o
165 165
 OBJS-$(CONFIG_PCM_ALAW_MUXER)            += raw.o
166
-OBJS-$(CONFIG_PCM_F32BE_DEMUXER)         += raw.o
166
+OBJS-$(CONFIG_PCM_F32BE_DEMUXER)         += pcmdec.o pcm.o raw.o
167 167
 OBJS-$(CONFIG_PCM_F32BE_MUXER)           += raw.o
168
-OBJS-$(CONFIG_PCM_F32LE_DEMUXER)         += raw.o
168
+OBJS-$(CONFIG_PCM_F32LE_DEMUXER)         += pcmdec.o pcm.o raw.o
169 169
 OBJS-$(CONFIG_PCM_F32LE_MUXER)           += raw.o
170
-OBJS-$(CONFIG_PCM_F64BE_DEMUXER)         += raw.o
170
+OBJS-$(CONFIG_PCM_F64BE_DEMUXER)         += pcmdec.o pcm.o raw.o
171 171
 OBJS-$(CONFIG_PCM_F64BE_MUXER)           += raw.o
172
-OBJS-$(CONFIG_PCM_F64LE_DEMUXER)         += raw.o
172
+OBJS-$(CONFIG_PCM_F64LE_DEMUXER)         += pcmdec.o pcm.o raw.o
173 173
 OBJS-$(CONFIG_PCM_F64LE_MUXER)           += raw.o
174
-OBJS-$(CONFIG_PCM_MULAW_DEMUXER)         += raw.o
174
+OBJS-$(CONFIG_PCM_MULAW_DEMUXER)         += pcmdec.o pcm.o raw.o
175 175
 OBJS-$(CONFIG_PCM_MULAW_MUXER)           += raw.o
176
-OBJS-$(CONFIG_PCM_S16BE_DEMUXER)         += raw.o
176
+OBJS-$(CONFIG_PCM_S16BE_DEMUXER)         += pcmdec.o pcm.o raw.o
177 177
 OBJS-$(CONFIG_PCM_S16BE_MUXER)           += raw.o
178
-OBJS-$(CONFIG_PCM_S16LE_DEMUXER)         += raw.o
178
+OBJS-$(CONFIG_PCM_S16LE_DEMUXER)         += pcmdec.o pcm.o raw.o
179 179
 OBJS-$(CONFIG_PCM_S16LE_MUXER)           += raw.o
180
-OBJS-$(CONFIG_PCM_S24BE_DEMUXER)         += raw.o
180
+OBJS-$(CONFIG_PCM_S24BE_DEMUXER)         += pcmdec.o pcm.o raw.o
181 181
 OBJS-$(CONFIG_PCM_S24BE_MUXER)           += raw.o
182
-OBJS-$(CONFIG_PCM_S24LE_DEMUXER)         += raw.o
182
+OBJS-$(CONFIG_PCM_S24LE_DEMUXER)         += pcmdec.o pcm.o raw.o
183 183
 OBJS-$(CONFIG_PCM_S24LE_MUXER)           += raw.o
184
-OBJS-$(CONFIG_PCM_S32BE_DEMUXER)         += raw.o
184
+OBJS-$(CONFIG_PCM_S32BE_DEMUXER)         += pcmdec.o pcm.o raw.o
185 185
 OBJS-$(CONFIG_PCM_S32BE_MUXER)           += raw.o
186
-OBJS-$(CONFIG_PCM_S32LE_DEMUXER)         += raw.o
186
+OBJS-$(CONFIG_PCM_S32LE_DEMUXER)         += pcmdec.o pcm.o raw.o
187 187
 OBJS-$(CONFIG_PCM_S32LE_MUXER)           += raw.o
188
-OBJS-$(CONFIG_PCM_S8_DEMUXER)            += raw.o
188
+OBJS-$(CONFIG_PCM_S8_DEMUXER)            += pcmdec.o pcm.o raw.o
189 189
 OBJS-$(CONFIG_PCM_S8_MUXER)              += raw.o
190
-OBJS-$(CONFIG_PCM_U16BE_DEMUXER)         += raw.o
190
+OBJS-$(CONFIG_PCM_U16BE_DEMUXER)         += pcmdec.o pcm.o raw.o
191 191
 OBJS-$(CONFIG_PCM_U16BE_MUXER)           += raw.o
192
-OBJS-$(CONFIG_PCM_U16LE_DEMUXER)         += raw.o
192
+OBJS-$(CONFIG_PCM_U16LE_DEMUXER)         += pcmdec.o pcm.o raw.o
193 193
 OBJS-$(CONFIG_PCM_U16LE_MUXER)           += raw.o
194
-OBJS-$(CONFIG_PCM_U24BE_DEMUXER)         += raw.o
194
+OBJS-$(CONFIG_PCM_U24BE_DEMUXER)         += pcmdec.o pcm.o raw.o
195 195
 OBJS-$(CONFIG_PCM_U24BE_MUXER)           += raw.o
196
-OBJS-$(CONFIG_PCM_U24LE_DEMUXER)         += raw.o
196
+OBJS-$(CONFIG_PCM_U24LE_DEMUXER)         += pcmdec.o pcm.o raw.o
197 197
 OBJS-$(CONFIG_PCM_U24LE_MUXER)           += raw.o
198
-OBJS-$(CONFIG_PCM_U32BE_DEMUXER)         += raw.o
198
+OBJS-$(CONFIG_PCM_U32BE_DEMUXER)         += pcmdec.o pcm.o raw.o
199 199
 OBJS-$(CONFIG_PCM_U32BE_MUXER)           += raw.o
200
-OBJS-$(CONFIG_PCM_U32LE_DEMUXER)         += raw.o
200
+OBJS-$(CONFIG_PCM_U32LE_DEMUXER)         += pcmdec.o pcm.o raw.o
201 201
 OBJS-$(CONFIG_PCM_U32LE_MUXER)           += raw.o
202
-OBJS-$(CONFIG_PCM_U8_DEMUXER)            += raw.o
202
+OBJS-$(CONFIG_PCM_U8_DEMUXER)            += pcmdec.o pcm.o raw.o
203 203
 OBJS-$(CONFIG_PCM_U8_MUXER)              += raw.o
204 204
 OBJS-$(CONFIG_PVA_DEMUXER)               += pva.o
205 205
 OBJS-$(CONFIG_QCP_DEMUXER)               += qcp.o
... ...
@@ -211,7 +211,7 @@ OBJS-$(CONFIG_RM_DEMUXER)                += rmdec.o rm.o
211 211
 OBJS-$(CONFIG_RM_MUXER)                  += rmenc.o rm.o
212 212
 OBJS-$(CONFIG_ROQ_DEMUXER)               += idroqdec.o
213 213
 OBJS-$(CONFIG_ROQ_MUXER)                 += idroqenc.o raw.o
214
-OBJS-$(CONFIG_RSO_DEMUXER)               += rsodec.o rso.o raw.o
214
+OBJS-$(CONFIG_RSO_DEMUXER)               += rsodec.o rso.o pcm.o
215 215
 OBJS-$(CONFIG_RSO_MUXER)                 += rsoenc.o rso.o
216 216
 OBJS-$(CONFIG_RPL_DEMUXER)               += rpl.o
217 217
 OBJS-$(CONFIG_RTP_MUXER)                 += rtp.o         \
... ...
@@ -244,8 +244,8 @@ OBJS-$(CONFIG_SEGAFILM_DEMUXER)          += segafilm.o
244 244
 OBJS-$(CONFIG_SHORTEN_DEMUXER)           += raw.o
245 245
 OBJS-$(CONFIG_SIFF_DEMUXER)              += siff.o
246 246
 OBJS-$(CONFIG_SMACKER_DEMUXER)           += smacker.o
247
-OBJS-$(CONFIG_SOL_DEMUXER)               += sol.o raw.o
248
-OBJS-$(CONFIG_SOX_DEMUXER)               += soxdec.o raw.o
247
+OBJS-$(CONFIG_SOL_DEMUXER)               += sol.o pcm.o
248
+OBJS-$(CONFIG_SOX_DEMUXER)               += soxdec.o pcm.o
249 249
 OBJS-$(CONFIG_SOX_MUXER)                 += soxenc.o
250 250
 OBJS-$(CONFIG_SPDIF_MUXER)               += spdif.o
251 251
 OBJS-$(CONFIG_SRT_DEMUXER)               += srtdec.o
... ...
@@ -268,8 +268,8 @@ OBJS-$(CONFIG_VMD_DEMUXER)               += sierravmd.o
268 268
 OBJS-$(CONFIG_VOC_DEMUXER)               += vocdec.o voc.o
269 269
 OBJS-$(CONFIG_VOC_MUXER)                 += vocenc.o voc.o
270 270
 OBJS-$(CONFIG_VQF_DEMUXER)               += vqf.o
271
-OBJS-$(CONFIG_W64_DEMUXER)               += wav.o riff.o raw.o
272
-OBJS-$(CONFIG_WAV_DEMUXER)               += wav.o riff.o raw.o
271
+OBJS-$(CONFIG_W64_DEMUXER)               += wav.o riff.o pcm.o
272
+OBJS-$(CONFIG_WAV_DEMUXER)               += wav.o riff.o pcm.o
273 273
 OBJS-$(CONFIG_WAV_MUXER)                 += wav.o riff.o
274 274
 OBJS-$(CONFIG_WC3_DEMUXER)               += wc3movie.o
275 275
 OBJS-$(CONFIG_WEBM_MUXER)                += matroskaenc.o matroska.o \
... ...
@@ -21,7 +21,7 @@
21 21
  */
22 22
 
23 23
 #include "avformat.h"
24
-#include "raw.h"
24
+#include "pcm.h"
25 25
 #include "libavutil/intreadwrite.h"
26 26
 
27 27
 #define AT1_SU_SIZE     212
... ...
@@ -21,7 +21,7 @@
21 21
 
22 22
 #include "libavutil/intfloat_readwrite.h"
23 23
 #include "avformat.h"
24
-#include "raw.h"
24
+#include "pcm.h"
25 25
 #include "aiff.h"
26 26
 
27 27
 #define AIFF                    0
... ...
@@ -28,7 +28,7 @@
28 28
  */
29 29
 
30 30
 #include "avformat.h"
31
-#include "raw.h"
31
+#include "pcm.h"
32 32
 #include "riff.h"
33 33
 
34 34
 /* if we don't know the size in advance */
... ...
@@ -19,7 +19,7 @@
19 19
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 20
  */
21 21
 #include "avformat.h"
22
-#include "raw.h"
22
+#include "pcm.h"
23 23
 #include "riff.h"
24 24
 
25 25
 typedef struct {
... ...
@@ -45,7 +45,7 @@
45 45
 
46 46
 #include "avformat.h"
47 47
 #include "libavutil/intreadwrite.h"
48
-#include "raw.h"
48
+#include "pcm.h"
49 49
 #include "riff.h"
50 50
 #include "id3v2.h"
51 51
 
52 52
new file mode 100644
... ...
@@ -0,0 +1,55 @@
0
+/*
1
+ * PCM common functions
2
+ * Copyright (c) 2003 Fabrice Bellard
3
+ *
4
+ * This file is part of FFmpeg.
5
+ *
6
+ * FFmpeg is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * FFmpeg is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with FFmpeg; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
+ */
20
+
21
+#include "avformat.h"
22
+#include "pcm.h"
23
+
24
+int pcm_read_seek(AVFormatContext *s,
25
+                  int stream_index, int64_t timestamp, int flags)
26
+{
27
+    AVStream *st;
28
+    int block_align, byte_rate;
29
+    int64_t pos, ret;
30
+
31
+    st = s->streams[0];
32
+
33
+    block_align = st->codec->block_align ? st->codec->block_align :
34
+        (av_get_bits_per_sample(st->codec->codec_id) * st->codec->channels) >> 3;
35
+    byte_rate = st->codec->bit_rate ? st->codec->bit_rate >> 3 :
36
+        block_align * st->codec->sample_rate;
37
+
38
+    if (block_align <= 0 || byte_rate <= 0)
39
+        return -1;
40
+    if (timestamp < 0) timestamp = 0;
41
+
42
+    /* compute the position by aligning it to block_align */
43
+    pos = av_rescale_rnd(timestamp * byte_rate,
44
+                         st->time_base.num,
45
+                         st->time_base.den * (int64_t)block_align,
46
+                         (flags & AVSEEK_FLAG_BACKWARD) ? AV_ROUND_DOWN : AV_ROUND_UP);
47
+    pos *= block_align;
48
+
49
+    /* recompute exact position */
50
+    st->cur_dts = av_rescale(pos, st->time_base.den, byte_rate * (int64_t)st->time_base.num);
51
+    if ((ret = url_fseek(s->pb, pos + s->data_offset, SEEK_SET)) < 0)
52
+        return ret;
53
+    return 0;
54
+}
0 55
new file mode 100644
... ...
@@ -0,0 +1,30 @@
0
+/*
1
+ * PCM common functions
2
+ * Copyright (C) 2007  Aurelien Jacobs <aurel@gnuage.org>
3
+ *
4
+ * This file is part of FFmpeg.
5
+ *
6
+ * FFmpeg is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * FFmpeg is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with FFmpeg; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
+ */
20
+
21
+#ifndef AVFORMAT_PCM_H
22
+#define AVFORMAT_PCM_H
23
+
24
+#include "avformat.h"
25
+
26
+int pcm_read_seek(AVFormatContext *s,
27
+                  int stream_index, int64_t timestamp, int flags);
28
+
29
+#endif /* AVFORMAT_PCM_H */
0 30
new file mode 100644
... ...
@@ -0,0 +1,122 @@
0
+/*
1
+ * RAW PCM demuxers
2
+ * Copyright (c) 2002 Fabrice Bellard
3
+ *
4
+ * This file is part of FFmpeg.
5
+ *
6
+ * FFmpeg is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * FFmpeg is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with FFmpeg; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
+ */
20
+
21
+#include "avformat.h"
22
+#include "raw.h"
23
+#include "pcm.h"
24
+
25
+#define RAW_SAMPLES     1024
26
+
27
+static int raw_read_packet(AVFormatContext *s, AVPacket *pkt)
28
+{
29
+    int ret, size, bps;
30
+    //    AVStream *st = s->streams[0];
31
+
32
+    size= RAW_SAMPLES*s->streams[0]->codec->block_align;
33
+
34
+    ret= av_get_packet(s->pb, pkt, size);
35
+
36
+    pkt->stream_index = 0;
37
+    if (ret < 0)
38
+        return ret;
39
+
40
+    bps= av_get_bits_per_sample(s->streams[0]->codec->codec_id);
41
+    assert(bps); // if false there IS a bug elsewhere (NOT in this function)
42
+    pkt->dts=
43
+    pkt->pts= pkt->pos*8 / (bps * s->streams[0]->codec->channels);
44
+
45
+    return ret;
46
+}
47
+
48
+#define PCMDEF(name, long_name, ext, codec) \
49
+AVInputFormat pcm_ ## name ## _demuxer = {\
50
+    #name,\
51
+    NULL_IF_CONFIG_SMALL(long_name),\
52
+    0,\
53
+    NULL,\
54
+    ff_raw_read_header,\
55
+    raw_read_packet,\
56
+    NULL,\
57
+    pcm_read_seek,\
58
+    .flags= AVFMT_GENERIC_INDEX,\
59
+    .extensions = ext,\
60
+    .value = codec,\
61
+};
62
+
63
+PCMDEF(f64be, "PCM 64 bit floating-point big-endian format",
64
+       NULL, CODEC_ID_PCM_F64BE)
65
+
66
+PCMDEF(f64le, "PCM 64 bit floating-point little-endian format",
67
+       NULL, CODEC_ID_PCM_F64LE)
68
+
69
+PCMDEF(f32be, "PCM 32 bit floating-point big-endian format",
70
+       NULL, CODEC_ID_PCM_F32BE)
71
+
72
+PCMDEF(f32le, "PCM 32 bit floating-point little-endian format",
73
+       NULL, CODEC_ID_PCM_F32LE)
74
+
75
+PCMDEF(s32be, "PCM signed 32 bit big-endian format",
76
+       NULL, CODEC_ID_PCM_S32BE)
77
+
78
+PCMDEF(s32le, "PCM signed 32 bit little-endian format",
79
+       NULL, CODEC_ID_PCM_S32LE)
80
+
81
+PCMDEF(s24be, "PCM signed 24 bit big-endian format",
82
+       NULL, CODEC_ID_PCM_S24BE)
83
+
84
+PCMDEF(s24le, "PCM signed 24 bit little-endian format",
85
+       NULL, CODEC_ID_PCM_S24LE)
86
+
87
+PCMDEF(s16be, "PCM signed 16 bit big-endian format",
88
+       AV_NE("sw", NULL), CODEC_ID_PCM_S16BE)
89
+
90
+PCMDEF(s16le, "PCM signed 16 bit little-endian format",
91
+       AV_NE(NULL, "sw"), CODEC_ID_PCM_S16LE)
92
+
93
+PCMDEF(s8, "PCM signed 8 bit format",
94
+       "sb", CODEC_ID_PCM_S8)
95
+
96
+PCMDEF(u32be, "PCM unsigned 32 bit big-endian format",
97
+       NULL, CODEC_ID_PCM_U32BE)
98
+
99
+PCMDEF(u32le, "PCM unsigned 32 bit little-endian format",
100
+       NULL, CODEC_ID_PCM_U32LE)
101
+
102
+PCMDEF(u24be, "PCM unsigned 24 bit big-endian format",
103
+       NULL, CODEC_ID_PCM_U24BE)
104
+
105
+PCMDEF(u24le, "PCM unsigned 24 bit little-endian format",
106
+       NULL, CODEC_ID_PCM_U24LE)
107
+
108
+PCMDEF(u16be, "PCM unsigned 16 bit big-endian format",
109
+       AV_NE("uw", NULL), CODEC_ID_PCM_U16BE)
110
+
111
+PCMDEF(u16le, "PCM unsigned 16 bit little-endian format",
112
+       AV_NE(NULL, "uw"), CODEC_ID_PCM_U16LE)
113
+
114
+PCMDEF(u8, "PCM unsigned 8 bit format",
115
+       "ub", CODEC_ID_PCM_U8)
116
+
117
+PCMDEF(alaw, "PCM A-law format",
118
+       "al", CODEC_ID_PCM_ALAW)
119
+
120
+PCMDEF(mulaw, "PCM mu-law format",
121
+       "ul", CODEC_ID_PCM_MULAW)
... ...
@@ -36,7 +36,7 @@ int ff_raw_write_packet(AVFormatContext *s, AVPacket *pkt)
36 36
 
37 37
 #if CONFIG_DEMUXERS
38 38
 /* raw input */
39
-static int raw_read_header(AVFormatContext *s, AVFormatParameters *ap)
39
+int ff_raw_read_header(AVFormatContext *s, AVFormatParameters *ap)
40 40
 {
41 41
     AVStream *st;
42 42
     enum CodecID id;
... ...
@@ -81,28 +81,6 @@ static int raw_read_header(AVFormatContext *s, AVFormatParameters *ap)
81 81
 }
82 82
 
83 83
 #define RAW_PACKET_SIZE 1024
84
-#define RAW_SAMPLES     1024
85
-
86
-static int raw_read_packet(AVFormatContext *s, AVPacket *pkt)
87
-{
88
-    int ret, size, bps;
89
-    //    AVStream *st = s->streams[0];
90
-
91
-    size= RAW_SAMPLES*s->streams[0]->codec->block_align;
92
-
93
-    ret= av_get_packet(s->pb, pkt, size);
94
-
95
-    pkt->stream_index = 0;
96
-    if (ret < 0)
97
-        return ret;
98
-
99
-    bps= av_get_bits_per_sample(s->streams[0]->codec->codec_id);
100
-    assert(bps); // if false there IS a bug elsewhere (NOT in this function)
101
-    pkt->dts=
102
-    pkt->pts= pkt->pos*8 / (bps * s->streams[0]->codec->channels);
103
-
104
-    return ret;
105
-}
106 84
 
107 85
 int ff_raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt)
108 86
 {
... ...
@@ -150,38 +128,6 @@ static int rawvideo_read_packet(AVFormatContext *s, AVPacket *pkt)
150 150
 #endif
151 151
 
152 152
 #if CONFIG_DEMUXERS
153
-int pcm_read_seek(AVFormatContext *s,
154
-                  int stream_index, int64_t timestamp, int flags)
155
-{
156
-    AVStream *st;
157
-    int block_align, byte_rate;
158
-    int64_t pos, ret;
159
-
160
-    st = s->streams[0];
161
-
162
-    block_align = st->codec->block_align ? st->codec->block_align :
163
-        (av_get_bits_per_sample(st->codec->codec_id) * st->codec->channels) >> 3;
164
-    byte_rate = st->codec->bit_rate ? st->codec->bit_rate >> 3 :
165
-        block_align * st->codec->sample_rate;
166
-
167
-    if (block_align <= 0 || byte_rate <= 0)
168
-        return -1;
169
-    if (timestamp < 0) timestamp = 0;
170
-
171
-    /* compute the position by aligning it to block_align */
172
-    pos = av_rescale_rnd(timestamp * byte_rate,
173
-                         st->time_base.num,
174
-                         st->time_base.den * (int64_t)block_align,
175
-                         (flags & AVSEEK_FLAG_BACKWARD) ? AV_ROUND_DOWN : AV_ROUND_UP);
176
-    pos *= block_align;
177
-
178
-    /* recompute exact position */
179
-    st->cur_dts = av_rescale(pos, st->time_base.den, byte_rate * (int64_t)st->time_base.num);
180
-    if ((ret = url_fseek(s->pb, pos + s->data_offset, SEEK_SET)) < 0)
181
-        return ret;
182
-    return 0;
183
-}
184
-
185 153
 int ff_raw_audio_read_header(AVFormatContext *s,
186 154
                              AVFormatParameters *ap)
187 155
 {
... ...
@@ -529,7 +475,7 @@ AVInputFormat rawvideo_demuxer = {
529 529
     NULL_IF_CONFIG_SMALL("raw video format"),
530 530
     0,
531 531
     NULL,
532
-    raw_read_header,
532
+    ff_raw_read_header,
533 533
     rawvideo_read_packet,
534 534
     .flags= AVFMT_GENERIC_INDEX,
535 535
     .extensions = "yuv,cif,qcif,rgb",
... ...
@@ -581,21 +527,6 @@ AVInputFormat vc1_demuxer = {
581 581
 
582 582
 /* PCM formats */
583 583
 
584
-#define PCMINPUTDEF(name, long_name, ext, codec) \
585
-AVInputFormat pcm_ ## name ## _demuxer = {\
586
-    #name,\
587
-    NULL_IF_CONFIG_SMALL(long_name),\
588
-    0,\
589
-    NULL,\
590
-    raw_read_header,\
591
-    raw_read_packet,\
592
-    NULL,\
593
-    pcm_read_seek,\
594
-    .flags= AVFMT_GENERIC_INDEX,\
595
-    .extensions = ext,\
596
-    .value = codec,\
597
-};
598
-
599 584
 #define PCMOUTPUTDEF(name, long_name, ext, codec) \
600 585
 AVOutputFormat pcm_ ## name ## _muxer = {\
601 586
     #name,\
... ...
@@ -611,15 +542,8 @@ AVOutputFormat pcm_ ## name ## _muxer = {\
611 611
 };
612 612
 
613 613
 
614
-#if  !CONFIG_MUXERS && CONFIG_DEMUXERS
615
-#define PCMDEF(name, long_name, ext, codec) \
616
-        PCMINPUTDEF(name, long_name, ext, codec)
617
-#elif CONFIG_MUXERS && !CONFIG_DEMUXERS
618
-#define PCMDEF(name, long_name, ext, codec) \
619
-        PCMOUTPUTDEF(name, long_name, ext, codec)
620
-#elif CONFIG_MUXERS && CONFIG_DEMUXERS
614
+#if CONFIG_MUXERS
621 615
 #define PCMDEF(name, long_name, ext, codec) \
622
-        PCMINPUTDEF(name, long_name, ext, codec)\
623 616
         PCMOUTPUTDEF(name, long_name, ext, codec)
624 617
 #else
625 618
 #define PCMDEF(name, long_name, ext, codec)
... ...
@@ -24,11 +24,10 @@
24 24
 
25 25
 #include "avformat.h"
26 26
 
27
-int pcm_read_seek(AVFormatContext *s,
28
-                  int stream_index, int64_t timestamp, int flags);
29
-
30 27
 int ff_raw_write_packet(AVFormatContext *s, AVPacket *pkt);
31 28
 
29
+int ff_raw_read_header(AVFormatContext *s, AVFormatParameters *ap);
30
+
32 31
 int ff_raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt);
33 32
 
34 33
 int ff_raw_audio_read_header(AVFormatContext *s, AVFormatParameters *ap);
... ...
@@ -23,7 +23,7 @@
23 23
 #include "libavutil/intreadwrite.h"
24 24
 #include "avformat.h"
25 25
 #include "internal.h"
26
-#include "raw.h"
26
+#include "pcm.h"
27 27
 #include "riff.h"
28 28
 #include "rso.h"
29 29
 
... ...
@@ -25,7 +25,7 @@
25 25
 
26 26
 #include "libavutil/bswap.h"
27 27
 #include "avformat.h"
28
-#include "raw.h"
28
+#include "pcm.h"
29 29
 
30 30
 /* if we don't know the size in advance */
31 31
 #define AU_UNKNOWN_SIZE ((uint32_t)(~0))
... ...
@@ -31,7 +31,7 @@
31 31
 
32 32
 #include "libavutil/intreadwrite.h"
33 33
 #include "avformat.h"
34
-#include "raw.h"
34
+#include "pcm.h"
35 35
 #include "sox.h"
36 36
 
37 37
 static int sox_probe(AVProbeData *p)
... ...
@@ -23,7 +23,7 @@
23 23
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 24
  */
25 25
 #include "avformat.h"
26
-#include "raw.h"
26
+#include "pcm.h"
27 27
 #include "riff.h"
28 28
 
29 29
 typedef struct {