/*
- * Adaptive stream format encoder
+ * Adaptive stream format muxer
* Copyright (c) 2000, 2001 Fabrice Bellard.
*
- * This library is free software; you can redistribute it and/or
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful,
+ * FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "avformat.h"
-#include "avi.h"
+#include "riff.h"
#include "asf.h"
#undef NDEBUG
#include <assert.h>
-#ifdef CONFIG_MUXERS
-
#define ASF_INDEXED_INTERVAL 10000000
#define ASF_INDEX_BLOCK 600
{
int64_t t;
- t = ti * int64_t_C(10000000);
- t += int64_t_C(116444736000000000);
+ t = ti * INT64_C(10000000);
+ t += INT64_C(116444736000000000);
return t;
}
AVCodecContext *enc;
int64_t header_offset, cur_pos, hpos;
int bit_rate;
+ int64_t duration;
+ duration = asf->duration + preroll_time * 10000;
has_title = (s->title[0] || s->author[0] || s->copyright[0] || s->comment[0]);
bit_rate = 0;
file_time = 0;
put_le64(pb, unix_to_file_time(file_time));
put_le64(pb, asf->nb_packets); /* number of packets */
- put_le64(pb, asf->duration); /* end time stamp (in 100ns units) */
- put_le64(pb, asf->duration); /* duration (in 100ns units) */
+ put_le64(pb, duration); /* end time stamp (in 100ns units) */
+ put_le64(pb, duration); /* duration (in 100ns units) */
put_le32(pb, preroll_time); /* start time stamp */
put_le32(pb, 0); /* ??? */
put_le32(pb, asf->is_streamed ? 1 : 0); /* ??? */
/* stream headers */
for(n=0;n<s->nb_streams;n++) {
int64_t es_pos;
- uint8_t *er_spr = NULL;
+ const uint8_t *er_spr = NULL;
int er_spr_len = 0;
// ASFStream *stream = &asf->streams[n];
if (enc->codec_type == CODEC_TYPE_AUDIO) {
if (enc->codec_id == CODEC_ID_ADPCM_G726) {
- er_spr = (uint8_t *)error_spread_ADPCM_G726;
+ er_spr = error_spread_ADPCM_G726;
er_spr_len = sizeof(error_spread_ADPCM_G726);
}
}
pts = (pkt->pts != AV_NOPTS_VALUE) ? pkt->pts : pkt->dts;
if (pts == AV_NOPTS_VALUE) {
if (codec->codec_type == CODEC_TYPE_AUDIO) {
- duration = (codec->frame_number * (int64_t)codec->frame_size * int64_t_C(10000000)) /
+ duration = (codec->frame_number * (int64_t)codec->frame_size * INT64_C(10000000)) /
codec->sample_rate;
} else {
duration = av_rescale(codec->frame_number * (int64_t)codec->time_base.num, 10000000, codec->time_base.den);
/* check index */
if ((!asf->is_streamed) && (codec->codec_type == CODEC_TYPE_VIDEO) && (pkt->flags & PKT_FLAG_KEY)) {
- start_sec = (int)(duration / int64_t_C(10000000));
- if (start_sec != (int)(asf->last_indexed_pts / int64_t_C(10000000))) {
+ start_sec = (int)(duration / INT64_C(10000000));
+ if (start_sec != (int)(asf->last_indexed_pts / INT64_C(10000000))) {
for(i=asf->nb_index_count;i<start_sec;i++) {
if (i>=asf->nb_index_memory_alloc) {
asf->nb_index_memory_alloc += ASF_INDEX_BLOCK;
return 0;
}
-AVOutputFormat asf_oformat = {
+#ifdef CONFIG_ASF_MUXER
+AVOutputFormat asf_muxer = {
"asf",
"asf format",
"video/x-ms-asf",
"asf,wmv,wma",
sizeof(ASFContext),
-#ifdef CONFIG_MP3LAME
+#ifdef CONFIG_LIBMP3LAME
CODEC_ID_MP3,
#else
CODEC_ID_MP2,
asf_write_trailer,
.flags = AVFMT_GLOBALHEADER,
};
+#endif
-AVOutputFormat asf_stream_oformat = {
+#ifdef CONFIG_ASF_STREAM_MUXER
+AVOutputFormat asf_stream_muxer = {
"asf_stream",
"asf format",
"video/x-ms-asf",
"asf,wmv,wma",
sizeof(ASFContext),
-#ifdef CONFIG_MP3LAME
+#ifdef CONFIG_LIBMP3LAME
CODEC_ID_MP3,
#else
CODEC_ID_MP2,
asf_write_trailer,
.flags = AVFMT_GLOBALHEADER,
};
-#endif //CONFIG_MUXERS
+#endif //CONFIG_ASF_STREAM_MUXER