From bdd00e2d1be31059bb772266d12ba418aa0f391a Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Sun, 23 Dec 2012 14:12:28 -0500 Subject: au: set stream start time and packet durations --- libavformat/au.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'libavformat/au.c') diff --git a/libavformat/au.c b/libavformat/au.c index fa2e0c4513..670ec79e59 100644 --- a/libavformat/au.c +++ b/libavformat/au.c @@ -120,6 +120,8 @@ static int au_read_header(AVFormatContext *s) st->codec->sample_rate = rate; st->codec->bit_rate = channels * rate * bps; st->codec->block_align = channels * bps >> 3; + + st->start_time = 0; avpriv_set_pts_info(st, 64, 1, rate); return 0; } @@ -134,6 +136,7 @@ static int au_read_packet(AVFormatContext *s, if (ret < 0) return ret; pkt->stream_index = 0; + pkt->duration = ret / s->streams[0]->codec->block_align; return 0; } -- cgit v1.2.3 From c88d245c9866e48cb8a238b7564964c1fcf3315f Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Sun, 23 Dec 2012 14:14:38 -0500 Subject: au: use ff_raw_write_packet() --- libavformat/Makefile | 2 +- libavformat/au.c | 11 +++-------- 2 files changed, 4 insertions(+), 9 deletions(-) (limited to 'libavformat/au.c') diff --git a/libavformat/Makefile b/libavformat/Makefile index 14e3e1ed68..2d663300fd 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -65,7 +65,7 @@ OBJS-$(CONFIG_ASF_MUXER) += asfenc.o asf.o OBJS-$(CONFIG_ASS_DEMUXER) += assdec.o OBJS-$(CONFIG_ASS_MUXER) += assenc.o OBJS-$(CONFIG_AU_DEMUXER) += au.o pcm.o -OBJS-$(CONFIG_AU_MUXER) += au.o +OBJS-$(CONFIG_AU_MUXER) += au.o rawenc.o OBJS-$(CONFIG_AVI_DEMUXER) += avidec.o OBJS-$(CONFIG_AVI_MUXER) += avienc.o OBJS-$(CONFIG_AVISYNTH) += avisynth.o diff --git a/libavformat/au.c b/libavformat/au.c index 670ec79e59..4c5af34133 100644 --- a/libavformat/au.c +++ b/libavformat/au.c @@ -154,6 +154,8 @@ AVInputFormat ff_au_demuxer = { #if CONFIG_AU_MUXER +#include "rawenc.h" + /* if we don't know the size in advance */ #define AU_UNKNOWN_SIZE ((uint32_t)(~0)) @@ -187,13 +189,6 @@ static int au_write_header(AVFormatContext *s) return 0; } -static int au_write_packet(AVFormatContext *s, AVPacket *pkt) -{ - AVIOContext *pb = s->pb; - avio_write(pb, pkt->data, pkt->size); - return 0; -} - static int au_write_trailer(AVFormatContext *s) { AVIOContext *pb = s->pb; @@ -221,7 +216,7 @@ AVOutputFormat ff_au_muxer = { .audio_codec = AV_CODEC_ID_PCM_S16BE, .video_codec = AV_CODEC_ID_NONE, .write_header = au_write_header, - .write_packet = au_write_packet, + .write_packet = ff_raw_write_packet, .write_trailer = au_write_trailer, .codec_tag = (const AVCodecTag* const []){ codec_au_tags, 0 }, }; -- cgit v1.2.3