Mercurial > libavformat.hg
annotate aiffenc.c @ 5442:65a5773a23a5 libavformat
APIChanges & minor bump due to avg_frame_rate addition.
author | michael |
---|---|
date | Sun, 13 Dec 2009 15:55:07 +0000 |
parents | 63c52dca959b |
children |
rev | line source |
---|---|
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
1 /* |
5283
63c52dca959b
Split up the AIFF muxer and demuxer into separate files.
jbr
parents:
5279
diff
changeset
|
2 * AIFF/AIFF-C muxer |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
3 * Copyright (c) 2006 Patrick Guimond |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
4 * |
1358
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1172
diff
changeset
|
5 * This file is part of FFmpeg. |
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1172
diff
changeset
|
6 * |
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1172
diff
changeset
|
7 * FFmpeg is free software; you can redistribute it and/or |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
8 * modify it under the terms of the GNU Lesser General Public |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
9 * 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
|
10 * version 2.1 of the License, or (at your option) any later version. |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
11 * |
1358
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1172
diff
changeset
|
12 * FFmpeg is distributed in the hope that it will be useful, |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
15 * Lesser General Public License for more details. |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
16 * |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
17 * 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
|
18 * License along with FFmpeg; if not, write to the Free Software |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
20 */ |
3286 | 21 |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
22 #include "avformat.h" |
5283
63c52dca959b
Split up the AIFF muxer and demuxer into separate files.
jbr
parents:
5279
diff
changeset
|
23 #include "aiff.h" |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
24 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
25 typedef struct { |
3973
549a09cf23fe
Remove offset_t typedef and use int64_t directly instead.
diego
parents:
3967
diff
changeset
|
26 int64_t form; |
549a09cf23fe
Remove offset_t typedef and use int64_t directly instead.
diego
parents:
3967
diff
changeset
|
27 int64_t frames; |
549a09cf23fe
Remove offset_t typedef and use int64_t directly instead.
diego
parents:
3967
diff
changeset
|
28 int64_t ssnd; |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
29 } AIFFOutputContext; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
30 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
31 static int aiff_write_header(AVFormatContext *s) |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
32 { |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
33 AIFFOutputContext *aiff = s->priv_data; |
2771
d52c718e83f9
Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents:
2545
diff
changeset
|
34 ByteIOContext *pb = s->pb; |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
35 AVCodecContext *enc = s->streams[0]->codec; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
36 AVExtFloat sample_rate; |
1790
d30211065a35
use aiff when we can, some players only support aiff
bcoudurier
parents:
1684
diff
changeset
|
37 int aifc = 0; |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
38 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
39 /* First verify if format is ok */ |
3070 | 40 if (!enc->codec_tag) |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
41 return -1; |
1790
d30211065a35
use aiff when we can, some players only support aiff
bcoudurier
parents:
1684
diff
changeset
|
42 if (enc->codec_tag != MKTAG('N','O','N','E')) |
d30211065a35
use aiff when we can, some players only support aiff
bcoudurier
parents:
1684
diff
changeset
|
43 aifc = 1; |
d30211065a35
use aiff when we can, some players only support aiff
bcoudurier
parents:
1684
diff
changeset
|
44 |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
45 /* FORM AIFF header */ |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
46 put_tag(pb, "FORM"); |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
47 aiff->form = url_ftell(pb); |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
48 put_be32(pb, 0); /* file length */ |
1790
d30211065a35
use aiff when we can, some players only support aiff
bcoudurier
parents:
1684
diff
changeset
|
49 put_tag(pb, aifc ? "AIFC" : "AIFF"); |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
50 |
3068
9cc9ff5aff9c
set bps to uncompressed original sound data for compressed audio
bcoudurier
parents:
3067
diff
changeset
|
51 if (aifc) { // compressed audio |
3908
1d3d17de20ba
Bump Major version, this commit is almost just renaming bits_per_sample to
michael
parents:
3891
diff
changeset
|
52 enc->bits_per_coded_sample = 16; |
3068
9cc9ff5aff9c
set bps to uncompressed original sound data for compressed audio
bcoudurier
parents:
3067
diff
changeset
|
53 if (!enc->block_align) { |
9cc9ff5aff9c
set bps to uncompressed original sound data for compressed audio
bcoudurier
parents:
3067
diff
changeset
|
54 av_log(s, AV_LOG_ERROR, "block align not set\n"); |
9cc9ff5aff9c
set bps to uncompressed original sound data for compressed audio
bcoudurier
parents:
3067
diff
changeset
|
55 return -1; |
9cc9ff5aff9c
set bps to uncompressed original sound data for compressed audio
bcoudurier
parents:
3067
diff
changeset
|
56 } |
1791 | 57 /* Version chunk */ |
58 put_tag(pb, "FVER"); | |
59 put_be32(pb, 4); | |
60 put_be32(pb, 0xA2805140); | |
1790
d30211065a35
use aiff when we can, some players only support aiff
bcoudurier
parents:
1684
diff
changeset
|
61 } |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
62 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
63 /* Common chunk */ |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
64 put_tag(pb, "COMM"); |
1790
d30211065a35
use aiff when we can, some players only support aiff
bcoudurier
parents:
1684
diff
changeset
|
65 put_be32(pb, aifc ? 24 : 18); /* size */ |
3070 | 66 put_be16(pb, enc->channels); /* Number of channels */ |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
67 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
68 aiff->frames = url_ftell(pb); |
3070 | 69 put_be32(pb, 0); /* Number of frames */ |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
70 |
3908
1d3d17de20ba
Bump Major version, this commit is almost just renaming bits_per_sample to
michael
parents:
3891
diff
changeset
|
71 if (!enc->bits_per_coded_sample) |
1d3d17de20ba
Bump Major version, this commit is almost just renaming bits_per_sample to
michael
parents:
3891
diff
changeset
|
72 enc->bits_per_coded_sample = av_get_bits_per_sample(enc->codec_id); |
1d3d17de20ba
Bump Major version, this commit is almost just renaming bits_per_sample to
michael
parents:
3891
diff
changeset
|
73 if (!enc->bits_per_coded_sample) { |
1375
c42cb95fa0d4
use av_get_bits_per_sample, compute block align if not set
bcoudurier
parents:
1374
diff
changeset
|
74 av_log(s, AV_LOG_ERROR, "could not compute bits per sample\n"); |
c42cb95fa0d4
use av_get_bits_per_sample, compute block align if not set
bcoudurier
parents:
1374
diff
changeset
|
75 return -1; |
c42cb95fa0d4
use av_get_bits_per_sample, compute block align if not set
bcoudurier
parents:
1374
diff
changeset
|
76 } |
c42cb95fa0d4
use av_get_bits_per_sample, compute block align if not set
bcoudurier
parents:
1374
diff
changeset
|
77 if (!enc->block_align) |
3908
1d3d17de20ba
Bump Major version, this commit is almost just renaming bits_per_sample to
michael
parents:
3891
diff
changeset
|
78 enc->block_align = (enc->bits_per_coded_sample * enc->channels) >> 3; |
1375
c42cb95fa0d4
use av_get_bits_per_sample, compute block align if not set
bcoudurier
parents:
1374
diff
changeset
|
79 |
3908
1d3d17de20ba
Bump Major version, this commit is almost just renaming bits_per_sample to
michael
parents:
3891
diff
changeset
|
80 put_be16(pb, enc->bits_per_coded_sample); /* Sample size */ |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
81 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
82 sample_rate = av_dbl2ext((double)enc->sample_rate); |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
83 put_buffer(pb, (uint8_t*)&sample_rate, sizeof(sample_rate)); |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
84 |
1790
d30211065a35
use aiff when we can, some players only support aiff
bcoudurier
parents:
1684
diff
changeset
|
85 if (aifc) { |
1791 | 86 put_le32(pb, enc->codec_tag); |
87 put_be16(pb, 0); | |
1790
d30211065a35
use aiff when we can, some players only support aiff
bcoudurier
parents:
1684
diff
changeset
|
88 } |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
89 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
90 /* Sound data chunk */ |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
91 put_tag(pb, "SSND"); |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
92 aiff->ssnd = url_ftell(pb); /* Sound chunk size */ |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
93 put_be32(pb, 0); /* Sound samples data size */ |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
94 put_be32(pb, 0); /* Data offset */ |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
95 put_be32(pb, 0); /* Block-size (block align) */ |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
96 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
97 av_set_pts_info(s->streams[0], 64, 1, s->streams[0]->codec->sample_rate); |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
98 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
99 /* Data is starting here */ |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
100 put_flush_packet(pb); |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
101 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
102 return 0; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
103 } |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
104 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
105 static int aiff_write_packet(AVFormatContext *s, AVPacket *pkt) |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
106 { |
2771
d52c718e83f9
Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents:
2545
diff
changeset
|
107 ByteIOContext *pb = s->pb; |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
108 put_buffer(pb, pkt->data, pkt->size); |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
109 return 0; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
110 } |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
111 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
112 static int aiff_write_trailer(AVFormatContext *s) |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
113 { |
2771
d52c718e83f9
Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents:
2545
diff
changeset
|
114 ByteIOContext *pb = s->pb; |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
115 AIFFOutputContext *aiff = s->priv_data; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
116 AVCodecContext *enc = s->streams[0]->codec; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
117 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
118 /* Chunks sizes must be even */ |
3973
549a09cf23fe
Remove offset_t typedef and use int64_t directly instead.
diego
parents:
3967
diff
changeset
|
119 int64_t file_size, end_size; |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
120 end_size = file_size = url_ftell(pb); |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
121 if (file_size & 1) { |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
122 put_byte(pb, 0); |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
123 end_size++; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
124 } |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
125 |
2771
d52c718e83f9
Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents:
2545
diff
changeset
|
126 if (!url_is_streamed(s->pb)) { |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
127 /* File length */ |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
128 url_fseek(pb, aiff->form, SEEK_SET); |
3071 | 129 put_be32(pb, file_size - aiff->form - 4); |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
130 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
131 /* Number of sample frames */ |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
132 url_fseek(pb, aiff->frames, SEEK_SET); |
3071 | 133 put_be32(pb, (file_size-aiff->ssnd-12)/enc->block_align); |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
134 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
135 /* Sound Data chunk size */ |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
136 url_fseek(pb, aiff->ssnd, SEEK_SET); |
3071 | 137 put_be32(pb, file_size - aiff->ssnd - 4); |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
138 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
139 /* return to the end */ |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
140 url_fseek(pb, end_size, SEEK_SET); |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
141 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
142 put_flush_packet(pb); |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
143 } |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
144 |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
145 return 0; |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
146 } |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
147 |
1169 | 148 AVOutputFormat aiff_muxer = { |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
149 "aiff", |
3424
7a0230981402
Make long_names in lavf/lavdev optional depending on CONFIG_SMALL.
diego
parents:
3297
diff
changeset
|
150 NULL_IF_CONFIG_SMALL("Audio IFF"), |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
151 "audio/aiff", |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
152 "aif,aiff,afc,aifc", |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
153 sizeof(AIFFOutputContext), |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
154 CODEC_ID_PCM_S16BE, |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
155 CODEC_ID_NONE, |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
156 aiff_write_header, |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
157 aiff_write_packet, |
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
158 aiff_write_trailer, |
5283
63c52dca959b
Split up the AIFF muxer and demuxer into separate files.
jbr
parents:
5279
diff
changeset
|
159 .codec_tag= (const AVCodecTag* const []){ff_codec_aiff_tags, 0}, |
925
2d9a65a1d9ea
AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)
michael
parents:
diff
changeset
|
160 }; |