Commit 4a54afa4 authored by conrad's avatar conrad

revert broken commit r3320. That code has been branched into:

http://svn.annodex.net/liboggz/branches/read-skeleton


git-svn-id: http://svn.annodex.net/liboggz/trunk@3322 8158c8cd-e7e1-0310-9fa4-c5954c97daef
parent 56a0d017
......@@ -70,21 +70,8 @@ enum OggzFlags {
/**
* Suffix
*/
OGGZ_SUFFIX = 0x80,
OGGZ_SUFFIX = 0x80
/**
* Construct skeleton packets if none are present in the stream. This
* operates as a filter both on reading existing streams and on writing
* new streams.
*/
OGGZ_CONSTRUCT_SKELETON = 0x100,
/**
* Correct skeleton packets if they are present (but incorrect) in the
* stream. This operates as a filter both on reading existing streams and
* on writing new streams.
*/
OGGZ_CORRECT_SKELETON = 0x200
};
enum OggzStopCtl {
......
......@@ -19,7 +19,6 @@ liboggz_la_SOURCES = \
oggz_table.c \
oggz_vector.c oggz_vector.h \
oggz_dlist.c oggz_dlist.h \
oggz_skeleton.c oggz_skeleton.h \
metric_internal.c
liboggz_la_LDFLAGS = -version-info @SHARED_VERSION_INFO@ @SHLIB_VERSION_ARG@
......
......@@ -82,14 +82,6 @@ oggz_new (int flags)
if (oggz == NULL) return NULL;
oggz->flags = flags;
/** DEBUGGING HACK SGS **/
// oggz->flags |= OGGZ_CONSTRUCT_SKELETON;
/** END DEBUGGING HACK **/
/* need auto-identify to construct skeleton */
if (oggz->flags & OGGZ_CONSTRUCT_SKELETON) {
oggz->flags |= OGGZ_AUTO;
}
oggz->file = NULL;
oggz->io = NULL;
......@@ -109,16 +101,7 @@ oggz_new (int flags)
oggz->order = NULL;
oggz->order_user_data = NULL;
if (oggz->flags & OGGZ_AUTO) {
oggz->packet_buffer = oggz_dlist_new ();
}
if (oggz->flags & OGGZ_CONSTRUCT_SKELETON) {
oggz->bos_buffer = oggz_dlist_new ();
}
oggz->non_bos_encountered = 0;
oggz->skeleton_seen = 0;
oggz->packet_buffer = oggz_dlist_new ();
if (OGGZ_CONFIG_WRITE && (oggz->flags & OGGZ_WRITE)) {
oggz_write_init (oggz);
......@@ -333,19 +316,6 @@ oggz_add_stream (OGGZ * oggz, long serialno)
{
oggz_stream_t * stream;
/*
* if we're trying to construct a skeleton and we have encountered an
* out-of-order bos packet then we can't really continue as we've already
* output the skeleton EOS
*/
if
(
oggz->non_bos_encountered == 1 && (oggz->flags & OGGZ_CONSTRUCT_SKELETON)
)
{
return NULL;
}
stream = oggz_malloc (sizeof (oggz_stream_t));
if (stream == NULL) return NULL;
......
......@@ -230,10 +230,6 @@ struct _OGGZ {
OggzVector * streams;
int all_at_eos; /* all streams are at eos */
int non_bos_encountered; /* a non-bos packet has been seen */
int skeleton_seen;
long skeleton_serialno;
int skeleton_packetno;
OggzMetric metric;
void * metric_user_data;
......@@ -248,7 +244,6 @@ struct _OGGZ {
} x;
OggzDList * packet_buffer;
OggzDList * bos_buffer;
};
OGGZ * oggz_read_init (OGGZ * oggz);
......
......@@ -59,7 +59,6 @@
#include "oggz_compat.h"
#include "oggz_private.h"
#include "oggz_skeleton.h"
/* #define DEBUG */
/* #define DEBUG_VERBOSE */
......@@ -329,31 +328,6 @@ oggz_read_deliver_packet(void *elem) {
return DLIST_ITER_CONTINUE;
}
OggzDListIterResponse
oggz_read_create_fisbone(void *elem) {
OggzBufferedPacket *p = (OggzBufferedPacket *)elem;
int packets;
ogg_packet *op = oggz_skeleton_create_fisbone(p->serialno, p->stream->content,
p->stream->granulerate_n, p->stream->granulerate_d,
p->stream->basegranule, p->stream->granuleshift,
&packets, (p->oggz->skeleton_packetno)++);
if (p->stream->read_packet) {
p->stream->read_packet(p->oggz, op, p->oggz->skeleton_serialno,
p->stream->read_user_data);
} else if (p->reader->read_packet) {
p->reader->read_packet(p->oggz, op, p->oggz->skeleton_serialno,
p->reader->read_user_data);
}
oggz_skeleton_destroy_packet(op);
return DLIST_ITER_CONTINUE;
}
static int
oggz_read_sync (OGGZ * oggz)
{
......@@ -389,13 +363,11 @@ oggz_read_sync (OGGZ * oggz)
if (stream == NULL) {
/* new stream ... check bos etc. */
assert(!"there should be no new streams here!\n");
if ((stream = oggz_add_stream (oggz, serialno)) == NULL) {
/* error -- could not add stream */
return -7;
}
}
os = &stream->ogg_stream;
result = ogg_stream_packetout(os, op);
......@@ -429,7 +401,7 @@ oggz_read_sync (OGGZ * oggz)
granulepos = op->granulepos;
content = oggz_stream_get_content(oggz, serialno);
/*
* if we have no metrics for this stream yet, then generate them
*/
......@@ -470,46 +442,7 @@ oggz_read_sync (OGGZ * oggz)
if (stream->packetno == 1) {
oggz_auto_read_comments (oggz, stream, serialno, op);
}
/*
* don't emit BOS packets until there's a non-BOS packet or
* until a Skeleton BOS has been seen
*/
if (oggz->flags & OGGZ_CONSTRUCT_SKELETON) {
if (content == OGGZ_CONTENT_SKELETON) {
oggz->skeleton_seen = 1;
oggz->skeleton_serialno = serialno;
}
if (!(oggz->non_bos_encountered || oggz->skeleton_seen)) {
OggzBufferedPacket *p = oggz_read_new_pbuffer_entry(
oggz, &packet, reader->current_granulepos,
serialno, stream, reader);
oggz_dlist_append(oggz->bos_buffer, p);
continue;
}
if (!oggz_dlist_is_empty(oggz->bos_buffer)) {
ogg_packet *op = oggz_skeleton_create_bos(0, 1000, 0, 1000);
if (stream->read_packet) {
cb_ret = stream->read_packet (oggz, op, serialno,
stream->read_user_data);
} else if (reader->read_packet) {
cb_ret = reader->read_packet (oggz, op, serialno,
reader->read_user_data);
}
oggz_skeleton_destroy_packet(op);
oggz_dlist_iter(oggz->bos_buffer, oggz_read_deliver_packet);
oggz->skeleton_packetno = 1;
oggz_dlist_iter(oggz->bos_buffer, oggz_read_create_fisbone);
oggz_dlist_delete(oggz->bos_buffer);
oggz->bos_buffer = oggz_dlist_new();
}
}
if (oggz->flags & OGGZ_AUTO) {
/*
......@@ -580,16 +513,13 @@ oggz_read_sync (OGGZ * oggz)
stream = oggz_get_stream (oggz, serialno);
if (stream != NULL) {
oggz->non_bos_encountered = 1;
}
if (stream == NULL) {
/* new stream ... check bos etc. */
if ((stream = oggz_add_stream (oggz, serialno)) == NULL) {
/* error -- could not add stream */
return -7;
}
/* identify stream type */
oggz_auto_identify(oggz, &og, serialno);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment