[NUT-devel] [nut]: r197 - in trunk/libnut: demuxer.c nut.h
ods15
subversion at mplayerhq.hu
Fri Nov 10 08:29:27 CET 2006
Author: ods15
Date: Fri Nov 10 08:29:26 2006
New Revision: 197
Modified:
trunk/libnut/demuxer.c
trunk/libnut/nut.h
Log:
make demuxer read info packets after main header. API change.
Modified: trunk/libnut/demuxer.c
==============================================================================
--- trunk/libnut/demuxer.c (original)
+++ trunk/libnut/demuxer.c Fri Nov 10 08:29:26 2006
@@ -778,7 +778,7 @@
return err;
}
-int nut_read_headers(nut_context_t * nut, nut_stream_header_t * s []) {
+int nut_read_headers(nut_context_t * nut, nut_stream_header_t * s [], nut_info_packet_t * info []) {
int i, err = 0;
*s = NULL;
if (!nut->seek_status) { // we already have headers, we were called just for index
@@ -830,6 +830,21 @@
nut->sc[i].pts_cache[j] = -1;
}
}
+ if (info) {
+ uint64_t tmp;
+ CHECK(get_bytes(nut->i, 8, &tmp));
+ while (tmp == INFO_STARTCODE) {
+ nut->info_count++;
+ ERROR(SIZE_MAX/sizeof(nut_info_packet_t) < nut->info_count + 1, -ERR_OUT_OF_MEM);
+ nut->info = nut->alloc->realloc(nut->info, sizeof(nut_info_packet_t) * (nut->info_count + 1));
+ ERROR(!nut->info, -ERR_OUT_OF_MEM);
+ memset(&nut->info[nut->info_count - 1], 0, sizeof(nut_info_packet_t));
+ nut->info[nut->info_count].count = -1;
+ CHECK(get_info_header(nut, &nut->info[nut->info_count - 1]));
+ CHECK(get_bytes(nut->i, 8, &tmp));
+ }
+ nut->i->buf_ptr -= 8;
+ }
if (nut->dopts.read_index) {
uint64_t tmp;
CHECK(get_bytes(nut->i, 8, &tmp));
@@ -871,6 +886,7 @@
ERROR(!*s, -ERR_OUT_OF_MEM);
for (i = 0; i < nut->stream_count; i++) (*s)[i] = nut->sc[i].sh;
(*s)[i].type = -1;
+ if (info) *info = nut->info;
err_out:
if (err && err != 2 && !nut->seek_status) {
if (nut->sc) for (i = 0; i < nut->stream_count; i++) {
@@ -1340,8 +1356,10 @@
nut->sc = NULL;
nut->tb = NULL;
+ nut->info = NULL;
nut->last_headers = 0;
nut->stream_count = 0;
+ nut->info_count = 0;
nut->dopts = *dopts;
nut->seek_status = 0;
nut->before_seek = 0;
Modified: trunk/libnut/nut.h
==============================================================================
--- trunk/libnut/nut.h (original)
+++ trunk/libnut/nut.h Fri Nov 10 08:29:26 2006
@@ -179,8 +179,9 @@
/** Read headers, must be called at begginning
@brief "s" is malloced and needs to be free'd.
+ at brief "info" is malloced and needs to be free'd using nut_free_info() for each packet! can be NULL though.
*/
-int nut_read_headers(nut_context_t * nut, nut_stream_header_t * s []);
+int nut_read_headers(nut_context_t * nut, nut_stream_header_t * s [], nut_info_packet_t * info []);
/** Just reads the frame DATA. all it's header has already been
read by nut_read_next_packet. buf must be allocated and big enough.
More information about the NUT-devel
mailing list