kopia lustrzana https://github.com/F5OEO/tstools
Attempt to make the Python binding work again...
rodzic
a65fa00879
commit
753e21ecc3
6
Makefile
6
Makefile
|
@ -80,7 +80,7 @@ ifeq ($(shell uname -s), Darwin)
|
||||||
#ARCH_FLAGS = -arch ppc -arch i386
|
#ARCH_FLAGS = -arch ppc -arch i386
|
||||||
else
|
else
|
||||||
SYSTEM = "other"
|
SYSTEM = "other"
|
||||||
ARCH_FLAGS =
|
ARCH_FLAGS = -fPIC
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CFLAGS = $(WARNING_FLAGS) $(OPTIMISE_FLAGS) $(LFS_FLAGS) -I. $(PROFILE_FLAGS) $(ARCH_FLAGS)
|
CFLAGS = $(WARNING_FLAGS) $(OPTIMISE_FLAGS) $(LFS_FLAGS) -I. $(PROFILE_FLAGS) $(ARCH_FLAGS)
|
||||||
|
@ -198,7 +198,7 @@ TEST_PRINTING_PROG = $(BINDIR)/test_printing
|
||||||
TEST_PROGS = test_nal_unit_list test_es_unit_list
|
TEST_PROGS = test_nal_unit_list test_es_unit_list
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
all: $(BINDIR) $(LIBDIR) $(OBJDIR) $(PROGS)
|
all: $(BINDIR) $(LIBDIR) $(OBJDIR) $(PROGS) $(SHARED_LIB)
|
||||||
|
|
||||||
# ts2ps is not yet an offical program, so for the moment build
|
# ts2ps is not yet an offical program, so for the moment build
|
||||||
# it separately
|
# it separately
|
||||||
|
@ -213,6 +213,8 @@ $(SHARED_LIB): $(OBJS)
|
||||||
libtool -dynamic $(OBJS) -o $(SHARED_LIB)
|
libtool -dynamic $(OBJS) -o $(SHARED_LIB)
|
||||||
else
|
else
|
||||||
$(STATIC_LIB): $(STATIC_LIB)($(OBJS))
|
$(STATIC_LIB): $(STATIC_LIB)($(OBJS))
|
||||||
|
$(SHARED_LIB): $(SHARED_LIB)($(OBJS))
|
||||||
|
$(LD) -shared -o $(SHARED_LIB) $(OBJS) -lc
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Build all of the utilities with the static library, so that they can
|
# Build all of the utilities with the static library, so that they can
|
||||||
|
|
|
@ -26,19 +26,17 @@
|
||||||
# ***** END LICENSE BLOCK *****
|
# ***** END LICENSE BLOCK *****
|
||||||
|
|
||||||
from distutils.core import setup
|
from distutils.core import setup
|
||||||
from Pyrex.Distutils.extension import Extension
|
from distutils.extension import Extension
|
||||||
from Pyrex.Distutils import build_ext
|
from Cython.Distutils import build_ext
|
||||||
|
|
||||||
tstools = Extension("tstools/tstools",
|
|
||||||
['tstools/tstools.pyx'],
|
|
||||||
include_dirs=['..'],
|
|
||||||
library_dirs=['../lib'],
|
|
||||||
libraries=['tstools'],
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
|
tstools = Extension("tstools.tstools",
|
||||||
|
['tstools/tstools.pyx'],
|
||||||
|
include_dirs=['..'],
|
||||||
|
library_dirs=['../lib'],
|
||||||
|
libraries=['tstools'],
|
||||||
|
)
|
||||||
setup(
|
setup(
|
||||||
name = 'tstools',
|
name = 'tstools',
|
||||||
ext_modules=[tstools],
|
cmdclass = {'build_ext': build_ext},
|
||||||
cmdclass = {'build_ext': build_ext}
|
ext_modules=[tstools]
|
||||||
)
|
)
|
||||||
|
|
|
@ -166,13 +166,13 @@ cdef extern from "ts_fns.h":
|
||||||
byte *desc_data, int desc_data_len)
|
byte *desc_data, int desc_data_len)
|
||||||
|
|
||||||
cdef extern from 'nalunit_defns.h':
|
cdef extern from 'nalunit_defns.h':
|
||||||
struct nal_unit_context
|
struct nal_unit_context:
|
||||||
pass
|
pass
|
||||||
ctypedef nal_unit_context *nal_unit_context_p
|
ctypedef nal_unit_context *nal_unit_context_p
|
||||||
struct nal_unit
|
struct nal_unit:
|
||||||
pass
|
pass
|
||||||
ctypedef nal_unit *nal_unit_p
|
ctypedef nal_unit *nal_unit_p
|
||||||
struct nal_unit_list
|
struct nal_unit_list:
|
||||||
nal_unit_p *array
|
nal_unit_p *array
|
||||||
int length
|
int length
|
||||||
int size
|
int size
|
||||||
|
@ -212,18 +212,18 @@ cdef extern from 'accessunit_fns.h':
|
||||||
int build_access_unit_context(ES_p es, access_unit_context_p *context)
|
int build_access_unit_context(ES_p es, access_unit_context_p *context)
|
||||||
void free_access_unit_context(access_unit_context_p *context)
|
void free_access_unit_context(access_unit_context_p *context)
|
||||||
int rewind_access_unit_context(access_unit_context_p context)
|
int rewind_access_unit_context(access_unit_context_p context)
|
||||||
void free_access_unit(access_unit_p *acc_unit)
|
void free_access_unit(access_unit_context_p *acc_unit)
|
||||||
int get_access_unit_bounds(access_unit_p access_unit, ES_offset *start,
|
int get_access_unit_bounds(access_unit_context_p access_unit, ES_offset *start,
|
||||||
uint32_t *length)
|
uint32_t *length)
|
||||||
int all_slices_I(access_unit_p access_unit)
|
int all_slices_I(access_unit_context_p access_unit)
|
||||||
int all_slices_P(access_unit_p access_unit)
|
int all_slices_P(access_unit_context_p access_unit)
|
||||||
int all_slices_I_or_P(access_unit_p access_unit)
|
int all_slices_I_or_P(access_unit_context_p access_unit)
|
||||||
int all_slices_B(access_unit_p access_unit)
|
int all_slices_B(access_unit_context_p access_unit)
|
||||||
int get_next_access_unit(access_unit_context_p context, int quiet,
|
int get_next_access_unit(access_unit_context_p context, int quiet,
|
||||||
int show_details, access_unit_p *ret_access_unit)
|
int show_details, access_unit_context_p *ret_access_unit)
|
||||||
int get_next_h264_frame(access_unit_context_p context, int quiet,
|
int get_next_h264_frame(access_unit_context_p context, int quiet,
|
||||||
int show_details, access_unit_p *frame)
|
int show_details, access_unit_context_p *frame)
|
||||||
int access_unit_has_PTS(access_unit_p access_unit)
|
int access_unit_has_PTS(access_unit_context_p access_unit)
|
||||||
|
|
||||||
cdef extern from 'printing_fns.h':
|
cdef extern from 'printing_fns.h':
|
||||||
void print_msg(const_char_ptr text)
|
void print_msg(const_char_ptr text)
|
||||||
|
@ -233,7 +233,8 @@ cdef extern from 'printing_fns.h':
|
||||||
int redirect_output( void (*new_print_message_fn) (const_char_ptr message),
|
int redirect_output( void (*new_print_message_fn) (const_char_ptr message),
|
||||||
void (*new_print_error_fn) (const_char_ptr message),
|
void (*new_print_error_fn) (const_char_ptr message),
|
||||||
void (*new_fprint_message_fn) (const_char_ptr format, va_list arg_ptr),
|
void (*new_fprint_message_fn) (const_char_ptr format, va_list arg_ptr),
|
||||||
void (*new_fprint_error_fn) (const_char_ptr format, va_list arg_ptr)
|
void (*new_fprint_error_fn) (const_char_ptr format, va_list arg_ptr),
|
||||||
|
void (*new_flush_msg_fn) ()
|
||||||
)
|
)
|
||||||
|
|
||||||
# This one isn't properly declared - it's not in the header files
|
# This one isn't properly declared - it's not in the header files
|
||||||
|
|
|
@ -118,10 +118,13 @@ cdef void our_format_msg(const_char_ptr format, va_list arg_ptr):
|
||||||
PyOS_vsnprintf(buffer, 1000, format, arg_ptr)
|
PyOS_vsnprintf(buffer, 1000, format, arg_ptr)
|
||||||
PySys_WriteStdout('%s',buffer)
|
PySys_WriteStdout('%s',buffer)
|
||||||
|
|
||||||
|
cdef void our_flush():
|
||||||
|
pass
|
||||||
|
|
||||||
def setup_printing():
|
def setup_printing():
|
||||||
cdef int err
|
cdef int err
|
||||||
err = cwrapper.redirect_output(our_print_msg, our_print_msg,
|
err = cwrapper.redirect_output(our_print_msg, our_print_msg,
|
||||||
our_format_msg, our_format_msg)
|
our_format_msg, our_format_msg, our_flush)
|
||||||
if err:
|
if err:
|
||||||
raise TSToolsException, 'Setting output redirection FAILED'
|
raise TSToolsException, 'Setting output redirection FAILED'
|
||||||
|
|
||||||
|
@ -137,7 +140,7 @@ cdef void our_doctest_format_msg(const_char_ptr format, va_list arg_ptr):
|
||||||
def setup_printing_for_doctest():
|
def setup_printing_for_doctest():
|
||||||
cdef int err
|
cdef int err
|
||||||
err = cwrapper.redirect_output(our_doctest_print_msg, our_doctest_print_msg,
|
err = cwrapper.redirect_output(our_doctest_print_msg, our_doctest_print_msg,
|
||||||
our_doctest_format_msg, our_doctest_format_msg)
|
our_doctest_format_msg, our_doctest_format_msg, our_flush)
|
||||||
if err:
|
if err:
|
||||||
raise TSToolsException, 'Setting doctest output redirection FAILED'
|
raise TSToolsException, 'Setting doctest output redirection FAILED'
|
||||||
else:
|
else:
|
||||||
|
@ -146,8 +149,8 @@ def setup_printing_for_doctest():
|
||||||
def test_printing():
|
def test_printing():
|
||||||
cwrapper.print_msg('Message\n')
|
cwrapper.print_msg('Message\n')
|
||||||
cwrapper.print_err('Error\n')
|
cwrapper.print_err('Error\n')
|
||||||
cwrapper.fprint_msg('Message "%s"\n','Fred')
|
#cwrapper.fprint_msg('Message "%s"\n','Fred')
|
||||||
cwrapper.fprint_err('Error "%s"\n','Fred')
|
#cwrapper.fprint_err('Error "%s"\n','Fred')
|
||||||
|
|
||||||
def test_c_printing():
|
def test_c_printing():
|
||||||
cwrapper.test_C_printing()
|
cwrapper.test_C_printing()
|
||||||
|
@ -473,7 +476,7 @@ cdef class ESFile:
|
||||||
retval = fclose(self.file_stream)
|
retval = fclose(self.file_stream)
|
||||||
if retval != 0:
|
if retval != 0:
|
||||||
raise TSToolsException,"Error closing file '%s':"\
|
raise TSToolsException,"Error closing file '%s':"\
|
||||||
" %s"%(filename,strerror(errno))
|
" %s"%(self.name,strerror(errno))
|
||||||
if self.stream != NULL:
|
if self.stream != NULL:
|
||||||
cwrapper.free_elementary_stream(&self.stream)
|
cwrapper.free_elementary_stream(&self.stream)
|
||||||
# And obviously we're not available any more
|
# And obviously we're not available any more
|
||||||
|
|
Ładowanie…
Reference in New Issue