diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2005-11-13 03:32:12 +0000 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2005-11-13 03:32:12 +0000 |
commit | a2a2668d57b08d60354bf5665570a79b2e5e20c5 (patch) | |
tree | b59e9c4970017d5e7b23572f485735153d593c19 /libavformat/avienc.c | |
parent | 6b0bdc754b2197d027c26589ed63a41ad19f87eb (diff) | |
download | ffmpeg-a2a2668d57b08d60354bf5665570a79b2e5e20c5.tar.gz |
Support for streaming: dont write indexes and dont signal HAS_INDEX in header. Also set filesize to max in this case.
Originally committed as revision 4698 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/avienc.c')
-rw-r--r-- | libavformat/avienc.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/libavformat/avienc.c b/libavformat/avienc.c index 80c705bc5c..ac3b0be069 100644 --- a/libavformat/avienc.c +++ b/libavformat/avienc.c @@ -357,7 +357,10 @@ static int avi_write_header(AVFormatContext *s) } put_le32(pb, bitrate / 8); /* XXX: not quite exact */ put_le32(pb, 0); /* padding */ - put_le32(pb, AVIF_TRUSTCKTYPE | AVIF_HASINDEX | AVIF_ISINTERLEAVED); /* flags */ + if (url_is_streamed(pb)) + put_le32(pb, AVIF_TRUSTCKTYPE | AVIF_ISINTERLEAVED); /* flags */ + else + put_le32(pb, AVIF_TRUSTCKTYPE | AVIF_HASINDEX | AVIF_ISINTERLEAVED); /* flags */ avi->frames_hdr_all = url_ftell(pb); /* remember this offset to fill later */ put_le32(pb, nb_frames); /* nb frames, filled later */ put_le32(pb, 0); /* initial frame */ @@ -412,7 +415,10 @@ static int avi_write_header(AVFormatContext *s) put_le32(pb, 0); /* start */ avi->frames_hdr_strm[i] = url_ftell(pb); /* remember this offset to fill later */ - put_le32(pb, 0); /* length, XXX: filled later */ + if (url_is_streamed(pb)) + put_le32(pb, AVI_MAX_RIFF_SIZE); /* FIXME: this may be broken, but who cares */ + else + put_le32(pb, 0); /* length, XXX: filled later */ /* suggested buffer size */ //FIXME set at the end to largest chunk if(stream->codec_type == CODEC_TYPE_VIDEO) @@ -502,6 +508,9 @@ static int avi_write_ix(AVFormatContext *s) unsigned char ix_tag[] = "ix00"; int i, j; + if (url_is_streamed(pb)) + return -1; + if (avi->riff_id > AVI_MASTER_INDEX_SIZE) return -1; @@ -638,7 +647,10 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt) } avi->packet_count[stream_index]++; - if (url_ftell(pb) - avi->riff_start > AVI_MAX_RIFF_SIZE) { + // Make sure to put an OpenDML chunk when the file size exceeds the limits + if (!url_is_streamed(pb) && + (url_ftell(pb) - avi->riff_start > AVI_MAX_RIFF_SIZE)) { + avi_write_ix(s); end_tag(pb, avi->movi_list); @@ -694,6 +706,8 @@ static int avi_write_trailer(AVFormatContext *s) int i, j, n, nb_frames; offset_t file_size; + if (!url_is_streamed(pb)) + { if (avi->riff_id == 1) { end_tag(pb, avi->movi_list); res = avi_write_idx1(s); @@ -722,6 +736,7 @@ static int avi_write_trailer(AVFormatContext *s) put_le32(pb, nb_frames); url_fseek(pb, file_size, SEEK_SET); } + } put_flush_packet(pb); for (i=0; i<MAX_STREAMS; i++) { |