Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Xiph.Org
liboggz
Commits
7e8bc47d
Commit
7e8bc47d
authored
Dec 18, 2003
by
conrad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated to 0.8.0
git-svn-id:
http://svn.annodex.net/liboggz/trunk@346
8158c8cd-e7e1-0310-9fa4-c5954c97daef
parent
8bb668dc
Changes
21
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
1270 additions
and
420 deletions
+1270
-420
NEWS
NEWS
+0
-1
README
README
+0
-2
configure.ac
configure.ac
+31
-8
doc/Doxyfile.in
doc/Doxyfile.in
+1
-1
doc/Makefile.am
doc/Makefile.am
+44
-4
include/oggz/Makefile.am
include/oggz/Makefile.am
+1
-1
include/oggz/oggz.h
include/oggz/oggz.h
+415
-77
include/oggz/oggz_constants.h
include/oggz/oggz_constants.h
+18
-1
src/examples/Makefile.am
src/examples/Makefile.am
+12
-1
src/examples/identity.c
src/examples/identity.c
+29
-1
src/examples/read-file.c
src/examples/read-file.c
+1
-1
src/liboggz/Makefile.am
src/liboggz/Makefile.am
+3
-2
src/liboggz/Version_script.in
src/liboggz/Version_script.in
+10
-2
src/liboggz/oggz.c
src/liboggz/oggz.c
+31
-27
src/liboggz/oggz_private.h
src/liboggz/oggz_private.h
+11
-16
src/liboggz/oggz_read.c
src/liboggz/oggz_read.c
+76
-176
src/liboggz/oggz_vector.c
src/liboggz/oggz_vector.c
+176
-23
src/liboggz/oggz_vector.h
src/liboggz/oggz_vector.h
+32
-13
src/liboggz/oggz_write.c
src/liboggz/oggz_write.c
+35
-11
src/tools/Makefile.am
src/tools/Makefile.am
+4
-0
src/tools/oggzdump.c
src/tools/oggzdump.c
+340
-52
No files found.
NEWS
View file @
7e8bc47d
README
View file @
7e8bc47d
configure.ac
View file @
7e8bc47d
...
@@ -3,24 +3,39 @@ AC_INIT
...
@@ -3,24 +3,39 @@ AC_INIT
AC_CONFIG_SRCDIR([src/liboggz/oggz.c])
AC_CONFIG_SRCDIR([src/liboggz/oggz.c])
AC_PREREQ(2.53)
AC_PREREQ(2.53)
AC_CONFIG_AUX_DIR(autotools)
AC_CANONICAL_TARGET
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE(liboggz, 0.
5.43
)
AM_INIT_AUTOMAKE(liboggz, 0.
8.0
)
AM_CONFIG_HEADER(config.h)
AM_CONFIG_HEADER(config.h)
SHARED_VERSION_INFO="
0:5
:0"
SHARED_VERSION_INFO="
1:0
:0"
SHLIB_VERSION_ARG=""
SHLIB_VERSION_ARG=""
# Checks for programs.
# Checks for programs.
AC_PROG_CC
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_MAKE_SET
AC_PROG_LIBTOOL
AC_PROG_LIBTOOL
AC_PROG_RANLIB
AC_C_CONST
AC_C_CONST
AC_C_BIGENDIAN
AC_C_BIGENDIAN
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([fcntl.h inttypes.h stdlib.h string.h unistd.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
# Checks for library functions.
AC_FUNC_REALLOC
AC_CHECK_FUNCS([memmove])
# Check for doxygen
# Check for doxygen
AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, true, false)
AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, true, false)
...
@@ -30,15 +45,15 @@ if test $HAVE_DOXYGEN = "false"; then
...
@@ -30,15 +45,15 @@ if test $HAVE_DOXYGEN = "false"; then
fi
fi
# Check for docbook
# Check for docbook
AC_CHECK_PROG(HAVE_DOCBOOK, docbook
2
man, true, false)
AC_CHECK_PROG(HAVE_DOCBOOK
TOMAN
, docbook
-to-
man, true, false)
AM_CONDITIONAL(HAVE_DOCBOOK,$HAVE_DOCBOOK)
AM_CONDITIONAL(HAVE_DOCBOOK
TOMAN
,$HAVE_DOCBOOK
TOMAN
)
AC_CHECK_PROG(HAVE_DOCBOOK2HTML, docbook2html, true, false)
dnl Check for types
AM_CONDITIONAL(HAVE_DOCBOOK2HTML,$HAVE_DOCBOOK2HTML)
dnl Checks for libraries.
dnl Checks for libraries.
LIBS=""
LIBS=""
# check for getopt in
standard
library
# check for getopt in
a separate
library
HAVE_GETOPT=no
HAVE_GETOPT=no
AC_CHECK_LIB(getopt, getopt, HAVE_GETOPT="yes")
AC_CHECK_LIB(getopt, getopt, HAVE_GETOPT="yes")
if test "x$HAVE_GETOPT" = xyes ; then
if test "x$HAVE_GETOPT" = xyes ; then
...
@@ -46,6 +61,13 @@ if test "x$HAVE_GETOPT" = xyes ; then
...
@@ -46,6 +61,13 @@ if test "x$HAVE_GETOPT" = xyes ; then
AC_SUBST(GETOPT_LIBS)
AC_SUBST(GETOPT_LIBS)
fi
fi
# check for getopt_long in standard library
HAVE_GETOPT_LONG=no
AC_CHECK_FUNC(getopt_long, HAVE_GETOPT_LONG="yes")
if test "x$HAVE_GETOPT_LONG" = xyes ; then
AC_DEFINE(HAVE_GETOPT_LONG, [], [Define to 1 if you have the 'getopt_long' function])
fi
dnl Overall configuration success flag
dnl Overall configuration success flag
oggz_config_ok=yes
oggz_config_ok=yes
...
@@ -211,6 +233,7 @@ src/Makefile
...
@@ -211,6 +233,7 @@ src/Makefile
src/liboggz/Version_script
src/liboggz/Version_script
src/liboggz/Makefile
src/liboggz/Makefile
src/tools/Makefile
src/tools/Makefile
src/tools/oggzdiff
src/tests/Makefile
src/tests/Makefile
src/examples/Makefile
src/examples/Makefile
oggz.pc
oggz.pc
...
...
doc/Doxyfile.in
View file @
7e8bc47d
...
@@ -419,7 +419,7 @@ EXAMPLE_RECURSIVE = NO
...
@@ -419,7 +419,7 @@ EXAMPLE_RECURSIVE = NO
# directories that contain image that are included in the documentation (see
# directories that contain image that are included in the documentation (see
# the \image command).
# the \image command).
IMAGE_PATH =
IMAGE_PATH =
.
# The INPUT_FILTER tag can be used to specify a program that doxygen should
# The INPUT_FILTER tag can be used to specify a program that doxygen should
# invoke to filter for each input file. Doxygen will invoke the filter program
# invoke to filter for each input file. Doxygen will invoke the filter program
...
...
doc/Makefile.am
View file @
7e8bc47d
docdir
=
$(prefix)
/share/doc/@PACKAGE@
docdir
=
$(prefix)
/share/doc/@PACKAGE@
EXTRA_DIST
=
Doxyfile.in liboggz
EXTRA_DIST
=
Doxyfile.in
\
forcefeed.fig forcefeed.eps forcefeed.png
\
hungry.fig hungry.eps hungry.png
\
oggzdump.1.sgml oggzdiff.1.sgml
\
oggzdump.1 oggzdiff.1
all
:
doxygen-build.stamp
man_MANS
=
oggzdump.1 oggzdiff.1
doc_DATA
=
doxygen-build.stamp
html
:
oggzdump.1.html
if
HAVE_DOCBOOKTOMAN
%.1
:
%.1.sgml
docbook-to-man
$<
>
$@
else
%.1
:
%.1.sgml
endif
if
HAVE_DOCBOOK2HTML
%.1.html
:
%.1.sgml
-
docbook2html
$<
mv
index.html
$@
endif
if
HAVE_DOXYGEN
if
HAVE_DOXYGEN
doxygen-build.stamp
:
Doxyfile $(top_srcdir)/include/oggz/*.h
doxygen-build.stamp
:
Doxyfile $(top_srcdir)/include/oggz/*.h
$(top_srcdir)/src/examples/*.c
doxygen
doxygen
touch
doxygen-build.stamp
touch
doxygen-build.stamp
else
else
...
@@ -14,6 +35,23 @@ doxygen-build.stamp:
...
@@ -14,6 +35,23 @@ doxygen-build.stamp:
touch
doxygen-build.stamp
touch
doxygen-build.stamp
endif
endif
dist_docdir
=
$(distdir)
/liboggz
dist-hook
:
if
test
-d
liboggz
;
then
\
mkdir
$(dist_docdir)
;
\
for
dir
in
liboggz/
*
;
do
\
if
test
-d
$$
dir
;
then
\
b
=
`
basename
$$
dir
`
;
\
mkdir
$(dist_docdir)
/
$$
b
;
\
for
f
in
$$
dir
/
*
;
do
\
cp
-p
$$
f
$(dist_docdir)
/
$$
b
;
\
done
\
fi
\
done
\
fi
install-data-local
:
doxygen-build.stamp
install-data-local
:
doxygen-build.stamp
$(mkinstalldirs)
$(docdir)
$(mkinstalldirs)
$(docdir)
if
test
-d
liboggz
;
then
\
if
test
-d
liboggz
;
then
\
...
@@ -21,7 +59,9 @@ install-data-local: doxygen-build.stamp
...
@@ -21,7 +59,9 @@ install-data-local: doxygen-build.stamp
if
test
-d
$$
dir
;
then
\
if
test
-d
$$
dir
;
then
\
b
=
`
basename
$$
dir
`
;
\
b
=
`
basename
$$
dir
`
;
\
$(mkinstalldirs)
$(docdir)
/
$$
b
;
\
$(mkinstalldirs)
$(docdir)
/
$$
b
;
\
(
cd
$$
dir
&&
$(INSTALL_DATA)
*
$(docdir)
/
$$
b
)
\
for
f
in
$$
dir
/
*
;
do
\
$(INSTALL_DATA)
$$
f
$(docdir)
/
$$
b
;
\
done
\
fi
\
fi
\
done
\
done
\
fi
fi
...
...
include/oggz/Makefile.am
View file @
7e8bc47d
...
@@ -2,5 +2,5 @@
...
@@ -2,5 +2,5 @@
# Include files to install
# Include files to install
includedir
=
$(prefix)
/include/oggz
includedir
=
$(prefix)
/include/oggz
include_HEADERS
=
oggz.h oggz_constants.h
include_HEADERS
=
oggz.h oggz_constants.h
oggz_table.h
include/oggz/oggz.h
View file @
7e8bc47d
This diff is collapsed.
Click to expand it.
include/oggz/oggz_constants.h
View file @
7e8bc47d
...
@@ -39,6 +39,9 @@
...
@@ -39,6 +39,9 @@
/**
/**
* Flags to oggz_new(), oggz_open(), and oggz_openfd().
* Flags to oggz_new(), oggz_open(), and oggz_openfd().
* Can be or'ed together in the following combinations:
* - OGGZ_READ | OGGZ_AUTO
* - OGGZ_WRITE | OGGZ_NONSTRICT
*/
*/
enum
OggzFlags
{
enum
OggzFlags
{
/** Read only */
/** Read only */
...
@@ -49,7 +52,15 @@ enum OggzFlags {
...
@@ -49,7 +52,15 @@ enum OggzFlags {
/** Disable strict adherence to mapping constraints, eg for
/** Disable strict adherence to mapping constraints, eg for
* handling an incomplete stream */
* handling an incomplete stream */
OGGZ_NONSTRICT
=
0x10
OGGZ_NONSTRICT
=
0x10
,
/**
* Scan for known headers while reading, and automatically set
* metrics appropriately. Opening a file for reading with
* \a flags = OGGZ_READ | OGGZ_AUTO will allow seeking on Speex,
* Vorbis, Theora and all Annodex streams in units of milliseconds,
* once all bos pages have been delivered. */
OGGZ_AUTO
=
0x20
};
};
/**
/**
...
@@ -88,12 +99,18 @@ enum OggzError {
...
@@ -88,12 +99,18 @@ enum OggzError {
/** Operation is inappropriate for oggz in current eos state */
/** Operation is inappropriate for oggz in current eos state */
OGGZ_ERR_EOS
=
-
6
,
OGGZ_ERR_EOS
=
-
6
,
/** Operation requires a valid metric, but none has been set */
OGGZ_ERR_BAD_METRIC
=
-
7
,
/** System specific error; check errno for details */
/** System specific error; check errno for details */
OGGZ_ERR_SYSTEM
=
-
10
,
OGGZ_ERR_SYSTEM
=
-
10
,
/** Functionality disabled at build time */
/** Functionality disabled at build time */
OGGZ_ERR_DISABLED
=
-
11
,
OGGZ_ERR_DISABLED
=
-
11
,
/** Seeking operation is not possible for this OGGZ */
OGGZ_ERR_NOSEEK
=
-
13
,
/** The requested serialno does not exist in this OGGZ */
/** The requested serialno does not exist in this OGGZ */
OGGZ_ERR_BAD_SERIALNO
=
-
20
,
OGGZ_ERR_BAD_SERIALNO
=
-
20
,
...
...
src/examples/Makefile.am
View file @
7e8bc47d
...
@@ -17,11 +17,22 @@ if OGGZ_CONFIG_READ
...
@@ -17,11 +17,22 @@ if OGGZ_CONFIG_READ
oggz_read_programs
=
read-file
oggz_read_programs
=
read-file
endif
endif
if
OGGZ_CONFIG_WRITE
oggz_write_programs
=
write-feed write-hungry
endif
# Programs to build
# Programs to build
noinst_PROGRAMS
=
$(oggz_rw_programs)
$(oggz_read_programs)
noinst_PROGRAMS
=
$(oggz_rw_programs)
$(oggz_read_programs)
\
$(oggz_write_programs)
identity_SOURCES
=
identity.c
identity_SOURCES
=
identity.c
identity_LDADD
=
$(OGGZ_LIBS)
identity_LDADD
=
$(OGGZ_LIBS)
read_file_SOURCES
=
read-file.c
read_file_SOURCES
=
read-file.c
read_file_LDADD
=
$(OGGZ_LIBS)
read_file_LDADD
=
$(OGGZ_LIBS)
write_feed_SOURCES
=
write-feed.c
write_feed_LDADD
=
$(OGGZ_LIBS)
write_hungry_SOURCES
=
write-hungry.c
write_hungry_LDADD
=
$(OGGZ_LIBS)
\ No newline at end of file
src/examples/identity.c
View file @
7e8bc47d
...
@@ -34,7 +34,8 @@
...
@@ -34,7 +34,8 @@
#include <stdlib.h>
#include <stdlib.h>
#include <oggz/oggz.h>
#include <oggz/oggz.h>
static
int
packetno
=
0
;
#define ID_WRITE_DIRECT
static
int
flush_next
=
0
;
static
int
flush_next
=
0
;
static
int
static
int
...
@@ -44,12 +45,20 @@ read_packet (OGGZ * oggz, ogg_packet * op, long serialno, void * user_data)
...
@@ -44,12 +45,20 @@ read_packet (OGGZ * oggz, ogg_packet * op, long serialno, void * user_data)
int
flush
;
int
flush
;
int
ret
;
int
ret
;
#if 0
flush = flush_next;
flush = flush_next;
if (op->granulepos == -1) {
if (op->granulepos == -1) {
flush_next = 0;
flush_next = 0;
} else {
} else {
flush_next = OGGZ_FLUSH_BEFORE;
flush_next = OGGZ_FLUSH_BEFORE;
}
}
#else
if
(
op
->
granulepos
==
-
1
)
{
flush
=
0
;
}
else
{
flush
=
OGGZ_FLUSH_AFTER
;
}
#endif
if
((
ret
=
oggz_write_feed
(
writer
,
op
,
serialno
,
flush
,
NULL
))
!=
0
)
{
if
((
ret
=
oggz_write_feed
(
writer
,
op
,
serialno
,
flush
,
NULL
))
!=
0
)
{
printf
(
"oggz_write_feed: %d
\n
"
,
ret
);
printf
(
"oggz_write_feed: %d
\n
"
,
ret
);
...
@@ -63,6 +72,8 @@ main (int argc, char ** argv)
...
@@ -63,6 +72,8 @@ main (int argc, char ** argv)
{
{
char
*
infilename
,
*
outfilename
;
char
*
infilename
,
*
outfilename
;
OGGZ
*
reader
,
*
writer
;
OGGZ
*
reader
,
*
writer
;
FILE
*
outfile
;
unsigned
char
buf
[
1024
];
long
n
;
long
n
;
if
(
argc
<
3
)
{
if
(
argc
<
3
)
{
...
@@ -77,17 +88,34 @@ main (int argc, char ** argv)
...
@@ -77,17 +88,34 @@ main (int argc, char ** argv)
exit
(
1
);
exit
(
1
);
}
}
#ifdef ID_WRITE_DIRECT
if
((
writer
=
oggz_open
(
outfilename
,
OGGZ_WRITE
))
==
NULL
)
{
if
((
writer
=
oggz_open
(
outfilename
,
OGGZ_WRITE
))
==
NULL
)
{
printf
(
"unable to open file %s
\n
"
,
outfilename
);
printf
(
"unable to open file %s
\n
"
,
outfilename
);
exit
(
1
);
exit
(
1
);
}
}
#else
if
((
writer
=
oggz_new
(
OGGZ_WRITE
))
==
NULL
)
{
printf
(
"Unable to create new writer
\n
"
);
}
outfile
=
fopen
(
outfilename
,
"w"
);
#endif
oggz_set_read_callback
(
reader
,
-
1
,
read_packet
,
writer
);
oggz_set_read_callback
(
reader
,
-
1
,
read_packet
,
writer
);
while
((
n
=
oggz_read
(
reader
,
1024
))
>
0
)
{
while
((
n
=
oggz_read
(
reader
,
1024
))
>
0
)
{
#ifdef ID_WRITE_DIRECT
while
(
oggz_write
(
writer
,
n
)
>
0
);
while
(
oggz_write
(
writer
,
n
)
>
0
);
#else
while
(
oggz_write_output
(
writer
,
buf
,
n
)
>
0
)
{
fwrite
(
buf
,
1
,
n
,
outfile
);
}
#endif
}
}
#ifndef ID_WRITE_DIRECT
fclose
(
outfile
);
#endif
oggz_close
(
writer
);
oggz_close
(
writer
);
oggz_close
(
reader
);
oggz_close
(
reader
);
...
...
src/examples/read-file.c
View file @
7e8bc47d
...
@@ -68,7 +68,7 @@ main (int argc, char ** argv)
...
@@ -68,7 +68,7 @@ main (int argc, char ** argv)
printf
(
"usage: %s filename
\n
"
,
argv
[
0
]);
printf
(
"usage: %s filename
\n
"
,
argv
[
0
]);
}
}
if
((
oggz
=
oggz_open
((
char
*
)
argv
[
1
],
OGGZ_READ
))
==
NULL
)
{
if
((
oggz
=
oggz_open
((
char
*
)
argv
[
1
],
OGGZ_READ
|
OGGZ_AUTO
))
==
NULL
)
{
printf
(
"unable to open file %s
\n
"
,
argv
[
1
]);
printf
(
"unable to open file %s
\n
"
,
argv
[
1
]);
exit
(
1
);
exit
(
1
);
}
}
...
...
src/liboggz/Makefile.am
View file @
7e8bc47d
...
@@ -11,9 +11,10 @@ lib_LTLIBRARIES = liboggz.la
...
@@ -11,9 +11,10 @@ lib_LTLIBRARIES = liboggz.la
liboggz_la_SOURCES
=
\
liboggz_la_SOURCES
=
\
oggz.c
\
oggz.c
\
oggz_private.h
\
oggz_private.h
oggz_byteorder.h oggz_macros.h
\
oggz_read.c oggz_write.c
\
oggz_read.c oggz_write.c
\
oggz_auto.c oggz_auto.h
\
oggz_table.c
\
oggz_vector.c oggz_vector.h
oggz_vector.c oggz_vector.h
liboggz_la_LDFLAGS
=
-version-info
@SHARED_VERSION_INFO@ @SHLIB_VERSION_ARG@
liboggz_la_LDFLAGS
=
-version-info
@SHARED_VERSION_INFO@ @SHLIB_VERSION_ARG@
src/liboggz/Version_script.in
View file @
7e8bc47d
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
global:
global:
oggz_new;
oggz_new;
oggz_open;
oggz_open;
oggz_open
fd
;
oggz_open
_stdio
;
oggz_flush;
oggz_flush;
oggz_close;
oggz_close;
oggz_get_bos;
oggz_get_bos;
...
@@ -24,11 +24,19 @@
...
@@ -24,11 +24,19 @@
oggz_write_output;
oggz_write_output;
oggz_write_get_next_page_size;
oggz_write_get_next_page_size;
oggz_set_metric;
oggz_set_metric;
oggz_set_metric_linear;
oggz_seek_units;
oggz_seek_units;
oggz_tell;
oggz_tell;
oggz_seek;
oggz_seek;
oggz_data_
begins_here
;
oggz_
set_
data_
start
;
oggz_serialno_new;
oggz_serialno_new;
oggz_table_new;
oggz_table_delete;
oggz_table_insert;
oggz_table_lookup;
oggz_table_size;
oggz_table_nth;
local:
local:
*;
*;
};
};
src/liboggz/oggz.c
View file @
7e8bc47d
...
@@ -46,6 +46,7 @@
...
@@ -46,6 +46,7 @@
#include <ogg/ogg.h>
#include <ogg/ogg.h>
#include "oggz_private.h"
#include "oggz_private.h"
#include "oggz_vector.h"
/*#define DEBUG*/
/*#define DEBUG*/
...
@@ -72,12 +73,12 @@ oggz_new (int flags)
...
@@ -72,12 +73,12 @@ oggz_new (int flags)
if
(
oggz
==
NULL
)
return
NULL
;
if
(
oggz
==
NULL
)
return
NULL
;
oggz
->
flags
=
flags
;
oggz
->
flags
=
flags
;
oggz
->
f
d
=
-
1
;
oggz
->
f
ile
=
NULL
;
oggz
->
offset
=
0
;
oggz
->
offset
=
0
;
oggz
->
offset_data_begin
=
0
;
oggz
->
offset_data_begin
=
0
;
oggz
_vector_init
(
&
oggz
->
streams
,
sizeof
(
oggz_stream_t
)
);
oggz
->
streams
=
oggz_vector_new
(
);
oggz
->
all_at_eos
=
0
;
oggz
->
all_at_eos
=
0
;
oggz
->
metric
=
NULL
;
oggz
->
metric
=
NULL
;
...
@@ -100,32 +101,32 @@ OGGZ *
...
@@ -100,32 +101,32 @@ OGGZ *
oggz_open
(
char
*
filename
,
int
flags
)
oggz_open
(
char
*
filename
,
int
flags
)
{
{
OGGZ
*
oggz
=
NULL
;
OGGZ
*
oggz
=
NULL
;
int
fd
=
-
1
;
FILE
*
file
=
NULL
;
if
(
oggz_flags_disabled
(
flags
))
return
NULL
;
if
(
oggz_flags_disabled
(
flags
))
return
NULL
;
if
(
flags
&
OGGZ_WRITE
)
{
if
(
flags
&
OGGZ_WRITE
)
{
f
d
=
open
(
filename
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
,
S_IRUSR
|
S_IWUSR
);
f
ile
=
f
open
(
filename
,
"w"
);
}
else
{
}
else
{
f
d
=
open
(
filename
,
O_RDONLY
);
f
ile
=
f
open
(
filename
,
"r"
);
}
}
if
(
f
d
==
-
1
)
return
NULL
;
if
(
f
ile
==
NULL
)
return
NULL
;
oggz
=
oggz_new
(
flags
);
oggz
=
oggz_new
(
flags
);
oggz
->
f
d
=
f
d
;
oggz
->
f
ile
=
f
ile
;
return
oggz
;
return
oggz
;
}
}
OGGZ
*
OGGZ
*
oggz_open
fd
(
int
fd
,
int
flags
)
oggz_open
_stdio
(
FILE
*
file
,
int
flags
)
{
{
OGGZ
*
oggz
=
NULL
;
OGGZ
*
oggz
=
NULL
;
if
(
oggz_flags_disabled
(
flags
))
return
NULL
;
if
(
oggz_flags_disabled
(
flags
))
return
NULL
;
oggz
=
oggz_new
(
flags
);
oggz
=
oggz_new
(
flags
);
oggz
->
f
d
=
f
d
;
oggz
->
f
ile
=
f
ile
;
return
oggz
;
return
oggz
;
}
}
...
@@ -135,9 +136,9 @@ oggz_flush (OGGZ * oggz)
...
@@ -135,9 +136,9 @@ oggz_flush (OGGZ * oggz)
{
{
if
(
oggz
==
NULL
)
return
OGGZ_ERR_BAD_OGGZ
;
if
(
oggz
==
NULL
)
return
OGGZ_ERR_BAD_OGGZ
;
if
(
oggz
->
f
d
==
-
1
)
return
OGGZ_ERR_INVALID
;
if
(
oggz
->
f
ile
==
NULL
)
return
OGGZ_ERR_INVALID
;
if
(
f
sync
(
oggz
->
f
d
)
==
-
1
)
{
if
(
f
flush
(
oggz
->
f
ile
)
==
EOF
)
{
return
OGGZ_ERR_SYSTEM
;
return
OGGZ_ERR_SYSTEM
;
}
}
...
@@ -163,8 +164,8 @@ oggz_close (OGGZ * oggz)
...
@@ -163,8 +164,8 @@ oggz_close (OGGZ * oggz)
{
{
if
(
oggz
==
NULL
)
return
OGGZ_ERR_BAD_OGGZ
;
if
(
oggz
==
NULL
)
return
OGGZ_ERR_BAD_OGGZ
;
oggz_vector_foreach
(
&
oggz
->
streams
,
oggz_stream_clear
);
oggz_vector_foreach
(
oggz
->
streams
,
oggz_stream_clear
);
oggz_vector_
clear
(
&
oggz
->
streams
);
oggz_vector_
delete
(
oggz
->
streams
);