1 /*
2 * AST muxer
3 * Copyright (c) 2012 James Almer
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
29
38
39 #define CHECK_LOOP(type) \
40 if (ast->loop ## type > 0) { \
41 ast->loop ## type = av_rescale_rnd(ast->loop ## type, par->sample_rate, 1000, AV_ROUND_DOWN); \
42 if (ast->loop ## type < 0 || ast->loop ## type > UINT_MAX) { \
43 av_log(s, AV_LOG_ERROR, "Invalid loop" #type " value\n"); \
44 return AVERROR(EINVAL); \
45 } \
46 }
47
49 {
53 unsigned int codec_tag;
54
55 if (
s->nb_streams == 1) {
56 par =
s->streams[0]->codecpar;
57 } else {
60 }
61
65 }
66
68 if (!codec_tag) {
71 }
72
76 }
77
78 /* Convert milliseconds to samples */
81
83
85 avio_wb32(pb, 0);
/* File size minus header */
91
96 avio_wb32(pb, 0);
/* Size of first block */
97
98 /* Unknown */
104
105 return 0;
106 }
107
109 {
114
115 if (
s->streams[0]->nb_frames == 0)
117
120
121 /* padding */
123
125
126 return 0;
127 }
128
130 {
135 int64_t
samples = (file_size - 64 - (32 *
s->streams[0]->nb_frames)) / par->
block_align;
/* PCM_S16BE_PLANAR */
136
138
140 /* Number of samples */
143
144 /* Loopstart if provided */
150 } else
152 } else
154
155 /* Loopend if provided. Otherwise number of samples again */
160 }
162 } else {
164 }
165
166 /* Size of first block */
168
169 /* File size minus header */
172
173 /* Loop flag */
177 }
178
180 }
181 return 0;
182 }
183
184 #define OFFSET(obj) offsetof(ASTMuxContext, obj)
189 };
190
196 };
197
201 .p.extensions = "ast",
210 };