#include "libavutil/avassert.h"
#include "libavutil/dict.h"
#include "libavutil/mathematics.h"
-#include "libavutil/parseutils.h"
#include "libavutil/opt.h"
#include "avformat.h"
#include "avlanguage.h"
{ AV_CODEC_ID_NONE, 0 },
};
+static const AVCodecTag *const asf_codec_tags[] = {
+ codec_asf_bmp_tags, ff_codec_bmp_tags, ff_codec_wav_tags, NULL
+};
+
#define PREROLL_TIME 3100
static void put_str16(AVIOContext *s, const char *tag)
int64_t pres_time = av_rescale_q(c->start, c->time_base, scale);
uint64_t offset;
int32_t send_time = get_send_time(asf, pres_time, &offset);
- int len = 0;
+ int len = 0, ret;
uint8_t *buf;
AVIOContext *dyn_buf;
if (t) {
- if (avio_open_dyn_buf(&dyn_buf) < 0)
- return AVERROR(ENOMEM);
+ if ((ret = avio_open_dyn_buf(&dyn_buf)) < 0)
+ return ret;
avio_put_str16le(dyn_buf, t->value);
len = avio_close_dyn_buf(dyn_buf, &buf);
}
/* title and other info */
if (has_title) {
- int len;
+ int len, ret;
uint8_t *buf;
AVIOContext *dyn_buf;
- if (avio_open_dyn_buf(&dyn_buf) < 0)
- return AVERROR(ENOMEM);
+ if ((ret = avio_open_dyn_buf(&dyn_buf)) < 0)
+ return ret;
hpos = put_header(pb, &ff_asf_comment_header);
avio_wl16(pb, 40 + par->extradata_size); /* size */
/* BITMAPINFOHEADER header */
- ff_put_bmp_header(pb, par, 1, 0);
+ ff_put_bmp_header(pb, par, 1, 0, 0);
}
end_header(pb, hpos);
}
if (desc) {
AVIOContext *dyn_buf;
uint8_t *buf;
- int len;
+ int len, ret;
- if (avio_open_dyn_buf(&dyn_buf) < 0)
- return AVERROR(ENOMEM);
+ if ((ret = avio_open_dyn_buf(&dyn_buf)) < 0)
+ return ret;
avio_put_str16le(dyn_buf, desc);
len = avio_close_dyn_buf(dyn_buf, &buf);
return -1;
}
- avio_flush(s->pb);
-
asf->packet_nb_payloads = 0;
asf->packet_timestamp_start = -1;
asf->packet_timestamp_end = -1;
avio_write(s->pb, asf->packet_buf, s->packet_size - packet_hdr_size);
- avio_flush(s->pb);
+ avio_write_marker(s->pb, AV_NOPTS_VALUE, AVIO_DATA_MARKER_FLUSH_POINT);
+
asf->nb_packets++;
asf->packet_nb_payloads = 0;
asf->packet_timestamp_start = -1;
return ret;
asf_write_index(s, asf->index_ptr, asf->maximum_packet, asf->next_start_sec);
}
- avio_flush(s->pb);
if (asf->is_streamed || !(s->pb->seekable & AVIO_SEEKABLE_NORMAL)) {
put_chunk(s, 0x4524, 0, 0); /* end of stream */
.write_packet = asf_write_packet,
.write_trailer = asf_write_trailer,
.flags = AVFMT_GLOBALHEADER,
- .codec_tag = (const AVCodecTag * const []) {
- codec_asf_bmp_tags, ff_codec_bmp_tags, ff_codec_wav_tags, 0
- },
+ .codec_tag = asf_codec_tags,
.priv_class = &asf_muxer_class,
};
#endif /* CONFIG_ASF_MUXER */
.write_packet = asf_write_packet,
.write_trailer = asf_write_trailer,
.flags = AVFMT_GLOBALHEADER,
- .codec_tag = (const AVCodecTag * const []) {
- codec_asf_bmp_tags, ff_codec_bmp_tags, ff_codec_wav_tags, 0
- },
+ .codec_tag = asf_codec_tags,
.priv_class = &asf_stream_muxer_class,
};
#endif /* CONFIG_ASF_STREAM_MUXER */