[cvs-annodex] commit (/annodex):
libannodex/trunk/include/annodex/anx_import.h
libannodex/trunk/src/importers/anx_import_anx.c
libannodex/trunk/src/importers/anx_import_cmml.c
libannodex/trunk/src/importers/anx_import_ogg.c
libannodex/trunk/src/importers/anx_import_sndfile.c
libannodex/trunk/src/libannodex/anx_import.c
libannodex/trunk/src/libannodex/anx_write.c
conrad
nobody at lists.annodex.net
Mon Sep 13 08:32:31 EST 2004
Update of /annodex (new revision 567)
Modified files:
libannodex/trunk/include/annodex/anx_import.h
libannodex/trunk/src/importers/anx_import_anx.c
libannodex/trunk/src/importers/anx_import_cmml.c
libannodex/trunk/src/importers/anx_import_ogg.c
libannodex/trunk/src/importers/anx_import_sndfile.c
libannodex/trunk/src/libannodex/anx_import.c
libannodex/trunk/src/libannodex/anx_write.c
Log Message:
more accurate temporal interleaving, and lookahead for ogg/anx importers
Modified: libannodex/trunk/include/annodex/anx_import.h
===================================================================
--- libannodex/trunk/include/annodex/anx_import.h 2004-09-12 10:40:26 UTC (rev 566)
+++ libannodex/trunk/include/annodex/anx_import.h 2004-09-12 22:32:31 UTC (rev 567)
@@ -166,6 +166,7 @@
double start_time;
double end_time;
void * custom_data;
+ double current_time;
};
#ifdef __cplusplus
Modified: libannodex/trunk/src/importers/anx_import_anx.c
===================================================================
--- libannodex/trunk/src/importers/anx_import_anx.c 2004-09-12 10:40:26 UTC (rev 566)
+++ libannodex/trunk/src/importers/anx_import_anx.c 2004-09-12 22:32:31 UTC (rev 567)
@@ -56,6 +56,7 @@
unsigned char * data;
long granulepos;
AnxSourceTrack * media_track;
+ double current_time;
};
struct _AnxAnxTrack {
@@ -264,6 +265,7 @@
aam->length = n;
aam->data = anx_malloc (n);
aam->granulepos = anx_tell (anx);
+ aam->current_time = anx_tell_time (anx);
aam->media_track = media_track;
#if 0
@@ -311,6 +313,7 @@
m->eos = 0;
m->start_time = start_time;
m->end_time = end_time;
+ m->current_time = start_time;
aad = anx_malloc (sizeof (AnxAnxData));
m->custom_data = aad;
@@ -404,8 +407,18 @@
anx_free (aam);
aad->current_offset = 0;
+
+ while ((aad->media_packets == NULL) &&
+ (anx_read (aad->anx_reader, 1024)) > 0);
+
+ if (aad->media_packets != NULL)
+ aam = (AnxAnxSource *)aad->media_packets->data;
}
+ /* Set current time to the current time of the next packet that would
+ * be served */
+ media->current_time = aam->current_time;
+
/* if (anx_eos(aad->anx_reader)) media->eos = 1;*/
return bytes_to_read;
Modified: libannodex/trunk/src/importers/anx_import_cmml.c
===================================================================
--- libannodex/trunk/src/importers/anx_import_cmml.c 2004-09-12 10:40:26 UTC (rev 566)
+++ libannodex/trunk/src/importers/anx_import_cmml.c 2004-09-12 22:32:31 UTC (rev 567)
@@ -334,6 +334,7 @@
m->start_time = 0;
m->end_time = 0;
m->custom_data = NULL;
+ m->current_time = start_time;
return m;
}
Modified: libannodex/trunk/src/importers/anx_import_ogg.c
===================================================================
--- libannodex/trunk/src/importers/anx_import_ogg.c 2004-09-12 10:40:26 UTC (rev 566)
+++ libannodex/trunk/src/importers/anx_import_ogg.c 2004-09-12 22:32:31 UTC (rev 567)
@@ -73,6 +73,7 @@
unsigned char * data;
long granulepos;
AnxSourceTrack * media_track;
+ double current_time;
};
struct _AnxOggData {
@@ -245,6 +246,7 @@
aam->length = op->bytes;
aam->data = anx_malloc (op->bytes);
aam->granulepos = op->granulepos;
+ aam->current_time = ((double)oggz_tell_units (oggz)) / 1000.0;
aam->media_track = track;
#if 0
@@ -290,6 +292,7 @@
m->tracks = NULL;
m->current_track = NULL;
+ m->current_time = start_time;
/* PADDING::: Fix here */
aod = anx_malloc (sizeof (AnxOggData));
@@ -379,6 +382,8 @@
media->current_track->current_granule = aam->granulepos;
#endif
+ media->current_time = aam->current_time;
+
/* If that's finished this media packet, advance to the next one */
if (aod->current_offset >= aam->length) {
aod->media_packets =
@@ -388,8 +393,17 @@
anx_free (aam);
aod->current_offset = 0;
+
+ while ((aod->media_packets == NULL) && (oggz_read (aod->oggz, 1024)) != 0);
+
+ if (aod->media_packets != NULL)
+ aam = (AnxOggMedia *)aod->media_packets->data;
}
+ /* Set current time to the current time of the next packet that would
+ * be served */
+ media->current_time = aam->current_time;
+
return bytes_to_read;
}
Modified: libannodex/trunk/src/importers/anx_import_sndfile.c
===================================================================
--- libannodex/trunk/src/importers/anx_import_sndfile.c 2004-09-12 10:40:26 UTC (rev 566)
+++ libannodex/trunk/src/importers/anx_import_sndfile.c 2004-09-12 22:32:31 UTC (rev 567)
@@ -176,6 +176,7 @@
m->eos = 0;
m->start_time = start_time;
m->end_time = end_time;
+ m->current_time = start_time;
sfd = anx_malloc (sizeof (AnxSndfileData));
m->custom_data = sfd;
@@ -327,6 +328,7 @@
sfd->frame_remaining = sfd->framesperpacket;
track->current_granule += sfd->framesperpacket;
if (track->current_granule >= track->end_granule) track->eos = 1;
+ media->current_time = track->current_granule / sfd->sf_info->samplerate;
}
n = frames_to_read * (sfd->sf_info->channels * sizeof (short));
Modified: libannodex/trunk/src/libannodex/anx_import.c
===================================================================
--- libannodex/trunk/src/libannodex/anx_import.c 2004-09-12 10:40:26 UTC (rev 566)
+++ libannodex/trunk/src/libannodex/anx_import.c 2004-09-12 22:32:31 UTC (rev 567)
@@ -437,11 +437,14 @@
{
if (media == NULL) return -1.0;
+ return media->current_time;
+#if 0
if (anx_media_ensure_current_track (media) == -1) return -1.0;
return ((double)media->current_track->current_granule *
(double)media->current_track->granule_rate_d /
(double)media->current_track->granule_rate_n);
+#endif
}
int
Modified: libannodex/trunk/src/libannodex/anx_write.c
===================================================================
--- libannodex/trunk/src/libannodex/anx_write.c 2004-09-12 10:40:26 UTC (rev 566)
+++ libannodex/trunk/src/libannodex/anx_write.c 2004-09-12 22:32:31 UTC (rev 567)
@@ -374,7 +374,7 @@
long serialno, anx_int64_t granulepos, int bos, int eos,
int flush)
{
- AnxWriter * writer = &annodex->x.writer;
+ /*AnxWriter * writer = &annodex->x.writer;*/
ogg_packet op;
int ret;
@@ -649,7 +649,8 @@
printf ("anx_write: got media [%d] %p time %f %s\n", i++, media,
media_time, anx_media_eos (media) ? "(eos)" : "");
#endif
- if (!anx_media_eos (media) && media_time != -1 && media_time < min_time) {
+ if (!anx_media_eos (media) &&
+ (media_time != -1 && media_time < min_time)) {
soonest_media = media;
min_time = media_time;
}
--
conrad
More information about the cvs-annodex
mailing list