aboutsummaryrefslogtreecommitdiffstats
path: root/libav
diff options
context:
space:
mode:
authorJuanjo <pulento@users.sourceforge.net>2002-04-09 04:52:49 +0000
committerJuanjo <pulento@users.sourceforge.net>2002-04-09 04:52:49 +0000
commite0d2714adc4985198a4c9fadf76508cfe7c131d0 (patch)
tree8907aa932e9da43372590f5454fd7fd231e0983e /libav
parent9f862d1133e23c26e7b682c625f380f68cd4627b (diff)
downloadffmpeg-e0d2714adc4985198a4c9fadf76508cfe7c131d0.tar.gz
- Fixed AC3 decoding for 5:1 AC3 streams. Now when calling av_audio_decode for
AC3 set avcodec_context->channels to the desired number channels, if the setting is 0 AC3 decoder will set it to the channels found in the stream. - Changed ffmpeg to cope with the new "way" of AC3 decoding. - ASF muxer now uses Tickers for PTS calculations. Originally committed as revision 393 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libav')
-rw-r--r--libav/asf.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/libav/asf.c b/libav/asf.c
index 90fa685c3f..adc2437ea4 100644
--- a/libav/asf.c
+++ b/libav/asf.c
@@ -18,6 +18,7 @@
*/
#include "avformat.h"
#include "avi.h"
+#include "tick.h"
#define PACKET_SIZE 3200
#define PACKET_HEADER_SIZE 12
@@ -26,6 +27,7 @@
typedef struct {
int num;
int seq;
+ Ticker pts_ticker;
/* use for reading */
AVPacket pkt;
int frag_offset;
@@ -283,6 +285,7 @@ static int asf_write_header1(AVFormatContext *s, INT64 file_size, INT64 data_chu
/* stream headers */
for(n=0;n<s->nb_streams;n++) {
+ ASFStream *stream = &asf->streams[n];
enc = &s->streams[n]->codec;
asf->streams[n].num = n + 1;
asf->streams[n].seq = 0;
@@ -292,12 +295,20 @@ static int asf_write_header1(AVFormatContext *s, INT64 file_size, INT64 data_chu
wav_extra_size = 0;
extra_size = 18 + wav_extra_size;
extra_size2 = 0;
+ /* Init the ticker */
+ ticker_init(&stream->pts_ticker,
+ enc->sample_rate,
+ 1000 * enc->frame_size);
break;
default:
case CODEC_TYPE_VIDEO:
wav_extra_size = 0;
extra_size = 0x33;
extra_size2 = 0;
+ /* Init the ticker */
+ ticker_init(&stream->pts_ticker,
+ enc->frame_rate,
+ 1000 * FRAME_RATE_BASE);
break;
}
@@ -543,26 +554,27 @@ static int asf_write_packet(AVFormatContext *s, int stream_index,
UINT8 *buf, int size, int force_pts)
{
ASFContext *asf = s->priv_data;
+ ASFStream *stream;
int timestamp;
INT64 duration;
AVCodecContext *codec;
codec = &s->streams[stream_index]->codec;
+ stream = &asf->streams[stream_index];
+
if (codec->codec_type == CODEC_TYPE_AUDIO) {
- timestamp = (int)((float)codec->frame_number * codec->frame_size * 1000.0 /
- codec->sample_rate);
+ timestamp = (int)ticker_tick(&stream->pts_ticker, codec->frame_number);
duration = (codec->frame_number * codec->frame_size * INT64_C(10000000)) /
codec->sample_rate;
} else {
- timestamp = (int)((float)codec->frame_number * 1000.0 * FRAME_RATE_BASE /
- codec->frame_rate);
+ timestamp = (int)ticker_tick(&stream->pts_ticker, codec->frame_number);
duration = codec->frame_number *
((INT64_C(10000000) * FRAME_RATE_BASE) / codec->frame_rate);
}
if (duration > asf->duration)
asf->duration = duration;
- put_frame(s, &asf->streams[stream_index], (int)timestamp, buf, size);
+ put_frame(s, stream, timestamp, buf, size);
return 0;
}