[NUT-devel] [nut]: r183 - in trunk/libnut: muxer.c nut.h
ods15
subversion at mplayerhq.hu
Sat Nov 4 15:03:54 CET 2006
Author: ods15
Date: Sat Nov 4 15:03:54 2006
New Revision: 183
Modified:
trunk/libnut/muxer.c
trunk/libnut/nut.h
Log:
implement nut_write_info() in muxer, though spec is unclear about legality...
Modified: trunk/libnut/muxer.c
==============================================================================
--- trunk/libnut/muxer.c (original)
+++ trunk/libnut/muxer.c Sat Nov 4 15:03:54 2006
@@ -226,7 +226,7 @@
put_header(nut->o, tmp, nut->tmp_buffer2, STREAM_STARTCODE, 0);
}
-static void put_info(nut_context_t * nut, nut_info_packet_t * info) {
+static void put_info(nut_context_t * nut, const nut_info_packet_t * info) {
output_buffer_t * tmp = clear_buffer(nut->tmp_buffer);
int i;
@@ -455,13 +455,9 @@
return size;
}
-void nut_write_frame(nut_context_t * nut, const nut_packet_t * fd, const uint8_t * buf) {
- stream_context_t * sc = &nut->sc[fd->stream];
- output_buffer_t * tmp;
- int i;
-
- if (bctello(nut->o) > (1 << 23)) { // main header repetition
- i = 23; // ### magic value for header repetition
+static void check_header_repetition(nut_context_t * nut) {
+ if (bctello(nut->o) > (1 << 23)) {
+ int i = 23; // ### magic value for header repetition
if (bctello(nut->o) > (1 << 25)) {
for (i = 26; bctello(nut->o) > (1 << i); i++);
i--;
@@ -470,6 +466,14 @@
put_headers(nut);
}
}
+}
+
+void nut_write_frame(nut_context_t * nut, const nut_packet_t * fd, const uint8_t * buf) {
+ stream_context_t * sc = &nut->sc[fd->stream];
+ output_buffer_t * tmp;
+ int i;
+
+ check_header_repetition(nut);
// distance syncpoints
if (nut->last_syncpoint < nut->last_headers ||
bctello(nut->o) - nut->last_syncpoint + fd->len + frame_header(nut, NULL, fd) > nut->max_distance) put_syncpoint(nut);
@@ -500,6 +504,12 @@
else sc->eor = 0;
}
+void nut_write_info(nut_context_t * nut, const nut_info_packet_t * info) {
+ check_header_repetition(nut);
+ nut->last_headers = bctello(nut->o); // to force syncpoint writing after the info header
+ put_info(nut, info);
+}
+
nut_context_t * nut_muxer_init(const nut_muxer_opts_t * mopts, const nut_stream_header_t s[], const nut_info_packet_t info[]) {
nut_context_t * nut;
int i;
Modified: trunk/libnut/nut.h
==============================================================================
--- trunk/libnut/nut.h (original)
+++ trunk/libnut/nut.h Sat Nov 4 15:03:54 2006
@@ -129,6 +129,7 @@
/** nut_write_frame does magic, it writes headers */
void nut_write_frame(nut_context_t * nut, const nut_packet_t * p, const uint8_t * buf);
+/** the use of this function is illegal in non realtime streams!! */
void nut_write_info(nut_context_t * nut, const nut_info_packet_t * info);
/** do the same as the above function, but deal with frame reordering */
More information about the NUT-devel
mailing list