aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2007-08-10 12:59:17 +0000
committerMichael Niedermayer <michaelni@gmx.at>2007-08-10 12:59:17 +0000
commit14b3f9961f3cf9173c43c936eb0cfb5a35fb8419 (patch)
treed602c781e6377bd589c8a48d3ca222f0eef3b843 /libavformat
parentead1939f69bf2eced51f7ec00967e491973d7994 (diff)
downloadffmpeg-14b3f9961f3cf9173c43c936eb0cfb5a35fb8419.tar.gz
header repetition
Originally committed as revision 10051 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/nut.h1
-rw-r--r--libavformat/nutenc.c11
2 files changed, 10 insertions, 2 deletions
diff --git a/libavformat/nut.h b/libavformat/nut.h
index 0816d4640d..5a154f0164 100644
--- a/libavformat/nut.h
+++ b/libavformat/nut.h
@@ -88,6 +88,7 @@ typedef struct {
unsigned int max_distance;
unsigned int time_base_count;
int64_t last_syncpoint_pos;
+ int header_count;
AVRational *time_base;
struct AVTreeNode *syncpoints;
} NUTContext;
diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c
index 42d861f0d8..dcb2baf7fd 100644
--- a/libavformat/nutenc.c
+++ b/libavformat/nutenc.c
@@ -365,6 +365,9 @@ static void write_headers(NUTContext *nut, ByteIOContext *bc){
url_open_dyn_buf(&dyn_bc);
write_globalinfo(nut, &dyn_bc);
put_packet(nut, bc, &dyn_bc, 1, INFO_STARTCODE);
+
+ nut->last_syncpoint_pos= INT_MIN;
+ nut->header_count++;
}
static int write_header(AVFormatContext *s){
@@ -416,7 +419,7 @@ static int write_header(AVFormatContext *s){
put_flush_packet(bc);
- //FIXME header repeation, index
+ //FIXME index
return 0;
}
@@ -445,6 +448,9 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt){
int key_frame = !!(pkt->flags & PKT_FLAG_KEY);
int store_sp=0;
+ if(1LL<<(20+3*nut->header_count) <= url_ftell(bc))
+ write_headers(nut, bc);
+
if(key_frame && !!(nus->last_flags & FLAG_KEY))
store_sp= 1;
@@ -563,7 +569,8 @@ static int write_trailer(AVFormatContext *s){
NUTContext *nut= s->priv_data;
ByteIOContext *bc= &s->pb;
- write_headers(nut, bc);
+ while(nut->header_count<3)
+ write_headers(nut, bc);
put_flush_packet(bc);
return 0;