[NUT-devel] r59 - trunk/libnut
ods15 at mplayerhq.hu
ods15 at mplayerhq.hu
Sat Feb 11 17:25:50 CET 2006
Author: ods15
Date: 2006-02-11 17:25:50 +0100 (Sat, 11 Feb 2006)
New Revision: 59
Modified:
trunk/libnut/muxer.c
trunk/libnut/priv.h
Log:
More preparing for syncpoint checksum
Modified: trunk/libnut/muxer.c
===================================================================
--- trunk/libnut/muxer.c 2006-02-11 16:11:35 UTC (rev 58)
+++ trunk/libnut/muxer.c 2006-02-11 16:25:50 UTC (rev 59)
@@ -84,6 +84,11 @@
free(bc);
}
+static output_buffer_t * clear_buffer(output_buffer_t * bc) {
+ bc->buf_ptr = bc->buf;
+ return bc;
+}
+
static void put_bytes(output_buffer_t * bc, int count, uint64_t val) {
ready_write_buf(bc, count);
for(count--; count >= 0; count--){
@@ -279,7 +284,7 @@
}
static void put_main_header(nut_context_t * nut) {
- output_buffer_t *tmp = new_mem_buffer();
+ output_buffer_t * tmp = clear_buffer(nut->tmp_buffer);
int i, j, n;
int flag, fields, sflag, timestamp = 0, mul = 1, stream = 0, size, count;
@@ -314,11 +319,10 @@
assert(nut->fti[n].tmp_flag == -1);
put_header(nut->o, tmp, MAIN_STARTCODE, 0);
- free_buffer(tmp);
}
static void put_stream_header(nut_context_t * nut, int id) {
- output_buffer_t * tmp = new_mem_buffer();
+ output_buffer_t * tmp = clear_buffer(nut->tmp_buffer);
stream_context_t * sc = &nut->sc[id];
put_v(tmp, id); // ### is stream_id staying in spec
@@ -348,7 +352,6 @@
}
put_header(nut->o, tmp, STREAM_STARTCODE, 0);
- free_buffer(tmp);
}
static void put_headers(nut_context_t * nut) {
@@ -360,7 +363,7 @@
}
static void put_index(nut_context_t * nut) {
- output_buffer_t * tmp = new_mem_buffer();
+ output_buffer_t * tmp = clear_buffer(nut->tmp_buffer);
syncpoint_list_t * s = &nut->syncpoints;
int i;
uint64_t max_pts = 0;
@@ -417,11 +420,10 @@
}
put_header(nut->o, tmp, INDEX_STARTCODE, 1);
- free_buffer(tmp);
}
void nut_write_info(nut_context_t * nut, const nut_info_packet_t info []) {
- output_buffer_t *tmp = new_mem_buffer();
+ output_buffer_t * tmp = clear_buffer(nut->tmp_buffer);
int i;
for(i = 0; ; i++){
@@ -444,7 +446,6 @@
}
put_header(nut->o, tmp, INFO_STARTCODE, 0);
- free_buffer(tmp);
}
void nut_write_frame(nut_context_t * nut, const nut_packet_t * fd, const uint8_t * buf) {
@@ -479,6 +480,7 @@
// TODO check that all input is valid
nut->o = new_output_buffer(mopts->output);
+ nut->tmp_buffer = new_mem_buffer(); // general purpose buffer
nut->max_distance = 32768; // TODO
nut->fti = ft_default; // TODO
nut->mopts = *mopts;
@@ -567,6 +569,7 @@
free(nut->syncpoints.s);
free(nut->syncpoints.pts);
+ free_buffer(nut->tmp_buffer);
free_buffer(nut->o); // flushes file
fprintf(stderr, "TOTAL: %d bytes data, %d bytes overhead, %.2lf%% overhead\n", total,
(int)ftell(nut->mopts.output.priv) - total, (double)(ftell(nut->mopts.output.priv) - total) / total*100);
Modified: trunk/libnut/priv.h
===================================================================
--- trunk/libnut/priv.h 2006-02-11 16:11:35 UTC (rev 58)
+++ trunk/libnut/priv.h 2006-02-11 16:25:50 UTC (rev 59)
@@ -128,6 +128,7 @@
nut_demuxer_opts_t dopts;
input_buffer_t * i;
output_buffer_t * o;
+ output_buffer_t * tmp_buffer;
int stream_count;
stream_context_t * sc;
More information about the NUT-devel
mailing list