diff options
author | Juanjo <pulento@users.sourceforge.net> | 2002-04-07 21:44:29 +0000 |
---|---|---|
committer | Juanjo <pulento@users.sourceforge.net> | 2002-04-07 21:44:29 +0000 |
commit | 10bb7023a224adbcd2b97d5115db57bf13094906 (patch) | |
tree | 85921bed3e9756d92ba95b8bd3f74e9cea9d0866 /libav | |
parent | 3bf43d42eda38abd5b75d004e1431d71aacfbe48 (diff) | |
download | ffmpeg-10bb7023a224adbcd2b97d5115db57bf13094906.tar.gz |
- Added force_pts to av_write_packet() to be able to force PTS, this helps
(and fix) stream copying. By now force_pts it's just honoured by the MPEG
muxer. ASF could honour this also, but it should be fixed to use Tickers
first.
- MPEG audio decoder exports it's frame size in bytes.
- Hope this fix the floating point exception found in ffserver.
Originally committed as revision 382 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libav')
-rw-r--r-- | libav/asf.c | 2 | ||||
-rw-r--r-- | libav/audio.c | 2 | ||||
-rw-r--r-- | libav/avformat.h | 4 | ||||
-rw-r--r-- | libav/avienc.c | 2 | ||||
-rw-r--r-- | libav/ffm.c | 2 | ||||
-rw-r--r-- | libav/img.c | 2 | ||||
-rw-r--r-- | libav/jpeg.c | 8 | ||||
-rw-r--r-- | libav/mpeg.c | 13 | ||||
-rw-r--r-- | libav/raw.c | 2 | ||||
-rw-r--r-- | libav/rm.c | 2 | ||||
-rw-r--r-- | libav/swf.c | 2 | ||||
-rw-r--r-- | libav/utils.c | 4 | ||||
-rw-r--r-- | libav/wav.c | 2 |
13 files changed, 26 insertions, 21 deletions
diff --git a/libav/asf.c b/libav/asf.c index 60960db2b9..0dc4fca2d7 100644 --- a/libav/asf.c +++ b/libav/asf.c @@ -524,7 +524,7 @@ static void put_frame(AVFormatContext *s, ASFStream *stream, int timestamp, static int asf_write_packet(AVFormatContext *s, int stream_index, - UINT8 *buf, int size) + UINT8 *buf, int size, int force_pts) { ASFContext *asf = s->priv_data; int timestamp; diff --git a/libav/audio.c b/libav/audio.c index 2f4ef759b6..330310c292 100644 --- a/libav/audio.c +++ b/libav/audio.c @@ -161,7 +161,7 @@ static int audio_write_header(AVFormatContext *s1) } static int audio_write_packet(AVFormatContext *s1, int stream_index, - UINT8 *buf, int size) + UINT8 *buf, int size, int force_pts) { AudioData *s = s1->priv_data; int len, ret; diff --git a/libav/avformat.h b/libav/avformat.h index 630c5af95b..2f5025c168 100644 --- a/libav/avformat.h +++ b/libav/avformat.h @@ -44,7 +44,7 @@ typedef struct AVFormat { int (*write_header)(struct AVFormatContext *); int (*write_packet)(struct AVFormatContext *, int stream_index, - unsigned char *buf, int size); + unsigned char *buf, int size, int force_pts); int (*write_trailer)(struct AVFormatContext *); /* optional input support */ @@ -187,7 +187,7 @@ AVFormatContext *av_open_input_file(const char *filename, int av_read_packet(AVFormatContext *s, AVPacket *pkt); void av_close_input_file(AVFormatContext *s); -int av_write_packet(AVFormatContext *s, AVPacket *pkt); +int av_write_packet(AVFormatContext *s, AVPacket *pkt, int force_pts); void dump_format(AVFormatContext *ic, int index, diff --git a/libav/avienc.c b/libav/avienc.c index 1be5da424c..b21a2527a2 100644 --- a/libav/avienc.c +++ b/libav/avienc.c @@ -277,7 +277,7 @@ static int avi_write_header(AVFormatContext *s) } static int avi_write_packet(AVFormatContext *s, int stream_index, - UINT8 *buf, int size) + UINT8 *buf, int size, int force_pts) { AVIContext *avi = s->priv_data; ByteIOContext *pb = &s->pb; diff --git a/libav/ffm.c b/libav/ffm.c index 80f41ff0f0..b5d28333e1 100644 --- a/libav/ffm.c +++ b/libav/ffm.c @@ -195,7 +195,7 @@ static int ffm_write_header(AVFormatContext *s) } static int ffm_write_packet(AVFormatContext *s, int stream_index, - UINT8 *buf, int size) + UINT8 *buf, int size, int force_pts) { AVStream *st = s->streams[stream_index]; FFMStream *fst = st->priv_data; diff --git a/libav/img.c b/libav/img.c index e793d43d09..57cc0c303a 100644 --- a/libav/img.c +++ b/libav/img.c @@ -515,7 +515,7 @@ static int img_write_header(AVFormatContext *s) } static int img_write_packet(AVFormatContext *s, int stream_index, - UINT8 *buf, int size) + UINT8 *buf, int size, int force_pts) { VideoData *img = s->priv_data; AVStream *st = s->streams[stream_index]; diff --git a/libav/jpeg.c b/libav/jpeg.c index 531e79792c..94971d9f8f 100644 --- a/libav/jpeg.c +++ b/libav/jpeg.c @@ -32,8 +32,8 @@ static int mpjpeg_write_header(AVFormatContext *s) return 0; } -static int mpjpeg_write_packet(AVFormatContext *s, - int stream_index, UINT8 *buf, int size) +static int mpjpeg_write_packet(AVFormatContext *s, int stream_index, + UINT8 *buf, int size, int force_pts) { UINT8 buf1[256]; @@ -74,7 +74,7 @@ static int single_jpeg_write_header(AVFormatContext *s) } static int single_jpeg_write_packet(AVFormatContext *s, int stream_index, - UINT8 *buf, int size) + UINT8 *buf, int size, int force_pts) { put_buffer(&s->pb, buf, size); put_flush_packet(&s->pb); @@ -120,7 +120,7 @@ static int jpeg_write_header(AVFormatContext *s1) } static int jpeg_write_packet(AVFormatContext *s1, int stream_index, - UINT8 *buf, int size) + UINT8 *buf, int size, int force_pts) { JpegContext *s = s1->priv_data; char filename[1024]; diff --git a/libav/mpeg.c b/libav/mpeg.c index 2871278778..637972471c 100644 --- a/libav/mpeg.c +++ b/libav/mpeg.c @@ -321,18 +321,21 @@ static void flush_packet(AVFormatContext *ctx, int stream_index) stream->start_pts = -1; } -static int mpeg_mux_write_packet(AVFormatContext *ctx, - int stream_index, UINT8 *buf, int size) +static int mpeg_mux_write_packet(AVFormatContext *ctx, int stream_index, + UINT8 *buf, int size, int force_pts) { MpegMuxContext *s = ctx->priv_data; AVStream *st = ctx->streams[stream_index]; StreamInfo *stream = st->priv_data; int len; - + while (size > 0) { /* set pts */ - if (stream->start_pts == -1) + if (stream->start_pts == -1) { + if (force_pts) + stream->pts = force_pts; stream->start_pts = stream->pts; + } len = s->packet_data_max_size - stream->buffer_ptr; if (len > size) len = size; @@ -714,6 +717,8 @@ static int mpeg_mux_read_packet(AVFormatContext *s, goto redo; found: av_new_packet(pkt, len); + //printf("\nRead Packet ID: %x PTS: %f Size: %d", startcode, + // (float)pts/90000, len); get_buffer(&s->pb, pkt->data, pkt->size); pkt->pts = pts; pkt->stream_index = i; diff --git a/libav/raw.c b/libav/raw.c index 02b56b48ee..d2c2c3486a 100644 --- a/libav/raw.c +++ b/libav/raw.c @@ -26,7 +26,7 @@ int raw_write_header(struct AVFormatContext *s) int raw_write_packet(struct AVFormatContext *s, int stream_index, - unsigned char *buf, int size) + unsigned char *buf, int size, int force_pts) { put_buffer(&s->pb, buf, size); put_flush_packet(&s->pb); diff --git a/libav/rm.c b/libav/rm.c index d987ba30ca..be2f064bad 100644 --- a/libav/rm.c +++ b/libav/rm.c @@ -389,7 +389,7 @@ static int rm_write_video(AVFormatContext *s, UINT8 *buf, int size) } static int rm_write_packet(AVFormatContext *s, int stream_index, - UINT8 *buf, int size) + UINT8 *buf, int size, int force_pts) { if (s->streams[stream_index]->codec.codec_type == CODEC_TYPE_AUDIO) diff --git a/libav/swf.c b/libav/swf.c index ebd4ada886..27755a3969 100644 --- a/libav/swf.c +++ b/libav/swf.c @@ -378,7 +378,7 @@ static int swf_write_audio(AVFormatContext *s, UINT8 *buf, int size) } static int swf_write_packet(AVFormatContext *s, int stream_index, - UINT8 *buf, int size) + UINT8 *buf, int size, int force_pts) { AVCodecContext *codec = &s->streams[stream_index]->codec; if (codec->codec_type == CODEC_TYPE_AUDIO) diff --git a/libav/utils.c b/libav/utils.c index 7315ebdc92..8570be2055 100644 --- a/libav/utils.c +++ b/libav/utils.c @@ -375,10 +375,10 @@ void av_close_input_file(AVFormatContext *s) } -int av_write_packet(AVFormatContext *s, AVPacket *pkt) +int av_write_packet(AVFormatContext *s, AVPacket *pkt, int force_pts) { /* XXX: currently, an emulation because internal API must change */ - return s->format->write_packet(s, pkt->stream_index, pkt->data, pkt->size); + return s->format->write_packet(s, pkt->stream_index, pkt->data, pkt->size, force_pts); } /* "user interface" functions */ diff --git a/libav/wav.c b/libav/wav.c index df18a64ec7..0023ac608a 100644 --- a/libav/wav.c +++ b/libav/wav.c @@ -127,7 +127,7 @@ static int wav_write_header(AVFormatContext *s) } static int wav_write_packet(AVFormatContext *s, int stream_index_ptr, - UINT8 *buf, int size) + UINT8 *buf, int size, int force_pts) { ByteIOContext *pb = &s->pb; put_buffer(pb, buf, size); |