[xiph-cvs] cvs commit: ogg/src buffer.c mutex.h ogginternal.h mutex.c
Monty
xiphmont at xiph.org
Tue Jan 21 00:18:34 PST 2003
xiphmont 03/01/21 03:18:34
Modified: src Tag: libogg2-zerocopy buffer.c mutex.h
ogginternal.h
Removed: src Tag: libogg2-zerocopy mutex.c
Log:
Checkpoint to avoid losing work.
Revision Changes Path
No revision
<p>No revision
<p>1.1.2.2 +2 -2 ogg/src/Attic/buffer.c
Index: buffer.c
===================================================================
RCS file: /usr/local/cvsroot/ogg/src/Attic/buffer.c,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- buffer.c 21 Jan 2003 07:16:46 -0000 1.1.2.1
+++ buffer.c 21 Jan 2003 08:18:34 -0000 1.1.2.2
@@ -11,7 +11,7 @@
********************************************************************
function: centralized fragment buffer management
- last mod: $Id: buffer.c,v 1.1.2.1 2003/01/21 07:16:46 xiphmont Exp $
+ last mod: $Id: buffer.c,v 1.1.2.2 2003/01/21 08:18:34 xiphmont Exp $
********************************************************************/
@@ -19,8 +19,8 @@
#include <stdio.h>
#endif
+#include <stdlib.h>
#include "ogginternal.h"
-#include "mutex.h"
/* basic, centralized Ogg memory management.
@@ -146,7 +146,7 @@
{
ogg_buffer *next=ob->next;
bytes-=ob->used;
- _ogg_buffer_release(ob);
+ _ogg_buffer_release(ob,or->owner);
ob=next;
}
}
<p><p>1.1.2.2 +6 -10 ogg/src/Attic/mutex.h
Index: mutex.h
===================================================================
RCS file: /usr/local/cvsroot/ogg/src/Attic/mutex.h,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- mutex.h 31 Dec 2002 01:18:02 -0000 1.1.2.1
+++ mutex.h 21 Jan 2003 08:18:34 -0000 1.1.2.2
@@ -11,7 +11,7 @@
********************************************************************
function: #ifdef jail for basic thread mutexing
- last mod: $Id: mutex.h,v 1.1.2.1 2002/12/31 01:18:02 xiphmont Exp $
+ last mod: $Id: mutex.h,v 1.1.2.2 2003/01/21 08:18:34 xiphmont Exp $
********************************************************************/
@@ -25,20 +25,17 @@
#ifndef _OGG_MUTEX_H_
#define _OGG_MUTEX_H_
-#include <ogg/ogg.h>
-
#ifdef USE_POSIX_THREADS
#define _REENTRANT 1
#include <pthread.h>
-static typedef ogg_mutex_t pthread_mutex_t;
-#define ogg_mutex_init(m) (pthread_mutex_init(m,NULL))
+typedef pthread_mutex_t ogg_mutex_t;
+#define ogg_mutex_init(m) (pthread_mutex_init((m),NULL))
#define ogg_mutex_clear(m) (pthread_mutex_destroy(m))
#define ogg_mutex_lock(m) (pthread_mutex_lock(m))
#define ogg_mutex_unlock(m) (pthread_mutex_unlock(m))
-#else
-#ifdef USE_NO_THREADS
-static typedef ogg_mutex_t int;
+#elif USE_NO_THREADS
+typedef int ogg_mutex_t;
static void noop(void){return};
#define ogg_mutex_init(m) (noop())
#define ogg_mutex_clear(m) (noop())
@@ -50,5 +47,4 @@
#endif
-
-#endif
+#endif /*_OGG_MUTEX_H_*/
<p><p>1.1.2.2 +53 -36 ogg/src/Attic/ogginternal.h
Index: ogginternal.h
===================================================================
RCS file: /usr/local/cvsroot/ogg/src/Attic/ogginternal.h,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- ogginternal.h 31 Dec 2002 01:18:02 -0000 1.1.2.1
+++ ogginternal.h 21 Jan 2003 08:18:34 -0000 1.1.2.2
@@ -11,66 +11,83 @@
********************************************************************
function: internal/hidden data representation structures
- last mod: $Id: ogginternal.h,v 1.1.2.1 2002/12/31 01:18:02 xiphmont Exp $
+ last mod: $Id: ogginternal.h,v 1.1.2.2 2003/01/21 08:18:34 xiphmont Exp $
********************************************************************/
#ifndef _OGGI_H
#define _OGGI_H
-typedef struct _ogg_sync_state * ogg_sync_state;
-typedef struct _ogg_stream_state * ogg_stream_state;
-typedef struct ogg_lbuffer fragmented_reference;
-
#include <ogg/ogg.h>
+#include "mutex.h"
+
+struct ogg_buffer_state{
+ ogg_buffer *unused_pool;
+ int outstanding;
+ ogg_mutex_t mutex;
+};
typedef struct{
- fragmented_reference *segment;
+ ogg_buffer_reference *segment;
int cursor;
} fragmented_cursor;
-/* an internal type meant to be struct-compatable with fragmented_reference */
-typedef struct fragmented_buffer {
- unsigned char *data;
- int used;
- struct fragmented_buffer *next;
- int size;
-} fragmented_buffer;
+struct ogg_buffer {
+ unsigned char *data;
+ int used;
+ struct ogg_buffer *next;
+ int size;
+ int refcount;
+};
+
+struct oggpack_buffer {
+ int headbit;
+ unsigned char *headptr;
+ long headend;
+
+ /* memory management */
+ ogg_buffer *head;
+ ogg_buffer *tail;
+ ogg_buffer_state *owner; /* centralized mem management; buffer fragment
+ memory is owned and managed by the physical
+ stream abstraction */
+
+ /* render the byte/bit counter API constant time */
+ long length; /* meaningful only in decode */
+ long count; /* doesn't count the tail */
+
+};
typedef struct ogg_packet_chain {
- fragmented_reference *packet;
- long bytes;
+ ogg_buffer_reference packet;
ogg_int64_t granulepos;
struct ogg_packet_chain *next;
} ogg_packet_chain;
-
-typedef struct {
+struct ogg_sync_state {
/* stream buffers */
- fragmented_buffer *unused_fifo;
- fragmented_buffer *fifo_head;
- fragmented_buffer *fifo_tail;
- fragmented_buffer *fifo_returned;
- int fifo_returned_pos;
- int fifo_fill;
+ ogg_buffer *unused_fifo;
+ ogg_buffer *fifo_head;
+ ogg_buffer *fifo_tail;
+ ogg_buffer *fifo_returned;
+ int fifo_returned_pos;
+ int fifo_fill;
/* stream sync management */
- int unsynced;
- int headerbytes;
- int bodybytes;
-
- /* page/packet tracking and management */
- ogg_packet_chain *unused_packet; /* contain allocated ->data
- storage */
- struct _ogg_stream_state *stream_list;
+ int unsynced;
+ int headerbytes;
+ int bodybytes;
-} _ogg_sync_state;
+};
-typedef struct ogg_stream_state {
+struct ogg_stream_state {
+ ogg_packet_chain *unused;
ogg_packet_chain *head;
ogg_packet_chain *tail;
+
+
long body_len;
unsigned char *header; /* working space for header encode */
@@ -90,9 +107,9 @@
layer) also knows about the gap */
/* for sync memory management use */
- struct _ogg_sync_state *sync;
- struct _ogg_stream_state *next;
+ struct ogg_sync_state *sync;
+ struct ogg_stream_state *next;
-} _ogg_stream_state;
+};
#endif
<p><p>--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list