annotate wav.c @ 5126:789e13163b3b libavformat

Sony Wave64 demuxer patch by Daniel Verkamp, daniel drv nu
author diego
date Mon, 10 Aug 2009 16:27:33 +0000
parents 33a244b7ca65
children e73c5f33463b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 874
diff changeset
1 /*
1415
3b00fb8ef8e4 replace coder/decoder file description in libavformat by muxer/demuxer
aurel
parents: 1358
diff changeset
2 * WAV muxer and demuxer
4251
77e0c7511d41 cosmetics: Remove pointless period after copyright statement non-sentences.
diego
parents: 4206
diff changeset
3 * Copyright (c) 2001, 2002 Fabrice Bellard
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
4 *
5126
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
5 * Sony Wave64 demuxer
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
6 * Copyright (c) 2009 Daniel Verkamp
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
7 *
1358
0899bfe4105c Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 1172
diff changeset
8 * This file is part of FFmpeg.
0899bfe4105c Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 1172
diff changeset
9 *
0899bfe4105c Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 1172
diff changeset
10 * FFmpeg is free software; you can redistribute it and/or
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
11 * modify it under the terms of the GNU Lesser General Public
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
12 * License as published by the Free Software Foundation; either
1358
0899bfe4105c Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 1172
diff changeset
13 * version 2.1 of the License, or (at your option) any later version.
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
14 *
1358
0899bfe4105c Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 1172
diff changeset
15 * FFmpeg is distributed in the hope that it will be useful,
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
18 * Lesser General Public License for more details.
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
19 *
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
20 * You should have received a copy of the GNU Lesser General Public
1358
0899bfe4105c Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 1172
diff changeset
21 * License along with FFmpeg; if not, write to the Free Software
896
edbe5c3717f9 Update licensing information: The FSF changed postal address.
diego
parents: 893
diff changeset
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
23 */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
24 #include "avformat.h"
2545
213268d7594e move unrelated functions declarations out of allformats.h
aurel
parents: 2274
diff changeset
25 #include "raw.h"
1172
6a5e58d2114b move common stuff from avienc.c and wav.c to new file riff.c
mru
parents: 1169
diff changeset
26 #include "riff.h"
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
27
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
28 typedef struct {
3973
549a09cf23fe Remove offset_t typedef and use int64_t directly instead.
diego
parents: 3934
diff changeset
29 int64_t data;
549a09cf23fe Remove offset_t typedef and use int64_t directly instead.
diego
parents: 3934
diff changeset
30 int64_t data_end;
1781
ce4617062f7b Add FACT chunk for non-PCM wav formats
mbardiaux
parents: 1756
diff changeset
31 int64_t minpts;
ce4617062f7b Add FACT chunk for non-PCM wav formats
mbardiaux
parents: 1756
diff changeset
32 int64_t maxpts;
ce4617062f7b Add FACT chunk for non-PCM wav formats
mbardiaux
parents: 1756
diff changeset
33 int last_duration;
5126
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
34 int w64;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
35 } WAVContext;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
36
4206
c3102b189cb6 Change semantic of CONFIG_*, HAVE_* and ARCH_*.
aurel
parents: 3973
diff changeset
37 #if CONFIG_WAV_MUXER
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
38 static int wav_write_header(AVFormatContext *s)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
39 {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
40 WAVContext *wav = s->priv_data;
2771
d52c718e83f9 Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents: 2545
diff changeset
41 ByteIOContext *pb = s->pb;
3973
549a09cf23fe Remove offset_t typedef and use int64_t directly instead.
diego
parents: 3934
diff changeset
42 int64_t fmt, fact;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
43
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
44 put_tag(pb, "RIFF");
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
45 put_le32(pb, 0); /* file length */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
46 put_tag(pb, "WAVE");
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
47
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
48 /* format header */
5058
33a244b7ca65 Add ff_ prefixes to exported symbols in libavformat/riff.h.
diego
parents: 5001
diff changeset
49 fmt = ff_start_tag(pb, "fmt ");
33a244b7ca65 Add ff_ prefixes to exported symbols in libavformat/riff.h.
diego
parents: 5001
diff changeset
50 if (ff_put_wav_header(pb, s->streams[0]->codec) < 0) {
3925
dfd3033e7de7 add error message for unsupported codecs in WAVE.
jbr
parents: 3871
diff changeset
51 av_log(s, AV_LOG_ERROR, "%s codec not supported in WAVE format\n",
3934
1aa5e41ceaef Avoid segfault due to not set AVCodec.
michael
parents: 3925
diff changeset
52 s->streams[0]->codec->codec ? s->streams[0]->codec->codec->name : "NONE");
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
53 av_free(wav);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
54 return -1;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
55 }
5058
33a244b7ca65 Add ff_ prefixes to exported symbols in libavformat/riff.h.
diego
parents: 5001
diff changeset
56 ff_end_tag(pb, fmt);
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
57
1781
ce4617062f7b Add FACT chunk for non-PCM wav formats
mbardiaux
parents: 1756
diff changeset
58 if(s->streams[0]->codec->codec_tag != 0x01 /* hence for all other than PCM */
2771
d52c718e83f9 Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents: 2545
diff changeset
59 && !url_is_streamed(s->pb)) {
5058
33a244b7ca65 Add ff_ prefixes to exported symbols in libavformat/riff.h.
diego
parents: 5001
diff changeset
60 fact = ff_start_tag(pb, "fact");
1781
ce4617062f7b Add FACT chunk for non-PCM wav formats
mbardiaux
parents: 1756
diff changeset
61 put_le32(pb, 0);
5058
33a244b7ca65 Add ff_ prefixes to exported symbols in libavformat/riff.h.
diego
parents: 5001
diff changeset
62 ff_end_tag(pb, fact);
1781
ce4617062f7b Add FACT chunk for non-PCM wav formats
mbardiaux
parents: 1756
diff changeset
63 }
ce4617062f7b Add FACT chunk for non-PCM wav formats
mbardiaux
parents: 1756
diff changeset
64
820
feca73904e67 changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility
michael
parents: 817
diff changeset
65 av_set_pts_info(s->streams[0], 64, 1, s->streams[0]->codec->sample_rate);
1781
ce4617062f7b Add FACT chunk for non-PCM wav formats
mbardiaux
parents: 1756
diff changeset
66 wav->maxpts = wav->last_duration = 0;
ce4617062f7b Add FACT chunk for non-PCM wav formats
mbardiaux
parents: 1756
diff changeset
67 wav->minpts = INT64_MAX;
645
9fc2d2cc4608 wav timestamp truncation fix by (Wolfram Gloger <wmglo dent.med.uni-muenchen de>)
michael
parents: 587
diff changeset
68
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
69 /* data header */
5058
33a244b7ca65 Add ff_ prefixes to exported symbols in libavformat/riff.h.
diego
parents: 5001
diff changeset
70 wav->data = ff_start_tag(pb, "data");
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 874
diff changeset
71
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
72 put_flush_packet(pb);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
73
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
74 return 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
75 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
76
468
60f897e8dd2d pass AVPacket into av_write_frame()
michael
parents: 413
diff changeset
77 static int wav_write_packet(AVFormatContext *s, AVPacket *pkt)
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
78 {
2771
d52c718e83f9 Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents: 2545
diff changeset
79 ByteIOContext *pb = s->pb;
1781
ce4617062f7b Add FACT chunk for non-PCM wav formats
mbardiaux
parents: 1756
diff changeset
80 WAVContext *wav = s->priv_data;
468
60f897e8dd2d pass AVPacket into av_write_frame()
michael
parents: 413
diff changeset
81 put_buffer(pb, pkt->data, pkt->size);
1781
ce4617062f7b Add FACT chunk for non-PCM wav formats
mbardiaux
parents: 1756
diff changeset
82 if(pkt->pts != AV_NOPTS_VALUE) {
ce4617062f7b Add FACT chunk for non-PCM wav formats
mbardiaux
parents: 1756
diff changeset
83 wav->minpts = FFMIN(wav->minpts, pkt->pts);
ce4617062f7b Add FACT chunk for non-PCM wav formats
mbardiaux
parents: 1756
diff changeset
84 wav->maxpts = FFMAX(wav->maxpts, pkt->pts);
ce4617062f7b Add FACT chunk for non-PCM wav formats
mbardiaux
parents: 1756
diff changeset
85 wav->last_duration = pkt->duration;
ce4617062f7b Add FACT chunk for non-PCM wav formats
mbardiaux
parents: 1756
diff changeset
86 } else
ce4617062f7b Add FACT chunk for non-PCM wav formats
mbardiaux
parents: 1756
diff changeset
87 av_log(s, AV_LOG_ERROR, "wav_write_packet: NOPTS\n");
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
88 return 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
89 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
90
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
91 static int wav_write_trailer(AVFormatContext *s)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
92 {
2771
d52c718e83f9 Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents: 2545
diff changeset
93 ByteIOContext *pb = s->pb;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
94 WAVContext *wav = s->priv_data;
3973
549a09cf23fe Remove offset_t typedef and use int64_t directly instead.
diego
parents: 3934
diff changeset
95 int64_t file_size;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
96
2771
d52c718e83f9 Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents: 2545
diff changeset
97 if (!url_is_streamed(s->pb)) {
5058
33a244b7ca65 Add ff_ prefixes to exported symbols in libavformat/riff.h.
diego
parents: 5001
diff changeset
98 ff_end_tag(pb, wav->data);
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
99
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
100 /* update file size */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
101 file_size = url_ftell(pb);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
102 url_fseek(pb, 4, SEEK_SET);
65
a58a8a53eb46 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 0
diff changeset
103 put_le32(pb, (uint32_t)(file_size - 8));
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
104 url_fseek(pb, file_size, SEEK_SET);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
105
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
106 put_flush_packet(pb);
1781
ce4617062f7b Add FACT chunk for non-PCM wav formats
mbardiaux
parents: 1756
diff changeset
107
ce4617062f7b Add FACT chunk for non-PCM wav formats
mbardiaux
parents: 1756
diff changeset
108 if(s->streams[0]->codec->codec_tag != 0x01) {
ce4617062f7b Add FACT chunk for non-PCM wav formats
mbardiaux
parents: 1756
diff changeset
109 /* Update num_samps in fact chunk */
ce4617062f7b Add FACT chunk for non-PCM wav formats
mbardiaux
parents: 1756
diff changeset
110 int number_of_samples;
ce4617062f7b Add FACT chunk for non-PCM wav formats
mbardiaux
parents: 1756
diff changeset
111 number_of_samples = av_rescale(wav->maxpts - wav->minpts + wav->last_duration,
ce4617062f7b Add FACT chunk for non-PCM wav formats
mbardiaux
parents: 1756
diff changeset
112 s->streams[0]->codec->sample_rate * (int64_t)s->streams[0]->time_base.num,
ce4617062f7b Add FACT chunk for non-PCM wav formats
mbardiaux
parents: 1756
diff changeset
113 s->streams[0]->time_base.den);
ce4617062f7b Add FACT chunk for non-PCM wav formats
mbardiaux
parents: 1756
diff changeset
114 url_fseek(pb, wav->data-12, SEEK_SET);
ce4617062f7b Add FACT chunk for non-PCM wav formats
mbardiaux
parents: 1756
diff changeset
115 put_le32(pb, number_of_samples);
ce4617062f7b Add FACT chunk for non-PCM wav formats
mbardiaux
parents: 1756
diff changeset
116 url_fseek(pb, file_size, SEEK_SET);
ce4617062f7b Add FACT chunk for non-PCM wav formats
mbardiaux
parents: 1756
diff changeset
117 put_flush_packet(pb);
ce4617062f7b Add FACT chunk for non-PCM wav formats
mbardiaux
parents: 1756
diff changeset
118 }
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
119 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
120 return 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
121 }
3871
e6aeb2733e34 Replace generic CONFIG_MUXERS preprocessor conditionals by more specific
diego
parents: 3766
diff changeset
122 #endif /* CONFIG_WAV_MUXER */
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
123
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
124 /* return the size of the found tag */
5001
4da68099d180 Change find_tag return type to int64_t, fix a bug
bcoudurier
parents: 4251
diff changeset
125 static int64_t find_tag(ByteIOContext *pb, uint32_t tag1)
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
126 {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
127 unsigned int tag;
5001
4da68099d180 Change find_tag return type to int64_t, fix a bug
bcoudurier
parents: 4251
diff changeset
128 int64_t size;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
129
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
130 for(;;) {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
131 if (url_feof(pb))
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
132 return -1;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
133 tag = get_le32(pb);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
134 size = get_le32(pb);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
135 if (tag == tag1)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
136 break;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
137 url_fseek(pb, size, SEEK_CUR);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
138 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
139 return size;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
140 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
141
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
142 static int wav_probe(AVProbeData *p)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
143 {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
144 /* check file header */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
145 if (p->buf_size <= 32)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
146 return 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
147 if (p->buf[0] == 'R' && p->buf[1] == 'I' &&
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
148 p->buf[2] == 'F' && p->buf[3] == 'F' &&
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
149 p->buf[8] == 'W' && p->buf[9] == 'A' &&
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
150 p->buf[10] == 'V' && p->buf[11] == 'E')
3233
e2bdb989f7da Decrease returning probe score for WAV demuxer to avoid
voroshil
parents: 2771
diff changeset
151 /*
e2bdb989f7da Decrease returning probe score for WAV demuxer to avoid
voroshil
parents: 2771
diff changeset
152 Since ACT demuxer has standard WAV header at top of it's own,
e2bdb989f7da Decrease returning probe score for WAV demuxer to avoid
voroshil
parents: 2771
diff changeset
153 returning score is decreased to avoid probe conflict
e2bdb989f7da Decrease returning probe score for WAV demuxer to avoid
voroshil
parents: 2771
diff changeset
154 between ACT and WAV.
e2bdb989f7da Decrease returning probe score for WAV demuxer to avoid
voroshil
parents: 2771
diff changeset
155 */
e2bdb989f7da Decrease returning probe score for WAV demuxer to avoid
voroshil
parents: 2771
diff changeset
156 return AVPROBE_SCORE_MAX - 1;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
157 else
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
158 return 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
159 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
160
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
161 /* wav input */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
162 static int wav_read_header(AVFormatContext *s,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
163 AVFormatParameters *ap)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
164 {
5001
4da68099d180 Change find_tag return type to int64_t, fix a bug
bcoudurier
parents: 4251
diff changeset
165 int64_t size;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
166 unsigned int tag;
2771
d52c718e83f9 Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents: 2545
diff changeset
167 ByteIOContext *pb = s->pb;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
168 AVStream *st;
1136
d65cd7c3573e dont read over the end of a data chunk and at the end search for the next
michael
parents: 1122
diff changeset
169 WAVContext *wav = s->priv_data;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
170
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
171 /* check RIFF header */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
172 tag = get_le32(pb);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
173
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
174 if (tag != MKTAG('R', 'I', 'F', 'F'))
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
175 return -1;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
176 get_le32(pb); /* file size */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
177 tag = get_le32(pb);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
178 if (tag != MKTAG('W', 'A', 'V', 'E'))
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
179 return -1;
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 874
diff changeset
180
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
181 /* parse fmt header */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
182 size = find_tag(pb, MKTAG('f', 'm', 't', ' '));
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
183 if (size < 0)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
184 return -1;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
185 st = av_new_stream(s, 0);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
186 if (!st)
2273
7eb456c4ed8a Replace all occurrences of AVERROR_NOMEM with AVERROR(ENOMEM).
takis
parents: 2023
diff changeset
187 return AVERROR(ENOMEM);
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
188
5058
33a244b7ca65 Add ff_ prefixes to exported symbols in libavformat/riff.h.
diego
parents: 5001
diff changeset
189 ff_get_wav_header(pb, st->codec, size);
2023
a3e79d6e4e3c add an enum for need_parsing
aurel
parents: 1781
diff changeset
190 st->need_parsing = AVSTREAM_PARSE_FULL;
567
23b915bb10f5 set correct timebase
michael
parents: 564
diff changeset
191
820
feca73904e67 changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility
michael
parents: 817
diff changeset
192 av_set_pts_info(st, 64, 1, st->codec->sample_rate);
567
23b915bb10f5 set correct timebase
michael
parents: 564
diff changeset
193
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
194 size = find_tag(pb, MKTAG('d', 'a', 't', 'a'));
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
195 if (size < 0)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
196 return -1;
1136
d65cd7c3573e dont read over the end of a data chunk and at the end search for the next
michael
parents: 1122
diff changeset
197 wav->data_end= url_ftell(pb) + size;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
198 return 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
199 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
200
5126
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
201 #if CONFIG_W64_DEMUXER
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
202
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
203 static const uint8_t guid_riff[16] = { 'r', 'i', 'f', 'f',
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
204 0x2E, 0x91, 0xCF, 0x11, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00 };
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
205
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
206 static const uint8_t guid_wave[16] = { 'w', 'a', 'v', 'e',
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
207 0xF3, 0xAC, 0xD3, 0x11, 0x8C, 0xD1, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A };
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
208
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
209 static const uint8_t guid_fmt [16] = { 'f', 'm', 't', ' ',
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
210 0xF3, 0xAC, 0xD3, 0x11, 0x8C, 0xD1, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A };
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
211
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
212 static const uint8_t guid_data[16] = { 'd', 'a', 't', 'a',
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
213 0xF3, 0xAC, 0xD3, 0x11, 0x8C, 0xD1, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A };
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
214
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
215 static int w64_probe(AVProbeData *p)
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
216 {
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
217 if (p->buf_size <= 40)
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
218 return 0;
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
219 if (!memcmp(p->buf, guid_riff, 16) &&
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
220 !memcmp(p->buf + 24, guid_wave, 16)) {
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
221 return AVPROBE_SCORE_MAX;
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
222 } else
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
223 return 0;
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
224 }
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
225
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
226 /** Find chunk with w64 GUID by skipping over other chunks
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
227 * @return the size of the found chunk
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
228 */
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
229 static int64_t find_guid(ByteIOContext *pb, const uint8_t guid1[16])
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
230 {
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
231 uint8_t guid[16];
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
232 int64_t size;
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
233
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
234 while (!url_feof(pb)) {
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
235 get_buffer(pb, guid, 16);
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
236 size = get_le64(pb);
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
237 if (size <= 24)
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
238 return -1;
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
239 if (!memcmp(guid, guid1, 16))
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
240 return size;
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
241 url_fskip(pb, FFALIGN(size, INT64_C(8)) - 24);
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
242 }
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
243 return -1;
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
244 }
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
245
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
246 static int w64_read_header(AVFormatContext *s, AVFormatParameters *ap)
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
247 {
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
248 int64_t size;
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
249 ByteIOContext *pb = s->pb;
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
250 WAVContext *wav = s->priv_data;
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
251 AVStream *st;
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
252 uint8_t guid[16];
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
253
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
254 get_buffer(pb, guid, 16);
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
255 if (memcmp(guid, guid_riff, 16))
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
256 return -1;
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
257
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
258 if (get_le64(pb) < 16 + 8 + 16 + 8 + 16 + 8) /* riff + wave + fmt + sizes */
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
259 return -1;
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
260
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
261 get_buffer(pb, guid, 16);
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
262 if (memcmp(guid, guid_wave, 16)) {
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
263 av_log(s, AV_LOG_ERROR, "could not find wave guid\n");
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
264 return -1;
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
265 }
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
266
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
267 size = find_guid(pb, guid_fmt);
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
268 if (size < 0) {
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
269 av_log(s, AV_LOG_ERROR, "could not find fmt guid\n");
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
270 return -1;
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
271 }
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
272
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
273 st = av_new_stream(s, 0);
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
274 if (!st)
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
275 return AVERROR(ENOMEM);
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
276
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
277 /* subtract chunk header size - normal wav file doesn't count it */
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
278 ff_get_wav_header(pb, st->codec, size - 24);
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
279 url_fskip(pb, FFALIGN(size, INT64_C(8)) - size);
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
280
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
281 st->need_parsing = AVSTREAM_PARSE_FULL;
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
282
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
283 av_set_pts_info(st, 64, 1, st->codec->sample_rate);
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
284
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
285 size = find_guid(pb, guid_data);
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
286 if (size < 0) {
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
287 av_log(s, AV_LOG_ERROR, "could not find data guid\n");
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
288 return -1;
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
289 }
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
290 wav->data_end = url_ftell(pb) + size - 24;
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
291 wav->w64 = 1;
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
292
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
293 return 0;
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
294 }
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
295 #endif /* CONFIG_W64_DEMUXER */
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
296
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
297 #define MAX_SIZE 4096
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
298
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
299 static int wav_read_packet(AVFormatContext *s,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
300 AVPacket *pkt)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
301 {
5126
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
302 int ret, size;
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
303 int64_t left;
309
6c9fddf8458c seeking support - fixed some ADPCM decoding cases
bellard
parents: 277
diff changeset
304 AVStream *st;
1136
d65cd7c3573e dont read over the end of a data chunk and at the end search for the next
michael
parents: 1122
diff changeset
305 WAVContext *wav = s->priv_data;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
306
2771
d52c718e83f9 Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents: 2545
diff changeset
307 if (url_feof(s->pb))
2274
b21c2af60bc9 Replace all occurrences of AVERROR_IO with AVERROR(EIO).
takis
parents: 2273
diff changeset
308 return AVERROR(EIO);
309
6c9fddf8458c seeking support - fixed some ADPCM decoding cases
bellard
parents: 277
diff changeset
309 st = s->streams[0];
6c9fddf8458c seeking support - fixed some ADPCM decoding cases
bellard
parents: 277
diff changeset
310
2771
d52c718e83f9 Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents: 2545
diff changeset
311 left= wav->data_end - url_ftell(s->pb);
1136
d65cd7c3573e dont read over the end of a data chunk and at the end search for the next
michael
parents: 1122
diff changeset
312 if(left <= 0){
5126
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
313 if (CONFIG_W64_DEMUXER && wav->w64) {
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
314 left = find_guid(s->pb, guid_data) - 24;
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
315 } else
2771
d52c718e83f9 Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents: 2545
diff changeset
316 left = find_tag(s->pb, MKTAG('d', 'a', 't', 'a'));
1136
d65cd7c3573e dont read over the end of a data chunk and at the end search for the next
michael
parents: 1122
diff changeset
317 if (left < 0) {
2274
b21c2af60bc9 Replace all occurrences of AVERROR_IO with AVERROR(EIO).
takis
parents: 2273
diff changeset
318 return AVERROR(EIO);
1136
d65cd7c3573e dont read over the end of a data chunk and at the end search for the next
michael
parents: 1122
diff changeset
319 }
2771
d52c718e83f9 Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents: 2545
diff changeset
320 wav->data_end= url_ftell(s->pb) + left;
1136
d65cd7c3573e dont read over the end of a data chunk and at the end search for the next
michael
parents: 1122
diff changeset
321 }
d65cd7c3573e dont read over the end of a data chunk and at the end search for the next
michael
parents: 1122
diff changeset
322
309
6c9fddf8458c seeking support - fixed some ADPCM decoding cases
bellard
parents: 277
diff changeset
323 size = MAX_SIZE;
820
feca73904e67 changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility
michael
parents: 817
diff changeset
324 if (st->codec->block_align > 1) {
feca73904e67 changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility
michael
parents: 817
diff changeset
325 if (size < st->codec->block_align)
feca73904e67 changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility
michael
parents: 817
diff changeset
326 size = st->codec->block_align;
feca73904e67 changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility
michael
parents: 817
diff changeset
327 size = (size / st->codec->block_align) * st->codec->block_align;
309
6c9fddf8458c seeking support - fixed some ADPCM decoding cases
bellard
parents: 277
diff changeset
328 }
1136
d65cd7c3573e dont read over the end of a data chunk and at the end search for the next
michael
parents: 1122
diff changeset
329 size= FFMIN(size, left);
2771
d52c718e83f9 Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents: 2545
diff changeset
330 ret= av_get_packet(s->pb, pkt, size);
1756
5d72afc6c8aa better generic index building and seeking code
michael
parents: 1679
diff changeset
331 if (ret <= 0)
2274
b21c2af60bc9 Replace all occurrences of AVERROR_IO with AVERROR(EIO).
takis
parents: 2273
diff changeset
332 return AVERROR(EIO);
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
333 pkt->stream_index = 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
334
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
335 /* note: we need to modify the packet size here to handle the last
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
336 packet */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
337 pkt->size = ret;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
338 return ret;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
339 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
340
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 874
diff changeset
341 static int wav_read_seek(AVFormatContext *s,
558
89bd76208427 100l (forgoten seeking functions)
michael
parents: 550
diff changeset
342 int stream_index, int64_t timestamp, int flags)
309
6c9fddf8458c seeking support - fixed some ADPCM decoding cases
bellard
parents: 277
diff changeset
343 {
6c9fddf8458c seeking support - fixed some ADPCM decoding cases
bellard
parents: 277
diff changeset
344 AVStream *st;
6c9fddf8458c seeking support - fixed some ADPCM decoding cases
bellard
parents: 277
diff changeset
345
6c9fddf8458c seeking support - fixed some ADPCM decoding cases
bellard
parents: 277
diff changeset
346 st = s->streams[0];
820
feca73904e67 changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility
michael
parents: 817
diff changeset
347 switch(st->codec->codec_id) {
309
6c9fddf8458c seeking support - fixed some ADPCM decoding cases
bellard
parents: 277
diff changeset
348 case CODEC_ID_MP2:
6c9fddf8458c seeking support - fixed some ADPCM decoding cases
bellard
parents: 277
diff changeset
349 case CODEC_ID_MP3:
6c9fddf8458c seeking support - fixed some ADPCM decoding cases
bellard
parents: 277
diff changeset
350 case CODEC_ID_AC3:
496
112057e05179 libdts support by (Benjamin Zores <ben at geexbox dot org>)
michael
parents: 482
diff changeset
351 case CODEC_ID_DTS:
309
6c9fddf8458c seeking support - fixed some ADPCM decoding cases
bellard
parents: 277
diff changeset
352 /* use generic seeking with dynamically generated indexes */
6c9fddf8458c seeking support - fixed some ADPCM decoding cases
bellard
parents: 277
diff changeset
353 return -1;
6c9fddf8458c seeking support - fixed some ADPCM decoding cases
bellard
parents: 277
diff changeset
354 default:
6c9fddf8458c seeking support - fixed some ADPCM decoding cases
bellard
parents: 277
diff changeset
355 break;
6c9fddf8458c seeking support - fixed some ADPCM decoding cases
bellard
parents: 277
diff changeset
356 }
558
89bd76208427 100l (forgoten seeking functions)
michael
parents: 550
diff changeset
357 return pcm_read_seek(s, stream_index, timestamp, flags);
309
6c9fddf8458c seeking support - fixed some ADPCM decoding cases
bellard
parents: 277
diff changeset
358 }
6c9fddf8458c seeking support - fixed some ADPCM decoding cases
bellard
parents: 277
diff changeset
359
4206
c3102b189cb6 Change semantic of CONFIG_*, HAVE_* and ARCH_*.
aurel
parents: 3973
diff changeset
360 #if CONFIG_WAV_DEMUXER
1169
d18cc9a1fd02 allow individual selection of muxers and demuxers
mru
parents: 1167
diff changeset
361 AVInputFormat wav_demuxer = {
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
362 "wav",
3424
7a0230981402 Make long_names in lavf/lavdev optional depending on CONFIG_SMALL.
diego
parents: 3233
diff changeset
363 NULL_IF_CONFIG_SMALL("WAV format"),
1136
d65cd7c3573e dont read over the end of a data chunk and at the end search for the next
michael
parents: 1122
diff changeset
364 sizeof(WAVContext),
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
365 wav_probe,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
366 wav_read_header,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
367 wav_read_packet,
3484
31a0f3b99ef7 remove useless close funcs
bcoudurier
parents: 3424
diff changeset
368 NULL,
309
6c9fddf8458c seeking support - fixed some ADPCM decoding cases
bellard
parents: 277
diff changeset
369 wav_read_seek,
1756
5d72afc6c8aa better generic index building and seeking code
michael
parents: 1679
diff changeset
370 .flags= AVFMT_GENERIC_INDEX,
5058
33a244b7ca65 Add ff_ prefixes to exported symbols in libavformat/riff.h.
diego
parents: 5001
diff changeset
371 .codec_tag= (const AVCodecTag* const []){ff_codec_wav_tags, 0},
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
372 };
1169
d18cc9a1fd02 allow individual selection of muxers and demuxers
mru
parents: 1167
diff changeset
373 #endif
4206
c3102b189cb6 Change semantic of CONFIG_*, HAVE_* and ARCH_*.
aurel
parents: 3973
diff changeset
374 #if CONFIG_WAV_MUXER
1169
d18cc9a1fd02 allow individual selection of muxers and demuxers
mru
parents: 1167
diff changeset
375 AVOutputFormat wav_muxer = {
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
376 "wav",
3424
7a0230981402 Make long_names in lavf/lavdev optional depending on CONFIG_SMALL.
diego
parents: 3233
diff changeset
377 NULL_IF_CONFIG_SMALL("WAV format"),
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
378 "audio/x-wav",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
379 "wav",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
380 sizeof(WAVContext),
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
381 CODEC_ID_PCM_S16LE,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
382 CODEC_ID_NONE,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
383 wav_write_header,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
384 wav_write_packet,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
385 wav_write_trailer,
5058
33a244b7ca65 Add ff_ prefixes to exported symbols in libavformat/riff.h.
diego
parents: 5001
diff changeset
386 .codec_tag= (const AVCodecTag* const []){ff_codec_wav_tags, 0},
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
387 };
1169
d18cc9a1fd02 allow individual selection of muxers and demuxers
mru
parents: 1167
diff changeset
388 #endif
5126
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
389 #if CONFIG_W64_DEMUXER
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
390 AVInputFormat w64_demuxer = {
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
391 "w64",
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
392 NULL_IF_CONFIG_SMALL("Sony Wave64 format"),
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
393 sizeof(WAVContext),
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
394 w64_probe,
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
395 w64_read_header,
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
396 wav_read_packet,
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
397 NULL,
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
398 wav_read_seek,
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
399 .flags = AVFMT_GENERIC_INDEX,
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
400 .codec_tag = (const AVCodecTag* const []){ff_codec_wav_tags, 0},
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
401 };
789e13163b3b Sony Wave64 demuxer
diego
parents: 5058
diff changeset
402 #endif