From 494bbf580590133268ed84a6de55dc7d693057fb Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 8 Aug 2006 20:31:19 +0000 Subject: [PATCH] dont be too picky about timestampsbeing wrong if the destination container is without timestamps and raw of the raw video / raw audio sort Originally committed as revision 5961 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavformat/avformat.h | 1 + libavformat/raw.c | 13 ++++++++++++- libavformat/utils.c | 4 ++-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 8fec18deee..a71f98145c 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -122,6 +122,7 @@ typedef struct AVFormatParameters { #define AVFMT_RAWPICTURE 0x0020 /* format wants AVPicture structure for raw picture data */ #define AVFMT_GLOBALHEADER 0x0040 /* format wants global header */ +#define AVFMT_NOTIMESTAMPS 0x0080 /* format doesnt need / has any timestamps */ typedef struct AVOutputFormat { const char *name; diff --git a/libavformat/raw.c b/libavformat/raw.c index 752dbf0931..2edf1cd2d7 100644 --- a/libavformat/raw.c +++ b/libavformat/raw.c @@ -423,6 +423,7 @@ AVOutputFormat flac_muxer = { flac_write_header, raw_write_packet, raw_write_trailer, + .flags= AVFMT_NOTIMESTAMPS, }; #endif //CONFIG_MUXERS @@ -449,6 +450,7 @@ AVOutputFormat ac3_muxer = { raw_write_header, raw_write_packet, raw_write_trailer, + .flags= AVFMT_NOTIMESTAMPS, }; #endif //CONFIG_MUXERS @@ -498,6 +500,7 @@ AVOutputFormat h261_muxer = { raw_write_header, raw_write_packet, raw_write_trailer, + .flags= AVFMT_NOTIMESTAMPS, }; #endif //CONFIG_MUXERS @@ -525,6 +528,7 @@ AVOutputFormat h263_muxer = { raw_write_header, raw_write_packet, raw_write_trailer, + .flags= AVFMT_NOTIMESTAMPS, }; #endif //CONFIG_MUXERS @@ -552,6 +556,7 @@ AVOutputFormat m4v_muxer = { raw_write_header, raw_write_packet, raw_write_trailer, + .flags= AVFMT_NOTIMESTAMPS, }; #endif //CONFIG_MUXERS @@ -579,6 +584,7 @@ AVOutputFormat h264_muxer = { raw_write_header, raw_write_packet, raw_write_trailer, + .flags= AVFMT_NOTIMESTAMPS, }; #endif //CONFIG_MUXERS @@ -605,6 +611,7 @@ AVOutputFormat mpeg1video_muxer = { raw_write_header, raw_write_packet, raw_write_trailer, + .flags= AVFMT_NOTIMESTAMPS, }; #endif //CONFIG_MUXERS @@ -620,6 +627,7 @@ AVOutputFormat mpeg2video_muxer = { raw_write_header, raw_write_packet, raw_write_trailer, + .flags= AVFMT_NOTIMESTAMPS, }; #endif //CONFIG_MUXERS @@ -659,6 +667,7 @@ AVOutputFormat mjpeg_muxer = { raw_write_header, raw_write_packet, raw_write_trailer, + .flags= AVFMT_NOTIMESTAMPS, }; #endif //CONFIG_MUXERS @@ -690,6 +699,7 @@ AVOutputFormat pcm_ ## name ## _muxer = {\ raw_write_header,\ raw_write_packet,\ raw_write_trailer,\ + .flags= AVFMT_NOTIMESTAMPS,\ }; @@ -786,6 +796,7 @@ AVOutputFormat rawvideo_muxer = { raw_write_header, raw_write_packet, raw_write_trailer, + .flags= AVFMT_NOTIMESTAMPS, }; #endif //CONFIG_MUXERS @@ -810,6 +821,6 @@ AVOutputFormat null_muxer = { raw_write_header, null_write_packet, raw_write_trailer, - .flags = AVFMT_NOFILE | AVFMT_RAWPICTURE, + .flags = AVFMT_NOFILE | AVFMT_RAWPICTURE | AVFMT_NOTIMESTAMPS, }; #endif //CONFIG_MUXERS diff --git a/libavformat/utils.c b/libavformat/utils.c index 451706dcc6..5e00bb33dd 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2402,7 +2402,7 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt) int ret; ret=compute_pkt_fields2(s->streams[pkt->stream_index], pkt); - if(ret<0) + if(ret<0 && !(s->oformat->flags & AVFMT_NOTIMESTAMPS)) return ret; truncate_ts(s->streams[pkt->stream_index], pkt); @@ -2509,7 +2509,7 @@ int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt){ return 0; //av_log(NULL, AV_LOG_DEBUG, "av_interleaved_write_frame %d %Ld %Ld\n", pkt->size, pkt->dts, pkt->pts); - if(compute_pkt_fields2(st, pkt) < 0) + if(compute_pkt_fields2(st, pkt) < 0 && !(s->oformat->flags & AVFMT_NOTIMESTAMPS)) return -1; if(pkt->dts == AV_NOPTS_VALUE)