diff --git a/api/api_support.py b/api/api_support.py new file mode 100644 index 00000000..ad523f71 --- /dev/null +++ b/api/api_support.py @@ -0,0 +1,50 @@ +import ccextractor as cc +import ccx_to_python_g608 as g608 +import python_srt_generator as srt_generator +## +#help_string to be included in the documentation +#it is the help string for telling what kind of output the user wants to STDOUT +#the redirection of output to STDOUT can be changed easily to whatsoever usage the user wants to put in. +## +help_string = """ + Case is the value that would give the desired output. + case = 0 --> print start_time,end_time,text,color,font + case = 1 --> print start_time,end_time,text + case = 2 --> print start_time,end_time,color + case = 3 --> print start_time,end_time,font + case = 4 --> print start_time,end_time,text,color + case = 5 --> print start_time,end_time,text,font + case = 6 --> print start_time,end_time,color,font + """ +text,font,color = [],[],[] +filename = " " +srt_counter = " " +def generate_output_srt(line): + global text,font,color + global filename, srt_counter + if "filename:" in line: + filename = str(str(line.split(":")[1]).split("\n")[0]) + #check for an alternative to wipe the output file in python + fh = srt_generator.generate_file_handle(filename,'w') + fh.write("") + srt_generator.delete_file_handle(fh) + elif "srt_counter-" in line: + srt_counter = str(line.split("-")[1]) + fh = srt_generator.generate_file_handle(filename,'a') + fh.write(srt_counter) + srt_generator.delete_file_handle(fh) + elif "start_time" in line: + fh = srt_generator.generate_file_handle(filename,'a') + srt_generator.generate_output_srt_time(fh, line) + srt_generator.delete_file_handle(fh) + elif "***END OF FRAME***" in line: + data = g608.return_g608_grid(0,text,color,font) + fh = srt_generator.generate_file_handle(filename,'a') + srt_generator.generate_output_srt(fh, data) + srt_generator.delete_file_handle(fh) + text,font,color = [],[],[] + else: + g608.g608_grid_former(line,text,color,font) + + + diff --git a/api/api_testing.py b/api/api_testing.py index 6285d39c..950514d2 100644 --- a/api/api_testing.py +++ b/api/api_testing.py @@ -1,17 +1,65 @@ +### +#MANDATORY UPDATES IN EVERY PYTHON SCRIPT +### import ccextractor as cc -import os -import time +import api_support +from multiprocessing import Queue,Process,Event import sys -s = cc.api_init_options() -cc.check_configuration_file(s) -for i in sys.argv[1:]: - cc.api_add_param(s,str(i)) -#cc.setstdout(s) -compile_ret = cc.compile_params(s,len(sys.argv[1:])); -start_ret = cc.api_start(s); +import time + +def templer(): + s = cc.api_init_options() + cc.check_configuration_file(s) + for i in sys.argv[1:]: + cc.api_add_param(s,str(i)) + #very mandatory for keeping a track of pythonapi call. Always must be set. + cc.my_pythonapi(s, callback) + + compile_ret = cc.compile_params(s,len(sys.argv[1:])); + + #very mandatory for keeping a track of pythonapi call. Always must be called so that the program knows that the call is from pythonapi. + cc.call_from_python_api(s) + + start_ret = cc.api_start(s); + +def callback(line): + api_support.generate_output_srt(line) +if __name__=="__main__": + templer() + + + + + + + + + + + +#for item in cc.captions_timings_list: +# print item(0),item(1) +# print item(2) +#cc.cvar.array.has_api_start_exited=1 +#print "\n" +#print "The extracted captions with respective timings are as follows:" +###one line functions to directly check the extracted captions that would be otherwise accessible in python. +###just uncomment the next line. +#cc.show_extracted_captions_with_timings() + +###THE FOLLOWING LOOP LETS USER USE THE EXTRACTED CAPTIONS ALONG WITH THEIR TIMINGS. +#for i in xrange(cc.cc_to_python_get_number_of_subs()): +# caption = cc.cc_to_python_get_modified_sub(i) +# print caption.srt_counter +# print "start time = {}\t end time = {}".format(caption.start_time,caption.end_time) +# for j in xrange(cc.cc_to_python_get_modified_sub_buffer_size(i)): +# print cc.cc_to_python_get_modified_sub_buffer(i,j) + +""" #print cc.cc_to_python_get_subs_number_of_lines() #printing python_subs.subs #for item in xrange(cc.cc_to_python_get_subs_number_of_lines()): # print cc.cc_to_python_get_sub(item) #os.system('clear') +""" diff --git a/api/build_api b/api/build_api index 224da363..1eeb3ac9 100755 --- a/api/build_api +++ b/api/build_api @@ -11,11 +11,12 @@ SRC_HASH="$(find ../src/lib_hash/ -name '*.c')" SRC_PROTOBUF="$(find ../src/protobuf-c/ -name '*.c')" SRC_UTF8PROC="../src/utf8proc/utf8proc.c" API_WRAPPERS="$(find ../api/wrappers/ -name '*.c')" -BLD_SOURCES="../src/ccextractor.c ccextractor_wrap.c $SRC_CCX $SRC_GPAC $SRC_ZLIB $SRC_ZVBI $SRC_LIBPNG $SRC_HASH $SRC_PROTOBUF $SRC_UTF8PROC $API_WRAPPERS" +API_EXTRACTORS="$(find ../api/extractors/ -name '*.c')" +BLD_SOURCES="../src/ccextractor.c ccextractor_wrap.c $SRC_CCX $SRC_GPAC $SRC_ZLIB $SRC_ZVBI $SRC_LIBPNG $SRC_HASH $SRC_PROTOBUF $SRC_UTF8PROC $API_WRAPPERS $API_EXTRACTORS" ../linux/pre-build.sh -out=$((LC_ALL=C gcc -fPIC -c $BLD_INCLUDE $BLD_SOURCES) 2>&1) +out=$((LC_ALL=C gcc -fPIC -c -DPYTHONAPI $BLD_FLAGS $BLD_INCLUDE $BLD_SOURCES $BLD_LINKER) 2>&1) #out=$((LC_ALL=C gcc -fPIC -c -Wl,-wrap,write $BLD_INCLUDE $BLD_SOURCES) 2>&1) res=$? if [[ $out == *"gcc: command not found"* ]] diff --git a/api/build_library b/api/build_library index f912261a..96a70bc1 100755 --- a/api/build_library +++ b/api/build_library @@ -2,7 +2,7 @@ BLD_LINKER="-lm -zmuldefs -l tesseract -l lept -l python2.7" WRAPPER_FLAGS="-Wl,-wrap,write" -out=$((swig -python ccextractor.i && ./build_api && gcc -shared $(find -name '*.o') -o _ccextractor.so ) 2>&1) +out=$((swig -python ccextractor.i && ./build_api && gcc -shared $(find -name '*.o') -o _ccextractor.so $BLD_LINKER) 2>&1) #out=$((swig -python ccextractor.i && ./build_api && gcc -shared $WRAPPER_FLAGS $(find -name '*.o') -o _ccextractor.so ) 2>&1) res=$? if [[ $out == *"gcc: command not found"* ]] diff --git a/api/ccextractor.i b/api/ccextractor.i index 7b2ee351..7445864d 100644 --- a/api/ccextractor.i +++ b/api/ccextractor.i @@ -9,6 +9,69 @@ #include "../src/lib_ccx/ccx_share.h" #include "../src/ccextractor.h" #include "../api/wrappers/wrapper.h" +%} +void my_pythonapi(struct ccx_s_options *api_options, PyObject* func); +%pythoncode %{ +def g608_grid_former(line,text,color,font): + if "text[" in line: + line = str(line.split(":", 1)[1]) + line = str(line.split("\n")[0]) + text.append(line) + if "color[" in line: + line = str(line.split(":", 1)[1]) + line = str(line.split("\n")[0]) + color.append(line) + if "font[" in line: + line = str(line.split(":", 1)[1]) + line = str(line.split("\n")[0]) + font.append(line) + +def print_g608_grid(case,text,color,font): + help_string = """ + Case is the value that would give the desired output. + case = 0 --> print start_time,end_time,text,color,font + case = 1 --> print start_time,end_time,text + case = 2 --> print start_time,end_time,color + case = 3 --> print start_time,end_time,font + case = 4 --> print start_time,end_time,text,color + case = 5 --> print start_time,end_time,text,font + case = 6 --> print start_time,end_time,color,font + """ + if case==0: + if text: + print "\n".join(text) + if color: + print "\n".join(color) + if font: + print "\n".join(font) + + elif case==1: + if text: + print "\n".join(text) + elif case==2: + if color: + print "\n".join(color) + elif case==3: + if font: + print "\n".join(font) + elif case==4: + if text: + print "\n".join(text) + if color: + print "\n".join(color) + elif case==5: + if text: + print "\n".join(text) + if font: + print "\n".join(font) + elif case==6: + if color: + print "\n".join(color) + if font: + print "\n".join(font) + else: + print help_string + %} %include "../src/lib_ccx/ccx_common_common.h" %include "../src/ccextractor.h" diff --git a/api/ccextractor.py b/api/ccextractor.py index aa2d88fd..4e082a44 100644 --- a/api/ccextractor.py +++ b/api/ccextractor.py @@ -95,6 +95,72 @@ except __builtin__.Exception: pass _newclass = 0 + +def my_pythonapi(api_options, func): + return _ccextractor.my_pythonapi(api_options, func) +my_pythonapi = _ccextractor.my_pythonapi + +def g608_grid_former(line,text,color,font): + if "text[" in line: + line = str(line.split(":", 1)[1]) + line = str(line.split("\n")[0]) + text.append(line) + if "color[" in line: + line = str(line.split(":", 1)[1]) + line = str(line.split("\n")[0]) + color.append(line) + if "font[" in line: + line = str(line.split(":", 1)[1]) + line = str(line.split("\n")[0]) + font.append(line) + +def print_g608_grid(case,text,color,font): + help_string = """ + Case is the value that would give the desired output. + case = 0 --> print start_time,end_time,text,color,font + case = 1 --> print start_time,end_time,text + case = 2 --> print start_time,end_time,color + case = 3 --> print start_time,end_time,font + case = 4 --> print start_time,end_time,text,color + case = 5 --> print start_time,end_time,text,font + case = 6 --> print start_time,end_time,color,font + """ + if case==0: + if text: + print "\n".join(text) + if color: + print "\n".join(color) + if font: + print "\n".join(font) + + elif case==1: + if text: + print "\n".join(text) + elif case==2: + if color: + print "\n".join(color) + elif case==3: + if font: + print "\n".join(font) + elif case==4: + if text: + print "\n".join(text) + if color: + print "\n".join(color) + elif case==5: + if text: + print "\n".join(text) + if font: + print "\n".join(font) + elif case==6: + if color: + print "\n".join(color) + if font: + print "\n".join(font) + else: + print help_string + + EXIT_OK = _ccextractor.EXIT_OK EXIT_NO_INPUT_FILES = _ccextractor.EXIT_NO_INPUT_FILES EXIT_TOO_MANY_INPUT_FILES = _ccextractor.EXIT_TOO_MANY_INPUT_FILES @@ -145,49 +211,111 @@ debug_608_to_ASC = _ccextractor.debug_608_to_ASC def add_cc_sub_text(sub, str, start_time, end_time, info, mode, arg7): return _ccextractor.add_cc_sub_text(sub, str, start_time, end_time, info, mode, arg7) add_cc_sub_text = _ccextractor.add_cc_sub_text -class cc_to_python_subs(_object): +class python_subs_modified(_object): __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, cc_to_python_subs, name, value) + __setattr__ = lambda self, name, value: _swig_setattr(self, python_subs_modified, name, value) __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, cc_to_python_subs, name) + __getattr__ = lambda self, name: _swig_getattr(self, python_subs_modified, name) __repr__ = _swig_repr - __swig_setmethods__["inputfile"] = _ccextractor.cc_to_python_subs_inputfile_set - __swig_getmethods__["inputfile"] = _ccextractor.cc_to_python_subs_inputfile_get + __swig_setmethods__["buffer_count"] = _ccextractor.python_subs_modified_buffer_count_set + __swig_getmethods__["buffer_count"] = _ccextractor.python_subs_modified_buffer_count_get if _newclass: - inputfile = _swig_property(_ccextractor.cc_to_python_subs_inputfile_get, _ccextractor.cc_to_python_subs_inputfile_set) - __swig_setmethods__["num_input_files"] = _ccextractor.cc_to_python_subs_num_input_files_set - __swig_getmethods__["num_input_files"] = _ccextractor.cc_to_python_subs_num_input_files_get + buffer_count = _swig_property(_ccextractor.python_subs_modified_buffer_count_get, _ccextractor.python_subs_modified_buffer_count_set) + __swig_setmethods__["srt_counter"] = _ccextractor.python_subs_modified_srt_counter_set + __swig_getmethods__["srt_counter"] = _ccextractor.python_subs_modified_srt_counter_get if _newclass: - num_input_files = _swig_property(_ccextractor.cc_to_python_subs_num_input_files_get, _ccextractor.cc_to_python_subs_num_input_files_set) - __swig_setmethods__["basefilename"] = _ccextractor.cc_to_python_subs_basefilename_set - __swig_getmethods__["basefilename"] = _ccextractor.cc_to_python_subs_basefilename_get + srt_counter = _swig_property(_ccextractor.python_subs_modified_srt_counter_get, _ccextractor.python_subs_modified_srt_counter_set) + __swig_setmethods__["start_time"] = _ccextractor.python_subs_modified_start_time_set + __swig_getmethods__["start_time"] = _ccextractor.python_subs_modified_start_time_get if _newclass: - basefilename = _swig_property(_ccextractor.cc_to_python_subs_basefilename_get, _ccextractor.cc_to_python_subs_basefilename_set) - __swig_setmethods__["extension"] = _ccextractor.cc_to_python_subs_extension_set - __swig_getmethods__["extension"] = _ccextractor.cc_to_python_subs_extension_get + start_time = _swig_property(_ccextractor.python_subs_modified_start_time_get, _ccextractor.python_subs_modified_start_time_set) + __swig_setmethods__["end_time"] = _ccextractor.python_subs_modified_end_time_set + __swig_getmethods__["end_time"] = _ccextractor.python_subs_modified_end_time_get if _newclass: - extension = _swig_property(_ccextractor.cc_to_python_subs_extension_get, _ccextractor.cc_to_python_subs_extension_set) - __swig_setmethods__["subs"] = _ccextractor.cc_to_python_subs_subs_set - __swig_getmethods__["subs"] = _ccextractor.cc_to_python_subs_subs_get + end_time = _swig_property(_ccextractor.python_subs_modified_end_time_get, _ccextractor.python_subs_modified_end_time_set) + __swig_setmethods__["buffer"] = _ccextractor.python_subs_modified_buffer_set + __swig_getmethods__["buffer"] = _ccextractor.python_subs_modified_buffer_get if _newclass: - subs = _swig_property(_ccextractor.cc_to_python_subs_subs_get, _ccextractor.cc_to_python_subs_subs_set) - __swig_setmethods__["number_of_lines"] = _ccextractor.cc_to_python_subs_number_of_lines_set - __swig_getmethods__["number_of_lines"] = _ccextractor.cc_to_python_subs_number_of_lines_get + buffer = _swig_property(_ccextractor.python_subs_modified_buffer_get, _ccextractor.python_subs_modified_buffer_set) + __swig_setmethods__["g608_grid_color_count"] = _ccextractor.python_subs_modified_g608_grid_color_count_set + __swig_getmethods__["g608_grid_color_count"] = _ccextractor.python_subs_modified_g608_grid_color_count_get if _newclass: - number_of_lines = _swig_property(_ccextractor.cc_to_python_subs_number_of_lines_get, _ccextractor.cc_to_python_subs_number_of_lines_set) + g608_grid_color_count = _swig_property(_ccextractor.python_subs_modified_g608_grid_color_count_get, _ccextractor.python_subs_modified_g608_grid_color_count_set) + __swig_setmethods__["g608_grid_color"] = _ccextractor.python_subs_modified_g608_grid_color_set + __swig_getmethods__["g608_grid_color"] = _ccextractor.python_subs_modified_g608_grid_color_get + if _newclass: + g608_grid_color = _swig_property(_ccextractor.python_subs_modified_g608_grid_color_get, _ccextractor.python_subs_modified_g608_grid_color_set) + __swig_setmethods__["g608_grid_font_count"] = _ccextractor.python_subs_modified_g608_grid_font_count_set + __swig_getmethods__["g608_grid_font_count"] = _ccextractor.python_subs_modified_g608_grid_font_count_get + if _newclass: + g608_grid_font_count = _swig_property(_ccextractor.python_subs_modified_g608_grid_font_count_get, _ccextractor.python_subs_modified_g608_grid_font_count_set) + __swig_setmethods__["g608_grid_font"] = _ccextractor.python_subs_modified_g608_grid_font_set + __swig_getmethods__["g608_grid_font"] = _ccextractor.python_subs_modified_g608_grid_font_get + if _newclass: + g608_grid_font = _swig_property(_ccextractor.python_subs_modified_g608_grid_font_get, _ccextractor.python_subs_modified_g608_grid_font_set) def __init__(self): - this = _ccextractor.new_cc_to_python_subs() + this = _ccextractor.new_python_subs_modified() try: self.this.append(this) except __builtin__.Exception: self.this = this - __swig_destroy__ = _ccextractor.delete_cc_to_python_subs + __swig_destroy__ = _ccextractor.delete_python_subs_modified __del__ = lambda self: None -cc_to_python_subs_swigregister = _ccextractor.cc_to_python_subs_swigregister -cc_to_python_subs_swigregister(cc_to_python_subs) +python_subs_modified_swigregister = _ccextractor.python_subs_modified_swigregister +python_subs_modified_swigregister(python_subs_modified) cvar = _ccextractor.cvar +class python_subs_array(_object): + __swig_setmethods__ = {} + __setattr__ = lambda self, name, value: _swig_setattr(self, python_subs_array, name, value) + __swig_getmethods__ = {} + __getattr__ = lambda self, name: _swig_getattr(self, python_subs_array, name) + __repr__ = _swig_repr + __swig_setmethods__["temporary_file"] = _ccextractor.python_subs_array_temporary_file_set + __swig_getmethods__["temporary_file"] = _ccextractor.python_subs_array_temporary_file_get + if _newclass: + temporary_file = _swig_property(_ccextractor.python_subs_array_temporary_file_get, _ccextractor.python_subs_array_temporary_file_set) + __swig_setmethods__["fp"] = _ccextractor.python_subs_array_fp_set + __swig_getmethods__["fp"] = _ccextractor.python_subs_array_fp_get + if _newclass: + fp = _swig_property(_ccextractor.python_subs_array_fp_get, _ccextractor.python_subs_array_fp_set) + __swig_setmethods__["output_filename"] = _ccextractor.python_subs_array_output_filename_set + __swig_getmethods__["output_filename"] = _ccextractor.python_subs_array_output_filename_get + if _newclass: + output_filename = _swig_property(_ccextractor.python_subs_array_output_filename_get, _ccextractor.python_subs_array_output_filename_set) + __swig_setmethods__["has_api_start_exited"] = _ccextractor.python_subs_array_has_api_start_exited_set + __swig_getmethods__["has_api_start_exited"] = _ccextractor.python_subs_array_has_api_start_exited_get + if _newclass: + has_api_start_exited = _swig_property(_ccextractor.python_subs_array_has_api_start_exited_get, _ccextractor.python_subs_array_has_api_start_exited_set) + __swig_setmethods__["old_sub_count"] = _ccextractor.python_subs_array_old_sub_count_set + __swig_getmethods__["old_sub_count"] = _ccextractor.python_subs_array_old_sub_count_get + if _newclass: + old_sub_count = _swig_property(_ccextractor.python_subs_array_old_sub_count_get, _ccextractor.python_subs_array_old_sub_count_set) + __swig_setmethods__["sub_count"] = _ccextractor.python_subs_array_sub_count_set + __swig_getmethods__["sub_count"] = _ccextractor.python_subs_array_sub_count_get + if _newclass: + sub_count = _swig_property(_ccextractor.python_subs_array_sub_count_get, _ccextractor.python_subs_array_sub_count_set) + __swig_setmethods__["subs"] = _ccextractor.python_subs_array_subs_set + __swig_getmethods__["subs"] = _ccextractor.python_subs_array_subs_get + if _newclass: + subs = _swig_property(_ccextractor.python_subs_array_subs_get, _ccextractor.python_subs_array_subs_set) + __swig_setmethods__["is_transcript"] = _ccextractor.python_subs_array_is_transcript_set + __swig_getmethods__["is_transcript"] = _ccextractor.python_subs_array_is_transcript_get + if _newclass: + is_transcript = _swig_property(_ccextractor.python_subs_array_is_transcript_get, _ccextractor.python_subs_array_is_transcript_set) + + def __init__(self): + this = _ccextractor.new_python_subs_array() + try: + self.this.append(this) + except __builtin__.Exception: + self.this = this + __swig_destroy__ = _ccextractor.delete_python_subs_array + __del__ = lambda self: None +python_subs_array_swigregister = _ccextractor.python_subs_array_swigregister +python_subs_array_swigregister(python_subs_array) + def api_init_options(): return _ccextractor.api_init_options() @@ -229,21 +357,49 @@ def print_end_msg(): return _ccextractor.print_end_msg() print_end_msg = _ccextractor.print_end_msg +def show_extracted_captions_with_timings(): + return _ccextractor.show_extracted_captions_with_timings() +show_extracted_captions_with_timings = _ccextractor.show_extracted_captions_with_timings + def main(argc, argv): return _ccextractor.main(argc, argv) main = _ccextractor.main -def cc_to_python_get_subs_number_of_lines(): - return _ccextractor.cc_to_python_get_subs_number_of_lines() -cc_to_python_get_subs_number_of_lines = _ccextractor.cc_to_python_get_subs_number_of_lines +def cc_to_python_get_old_count(): + return _ccextractor.cc_to_python_get_old_count() +cc_to_python_get_old_count = _ccextractor.cc_to_python_get_old_count -def cc_to_python_get_sub(i): - return _ccextractor.cc_to_python_get_sub(i) -cc_to_python_get_sub = _ccextractor.cc_to_python_get_sub +def cc_to_python_set_old_count(): + return _ccextractor.cc_to_python_set_old_count() +cc_to_python_set_old_count = _ccextractor.cc_to_python_set_old_count -def __wrap_write(file_handle, buffer, nbyte): - return _ccextractor.__wrap_write(file_handle, buffer, nbyte) -__wrap_write = _ccextractor.__wrap_write +def cc_to_python_get_number_of_subs(): + return _ccextractor.cc_to_python_get_number_of_subs() +cc_to_python_get_number_of_subs = _ccextractor.cc_to_python_get_number_of_subs + +def cc_to_python_get_modified_sub(i): + return _ccextractor.cc_to_python_get_modified_sub(i) +cc_to_python_get_modified_sub = _ccextractor.cc_to_python_get_modified_sub + +def cc_to_python_get_modified_sub_buffer_size(i): + return _ccextractor.cc_to_python_get_modified_sub_buffer_size(i) +cc_to_python_get_modified_sub_buffer_size = _ccextractor.cc_to_python_get_modified_sub_buffer_size + +def cc_to_python_get_modified_sub_buffer(i, j): + return _ccextractor.cc_to_python_get_modified_sub_buffer(i, j) +cc_to_python_get_modified_sub_buffer = _ccextractor.cc_to_python_get_modified_sub_buffer + +def cc_to_python_get_output_filename(): + return _ccextractor.cc_to_python_get_output_filename() +cc_to_python_get_output_filename = _ccextractor.cc_to_python_get_output_filename + +def call_from_python_api(api_options): + return _ccextractor.call_from_python_api(api_options) +call_from_python_api = _ccextractor.call_from_python_api + +def set_pythonapi(api_options): + return _ccextractor.set_pythonapi(api_options) +set_pythonapi = _ccextractor.set_pythonapi def setautoprogram(api_options): return _ccextractor.setautoprogram(api_options) @@ -252,6 +408,14 @@ setautoprogram = _ccextractor.setautoprogram def setstdout(api_options): return _ccextractor.setstdout(api_options) setstdout = _ccextractor.setstdout + +def setpesheader(api_options): + return _ccextractor.setpesheader(api_options) +setpesheader = _ccextractor.setpesheader + +def setdebugdvbsub(api_options): + return _ccextractor.setdebugdvbsub(api_options) +setdebugdvbsub = _ccextractor.setdebugdvbsub # This file is compatible with both classic and new-style classes. diff --git a/api/ccextractor_wrap.c b/api/ccextractor_wrap.c index 80cb5867..ec314c8b 100644 --- a/api/ccextractor_wrap.c +++ b/api/ccextractor_wrap.c @@ -2979,18 +2979,20 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { /* -------- TYPES TABLE (BEGIN) -------- */ -#define SWIGTYPE_p_LLONG swig_types[0] -#define SWIGTYPE_p_cc_subtitle swig_types[1] -#define SWIGTYPE_p_cc_to_python_subs swig_types[2] +#define SWIGTYPE_p_FILE swig_types[0] +#define SWIGTYPE_p_LLONG swig_types[1] +#define SWIGTYPE_p_cc_subtitle swig_types[2] #define SWIGTYPE_p_ccx_s_options swig_types[3] #define SWIGTYPE_p_char swig_types[4] #define SWIGTYPE_p_int swig_types[5] #define SWIGTYPE_p_lib_ccx_ctx swig_types[6] #define SWIGTYPE_p_p_char swig_types[7] -#define SWIGTYPE_p_unsigned_char swig_types[8] -#define SWIGTYPE_p_unsigned_int swig_types[9] -static swig_type_info *swig_types[11]; -static swig_module_info swig_module = {swig_types, 10, 0, 0, 0, 0}; +#define SWIGTYPE_p_python_subs_array swig_types[8] +#define SWIGTYPE_p_python_subs_modified swig_types[9] +#define SWIGTYPE_p_unsigned_char swig_types[10] +#define SWIGTYPE_p_unsigned_int swig_types[11] +static swig_type_info *swig_types[13]; +static swig_module_info swig_module = {swig_types, 12, 0, 0, 0, 0}; #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) @@ -3358,6 +3360,30 @@ SWIG_FromCharPtr(const char *cptr) #ifdef __cplusplus extern "C" { #endif +SWIGINTERN PyObject *_wrap_my_pythonapi(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + struct ccx_s_options *arg1 = (struct ccx_s_options *) 0 ; + PyObject *arg2 = (PyObject *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:my_pythonapi",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ccx_s_options, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "my_pythonapi" "', argument " "1"" of type '" "struct ccx_s_options *""'"); + } + arg1 = (struct ccx_s_options *)(argp1); + arg2 = obj1; + my_pythonapi(arg1,arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + SWIGINTERN PyObject *_wrap_fdprintf__varargs__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *varargs) { PyObject *resultobj = 0; int arg1 ; @@ -3697,61 +3723,9 @@ SWIGINTERN PyObject *Swig_var_cc608_parity_table_get(void) { } -SWIGINTERN PyObject *_wrap_cc_to_python_subs_inputfile_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_python_subs_modified_buffer_count_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; - struct cc_to_python_subs *arg1 = (struct cc_to_python_subs *) 0 ; - char **arg2 = (char **) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"OO:cc_to_python_subs_inputfile_set",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cc_to_python_subs, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cc_to_python_subs_inputfile_set" "', argument " "1"" of type '" "struct cc_to_python_subs *""'"); - } - arg1 = (struct cc_to_python_subs *)(argp1); - res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_p_char, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "cc_to_python_subs_inputfile_set" "', argument " "2"" of type '" "char **""'"); - } - arg2 = (char **)(argp2); - if (arg1) (arg1)->inputfile = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cc_to_python_subs_inputfile_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - struct cc_to_python_subs *arg1 = (struct cc_to_python_subs *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject * obj0 = 0 ; - char **result = 0 ; - - if (!PyArg_ParseTuple(args,(char *)"O:cc_to_python_subs_inputfile_get",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cc_to_python_subs, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cc_to_python_subs_inputfile_get" "', argument " "1"" of type '" "struct cc_to_python_subs *""'"); - } - arg1 = (struct cc_to_python_subs *)(argp1); - result = (char **) ((arg1)->inputfile); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_p_char, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cc_to_python_subs_num_input_files_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - struct cc_to_python_subs *arg1 = (struct cc_to_python_subs *) 0 ; + struct python_subs_modified *arg1 = (struct python_subs_modified *) 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; @@ -3760,18 +3734,18 @@ SWIGINTERN PyObject *_wrap_cc_to_python_subs_num_input_files_set(PyObject *SWIGU PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OO:cc_to_python_subs_num_input_files_set",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cc_to_python_subs, 0 | 0 ); + if (!PyArg_ParseTuple(args,(char *)"OO:python_subs_modified_buffer_count_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_python_subs_modified, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cc_to_python_subs_num_input_files_set" "', argument " "1"" of type '" "struct cc_to_python_subs *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "python_subs_modified_buffer_count_set" "', argument " "1"" of type '" "struct python_subs_modified *""'"); } - arg1 = (struct cc_to_python_subs *)(argp1); + arg1 = (struct python_subs_modified *)(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "cc_to_python_subs_num_input_files_set" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "python_subs_modified_buffer_count_set" "', argument " "2"" of type '" "int""'"); } arg2 = (int)(val2); - if (arg1) (arg1)->num_input_files = arg2; + if (arg1) (arg1)->buffer_count = arg2; resultobj = SWIG_Py_Void(); return resultobj; fail: @@ -3779,21 +3753,21 @@ fail: } -SWIGINTERN PyObject *_wrap_cc_to_python_subs_num_input_files_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_python_subs_modified_buffer_count_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; - struct cc_to_python_subs *arg1 = (struct cc_to_python_subs *) 0 ; + struct python_subs_modified *arg1 = (struct python_subs_modified *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; int result; - if (!PyArg_ParseTuple(args,(char *)"O:cc_to_python_subs_num_input_files_get",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cc_to_python_subs, 0 | 0 ); + if (!PyArg_ParseTuple(args,(char *)"O:python_subs_modified_buffer_count_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_python_subs_modified, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cc_to_python_subs_num_input_files_get" "', argument " "1"" of type '" "struct cc_to_python_subs *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "python_subs_modified_buffer_count_get" "', argument " "1"" of type '" "struct python_subs_modified *""'"); } - arg1 = (struct cc_to_python_subs *)(argp1); - result = (int) ((arg1)->num_input_files); + arg1 = (struct python_subs_modified *)(argp1); + result = (int) ((arg1)->buffer_count); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: @@ -3801,9 +3775,61 @@ fail: } -SWIGINTERN PyObject *_wrap_cc_to_python_subs_basefilename_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_python_subs_modified_srt_counter_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; - struct cc_to_python_subs *arg1 = (struct cc_to_python_subs *) 0 ; + struct python_subs_modified *arg1 = (struct python_subs_modified *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:python_subs_modified_srt_counter_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_python_subs_modified, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "python_subs_modified_srt_counter_set" "', argument " "1"" of type '" "struct python_subs_modified *""'"); + } + arg1 = (struct python_subs_modified *)(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "python_subs_modified_srt_counter_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = (int)(val2); + if (arg1) (arg1)->srt_counter = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_python_subs_modified_srt_counter_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + struct python_subs_modified *arg1 = (struct python_subs_modified *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + int result; + + if (!PyArg_ParseTuple(args,(char *)"O:python_subs_modified_srt_counter_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_python_subs_modified, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "python_subs_modified_srt_counter_get" "', argument " "1"" of type '" "struct python_subs_modified *""'"); + } + arg1 = (struct python_subs_modified *)(argp1); + result = (int) ((arg1)->srt_counter); + resultobj = SWIG_From_int((int)(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_python_subs_modified_start_time_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + struct python_subs_modified *arg1 = (struct python_subs_modified *) 0 ; char *arg2 = (char *) 0 ; void *argp1 = 0 ; int res1 = 0 ; @@ -3813,23 +3839,23 @@ SWIGINTERN PyObject *_wrap_cc_to_python_subs_basefilename_set(PyObject *SWIGUNUS PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OO:cc_to_python_subs_basefilename_set",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cc_to_python_subs, 0 | 0 ); + if (!PyArg_ParseTuple(args,(char *)"OO:python_subs_modified_start_time_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_python_subs_modified, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cc_to_python_subs_basefilename_set" "', argument " "1"" of type '" "struct cc_to_python_subs *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "python_subs_modified_start_time_set" "', argument " "1"" of type '" "struct python_subs_modified *""'"); } - arg1 = (struct cc_to_python_subs *)(argp1); + arg1 = (struct python_subs_modified *)(argp1); res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "cc_to_python_subs_basefilename_set" "', argument " "2"" of type '" "char *""'"); + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "python_subs_modified_start_time_set" "', argument " "2"" of type '" "char *""'"); } arg2 = (char *)(buf2); - if (arg1->basefilename) free((char*)arg1->basefilename); + if (arg1->start_time) free((char*)arg1->start_time); if (arg2) { size_t size = strlen((const char *)(arg2)) + 1; - arg1->basefilename = (char *)(char *)memcpy(malloc((size)*sizeof(char)), (const char *)(arg2), sizeof(char)*(size)); + arg1->start_time = (char *)(char *)memcpy(malloc((size)*sizeof(char)), (const char *)(arg2), sizeof(char)*(size)); } else { - arg1->basefilename = 0; + arg1->start_time = 0; } resultobj = SWIG_Py_Void(); if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); @@ -3840,21 +3866,21 @@ fail: } -SWIGINTERN PyObject *_wrap_cc_to_python_subs_basefilename_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_python_subs_modified_start_time_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; - struct cc_to_python_subs *arg1 = (struct cc_to_python_subs *) 0 ; + struct python_subs_modified *arg1 = (struct python_subs_modified *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; char *result = 0 ; - if (!PyArg_ParseTuple(args,(char *)"O:cc_to_python_subs_basefilename_get",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cc_to_python_subs, 0 | 0 ); + if (!PyArg_ParseTuple(args,(char *)"O:python_subs_modified_start_time_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_python_subs_modified, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cc_to_python_subs_basefilename_get" "', argument " "1"" of type '" "struct cc_to_python_subs *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "python_subs_modified_start_time_get" "', argument " "1"" of type '" "struct python_subs_modified *""'"); } - arg1 = (struct cc_to_python_subs *)(argp1); - result = (char *) ((arg1)->basefilename); + arg1 = (struct python_subs_modified *)(argp1); + result = (char *) ((arg1)->start_time); resultobj = SWIG_FromCharPtr((const char *)result); return resultobj; fail: @@ -3862,9 +3888,9 @@ fail: } -SWIGINTERN PyObject *_wrap_cc_to_python_subs_extension_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_python_subs_modified_end_time_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; - struct cc_to_python_subs *arg1 = (struct cc_to_python_subs *) 0 ; + struct python_subs_modified *arg1 = (struct python_subs_modified *) 0 ; char *arg2 = (char *) 0 ; void *argp1 = 0 ; int res1 = 0 ; @@ -3874,23 +3900,23 @@ SWIGINTERN PyObject *_wrap_cc_to_python_subs_extension_set(PyObject *SWIGUNUSEDP PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OO:cc_to_python_subs_extension_set",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cc_to_python_subs, 0 | 0 ); + if (!PyArg_ParseTuple(args,(char *)"OO:python_subs_modified_end_time_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_python_subs_modified, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cc_to_python_subs_extension_set" "', argument " "1"" of type '" "struct cc_to_python_subs *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "python_subs_modified_end_time_set" "', argument " "1"" of type '" "struct python_subs_modified *""'"); } - arg1 = (struct cc_to_python_subs *)(argp1); + arg1 = (struct python_subs_modified *)(argp1); res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "cc_to_python_subs_extension_set" "', argument " "2"" of type '" "char *""'"); + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "python_subs_modified_end_time_set" "', argument " "2"" of type '" "char *""'"); } arg2 = (char *)(buf2); - if (arg1->extension) free((char*)arg1->extension); + if (arg1->end_time) free((char*)arg1->end_time); if (arg2) { size_t size = strlen((const char *)(arg2)) + 1; - arg1->extension = (char *)(char *)memcpy(malloc((size)*sizeof(char)), (const char *)(arg2), sizeof(char)*(size)); + arg1->end_time = (char *)(char *)memcpy(malloc((size)*sizeof(char)), (const char *)(arg2), sizeof(char)*(size)); } else { - arg1->extension = 0; + arg1->end_time = 0; } resultobj = SWIG_Py_Void(); if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); @@ -3901,21 +3927,21 @@ fail: } -SWIGINTERN PyObject *_wrap_cc_to_python_subs_extension_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_python_subs_modified_end_time_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; - struct cc_to_python_subs *arg1 = (struct cc_to_python_subs *) 0 ; + struct python_subs_modified *arg1 = (struct python_subs_modified *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; char *result = 0 ; - if (!PyArg_ParseTuple(args,(char *)"O:cc_to_python_subs_extension_get",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cc_to_python_subs, 0 | 0 ); + if (!PyArg_ParseTuple(args,(char *)"O:python_subs_modified_end_time_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_python_subs_modified, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cc_to_python_subs_extension_get" "', argument " "1"" of type '" "struct cc_to_python_subs *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "python_subs_modified_end_time_get" "', argument " "1"" of type '" "struct python_subs_modified *""'"); } - arg1 = (struct cc_to_python_subs *)(argp1); - result = (char *) ((arg1)->extension); + arg1 = (struct python_subs_modified *)(argp1); + result = (char *) ((arg1)->end_time); resultobj = SWIG_FromCharPtr((const char *)result); return resultobj; fail: @@ -3923,9 +3949,9 @@ fail: } -SWIGINTERN PyObject *_wrap_cc_to_python_subs_subs_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_python_subs_modified_buffer_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; - struct cc_to_python_subs *arg1 = (struct cc_to_python_subs *) 0 ; + struct python_subs_modified *arg1 = (struct python_subs_modified *) 0 ; char **arg2 = (char **) 0 ; void *argp1 = 0 ; int res1 = 0 ; @@ -3934,18 +3960,18 @@ SWIGINTERN PyObject *_wrap_cc_to_python_subs_subs_set(PyObject *SWIGUNUSEDPARM(s PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OO:cc_to_python_subs_subs_set",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cc_to_python_subs, 0 | 0 ); + if (!PyArg_ParseTuple(args,(char *)"OO:python_subs_modified_buffer_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_python_subs_modified, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cc_to_python_subs_subs_set" "', argument " "1"" of type '" "struct cc_to_python_subs *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "python_subs_modified_buffer_set" "', argument " "1"" of type '" "struct python_subs_modified *""'"); } - arg1 = (struct cc_to_python_subs *)(argp1); + arg1 = (struct python_subs_modified *)(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_p_char, 0 | 0 ); if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "cc_to_python_subs_subs_set" "', argument " "2"" of type '" "char **""'"); + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "python_subs_modified_buffer_set" "', argument " "2"" of type '" "char **""'"); } arg2 = (char **)(argp2); - if (arg1) (arg1)->subs = arg2; + if (arg1) (arg1)->buffer = arg2; resultobj = SWIG_Py_Void(); return resultobj; fail: @@ -3953,21 +3979,21 @@ fail: } -SWIGINTERN PyObject *_wrap_cc_to_python_subs_subs_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_python_subs_modified_buffer_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; - struct cc_to_python_subs *arg1 = (struct cc_to_python_subs *) 0 ; + struct python_subs_modified *arg1 = (struct python_subs_modified *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; char **result = 0 ; - if (!PyArg_ParseTuple(args,(char *)"O:cc_to_python_subs_subs_get",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cc_to_python_subs, 0 | 0 ); + if (!PyArg_ParseTuple(args,(char *)"O:python_subs_modified_buffer_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_python_subs_modified, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cc_to_python_subs_subs_get" "', argument " "1"" of type '" "struct cc_to_python_subs *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "python_subs_modified_buffer_get" "', argument " "1"" of type '" "struct python_subs_modified *""'"); } - arg1 = (struct cc_to_python_subs *)(argp1); - result = (char **) ((arg1)->subs); + arg1 = (struct python_subs_modified *)(argp1); + result = (char **) ((arg1)->buffer); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_p_char, 0 | 0 ); return resultobj; fail: @@ -3975,9 +4001,9 @@ fail: } -SWIGINTERN PyObject *_wrap_cc_to_python_subs_number_of_lines_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_python_subs_modified_g608_grid_color_count_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; - struct cc_to_python_subs *arg1 = (struct cc_to_python_subs *) 0 ; + struct python_subs_modified *arg1 = (struct python_subs_modified *) 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; @@ -3986,18 +4012,18 @@ SWIGINTERN PyObject *_wrap_cc_to_python_subs_number_of_lines_set(PyObject *SWIGU PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OO:cc_to_python_subs_number_of_lines_set",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cc_to_python_subs, 0 | 0 ); + if (!PyArg_ParseTuple(args,(char *)"OO:python_subs_modified_g608_grid_color_count_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_python_subs_modified, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cc_to_python_subs_number_of_lines_set" "', argument " "1"" of type '" "struct cc_to_python_subs *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "python_subs_modified_g608_grid_color_count_set" "', argument " "1"" of type '" "struct python_subs_modified *""'"); } - arg1 = (struct cc_to_python_subs *)(argp1); + arg1 = (struct python_subs_modified *)(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "cc_to_python_subs_number_of_lines_set" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "python_subs_modified_g608_grid_color_count_set" "', argument " "2"" of type '" "int""'"); } arg2 = (int)(val2); - if (arg1) (arg1)->number_of_lines = arg2; + if (arg1) (arg1)->g608_grid_color_count = arg2; resultobj = SWIG_Py_Void(); return resultobj; fail: @@ -4005,21 +4031,21 @@ fail: } -SWIGINTERN PyObject *_wrap_cc_to_python_subs_number_of_lines_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_python_subs_modified_g608_grid_color_count_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; - struct cc_to_python_subs *arg1 = (struct cc_to_python_subs *) 0 ; + struct python_subs_modified *arg1 = (struct python_subs_modified *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; int result; - if (!PyArg_ParseTuple(args,(char *)"O:cc_to_python_subs_number_of_lines_get",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cc_to_python_subs, 0 | 0 ); + if (!PyArg_ParseTuple(args,(char *)"O:python_subs_modified_g608_grid_color_count_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_python_subs_modified, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cc_to_python_subs_number_of_lines_get" "', argument " "1"" of type '" "struct cc_to_python_subs *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "python_subs_modified_g608_grid_color_count_get" "', argument " "1"" of type '" "struct python_subs_modified *""'"); } - arg1 = (struct cc_to_python_subs *)(argp1); - result = (int) ((arg1)->number_of_lines); + arg1 = (struct python_subs_modified *)(argp1); + result = (int) ((arg1)->g608_grid_color_count); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: @@ -4027,32 +4053,188 @@ fail: } -SWIGINTERN PyObject *_wrap_new_cc_to_python_subs(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_python_subs_modified_g608_grid_color_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; - struct cc_to_python_subs *result = 0 ; + struct python_subs_modified *arg1 = (struct python_subs_modified *) 0 ; + char **arg2 = (char **) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; - if (!PyArg_ParseTuple(args,(char *)":new_cc_to_python_subs")) SWIG_fail; - result = (struct cc_to_python_subs *)calloc(1, sizeof(struct cc_to_python_subs)); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_cc_to_python_subs, SWIG_POINTER_NEW | 0 ); + if (!PyArg_ParseTuple(args,(char *)"OO:python_subs_modified_g608_grid_color_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_python_subs_modified, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "python_subs_modified_g608_grid_color_set" "', argument " "1"" of type '" "struct python_subs_modified *""'"); + } + arg1 = (struct python_subs_modified *)(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_p_char, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "python_subs_modified_g608_grid_color_set" "', argument " "2"" of type '" "char **""'"); + } + arg2 = (char **)(argp2); + if (arg1) (arg1)->g608_grid_color = arg2; + resultobj = SWIG_Py_Void(); return resultobj; fail: return NULL; } -SWIGINTERN PyObject *_wrap_delete_cc_to_python_subs(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_python_subs_modified_g608_grid_color_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; - struct cc_to_python_subs *arg1 = (struct cc_to_python_subs *) 0 ; + struct python_subs_modified *arg1 = (struct python_subs_modified *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + char **result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:python_subs_modified_g608_grid_color_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_python_subs_modified, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "python_subs_modified_g608_grid_color_get" "', argument " "1"" of type '" "struct python_subs_modified *""'"); + } + arg1 = (struct python_subs_modified *)(argp1); + result = (char **) ((arg1)->g608_grid_color); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_p_char, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_python_subs_modified_g608_grid_font_count_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + struct python_subs_modified *arg1 = (struct python_subs_modified *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:python_subs_modified_g608_grid_font_count_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_python_subs_modified, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "python_subs_modified_g608_grid_font_count_set" "', argument " "1"" of type '" "struct python_subs_modified *""'"); + } + arg1 = (struct python_subs_modified *)(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "python_subs_modified_g608_grid_font_count_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = (int)(val2); + if (arg1) (arg1)->g608_grid_font_count = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_python_subs_modified_g608_grid_font_count_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + struct python_subs_modified *arg1 = (struct python_subs_modified *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + int result; + + if (!PyArg_ParseTuple(args,(char *)"O:python_subs_modified_g608_grid_font_count_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_python_subs_modified, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "python_subs_modified_g608_grid_font_count_get" "', argument " "1"" of type '" "struct python_subs_modified *""'"); + } + arg1 = (struct python_subs_modified *)(argp1); + result = (int) ((arg1)->g608_grid_font_count); + resultobj = SWIG_From_int((int)(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_python_subs_modified_g608_grid_font_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + struct python_subs_modified *arg1 = (struct python_subs_modified *) 0 ; + char **arg2 = (char **) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:python_subs_modified_g608_grid_font_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_python_subs_modified, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "python_subs_modified_g608_grid_font_set" "', argument " "1"" of type '" "struct python_subs_modified *""'"); + } + arg1 = (struct python_subs_modified *)(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_p_char, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "python_subs_modified_g608_grid_font_set" "', argument " "2"" of type '" "char **""'"); + } + arg2 = (char **)(argp2); + if (arg1) (arg1)->g608_grid_font = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_python_subs_modified_g608_grid_font_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + struct python_subs_modified *arg1 = (struct python_subs_modified *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + char **result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:python_subs_modified_g608_grid_font_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_python_subs_modified, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "python_subs_modified_g608_grid_font_get" "', argument " "1"" of type '" "struct python_subs_modified *""'"); + } + arg1 = (struct python_subs_modified *)(argp1); + result = (char **) ((arg1)->g608_grid_font); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_p_char, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_python_subs_modified(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + struct python_subs_modified *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)":new_python_subs_modified")) SWIG_fail; + result = (struct python_subs_modified *)calloc(1, sizeof(struct python_subs_modified)); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_python_subs_modified, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_delete_python_subs_modified(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + struct python_subs_modified *arg1 = (struct python_subs_modified *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"O:delete_cc_to_python_subs",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cc_to_python_subs, SWIG_POINTER_DISOWN | 0 ); + if (!PyArg_ParseTuple(args,(char *)"O:delete_python_subs_modified",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_python_subs_modified, SWIG_POINTER_DISOWN | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_cc_to_python_subs" "', argument " "1"" of type '" "struct cc_to_python_subs *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_python_subs_modified" "', argument " "1"" of type '" "struct python_subs_modified *""'"); } - arg1 = (struct cc_to_python_subs *)(argp1); + arg1 = (struct python_subs_modified *)(argp1); free((char *) arg1); resultobj = SWIG_Py_Void(); return resultobj; @@ -4061,10 +4243,485 @@ fail: } -SWIGINTERN PyObject *cc_to_python_subs_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *python_subs_modified_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; if (!PyArg_ParseTuple(args,(char *)"O:swigregister", &obj)) return NULL; - SWIG_TypeNewClientData(SWIGTYPE_p_cc_to_python_subs, SWIG_NewClientData(obj)); + SWIG_TypeNewClientData(SWIGTYPE_p_python_subs_modified, SWIG_NewClientData(obj)); + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject *_wrap_python_subs_array_temporary_file_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + struct python_subs_array *arg1 = (struct python_subs_array *) 0 ; + char *arg2 = (char *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:python_subs_array_temporary_file_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_python_subs_array, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "python_subs_array_temporary_file_set" "', argument " "1"" of type '" "struct python_subs_array *""'"); + } + arg1 = (struct python_subs_array *)(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "python_subs_array_temporary_file_set" "', argument " "2"" of type '" "char *""'"); + } + arg2 = (char *)(buf2); + if (arg1->temporary_file) free((char*)arg1->temporary_file); + if (arg2) { + size_t size = strlen((const char *)(arg2)) + 1; + arg1->temporary_file = (char *)(char *)memcpy(malloc((size)*sizeof(char)), (const char *)(arg2), sizeof(char)*(size)); + } else { + arg1->temporary_file = 0; + } + resultobj = SWIG_Py_Void(); + if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); + return NULL; +} + + +SWIGINTERN PyObject *_wrap_python_subs_array_temporary_file_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + struct python_subs_array *arg1 = (struct python_subs_array *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + char *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:python_subs_array_temporary_file_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_python_subs_array, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "python_subs_array_temporary_file_get" "', argument " "1"" of type '" "struct python_subs_array *""'"); + } + arg1 = (struct python_subs_array *)(argp1); + result = (char *) ((arg1)->temporary_file); + resultobj = SWIG_FromCharPtr((const char *)result); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_python_subs_array_fp_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + struct python_subs_array *arg1 = (struct python_subs_array *) 0 ; + FILE *arg2 = (FILE *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:python_subs_array_fp_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_python_subs_array, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "python_subs_array_fp_set" "', argument " "1"" of type '" "struct python_subs_array *""'"); + } + arg1 = (struct python_subs_array *)(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_FILE, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "python_subs_array_fp_set" "', argument " "2"" of type '" "FILE *""'"); + } + arg2 = (FILE *)(argp2); + if (arg1) (arg1)->fp = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_python_subs_array_fp_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + struct python_subs_array *arg1 = (struct python_subs_array *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + FILE *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:python_subs_array_fp_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_python_subs_array, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "python_subs_array_fp_get" "', argument " "1"" of type '" "struct python_subs_array *""'"); + } + arg1 = (struct python_subs_array *)(argp1); + result = (FILE *) ((arg1)->fp); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_FILE, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_python_subs_array_output_filename_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + struct python_subs_array *arg1 = (struct python_subs_array *) 0 ; + char *arg2 = (char *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:python_subs_array_output_filename_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_python_subs_array, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "python_subs_array_output_filename_set" "', argument " "1"" of type '" "struct python_subs_array *""'"); + } + arg1 = (struct python_subs_array *)(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "python_subs_array_output_filename_set" "', argument " "2"" of type '" "char *""'"); + } + arg2 = (char *)(buf2); + if (arg1->output_filename) free((char*)arg1->output_filename); + if (arg2) { + size_t size = strlen((const char *)(arg2)) + 1; + arg1->output_filename = (char *)(char *)memcpy(malloc((size)*sizeof(char)), (const char *)(arg2), sizeof(char)*(size)); + } else { + arg1->output_filename = 0; + } + resultobj = SWIG_Py_Void(); + if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); + return NULL; +} + + +SWIGINTERN PyObject *_wrap_python_subs_array_output_filename_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + struct python_subs_array *arg1 = (struct python_subs_array *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + char *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:python_subs_array_output_filename_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_python_subs_array, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "python_subs_array_output_filename_get" "', argument " "1"" of type '" "struct python_subs_array *""'"); + } + arg1 = (struct python_subs_array *)(argp1); + result = (char *) ((arg1)->output_filename); + resultobj = SWIG_FromCharPtr((const char *)result); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_python_subs_array_has_api_start_exited_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + struct python_subs_array *arg1 = (struct python_subs_array *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:python_subs_array_has_api_start_exited_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_python_subs_array, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "python_subs_array_has_api_start_exited_set" "', argument " "1"" of type '" "struct python_subs_array *""'"); + } + arg1 = (struct python_subs_array *)(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "python_subs_array_has_api_start_exited_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = (int)(val2); + if (arg1) (arg1)->has_api_start_exited = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_python_subs_array_has_api_start_exited_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + struct python_subs_array *arg1 = (struct python_subs_array *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + int result; + + if (!PyArg_ParseTuple(args,(char *)"O:python_subs_array_has_api_start_exited_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_python_subs_array, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "python_subs_array_has_api_start_exited_get" "', argument " "1"" of type '" "struct python_subs_array *""'"); + } + arg1 = (struct python_subs_array *)(argp1); + result = (int) ((arg1)->has_api_start_exited); + resultobj = SWIG_From_int((int)(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_python_subs_array_old_sub_count_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + struct python_subs_array *arg1 = (struct python_subs_array *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:python_subs_array_old_sub_count_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_python_subs_array, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "python_subs_array_old_sub_count_set" "', argument " "1"" of type '" "struct python_subs_array *""'"); + } + arg1 = (struct python_subs_array *)(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "python_subs_array_old_sub_count_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = (int)(val2); + if (arg1) (arg1)->old_sub_count = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_python_subs_array_old_sub_count_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + struct python_subs_array *arg1 = (struct python_subs_array *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + int result; + + if (!PyArg_ParseTuple(args,(char *)"O:python_subs_array_old_sub_count_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_python_subs_array, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "python_subs_array_old_sub_count_get" "', argument " "1"" of type '" "struct python_subs_array *""'"); + } + arg1 = (struct python_subs_array *)(argp1); + result = (int) ((arg1)->old_sub_count); + resultobj = SWIG_From_int((int)(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_python_subs_array_sub_count_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + struct python_subs_array *arg1 = (struct python_subs_array *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:python_subs_array_sub_count_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_python_subs_array, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "python_subs_array_sub_count_set" "', argument " "1"" of type '" "struct python_subs_array *""'"); + } + arg1 = (struct python_subs_array *)(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "python_subs_array_sub_count_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = (int)(val2); + if (arg1) (arg1)->sub_count = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_python_subs_array_sub_count_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + struct python_subs_array *arg1 = (struct python_subs_array *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + int result; + + if (!PyArg_ParseTuple(args,(char *)"O:python_subs_array_sub_count_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_python_subs_array, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "python_subs_array_sub_count_get" "', argument " "1"" of type '" "struct python_subs_array *""'"); + } + arg1 = (struct python_subs_array *)(argp1); + result = (int) ((arg1)->sub_count); + resultobj = SWIG_From_int((int)(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_python_subs_array_subs_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + struct python_subs_array *arg1 = (struct python_subs_array *) 0 ; + struct python_subs_modified *arg2 = (struct python_subs_modified *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:python_subs_array_subs_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_python_subs_array, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "python_subs_array_subs_set" "', argument " "1"" of type '" "struct python_subs_array *""'"); + } + arg1 = (struct python_subs_array *)(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_python_subs_modified, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "python_subs_array_subs_set" "', argument " "2"" of type '" "struct python_subs_modified *""'"); + } + arg2 = (struct python_subs_modified *)(argp2); + if (arg1) (arg1)->subs = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_python_subs_array_subs_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + struct python_subs_array *arg1 = (struct python_subs_array *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + struct python_subs_modified *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:python_subs_array_subs_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_python_subs_array, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "python_subs_array_subs_get" "', argument " "1"" of type '" "struct python_subs_array *""'"); + } + arg1 = (struct python_subs_array *)(argp1); + result = (struct python_subs_modified *) ((arg1)->subs); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_python_subs_modified, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_python_subs_array_is_transcript_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + struct python_subs_array *arg1 = (struct python_subs_array *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:python_subs_array_is_transcript_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_python_subs_array, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "python_subs_array_is_transcript_set" "', argument " "1"" of type '" "struct python_subs_array *""'"); + } + arg1 = (struct python_subs_array *)(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "python_subs_array_is_transcript_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = (int)(val2); + if (arg1) (arg1)->is_transcript = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_python_subs_array_is_transcript_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + struct python_subs_array *arg1 = (struct python_subs_array *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + int result; + + if (!PyArg_ParseTuple(args,(char *)"O:python_subs_array_is_transcript_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_python_subs_array, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "python_subs_array_is_transcript_get" "', argument " "1"" of type '" "struct python_subs_array *""'"); + } + arg1 = (struct python_subs_array *)(argp1); + result = (int) ((arg1)->is_transcript); + resultobj = SWIG_From_int((int)(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_python_subs_array(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + struct python_subs_array *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)":new_python_subs_array")) SWIG_fail; + result = (struct python_subs_array *)calloc(1, sizeof(struct python_subs_array)); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_python_subs_array, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_delete_python_subs_array(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + struct python_subs_array *arg1 = (struct python_subs_array *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:delete_python_subs_array",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_python_subs_array, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_python_subs_array" "', argument " "1"" of type '" "struct python_subs_array *""'"); + } + arg1 = (struct python_subs_array *)(argp1); + free((char *) arg1); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *python_subs_array_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *obj; + if (!PyArg_ParseTuple(args,(char *)"O:swigregister", &obj)) return NULL; + SWIG_TypeNewClientData(SWIGTYPE_p_python_subs_array, SWIG_NewClientData(obj)); return SWIG_Py_Void(); } @@ -4118,17 +4775,17 @@ SWIGINTERN PyObject *Swig_var_signal_ctx_get(void) { } -SWIGINTERN int Swig_var_python_subs_set(PyObject *_val) { +SWIGINTERN int Swig_var_array_set(PyObject *_val) { { void *argp = 0; - int res = SWIG_ConvertPtr(_val, &argp, SWIGTYPE_p_cc_to_python_subs, 0 ); + int res = SWIG_ConvertPtr(_val, &argp, SWIGTYPE_p_python_subs_array, 0 ); if (!SWIG_IsOK(res)) { - SWIG_exception_fail(SWIG_ArgError(res), "in variable '""python_subs""' of type '""struct cc_to_python_subs""'"); + SWIG_exception_fail(SWIG_ArgError(res), "in variable '""array""' of type '""struct python_subs_array""'"); } if (!argp) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in variable '""python_subs""' of type '""struct cc_to_python_subs""'"); + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in variable '""array""' of type '""struct python_subs_array""'"); } else { - python_subs = *((struct cc_to_python_subs *)(argp)); + array = *((struct python_subs_array *)(argp)); } } return 0; @@ -4137,10 +4794,33 @@ fail: } -SWIGINTERN PyObject *Swig_var_python_subs_get(void) { +SWIGINTERN PyObject *Swig_var_array_get(void) { PyObject *pyobj = 0; - pyobj = SWIG_NewPointerObj(SWIG_as_voidptr(&python_subs), SWIGTYPE_p_cc_to_python_subs, 0 ); + pyobj = SWIG_NewPointerObj(SWIG_as_voidptr(&array), SWIGTYPE_p_python_subs_array, 0 ); + return pyobj; +} + + +SWIGINTERN int Swig_var_signal_python_api_set(PyObject *_val) { + { + int val; + int res = SWIG_AsVal_int(_val, &val); + if (!SWIG_IsOK(res)) { + SWIG_exception_fail(SWIG_ArgError(res), "in variable '""signal_python_api""' of type '""int""'"); + } + signal_python_api = (int)(val); + } + return 0; +fail: + return 1; +} + + +SWIGINTERN PyObject *Swig_var_signal_python_api_get(void) { + PyObject *pyobj = 0; + + pyobj = SWIG_From_int((int)(signal_python_api)); return pyobj; } @@ -4384,6 +5064,18 @@ fail: } +SWIGINTERN PyObject *_wrap_show_extracted_captions_with_timings(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + + if (!PyArg_ParseTuple(args,(char *)":show_extracted_captions_with_timings")) SWIG_fail; + show_extracted_captions_with_timings(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + SWIGINTERN PyObject *_wrap_main(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; @@ -4415,12 +5107,12 @@ fail: } -SWIGINTERN PyObject *_wrap_cc_to_python_get_subs_number_of_lines(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_cc_to_python_get_old_count(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int result; - if (!PyArg_ParseTuple(args,(char *)":cc_to_python_get_subs_number_of_lines")) SWIG_fail; - result = (int)cc_to_python_get_subs_number_of_lines(); + if (!PyArg_ParseTuple(args,(char *)":cc_to_python_get_old_count")) SWIG_fail; + result = (int)cc_to_python_get_old_count(); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: @@ -4428,21 +5120,99 @@ fail: } -SWIGINTERN PyObject *_wrap_cc_to_python_get_sub(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_cc_to_python_set_old_count(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + + if (!PyArg_ParseTuple(args,(char *)":cc_to_python_set_old_count")) SWIG_fail; + cc_to_python_set_old_count(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_cc_to_python_get_number_of_subs(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int result; + + if (!PyArg_ParseTuple(args,(char *)":cc_to_python_get_number_of_subs")) SWIG_fail; + result = (int)cc_to_python_get_number_of_subs(); + resultobj = SWIG_From_int((int)(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_cc_to_python_get_modified_sub(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; int val1 ; int ecode1 = 0 ; PyObject * obj0 = 0 ; - char *result = 0 ; + struct python_subs_modified result; - if (!PyArg_ParseTuple(args,(char *)"O:cc_to_python_get_sub",&obj0)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"O:cc_to_python_get_modified_sub",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cc_to_python_get_sub" "', argument " "1"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cc_to_python_get_modified_sub" "', argument " "1"" of type '" "int""'"); } arg1 = (int)(val1); - result = (char *)cc_to_python_get_sub(arg1); + result = cc_to_python_get_modified_sub(arg1); + resultobj = SWIG_NewPointerObj((struct python_subs_modified *)memcpy((struct python_subs_modified *)calloc(1,sizeof(struct python_subs_modified)),&result,sizeof(struct python_subs_modified)), SWIGTYPE_p_python_subs_modified, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_cc_to_python_get_modified_sub_buffer_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int val1 ; + int ecode1 = 0 ; + PyObject * obj0 = 0 ; + int result; + + if (!PyArg_ParseTuple(args,(char *)"O:cc_to_python_get_modified_sub_buffer_size",&obj0)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cc_to_python_get_modified_sub_buffer_size" "', argument " "1"" of type '" "int""'"); + } + arg1 = (int)(val1); + result = (int)cc_to_python_get_modified_sub_buffer_size(arg1); + resultobj = SWIG_From_int((int)(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_cc_to_python_get_modified_sub_buffer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + char *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:cc_to_python_get_modified_sub_buffer",&obj0,&obj1)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cc_to_python_get_modified_sub_buffer" "', argument " "1"" of type '" "int""'"); + } + arg1 = (int)(val1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "cc_to_python_get_modified_sub_buffer" "', argument " "2"" of type '" "int""'"); + } + arg2 = (int)(val2); + result = (char *)cc_to_python_get_modified_sub_buffer(arg1,arg2); resultobj = SWIG_FromCharPtr((const char *)result); return resultobj; fail: @@ -4450,45 +5220,57 @@ fail: } -SWIGINTERN PyObject *_wrap___wrap_write(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_cc_to_python_get_output_filename(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; - int arg1 ; - char *arg2 = (char *) 0 ; - int arg3 ; - int val1 ; - int ecode1 = 0 ; - int res2 ; - char *buf2 = 0 ; - int alloc2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - int result; + char *result = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOO:__wrap_write",&obj0,&obj1,&obj2)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "__wrap_write" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "__wrap_write" "', argument " "2"" of type '" "char *""'"); - } - arg2 = (char *)(buf2); - ecode3 = SWIG_AsVal_int(obj2, &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "__wrap_write" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - result = (int)__wrap_write(arg1,arg2,arg3); - resultobj = SWIG_From_int((int)(result)); - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); + if (!PyArg_ParseTuple(args,(char *)":cc_to_python_get_output_filename")) SWIG_fail; + result = (char *)cc_to_python_get_output_filename(); + resultobj = SWIG_FromCharPtr((const char *)result); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_call_from_python_api(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + struct ccx_s_options *arg1 = (struct ccx_s_options *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:call_from_python_api",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ccx_s_options, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "call_from_python_api" "', argument " "1"" of type '" "struct ccx_s_options *""'"); + } + arg1 = (struct ccx_s_options *)(argp1); + call_from_python_api(arg1); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_set_pythonapi(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + struct ccx_s_options *arg1 = (struct ccx_s_options *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:set_pythonapi",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ccx_s_options, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "set_pythonapi" "', argument " "1"" of type '" "struct ccx_s_options *""'"); + } + arg1 = (struct ccx_s_options *)(argp1); + set_pythonapi(arg1); + resultobj = SWIG_Py_Void(); return resultobj; fail: - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return NULL; } @@ -4535,29 +5317,97 @@ fail: } +SWIGINTERN PyObject *_wrap_setpesheader(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + struct ccx_s_options *arg1 = (struct ccx_s_options *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:setpesheader",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ccx_s_options, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "setpesheader" "', argument " "1"" of type '" "struct ccx_s_options *""'"); + } + arg1 = (struct ccx_s_options *)(argp1); + setpesheader(arg1); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_setdebugdvbsub(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + struct ccx_s_options *arg1 = (struct ccx_s_options *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:setdebugdvbsub",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ccx_s_options, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "setdebugdvbsub" "', argument " "1"" of type '" "struct ccx_s_options *""'"); + } + arg1 = (struct ccx_s_options *)(argp1); + setdebugdvbsub(arg1); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + static PyMethodDef SwigMethods[] = { { (char *)"SWIG_PyInstanceMethod_New", (PyCFunction)SWIG_PyInstanceMethod_New, METH_O, NULL}, + { (char *)"my_pythonapi", _wrap_my_pythonapi, METH_VARARGS, NULL}, { (char *)"fdprintf", _wrap_fdprintf, METH_VARARGS, NULL}, { (char *)"millis_to_time", _wrap_millis_to_time, METH_VARARGS, NULL}, { (char *)"freep", _wrap_freep, METH_VARARGS, NULL}, { (char *)"dbg_print", _wrap_dbg_print, METH_VARARGS, NULL}, { (char *)"debug_608_to_ASC", _wrap_debug_608_to_ASC, METH_VARARGS, NULL}, { (char *)"add_cc_sub_text", _wrap_add_cc_sub_text, METH_VARARGS, NULL}, - { (char *)"cc_to_python_subs_inputfile_set", _wrap_cc_to_python_subs_inputfile_set, METH_VARARGS, NULL}, - { (char *)"cc_to_python_subs_inputfile_get", _wrap_cc_to_python_subs_inputfile_get, METH_VARARGS, NULL}, - { (char *)"cc_to_python_subs_num_input_files_set", _wrap_cc_to_python_subs_num_input_files_set, METH_VARARGS, NULL}, - { (char *)"cc_to_python_subs_num_input_files_get", _wrap_cc_to_python_subs_num_input_files_get, METH_VARARGS, NULL}, - { (char *)"cc_to_python_subs_basefilename_set", _wrap_cc_to_python_subs_basefilename_set, METH_VARARGS, NULL}, - { (char *)"cc_to_python_subs_basefilename_get", _wrap_cc_to_python_subs_basefilename_get, METH_VARARGS, NULL}, - { (char *)"cc_to_python_subs_extension_set", _wrap_cc_to_python_subs_extension_set, METH_VARARGS, NULL}, - { (char *)"cc_to_python_subs_extension_get", _wrap_cc_to_python_subs_extension_get, METH_VARARGS, NULL}, - { (char *)"cc_to_python_subs_subs_set", _wrap_cc_to_python_subs_subs_set, METH_VARARGS, NULL}, - { (char *)"cc_to_python_subs_subs_get", _wrap_cc_to_python_subs_subs_get, METH_VARARGS, NULL}, - { (char *)"cc_to_python_subs_number_of_lines_set", _wrap_cc_to_python_subs_number_of_lines_set, METH_VARARGS, NULL}, - { (char *)"cc_to_python_subs_number_of_lines_get", _wrap_cc_to_python_subs_number_of_lines_get, METH_VARARGS, NULL}, - { (char *)"new_cc_to_python_subs", _wrap_new_cc_to_python_subs, METH_VARARGS, NULL}, - { (char *)"delete_cc_to_python_subs", _wrap_delete_cc_to_python_subs, METH_VARARGS, NULL}, - { (char *)"cc_to_python_subs_swigregister", cc_to_python_subs_swigregister, METH_VARARGS, NULL}, + { (char *)"python_subs_modified_buffer_count_set", _wrap_python_subs_modified_buffer_count_set, METH_VARARGS, NULL}, + { (char *)"python_subs_modified_buffer_count_get", _wrap_python_subs_modified_buffer_count_get, METH_VARARGS, NULL}, + { (char *)"python_subs_modified_srt_counter_set", _wrap_python_subs_modified_srt_counter_set, METH_VARARGS, NULL}, + { (char *)"python_subs_modified_srt_counter_get", _wrap_python_subs_modified_srt_counter_get, METH_VARARGS, NULL}, + { (char *)"python_subs_modified_start_time_set", _wrap_python_subs_modified_start_time_set, METH_VARARGS, NULL}, + { (char *)"python_subs_modified_start_time_get", _wrap_python_subs_modified_start_time_get, METH_VARARGS, NULL}, + { (char *)"python_subs_modified_end_time_set", _wrap_python_subs_modified_end_time_set, METH_VARARGS, NULL}, + { (char *)"python_subs_modified_end_time_get", _wrap_python_subs_modified_end_time_get, METH_VARARGS, NULL}, + { (char *)"python_subs_modified_buffer_set", _wrap_python_subs_modified_buffer_set, METH_VARARGS, NULL}, + { (char *)"python_subs_modified_buffer_get", _wrap_python_subs_modified_buffer_get, METH_VARARGS, NULL}, + { (char *)"python_subs_modified_g608_grid_color_count_set", _wrap_python_subs_modified_g608_grid_color_count_set, METH_VARARGS, NULL}, + { (char *)"python_subs_modified_g608_grid_color_count_get", _wrap_python_subs_modified_g608_grid_color_count_get, METH_VARARGS, NULL}, + { (char *)"python_subs_modified_g608_grid_color_set", _wrap_python_subs_modified_g608_grid_color_set, METH_VARARGS, NULL}, + { (char *)"python_subs_modified_g608_grid_color_get", _wrap_python_subs_modified_g608_grid_color_get, METH_VARARGS, NULL}, + { (char *)"python_subs_modified_g608_grid_font_count_set", _wrap_python_subs_modified_g608_grid_font_count_set, METH_VARARGS, NULL}, + { (char *)"python_subs_modified_g608_grid_font_count_get", _wrap_python_subs_modified_g608_grid_font_count_get, METH_VARARGS, NULL}, + { (char *)"python_subs_modified_g608_grid_font_set", _wrap_python_subs_modified_g608_grid_font_set, METH_VARARGS, NULL}, + { (char *)"python_subs_modified_g608_grid_font_get", _wrap_python_subs_modified_g608_grid_font_get, METH_VARARGS, NULL}, + { (char *)"new_python_subs_modified", _wrap_new_python_subs_modified, METH_VARARGS, NULL}, + { (char *)"delete_python_subs_modified", _wrap_delete_python_subs_modified, METH_VARARGS, NULL}, + { (char *)"python_subs_modified_swigregister", python_subs_modified_swigregister, METH_VARARGS, NULL}, + { (char *)"python_subs_array_temporary_file_set", _wrap_python_subs_array_temporary_file_set, METH_VARARGS, NULL}, + { (char *)"python_subs_array_temporary_file_get", _wrap_python_subs_array_temporary_file_get, METH_VARARGS, NULL}, + { (char *)"python_subs_array_fp_set", _wrap_python_subs_array_fp_set, METH_VARARGS, NULL}, + { (char *)"python_subs_array_fp_get", _wrap_python_subs_array_fp_get, METH_VARARGS, NULL}, + { (char *)"python_subs_array_output_filename_set", _wrap_python_subs_array_output_filename_set, METH_VARARGS, NULL}, + { (char *)"python_subs_array_output_filename_get", _wrap_python_subs_array_output_filename_get, METH_VARARGS, NULL}, + { (char *)"python_subs_array_has_api_start_exited_set", _wrap_python_subs_array_has_api_start_exited_set, METH_VARARGS, NULL}, + { (char *)"python_subs_array_has_api_start_exited_get", _wrap_python_subs_array_has_api_start_exited_get, METH_VARARGS, NULL}, + { (char *)"python_subs_array_old_sub_count_set", _wrap_python_subs_array_old_sub_count_set, METH_VARARGS, NULL}, + { (char *)"python_subs_array_old_sub_count_get", _wrap_python_subs_array_old_sub_count_get, METH_VARARGS, NULL}, + { (char *)"python_subs_array_sub_count_set", _wrap_python_subs_array_sub_count_set, METH_VARARGS, NULL}, + { (char *)"python_subs_array_sub_count_get", _wrap_python_subs_array_sub_count_get, METH_VARARGS, NULL}, + { (char *)"python_subs_array_subs_set", _wrap_python_subs_array_subs_set, METH_VARARGS, NULL}, + { (char *)"python_subs_array_subs_get", _wrap_python_subs_array_subs_get, METH_VARARGS, NULL}, + { (char *)"python_subs_array_is_transcript_set", _wrap_python_subs_array_is_transcript_set, METH_VARARGS, NULL}, + { (char *)"python_subs_array_is_transcript_get", _wrap_python_subs_array_is_transcript_get, METH_VARARGS, NULL}, + { (char *)"new_python_subs_array", _wrap_new_python_subs_array, METH_VARARGS, NULL}, + { (char *)"delete_python_subs_array", _wrap_delete_python_subs_array, METH_VARARGS, NULL}, + { (char *)"python_subs_array_swigregister", python_subs_array_swigregister, METH_VARARGS, NULL}, { (char *)"api_init_options", _wrap_api_init_options, METH_VARARGS, NULL}, { (char *)"check_configuration_file", _wrap_check_configuration_file, METH_VARARGS, NULL}, { (char *)"compile_params", _wrap_compile_params, METH_VARARGS, NULL}, @@ -4568,62 +5418,79 @@ static PyMethodDef SwigMethods[] = { { (char *)"sigterm_handler", _wrap_sigterm_handler, METH_VARARGS, NULL}, { (char *)"sigint_handler", _wrap_sigint_handler, METH_VARARGS, NULL}, { (char *)"print_end_msg", _wrap_print_end_msg, METH_VARARGS, NULL}, + { (char *)"show_extracted_captions_with_timings", _wrap_show_extracted_captions_with_timings, METH_VARARGS, NULL}, { (char *)"main", _wrap_main, METH_VARARGS, NULL}, - { (char *)"cc_to_python_get_subs_number_of_lines", _wrap_cc_to_python_get_subs_number_of_lines, METH_VARARGS, NULL}, - { (char *)"cc_to_python_get_sub", _wrap_cc_to_python_get_sub, METH_VARARGS, NULL}, - { (char *)"__wrap_write", _wrap___wrap_write, METH_VARARGS, NULL}, + { (char *)"cc_to_python_get_old_count", _wrap_cc_to_python_get_old_count, METH_VARARGS, NULL}, + { (char *)"cc_to_python_set_old_count", _wrap_cc_to_python_set_old_count, METH_VARARGS, NULL}, + { (char *)"cc_to_python_get_number_of_subs", _wrap_cc_to_python_get_number_of_subs, METH_VARARGS, NULL}, + { (char *)"cc_to_python_get_modified_sub", _wrap_cc_to_python_get_modified_sub, METH_VARARGS, NULL}, + { (char *)"cc_to_python_get_modified_sub_buffer_size", _wrap_cc_to_python_get_modified_sub_buffer_size, METH_VARARGS, NULL}, + { (char *)"cc_to_python_get_modified_sub_buffer", _wrap_cc_to_python_get_modified_sub_buffer, METH_VARARGS, NULL}, + { (char *)"cc_to_python_get_output_filename", _wrap_cc_to_python_get_output_filename, METH_VARARGS, NULL}, + { (char *)"call_from_python_api", _wrap_call_from_python_api, METH_VARARGS, NULL}, + { (char *)"set_pythonapi", _wrap_set_pythonapi, METH_VARARGS, NULL}, { (char *)"setautoprogram", _wrap_setautoprogram, METH_VARARGS, NULL}, { (char *)"setstdout", _wrap_setstdout, METH_VARARGS, NULL}, + { (char *)"setpesheader", _wrap_setpesheader, METH_VARARGS, NULL}, + { (char *)"setdebugdvbsub", _wrap_setdebugdvbsub, METH_VARARGS, NULL}, { NULL, NULL, 0, NULL } }; /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */ +static swig_type_info _swigt__p_FILE = {"_p_FILE", "FILE *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_LLONG = {"_p_LLONG", "LLONG *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_cc_subtitle = {"_p_cc_subtitle", "struct cc_subtitle *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_cc_to_python_subs = {"_p_cc_to_python_subs", "struct cc_to_python_subs *|cc_to_python_subs *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_ccx_s_options = {"_p_ccx_s_options", "struct ccx_s_options *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_int = {"_p_int", "int *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_lib_ccx_ctx = {"_p_lib_ccx_ctx", "struct lib_ccx_ctx *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_p_char = {"_p_p_char", "char **", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_python_subs_array = {"_p_python_subs_array", "struct python_subs_array *|python_subs_array *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_python_subs_modified = {"_p_python_subs_modified", "struct python_subs_modified *|python_subs_modified *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "unsigned char *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_unsigned_int = {"_p_unsigned_int", "unsigned int *", 0, 0, (void*)0, 0}; static swig_type_info *swig_type_initial[] = { + &_swigt__p_FILE, &_swigt__p_LLONG, &_swigt__p_cc_subtitle, - &_swigt__p_cc_to_python_subs, &_swigt__p_ccx_s_options, &_swigt__p_char, &_swigt__p_int, &_swigt__p_lib_ccx_ctx, &_swigt__p_p_char, + &_swigt__p_python_subs_array, + &_swigt__p_python_subs_modified, &_swigt__p_unsigned_char, &_swigt__p_unsigned_int, }; +static swig_cast_info _swigc__p_FILE[] = { {&_swigt__p_FILE, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_LLONG[] = { {&_swigt__p_LLONG, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_cc_subtitle[] = { {&_swigt__p_cc_subtitle, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_cc_to_python_subs[] = { {&_swigt__p_cc_to_python_subs, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_ccx_s_options[] = { {&_swigt__p_ccx_s_options, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_int[] = { {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_lib_ccx_ctx[] = { {&_swigt__p_lib_ccx_ctx, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_p_char[] = { {&_swigt__p_p_char, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_python_subs_array[] = { {&_swigt__p_python_subs_array, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_python_subs_modified[] = { {&_swigt__p_python_subs_modified, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_unsigned_char[] = { {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_unsigned_int[] = { {&_swigt__p_unsigned_int, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info *swig_cast_initial[] = { + _swigc__p_FILE, _swigc__p_LLONG, _swigc__p_cc_subtitle, - _swigc__p_cc_to_python_subs, _swigc__p_ccx_s_options, _swigc__p_char, _swigc__p_int, _swigc__p_lib_ccx_ctx, _swigc__p_p_char, + _swigc__p_python_subs_array, + _swigc__p_python_subs_modified, _swigc__p_unsigned_char, _swigc__p_unsigned_int, }; @@ -5346,7 +6213,8 @@ SWIG_init(void) { SWIG_addvarlink(SWIG_globals(),(char *)"cc608_parity_table",Swig_var_cc608_parity_table_get, Swig_var_cc608_parity_table_set); SWIG_addvarlink(SWIG_globals(),(char *)"ccx_options",Swig_var_ccx_options_get, Swig_var_ccx_options_set); SWIG_addvarlink(SWIG_globals(),(char *)"signal_ctx",Swig_var_signal_ctx_get, Swig_var_signal_ctx_set); - SWIG_addvarlink(SWIG_globals(),(char *)"python_subs",Swig_var_python_subs_get, Swig_var_python_subs_set); + SWIG_addvarlink(SWIG_globals(),(char *)"array",Swig_var_array_get, Swig_var_array_set); + SWIG_addvarlink(SWIG_globals(),(char *)"signal_python_api",Swig_var_signal_python_api_get, Swig_var_signal_python_api_set); #if PY_VERSION_HEX >= 0x03000000 return m; #else diff --git a/api/ccx_to_python_g608.py b/api/ccx_to_python_g608.py new file mode 100644 index 00000000..b90cbc37 --- /dev/null +++ b/api/ccx_to_python_g608.py @@ -0,0 +1,61 @@ +def g608_grid_former(line,text,color,font): + if "text[" in line: + line = str(line.split(":", 1)[1]) + line = str(line.split("\n")[0]) + text.append(line) + if "color[" in line: + line = str(line.split(":", 1)[1]) + line = str(line.split("\n")[0]) + color.append(line) + if "font[" in line: + line = str(line.split(":", 1)[1]) + line = str(line.split("\n")[0]) + font.append(line) + +def return_g608_grid(case,text,color,font): + ret_val = {'text':" ",'color':" ",'font':" "} + help_string = """ + Case is the value that would give the desired output. + case = 0 --> print start_time,end_time,text,color,font + case = 1 --> print start_time,end_time,text + case = 2 --> print start_time,end_time,color + case = 3 --> print start_time,end_time,font + case = 4 --> print start_time,end_time,text,color + case = 5 --> print start_time,end_time,text,font + case = 6 --> print start_time,end_time,color,font + """ + if case==0: + if text: + ret_val['text']=text + if color: + ret_val['color']=color + if font: + ret_val['font']=font + + elif case==1: + if text: + ret_val['text']=text + elif case==2: + if color: + ret_val['color']=color + elif case==3: + if font: + ret_val['font']=font + elif case==4: + if text: + ret_val['text']=text + if color: + ret_val['color']=color + elif case==5: + if text: + ret_val['text']=text + if font: + ret_val['font']=font + elif case==6: + if color: + ret_val['color']=color + if font: + ret_val['font']=font + else: + print help_string + return ret_val diff --git a/api/extractors/extractor.c b/api/extractors/extractor.c new file mode 100644 index 00000000..a170d777 --- /dev/null +++ b/api/extractors/extractor.c @@ -0,0 +1,171 @@ +#include "extractor.h" + +/*WRITE wrapper for extracting \ + * start_time, + * end_time, + * captions + */ +void python_extract(int srt_counter, unsigned h1, unsigned m1, unsigned s1, unsigned ms1, unsigned h2, unsigned m2, unsigned s2, unsigned ms2, char* buffer){ + //check if the srt_counter value already exists + int i; + for(i=0;i adding start and end time + * identifier = 1 ---> subtitle + * identifier = 2 ---> color + * identifier = 3 ---> font + */ + //check if the caption with same start and end time already exists + int i; + char* output; + char* start_time = time_wrapper("%02u:%02u:%02u,%03u",h1,m1,s1,ms1); + char* end_time = time_wrapper("%02u:%02u:%02u,%03u",h2,m2,s2,ms2); + for(i=0;i +#include +#include "ccextractor.h" + +void python_extract(int srt_counter, unsigned h1, unsigned m1, unsigned s1, unsigned ms1, unsigned h2, unsigned m2, unsigned s2, unsigned ms2, char* buffer); +void python_extract_time_based(unsigned h1, unsigned m1, unsigned s1, unsigned ms1, unsigned h2, unsigned m2, unsigned s2, unsigned ms2, char* buffer); +void python_extract_transcript(char* buffer); +void python_extract_g608_grid(unsigned h1, unsigned m1, unsigned s1, unsigned ms1, unsigned h2, unsigned m2, unsigned s2, unsigned ms2, char* buffer, int identifier, int srt_counter); + + + diff --git a/api/python_srt_generator.py b/api/python_srt_generator.py new file mode 100644 index 00000000..57b2a12a --- /dev/null +++ b/api/python_srt_generator.py @@ -0,0 +1,78 @@ +import ccextractor as cc +import re + +def generate_file_handle(filename, mode): + fh = open(filename,mode) +# print "Creating output file: ", fh.name + return fh + +def delete_file_handle(fh): + fh.close() +## +# data would be a dictionary containg the following keys: +# text, color, font +## +def generate_output_srt_time( fh, data): + data = data.split("-") + end_time = str(data[-1].split("\n")[0]) + start_time = str(data[1].split("\t")[0]) + fh.write(start_time) + fh.write(" --> ") + fh.write(end_time) + fh.write("\n") + fh.flush() + +""" + #Handling underline + buff = "" + underline_flag = 0 + for i,font_type in enumerate(font_line): + if font_type == 'U' and not underline_flag: + buff = buff + ' ' + underline_flag = 1 + underline=1 + elif font_type =="R" and underline_flag: + buff = buff + '' + underline_flag = 0 + continue; + buff += letter[i] + #adding a new line after buff has seen underline + #need to cross check with CCExtractor output as to how they are doing + if underline: + buff+= "\n" + else: + buff="" +""" +def comparing_text_font_grids(text, font): + temp = [] + + for letter,font_line in zip(text,font): + if " " not in letter: + buff="" + underline,italics = 0,0 + #Handling italics + italics_flag = 0 + for i,font_type in enumerate(font_line): + if font_type == 'I' and not italics_flag: + buff = buff + '' + italics_flag = 1 + elif font_type =="R" and italics_flag: + buff = buff + '' + italics_flag = 0 + buff += letter[i] + temp.append(buff) + return (temp,font) + + +def generate_output_srt( fh, d): + temp = [] + d['text'],d['font']= comparing_text_font_grids(d['text'],d['font']) + for item in d['text']: + if " " not in item: + o = re.sub(r'[\x00-\x1e]',r'',item) + o = re.sub(r'\x1f[!@#$%^&*()]*', r'', o) + temp.append(o) + fh.write(o) + fh.write("\n") + fh.flush() + fh.write("\n") diff --git a/api/wrappers/wrapper.c b/api/wrappers/wrapper.c index 1096fa04..697d9e1e 100644 --- a/api/wrappers/wrapper.c +++ b/api/wrappers/wrapper.c @@ -1,5 +1,26 @@ #include "wrapper.h" +#include "ccextractor.h" +/* +output=pythonapi wrapper +*/ + +//void set_pythonapi_via_python(struct ccx_s_options *api_options, PyObject * func){ +// printf("Inside set pythonapi\n"); +// array.reporter = func; +// api_add_param(api_options,"-pythonapi"); +//} + +void set_pythonapi(struct ccx_s_options *api_options){ + api_add_param(api_options,"-pythonapi"); +} +#if defined(PYTHONAPI) +void set_pythonapi_via_python(struct ccx_s_options *api_options, PyObject * func){ + //setting the user specified callback function as a array element which would be global in C + array.reporter = func; + api_add_param(api_options,"-pythonapi"); +} +#endif /* autoprogram wrapper */ diff --git a/api/wrappers/wrapper.h b/api/wrappers/wrapper.h index 4592f7a2..e707a35c 100644 --- a/api/wrappers/wrapper.h +++ b/api/wrappers/wrapper.h @@ -1,8 +1,16 @@ #include #include "ccextractor.h" +#if defined(PYTHONAPI) +//void set_pythonapi_via_python(struct ccx_s_options *api_options); +void set_pythonapi_via_python(struct ccx_s_options *api_options, PyObject * func); +#define my_pythonapi(args, func) set_pythonapi_via_python(args, func) +#else +#define my_pythonapi(args, func) set_pythonapi(args) +#endif +void set_pythonapi(struct ccx_s_options *api_options); void setautoprogram(struct ccx_s_options *api_options); void setstdout(struct ccx_s_options *api_options); void setpesheader(struct ccx_s_options *api_options); -void setdebugdbvsub(struct ccx_s_options *api_options); +void setdebugdvbsub(struct ccx_s_options *api_options); diff --git a/gsoc/skrill/first_phase_evaluation_script b/gsoc/skrill/first_phase_evaluation_script index f308b4f1..6e7f1385 100755 --- a/gsoc/skrill/first_phase_evaluation_script +++ b/gsoc/skrill/first_phase_evaluation_script @@ -1,6 +1,6 @@ #!/bin/bash -find /vagrant/First\ phase\ evaluation/ -name '*.ts' -exec sh -c ' +find /vagrant/Second\ phase\ evaluation/ -name '*.ts' -exec sh -c ' for file do - python ../../api/api_testing.py $file + python ../../api/api_testing.py $file -quiet done ' sh {} + diff --git a/linux/build b/linux/build index 4c1f01ac..3211aa1a 100755 --- a/linux/build +++ b/linux/build @@ -10,12 +10,14 @@ SRC_GPAC="$(find ../src/gpacmp4/ -name '*.c')" SRC_HASH="$(find ../src/lib_hash/ -name '*.c')" SRC_PROTOBUF="$(find ../src/protobuf-c/ -name '*.c')" SRC_UTF8PROC="../src/utf8proc/utf8proc.c" -BLD_SOURCES="../src/ccextractor.c $SRC_CCX $SRC_GPAC $SRC_ZLIB $SRC_ZVBI $SRC_LIBPNG $SRC_HASH $SRC_PROTOBUF $SRC_UTF8PROC" +API_WRAPPERS="$(find ../api/wrappers/ -name '*.c')" +API_EXTRACTORS="$(find ../api/extractors/ -name '*.c')" +BLD_SOURCES="../src/ccextractor.c $SRC_CCX $SRC_GPAC $SRC_ZLIB $SRC_ZVBI $SRC_LIBPNG $SRC_HASH $SRC_PROTOBUF $SRC_UTF8PROC $API_WRAPPERS $API_EXTRACTORS" BLD_LINKER="-lm -zmuldefs -l tesseract -l lept" ./pre-build.sh -out=$((LC_ALL=C gcc $BLD_FLAGS $BLD_INCLUDE -o ccextractor $BLD_SOURCES $BLD_LINKER)2>&1) +out=$((LC_ALL=C gcc -g $BLD_FLAGS $BLD_INCLUDE -o ccextractor $BLD_SOURCES $BLD_LINKER)2>&1) #out=$((LC_ALL=C gcc $BLD_FLAGS $BLD_INCLUDE $WRAPPER_FLAGS -o ccextractor $BLD_SOURCES $BLD_LINKER)2>&1) res=$? if [[ $out == *"gcc: command not found"* ]] diff --git a/src/ccextractor.c b/src/ccextractor.c index a61caa4a..3d079798 100644 --- a/src/ccextractor.c +++ b/src/ccextractor.c @@ -27,7 +27,8 @@ void sigterm_handler(int sig) void sigint_handler(int sig) { - if (ccx_options.print_file_reports) + remove(array.temporary_file); + if (ccx_options.print_file_reports) print_file_report(signal_ctx); exit(EXIT_SUCCESS); @@ -376,7 +377,6 @@ int api_start(struct ccx_s_options api_options){ if(is_decoder_processed_enough(ctx) == CCX_TRUE) break; } // file loop - python_subs.extension = ctx->extension; close_input_file(ctx); free((void *) ctx->extension); @@ -409,7 +409,6 @@ int api_start(struct ccx_s_options api_options){ curl_easy_cleanup(curl); curl_global_cleanup(); #endif - python_subs.basefilename = ctx->basefilename; dinit_libraries(&ctx); if (!ret) @@ -423,10 +422,14 @@ int api_start(struct ccx_s_options api_options){ mprint("code in the MythTV's branch. Please report results to the address above. If\n"); mprint("something is broken it will be fixed. Thanks\n"); } - return ret ? EXIT_OK : EXIT_NO_CAPTIONS; + remove(array.temporary_file); + fclose(array.fp); + return ret ? EXIT_OK : EXIT_NO_CAPTIONS; } struct ccx_s_options* api_init_options(){ + array.temporary_file = "test.txt"; + array.fp = fopen("test.txt", "a"); init_options(&ccx_options); return &ccx_options; } @@ -436,30 +439,33 @@ void check_configuration_file(struct ccx_s_options api_options){ } int compile_params(struct ccx_s_options *api_options,int argc){ - api_options->python_params = realloc(api_options->python_params, (api_options->python_param_count+1) * sizeof *api_options->python_params); + //adding the parameter ./ccextractor to the list of python_params for further parsing + api_options->python_params = realloc(api_options->python_params, (api_options->python_param_count+1) * sizeof *api_options->python_params); api_options->python_params[api_options->python_param_count] = malloc(strlen("./ccextractor")+1); strcpy(api_options->python_params[api_options->python_param_count], "./ccextractor"); api_options->python_param_count++; + char* temp = api_options->python_params[api_options->python_param_count-1]; int i; for (i = api_options->python_param_count-1; i > 0; i--) api_options->python_params[i] = api_options->python_params[i-1]; api_options->python_params[0] = temp; - int ret = parse_parameters (api_options, api_options->python_param_count, api_options->python_params); - if (ret == EXIT_NO_INPUT_FILES) - { + + int ret = parse_parameters (api_options, api_options->python_param_count, api_options->python_params); + if (ret == EXIT_NO_INPUT_FILES) + { print_usage (); fatal (EXIT_NO_INPUT_FILES, "(This help screen was shown because there were no input files)\n"); - } - else if (ret == EXIT_WITH_HELP) - { + } + else if (ret == EXIT_WITH_HELP) + { return EXIT_OK; - } - else if (ret != EXIT_OK) - { + } + else if (ret != EXIT_OK) + { exit(ret); - } - return EXIT_OK; + } + return EXIT_OK; } void api_add_param(struct ccx_s_options* api_options,char* arg){ @@ -469,59 +475,175 @@ void api_add_param(struct ccx_s_options* api_options,char* arg){ api_options->python_param_count++; } +/* + * Helper function to print the i-th param submitted by the user. + * Helpful for debugging + */ char * api_param(struct ccx_s_options* api_options, int count){ return api_options->python_params[count]; } +/* + * Helper function to get the total number of params provided by the user. + * Helpful for debugging + */ int api_param_count(struct ccx_s_options* api_options){ return api_options->python_param_count; } /*subs functions*/ -int cc_to_python_get_subs_number_of_lines(){ - return python_subs.number_of_lines; -} -char* cc_to_python_get_sub(int i){ - return python_subs.subs[i]; +int cc_to_python_get_old_count(){ + return array.old_sub_count; } +void cc_to_python_set_old_count(){ + array.old_sub_count=array.sub_count; +} -/*filename functions*/ +int cc_to_python_get_number_of_subs(){ + return array.sub_count; +} + +struct python_subs_modified cc_to_python_get_modified_sub(int i){ + return array.subs[i]; +} + +int cc_to_python_get_modified_sub_buffer_size(int i){ + return array.subs[i].buffer_count; +} +char* cc_to_python_get_modified_sub_buffer(int i, int j){ + return array.subs[i].buffer[j]; +} + +char* cc_to_python_get_output_filename(){ + return array.output_filename; +} /* -char* cc_to_python_get_basefilename(){ - return python_subs.basefilename; + * asprintf alternative + * Defined only in case of windows users. + */ +#ifdef _WIN32 +int vasprintf(char **strp, const char *fmt, va_list ap) { + //_vscprintf tells you how big the buffer needs to be + int len = _vscprintf(fmt, ap); + if (len == -1) { + return -1; + } + size_t size = (size_t)len + 1; + char *str = malloc(size); + if (!str) { + return -1; + } + // _vsprintf_s is the "secure" version of vsprintf + int r = vsprintf_s(str, len + 1, fmt, ap); + if (r == -1) { + free(str); + return -1; + } + *strp = str; + return r; + } + +int asprintf(char **strp, const char *fmt, ...) { + va_list ap; + va_start(ap, fmt); + int r = vasprintf(strp, fmt, ap); + va_end(ap); + return r; } -char* cc_to_python_get_extension(){ - return python_subs.extension; +#endif +char* time_wrapper(char* fmt, unsigned h, unsigned m, unsigned s, unsigned ms){ + char * time; + asprintf(&time,fmt, h, m, s, ms); + return time; +} + + +/* + * char* time_wrapper(char* fmt, unsigned h, unsigned m, unsigned s, unsigned ms){ +int buf_len = 12; +char *x = malloc( 10* sizeof(char)); +int size = snprintf(x, 13, fmt, h, m, s, ms); +if(size >= buf_len) { + x = realloc(x,(size) * sizeof(char)); + snprintf(x, 13, fmt, h, m, s, ms); +} +printf("\n%02u:%02u:%02u,%02u\t%s\n",h,m,s,ms,x); +return x; } */ - -//int __real_write(int file_handle, char* buffer, int nbyte); -int __wrap_write(int file_handle, char* buffer, int nbyte) -{ - python_subs.number_of_lines++; - - if (python_subs.number_of_lines==1) - python_subs.subs = malloc(python_subs.number_of_lines*sizeof(char*)); - else - python_subs.subs = realloc(python_subs.subs,python_subs.number_of_lines*sizeof(char*)); - - python_subs.subs[python_subs.number_of_lines-1] = malloc((strlen(buffer)+1)*sizeof(char)); - strcpy(python_subs.subs[python_subs.number_of_lines-1],buffer); - return write(file_handle,buffer,nbyte); -// return __real_write(file_handle,buffer,nbyte); +//char* time_wrapper(const char *fmt, ...) +//{ +// int n; +// int size = 1000; // Guess we need no more than 100 bytes */ +// char *p, *np; +// va_list ap; +// if ((p = malloc(size)) == NULL) +// return NULL; +// while (1) { +// /* Try to print in the allocated space */ +// va_start(ap, fmt); +// n = vsnprintf(p, size, fmt, ap); +// va_end(ap); +// /* Check error code */ +// if (n < 0) +// return NULL; +// /* If that worked, return the string */ +// if (n < size) +// return p; +// /* Else try again with more space */ +// size = n + 1; /* Precisely what is needed */ +// if ((np = realloc (p, size)) == NULL) { +// free(p); +// return NULL; +// } +// else { +// p = np; +// } +//} +//} +void show_extracted_captions_with_timings(){ +int i; +for(i=0;isignal_python_api; + if (indicator) + signal_python_api=1; + else + signal_python_api=0; +} +#if defined(PYTHONAPI) +void run(PyObject * reporter, char * line) { + const char * s = line; + assert ( PyFunction_Check(reporter) ); + PyObject* args = PyTuple_Pack(1, PyString_FromString(s)); + PyObject_CallObject((PyObject*)reporter, args); +} +#endif int main(int argc, char* argv[]){ - int i; - struct ccx_s_options* api_options = api_init_options(); - check_configuration_file(*api_options); - for(i = 1; i < argc; i++) - api_add_param(api_options,argv[i]); - - int compile_ret = compile_params(api_options,argc); - int start_ret = api_start(*api_options); - - return start_ret; +int i; +struct ccx_s_options* api_options = api_init_options(); +check_configuration_file(*api_options); +for(i = 1; i < argc; i++) + api_add_param(api_options,argv[i]); + +int compile_ret = compile_params(api_options,argc); +call_from_python_api(api_options); +//mprint("signal_python_api = %d\n", signal_python_api); +int start_ret = api_start(*api_options); + +//uncomment the next line to check the extracted captions along with timings +// show_extracted_captions_with_timings(); +return start_ret; } diff --git a/src/ccextractor.h b/src/ccextractor.h index 67bce637..4e91bb4c 100644 --- a/src/ccextractor.h +++ b/src/ccextractor.h @@ -22,18 +22,44 @@ CURLcode res; #define LEPT_MSG_SEVERITY L_SEVERITY_NONE #endif -struct cc_to_python_subs{ - char **inputfile; // List of files to process - int num_input_files; // How many input files - char* basefilename; - char* extension; - char** subs; - int number_of_lines; +#if defined(PYTHONAPI) +#include "Python.h" +#include "funcobject.h" +#endif + +struct python_subs_modified{ + int buffer_count; + int srt_counter; + char *start_time; + char* end_time; + char** buffer; + + //g608 specific elements + int g608_grid_color_count; + char** g608_grid_color; + int g608_grid_font_count; + char** g608_grid_font; }; +struct python_subs_array{ +#if defined(PYTHONAPI) + PyObject* reporter; +#endif + char* temporary_file; + FILE *fp; + char* output_filename; + int has_api_start_exited; + int old_sub_count; + int sub_count; + struct python_subs_modified* subs; + int is_transcript; +}; + + struct ccx_s_options ccx_options; struct lib_ccx_ctx *signal_ctx; -struct cc_to_python_subs python_subs; +struct python_subs_array array; +int signal_python_api; // 1 symbolises that python wrapper made the call. //volatile int terminate_asap = 0; struct ccx_s_options* api_init_options(); @@ -47,14 +73,20 @@ char * api_param(struct ccx_s_options* api_options, int count); void sigterm_handler(int sig); void sigint_handler(int sig); void print_end_msg(void); + +void show_extracted_captions_with_timings(); int main(int argc, char *argv[]); -int cc_to_python_get_subs_number_of_lines(); -char* cc_to_python_get_sub(int i); +int cc_to_python_get_old_count(); +void cc_to_python_set_old_count(); +int cc_to_python_get_number_of_subs(); +struct python_subs_modified cc_to_python_get_modified_sub(int i); +int cc_to_python_get_modified_sub_buffer_size(int i); +char* cc_to_python_get_modified_sub_buffer(int i, int j); +char* cc_to_python_get_output_filename(); -//char* cc_to_python_get_basefilename(); -//char* cc_to_python_get_extension(); - -//int __real_write(int file_handle, char* buffer, int nbyte); -int __wrap_write(int file_handle, char* buffer, int nbyte); +void call_from_python_api(struct ccx_s_options *api_options); +#if defined(PYTHONAPI) +void run(PyObject * reporter, char * line); +#endif #endif //CCEXTRACTOR_H diff --git a/src/lib_ccx/ccx_common_option.h b/src/lib_ccx/ccx_common_option.h index e3c6969a..ef2e1ecc 100644 --- a/src/lib_ccx/ccx_common_option.h +++ b/src/lib_ccx/ccx_common_option.h @@ -197,6 +197,7 @@ struct ccx_s_options // Options from user parameters #endif char** python_params; // An array of strings to store the params supplied in the python processing int python_param_count; // Count of the total number of params passed via python bindings + int signal_python_api; // 1 symbolises that python wrapper made the call. }; extern struct ccx_s_options ccx_options; diff --git a/src/lib_ccx/ccx_decoders_708_output.c b/src/lib_ccx/ccx_decoders_708_output.c index 65c8c60b..1fd2fb60 100644 --- a/src/lib_ccx/ccx_decoders_708_output.c +++ b/src/lib_ccx/ccx_decoders_708_output.c @@ -185,13 +185,13 @@ void _dtvcc_write_row(ccx_dtvcc_writer_ctx *writer, ccx_dtvcc_service_decoder *d ccx_common_logging.log_ftn("[CEA-708] _dtvcc_write_row: " "conversion failed: %s\n", strerror(errno)); - __wrap_write(fd, encoded_buf_start, encoded_buf - encoded_buf_start); + write(fd, encoded_buf_start, encoded_buf - encoded_buf_start); free(encoded_buf_start); } else { - __wrap_write(fd, buf, buf_len); + write(fd, buf, buf_len); } } @@ -215,18 +215,18 @@ void ccx_dtvcc_write_srt(ccx_dtvcc_writer_ctx *writer, ccx_dtvcc_service_decoder "%02u:%02u:%02u,%03u", buf + strlen(buf)); sprintf(buf + strlen(buf),"%s", (char *) encoder->encoded_crlf); - __wrap_write(encoder->dtvcc_writers[tv->service_number - 1].fd, buf, strlen(buf)); + write(encoder->dtvcc_writers[tv->service_number - 1].fd, buf, strlen(buf)); for (int i = 0; i < CCX_DTVCC_SCREENGRID_ROWS; i++) { if (!_dtvcc_is_row_empty(tv, i)) { _dtvcc_write_row(writer, decoder, i, encoder, 1); - __wrap_write(encoder->dtvcc_writers[tv->service_number - 1].fd, + write(encoder->dtvcc_writers[tv->service_number - 1].fd, encoder->encoded_crlf, encoder->encoded_crlf_length); } } - __wrap_write(encoder->dtvcc_writers[tv->service_number - 1].fd, + write(encoder->dtvcc_writers[tv->service_number - 1].fd, encoder->encoded_crlf, encoder->encoded_crlf_length); } @@ -284,10 +284,10 @@ void ccx_dtvcc_write_transcript(ccx_dtvcc_writer_ctx *writer, ccx_dtvcc_service_ sprintf(buf + strlen(buf), "POP|"); //TODO caption mode(pop, rollup, etc.) if (strlen(buf)) - __wrap_write(encoder->dtvcc_writers[tv->service_number - 1].fd, buf, strlen(buf)); + write(encoder->dtvcc_writers[tv->service_number - 1].fd, buf, strlen(buf)); _dtvcc_write_row(writer, decoder, i, encoder, 0); - __wrap_write(encoder->dtvcc_writers[tv->service_number - 1].fd, + write(encoder->dtvcc_writers[tv->service_number - 1].fd, encoder->encoded_crlf, encoder->encoded_crlf_length); } } @@ -315,15 +315,15 @@ void _dtvcc_write_sami_header(dtvcc_tv_screen *tv, struct encoder_ctx *encoder) buf_len += sprintf(buf + buf_len, "%s%s", encoder->encoded_crlf, encoder->encoded_crlf); buf_len += sprintf(buf + buf_len, "%s", encoder->encoded_crlf); - __wrap_write(encoder->dtvcc_writers[tv->service_number - 1].fd, buf, buf_len); + write(encoder->dtvcc_writers[tv->service_number - 1].fd, buf, buf_len); } void _dtvcc_write_sami_footer(dtvcc_tv_screen *tv, struct encoder_ctx *encoder) { char *buf = (char *) encoder->buffer; sprintf(buf, ""); - __wrap_write(encoder->dtvcc_writers[tv->service_number - 1].fd, buf, strlen(buf)); - __wrap_write(encoder->dtvcc_writers[tv->service_number - 1].fd, + write(encoder->dtvcc_writers[tv->service_number - 1].fd, buf, strlen(buf)); + write(encoder->dtvcc_writers[tv->service_number - 1].fd, encoder->encoded_crlf, encoder->encoded_crlf_length); } @@ -345,16 +345,16 @@ void ccx_dtvcc_write_sami(ccx_dtvcc_writer_ctx *writer, ccx_dtvcc_service_decode sprintf(buf, "

%s", (unsigned long long) tv->time_ms_show + encoder->subs_delay, encoder->encoded_crlf); - __wrap_write(encoder->dtvcc_writers[tv->service_number - 1].fd, buf, strlen(buf)); + write(encoder->dtvcc_writers[tv->service_number - 1].fd, buf, strlen(buf)); for (int i = 0; i < CCX_DTVCC_SCREENGRID_ROWS; i++) { if (!_dtvcc_is_row_empty(tv, i)) { _dtvcc_write_row(writer, decoder, i, encoder, 1); - __wrap_write(encoder->dtvcc_writers[tv->service_number - 1].fd, + write(encoder->dtvcc_writers[tv->service_number - 1].fd, encoder->encoded_br, encoder->encoded_br_length); - __wrap_write(encoder->dtvcc_writers[tv->service_number - 1].fd, + write(encoder->dtvcc_writers[tv->service_number - 1].fd, encoder->encoded_crlf, encoder->encoded_crlf_length); } } @@ -362,7 +362,7 @@ void ccx_dtvcc_write_sami(ccx_dtvcc_writer_ctx *writer, ccx_dtvcc_service_decode sprintf(buf, "

 

%s%s", (unsigned long long) tv->time_ms_hide + encoder->subs_delay, encoder->encoded_crlf, encoder->encoded_crlf); - __wrap_write(encoder->dtvcc_writers[tv->service_number - 1].fd, buf, strlen(buf)); + write(encoder->dtvcc_writers[tv->service_number - 1].fd, buf, strlen(buf)); } void _ccx_dtvcc_write(ccx_dtvcc_writer_ctx *writer, ccx_dtvcc_service_decoder *decoder, struct encoder_ctx *encoder) @@ -480,7 +480,7 @@ void ccx_dtvcc_writer_output(ccx_dtvcc_writer_ctx *writer, ccx_dtvcc_service_dec CCX_COMMON_EXIT_FILE_CREATION_FAILED, "[CEA-708] Failed to open a file\n"); } if (!encoder->no_bom) - __wrap_write(writer->fd, UTF8_BOM, sizeof(UTF8_BOM)); + write(writer->fd, UTF8_BOM, sizeof(UTF8_BOM)); } _ccx_dtvcc_write(writer, decoder, encoder); diff --git a/src/lib_ccx/ccx_decoders_common.c b/src/lib_ccx/ccx_decoders_common.c index 05551f67..b4c30274 100644 --- a/src/lib_ccx/ccx_decoders_common.c +++ b/src/lib_ccx/ccx_decoders_common.c @@ -558,4 +558,4 @@ void free_subtitle(struct cc_subtitle* sub) freep(&sub->data); freep(&sub); -} \ No newline at end of file +} diff --git a/src/lib_ccx/ccx_encoders_common.c b/src/lib_ccx/ccx_encoders_common.c index 42f5104f..6d6b9eef 100644 --- a/src/lib_ccx/ccx_encoders_common.c +++ b/src/lib_ccx/ccx_encoders_common.c @@ -9,7 +9,7 @@ #include "ccx_decoders_708_output.h" #include "ccx_encoders_xds.h" #include "ccx_encoders_helpers.h" - +#include "../ccextractor.h" #ifdef ENABLE_SHARING #include "ccx_share.h" #endif //ENABLE_SHARING @@ -353,7 +353,7 @@ int write_subtitle_file_footer(struct encoder_ctx *ctx,struct ccx_s_write *out) dbg_print(CCX_DMT_DECODER_608, "\r%s\n", str); } used = encode_line (ctx, ctx->buffer,(unsigned char *) str); - ret = __wrap_write(out->fh, ctx->buffer, used); + ret = write(out->fh, ctx->buffer, used); if (ret != used) { mprint("WARNING: loss of data\n"); @@ -366,7 +366,7 @@ int write_subtitle_file_footer(struct encoder_ctx *ctx,struct ccx_s_write *out) dbg_print(CCX_DMT_DECODER_608, "\r%s\n", str); } used = encode_line (ctx, ctx->buffer,(unsigned char *) str); - ret = __wrap_write (out->fh, ctx->buffer, used); + ret = write (out->fh, ctx->buffer, used); if (ret != used) { mprint("WARNING: loss of data\n"); @@ -382,7 +382,7 @@ int write_subtitle_file_footer(struct encoder_ctx *ctx,struct ccx_s_write *out) dbg_print(CCX_DMT_DECODER_608, "\r%s\n", str); } used = encode_line (ctx, ctx->buffer,(unsigned char *) str); - ret = __wrap_write (out->fh, ctx->buffer, used); + ret = write (out->fh, ctx->buffer, used); if (ret != used) { mprint("WARNING: loss of data\n"); @@ -401,7 +401,7 @@ static int write_bom(struct encoder_ctx *ctx, struct ccx_s_write *out) int ret = 0; if (!ctx->no_bom){ if (ctx->encoding == CCX_ENC_UTF_8){ // Write BOM - ret = __wrap_write(out->fh, UTF8_BOM, sizeof(UTF8_BOM)); + ret = write(out->fh, UTF8_BOM, sizeof(UTF8_BOM)); if ( ret < sizeof(UTF8_BOM)) { mprint("WARNING: Unable tp write UTF BOM\n"); return -1; @@ -409,7 +409,7 @@ static int write_bom(struct encoder_ctx *ctx, struct ccx_s_write *out) } if (ctx->encoding == CCX_ENC_UNICODE){ // Write BOM - ret = __wrap_write(out->fh, LITTLE_ENDIAN_BOM, sizeof(LITTLE_ENDIAN_BOM)); + ret = write(out->fh, LITTLE_ENDIAN_BOM, sizeof(LITTLE_ENDIAN_BOM)); if ( ret < sizeof(LITTLE_ENDIAN_BOM)) { mprint("WARNING: Unable to write LITTLE_ENDIAN_BOM \n"); return -1; @@ -437,7 +437,7 @@ static int write_subtitle_file_header(struct encoder_ctx *ctx, struct ccx_s_writ return -1; REQUEST_BUFFER_CAPACITY(ctx,strlen (ssa_header)*3); used = encode_line (ctx, ctx->buffer,(unsigned char *) ssa_header); - ret = __wrap_write (out->fh, ctx->buffer, used); + ret = write (out->fh, ctx->buffer, used); if(ret < used) { mprint("WARNING: Unable to write complete Buffer \n"); @@ -463,7 +463,7 @@ static int write_subtitle_file_header(struct encoder_ctx *ctx, struct ccx_s_writ { used = encode_line (ctx, ctx->buffer,(unsigned char *) webvtt_header[i]); } - ret = __wrap_write (out->fh, ctx->buffer,used); + ret = write (out->fh, ctx->buffer,used); if(ret < used) { mprint("WARNING: Unable to write complete Buffer \n"); @@ -478,7 +478,7 @@ static int write_subtitle_file_header(struct encoder_ctx *ctx, struct ccx_s_writ return -1; REQUEST_BUFFER_CAPACITY(ctx,strlen (sami_header)*3); used = encode_line (ctx, ctx->buffer,(unsigned char *) sami_header); - ret = __wrap_write (out->fh, ctx->buffer, used); + ret = write (out->fh, ctx->buffer, used); if(ret < used) { mprint("WARNING: Unable to write complete Buffer \n"); @@ -492,7 +492,7 @@ static int write_subtitle_file_header(struct encoder_ctx *ctx, struct ccx_s_writ return -1; REQUEST_BUFFER_CAPACITY(ctx,strlen (smptett_header)*3); used=encode_line (ctx, ctx->buffer,(unsigned char *) smptett_header); - ret = __wrap_write(out->fh, ctx->buffer, used); + ret = write(out->fh, ctx->buffer, used); if(ret < used) { mprint("WARNING: Unable to write complete Buffer \n"); @@ -506,7 +506,7 @@ static int write_subtitle_file_header(struct encoder_ctx *ctx, struct ccx_s_writ net_send_header(rcwt_header, sizeof(rcwt_header)); else { - ret = __wrap_write(out->fh, rcwt_header, sizeof(rcwt_header)); + ret = write(out->fh, rcwt_header, sizeof(rcwt_header)); if(ret < 0) { mprint("Unable to write rcwt header\n"); @@ -516,7 +516,7 @@ static int write_subtitle_file_header(struct encoder_ctx *ctx, struct ccx_s_writ break; case CCX_OF_RAW: - ret = __wrap_write(out->fh,BROADCAST_HEADER, sizeof(BROADCAST_HEADER)); + ret = write(out->fh,BROADCAST_HEADER, sizeof(BROADCAST_HEADER)); if(ret < sizeof(BROADCAST_HEADER)) { mprint("Unable to write Raw header\n"); @@ -539,7 +539,7 @@ static int write_subtitle_file_header(struct encoder_ctx *ctx, struct ccx_s_writ return -1; REQUEST_BUFFER_CAPACITY(ctx,strlen (simple_xml_header)*3); used=encode_line (ctx, ctx->buffer,(unsigned char *) simple_xml_header); - ret = __wrap_write(out->fh, ctx->buffer, used); + ret = write(out->fh, ctx->buffer, used); if(ret < used) { mprint("WARNING: Unable to write complete Buffer \n"); @@ -574,7 +574,7 @@ int write_cc_subtitle_as_simplexml(struct cc_subtitle *sub, struct encoder_ctx * { continue; } - ret = __wrap_write(context->out->fh, context->encoded_crlf, context->encoded_crlf_length); + ret = write(context->out->fh, context->encoded_crlf, context->encoded_crlf_length); if(ret < context->encoded_crlf_length) { mprint("Warning:Loss of data\n"); @@ -610,14 +610,14 @@ void write_cc_line_as_simplexml(struct eia608_screen *data, struct encoder_ctx * length = get_str_basic (context->subline, data->characters[line_number], context->trim_subs, CCX_ENC_ASCII, context->encoding, CCX_DECODER_608_SCREEN_WIDTH); - ret = __wrap_write(context->out->fh, cap, strlen(cap)); - ret = __wrap_write(context->out->fh, context->subline, length); + ret = write(context->out->fh, cap, strlen(cap)); + ret = write(context->out->fh, context->subline, length); if(ret < length) { mprint("Warning:Loss of data\n"); } - ret = __wrap_write(context->out->fh, cap1, strlen(cap1)); - ret = __wrap_write(context->out->fh, context->encoded_crlf, context->encoded_crlf_length); + ret = write(context->out->fh, cap1, strlen(cap1)); + ret = write(context->out->fh, context->encoded_crlf, context->encoded_crlf_length); } @@ -781,7 +781,6 @@ static int init_output_ctx(struct encoder_ctx *ctx, struct encoder_cfg *cfg) char *basefilename = NULL; // Input filename without the extension char *extension = NULL; // Input filename without the extension - #define check_ret(filename) if (ret != EXIT_OK) \ { \ fatal(CCX_COMMON_EXIT_FILE_CREATION_FAILED,"Failed to open output file: %s\nDetails : %s\n", filename, strerror(errno)); \ @@ -826,9 +825,8 @@ static int init_output_ctx(struct encoder_ctx *ctx, struct encoder_cfg *cfg) } else if (cfg->write_format != CCX_OF_NULL) { - basefilename = get_basename(ctx->first_input_file); - extension = get_file_extension(cfg->write_format); - + basefilename = get_basename(ctx->first_input_file); + extension = get_file_extension(cfg->write_format); if (basefilename == NULL) { basefilename = get_basename("untitled"); @@ -1054,7 +1052,7 @@ void set_encoder_rcwt_fileformat(struct encoder_ctx *ctx, short int format) static int write_newline(struct encoder_ctx *ctx, int lang) { - return __wrap_write(ctx->out[lang].fh, ctx->encoded_crlf, ctx->encoded_crlf_length); + return write(ctx->out[lang].fh, ctx->encoded_crlf, ctx->encoded_crlf_length); } struct ccx_s_write *get_output_ctx(struct encoder_ctx *ctx, int lan) @@ -1111,7 +1109,7 @@ int encode_sub(struct encoder_ctx *context, struct cc_subtitle *sub) xds_write_transcript_line_prefix(context, out, data->start_time, data->end_time, data->cur_xds_packet_class); if (data->xds_len > 0) { - ret = __wrap_write(out->fh, data->xds_str, data->xds_len); + ret = write(out->fh, data->xds_str, data->xds_len); if (ret < data->xds_len) { mprint("WARNING:Loss of data\n"); @@ -1131,8 +1129,12 @@ int encode_sub(struct encoder_ctx *context, struct cc_subtitle *sub) data->end_time += utc_refvalue * 1000; } - switch (context->write_format) - { + //making a call to python_encoder so that if the call is from the api, no output is generated. + if (signal_python_api) + wrote_something = pass_cc_buffer_to_python(data, context); + else { + switch (context->write_format) + { case CCX_OF_SRT: if (!context->startcredits_displayed && context->start_credits_text != NULL) try_to_add_start_credits(context, data->start_time); @@ -1182,7 +1184,8 @@ int encode_sub(struct encoder_ctx *context, struct cc_subtitle *sub) break; default: break; - } + } + } if (wrote_something) context->last_displayed_subs_ms = data->end_time; @@ -1200,7 +1203,7 @@ int encode_sub(struct encoder_ctx *context, struct cc_subtitle *sub) try_to_add_start_credits(context, sub->start_time); wrote_something = write_cc_bitmap_as_srt(sub, context); break; - case CCX_OF_SSA: + case CCX_OF_SSA: if (!context->startcredits_displayed && context->start_credits_text != NULL) try_to_add_start_credits(context, sub->start_time); wrote_something = write_cc_bitmap_as_ssa(sub, context); @@ -1245,7 +1248,7 @@ int encode_sub(struct encoder_ctx *context, struct cc_subtitle *sub) net_send_header(sub->data, sub->nb_data); else { - ret = __wrap_write(context->out->fh, sub->data, sub->nb_data); + ret = write(context->out->fh, sub->data, sub->nb_data); if (ret < sub->nb_data) { mprint("WARNING: Loss of data\n"); } @@ -1351,3 +1354,63 @@ void write_cc_buffer_to_gui(struct eia608_screen *data, struct encoder_ctx *cont } fflush(stderr); } + +unsigned int get_line_encoded(struct encoder_ctx *ctx, unsigned char *buffer, int line_num, struct eia608_screen *data) +{ + unsigned char *orig = buffer; // Keep for debugging + unsigned char *line = data->characters[line_num]; + for (int i = 0; i < 32; i++) + { + int bytes = 0; + switch (ctx->encoding) + { + case CCX_ENC_UTF_8: + bytes = get_char_in_utf_8(buffer, line[i]); + break; + case CCX_ENC_LATIN_1: + get_char_in_latin_1(buffer, line[i]); + bytes = 1; + break; + case CCX_ENC_UNICODE: + get_char_in_unicode(buffer, line[i]); + bytes = 2; + case CCX_ENC_ASCII: + *buffer = line[i]; + bytes = 1; + break; + } + buffer += bytes; + } + return (unsigned int)(buffer - orig); // Return length +} +unsigned int get_color_encoded(struct encoder_ctx *ctx, unsigned char *buffer, int line_num, struct eia608_screen *data) +{ + unsigned char *orig = buffer; // Keep for debugging + for (int i = 0; i < 32; i++) + { + if (data->colors[line_num][i] < 10) + *buffer++ = data->colors[line_num][i] + '0'; + else + *buffer++ = 'E'; + } + *buffer = 0; + return (unsigned)(buffer - orig); // Return length +} +unsigned int get_font_encoded(struct encoder_ctx *ctx, unsigned char *buffer, int line_num, struct eia608_screen *data) +{ + unsigned char *orig = buffer; // Keep for debugging + for (int i = 0; i < 32; i++) + { + if(data->fonts[line_num][i] == FONT_REGULAR) + *buffer++ = 'R'; + else if(data->fonts[line_num][i] == FONT_UNDERLINED_ITALICS) + *buffer++ = 'B'; + else if(data->fonts[line_num][i] == FONT_UNDERLINED) + *buffer++ = 'U'; + else if(data->fonts[line_num][i] == FONT_ITALICS) + *buffer++ = 'I'; + else + *buffer++ = 'E'; + } + return (unsigned)(buffer - orig); // Return length +} diff --git a/src/lib_ccx/ccx_encoders_common.h b/src/lib_ccx/ccx_encoders_common.h index 384a7b67..14cd3e86 100644 --- a/src/lib_ccx/ccx_encoders_common.h +++ b/src/lib_ccx/ccx_encoders_common.h @@ -214,4 +214,10 @@ int reset_output_ctx(struct encoder_ctx *ctx, struct encoder_cfg *cfg); void find_limit_characters(unsigned char *line, int *first_non_blank, int *last_non_blank, int max_len); int get_str_basic(unsigned char *out_buffer, unsigned char *in_buffer, int trim_subs, enum ccx_encoding_type in_enc, enum ccx_encoding_type out_enc, int max_len); + + +unsigned int get_line_encoded(struct encoder_ctx *ctx, unsigned char *buffer, int line_num, struct eia608_screen *data); +unsigned int get_color_encoded(struct encoder_ctx *ctx, unsigned char *buffer, int line_num, struct eia608_screen *data); +unsigned int get_font_encoded(struct encoder_ctx *ctx, unsigned char *buffer, int line_num, struct eia608_screen *data); +int pass_cc_buffer_to_python(struct eia608_screen *data, struct encoder_ctx *context); #endif diff --git a/src/lib_ccx/ccx_encoders_g608.c b/src/lib_ccx/ccx_encoders_g608.c index 39357e49..7cbea297 100644 --- a/src/lib_ccx/ccx_encoders_g608.c +++ b/src/lib_ccx/ccx_encoders_g608.c @@ -1,66 +1,8 @@ #include "lib_ccx.h" +#include "../ccextractor.h" #include "ccx_encoders_common.h" #include "ccx_encoders_helpers.h" -static unsigned int get_line_encoded(struct encoder_ctx *ctx, unsigned char *buffer, int line_num, struct eia608_screen *data) -{ - unsigned char *orig = buffer; // Keep for debugging - unsigned char *line = data->characters[line_num]; - for (int i = 0; i < 32; i++) - { - int bytes = 0; - switch (ctx->encoding) - { - case CCX_ENC_UTF_8: - bytes = get_char_in_utf_8(buffer, line[i]); - break; - case CCX_ENC_LATIN_1: - get_char_in_latin_1(buffer, line[i]); - bytes = 1; - break; - case CCX_ENC_UNICODE: - get_char_in_unicode(buffer, line[i]); - bytes = 2; - case CCX_ENC_ASCII: - *buffer = line[i]; - bytes = 1; - break; - } - buffer += bytes; - } - return (unsigned int)(buffer - orig); // Return length -} -static unsigned int get_color_encoded(struct encoder_ctx *ctx, unsigned char *buffer, int line_num, struct eia608_screen *data) -{ - unsigned char *orig = buffer; // Keep for debugging - for (int i = 0; i < 32; i++) - { - if (data->colors[line_num][i] < 10) - *buffer++ = data->colors[line_num][i] + '0'; - else - *buffer++ = 'E'; - } - *buffer = 0; - return (unsigned)(buffer - orig); // Return length -} -static unsigned int get_font_encoded(struct encoder_ctx *ctx, unsigned char *buffer, int line_num, struct eia608_screen *data) -{ - unsigned char *orig = buffer; // Keep for debugging - for (int i = 0; i < 32; i++) - { - if(data->fonts[line_num][i] == FONT_REGULAR) - *buffer++ = 'R'; - else if(data->fonts[line_num][i] == FONT_UNDERLINED_ITALICS) - *buffer++ = 'B'; - else if(data->fonts[line_num][i] == FONT_UNDERLINED) - *buffer++ = 'U'; - else if(data->fonts[line_num][i] == FONT_ITALICS) - *buffer++ = 'I'; - else - *buffer++ = 'E'; - } - return (unsigned)(buffer - orig); // Return length -} int write_cc_buffer_as_g608(struct eia608_screen *data, struct encoder_ctx *context) { int used; @@ -82,28 +24,42 @@ int write_cc_buffer_as_g608(struct eia608_screen *data, struct encoder_ctx *cont context->srt_counter++; sprintf(timeline, "%u%s", context->srt_counter, context->encoded_crlf); used = encode_line(context, context->buffer,(unsigned char *) timeline); - __wrap_write(context->out->fh, context->buffer, used); + if (!signal_python_api) + write(context->out->fh, context->buffer, used); sprintf (timeline, "%02u:%02u:%02u,%03u --> %02u:%02u:%02u,%03u%s", h1, m1, s1, ms1, h2, m2, s2, ms2, context->encoded_crlf); used = encode_line(context, context->buffer,(unsigned char *) timeline); - __wrap_write (context->out->fh, context->buffer, used); - + if (!signal_python_api) + write (context->out->fh, context->buffer, used); + if (signal_python_api) + python_extract_g608_grid(h1,m1,s1,ms1,h2,m2,s2,ms2,context->buffer,0); for (int i=0;i<15;i++) { int length = get_line_encoded (context, context->subline, i, data); - __wrap_write(context->out->fh, context->subline, length); + if (!signal_python_api) + write(context->out->fh, context->subline, length); + if (signal_python_api) + python_extract_g608_grid(h1,m1,s1,ms1,h2,m2,s2,ms2,context->subline,1); length = get_color_encoded (context, context->subline, i, data); - __wrap_write(context->out->fh, context->subline, length); + if (!signal_python_api) + write(context->out->fh, context->subline, length); + if (signal_python_api) + python_extract_g608_grid(h1,m1,s1,ms1,h2,m2,s2,ms2,context->subline,2); length = get_font_encoded (context, context->subline, i, data); - __wrap_write(context->out->fh, context->subline, length); - __wrap_write(context->out->fh, context->encoded_crlf, context->encoded_crlf_length); + if (!signal_python_api) + write(context->out->fh, context->subline, length); + if (signal_python_api) + python_extract_g608_grid(h1,m1,s1,ms1,h2,m2,s2,ms2,context->subline,3); + if (!signal_python_api) + write(context->out->fh, context->encoded_crlf, context->encoded_crlf_length); wrote_something=1; } - __wrap_write (context->out->fh, context->encoded_crlf, context->encoded_crlf_length); + if (!signal_python_api) + write (context->out->fh, context->encoded_crlf, context->encoded_crlf_length); return wrote_something; } diff --git a/src/lib_ccx/ccx_encoders_python.c b/src/lib_ccx/ccx_encoders_python.c new file mode 100644 index 00000000..33ed5b92 --- /dev/null +++ b/src/lib_ccx/ccx_encoders_python.c @@ -0,0 +1,47 @@ +#include "lib_ccx.h" +#include "../ccextractor.h" +#include "ccx_encoders_common.h" +#include "ccx_encoders_helpers.h" + +int pass_cc_buffer_to_python(struct eia608_screen *data, struct encoder_ctx *context) +{ + int used; + unsigned h1,m1,s1,ms1; + unsigned h2,m2,s2,ms2; + LLONG ms_start, ms_end; + int wrote_something = 0; + ms_start = data->start_time; + + ms_start+=context->subs_delay; + if (ms_start<0) // Drop screens that because of subs_delay start too early + return 0; + + ms_end = data->end_time; + + millis_to_time (ms_start,&h1,&m1,&s1,&ms1); + millis_to_time (ms_end-1,&h2,&m2,&s2,&ms2); // -1 To prevent overlapping with next line. + char timeline[128]; + context->srt_counter++; + sprintf(timeline, "%u%s", context->srt_counter, context->encoded_crlf); + used = encode_line(context, context->buffer,(unsigned char *) timeline); + sprintf (timeline, "%02u:%02u:%02u,%03u --> %02u:%02u:%02u,%03u%s", + h1, m1, s1, ms1, h2, m2, s2, ms2, context->encoded_crlf); + used = encode_line(context, context->buffer,(unsigned char *) timeline); + + + python_extract_g608_grid(h1,m1,s1,ms1,h2,m2,s2,ms2,context->buffer,0,context->srt_counter); + for (int i=0;i<15;i++) + { + int length = get_line_encoded (context, context->subline, i, data); + python_extract_g608_grid(h1,m1,s1,ms1,h2,m2,s2,ms2,context->subline,1,context->srt_counter); + + length = get_color_encoded (context, context->subline, i, data); + python_extract_g608_grid(h1,m1,s1,ms1,h2,m2,s2,ms2,context->subline,2,context->srt_counter); + + length = get_font_encoded (context, context->subline, i, data); + python_extract_g608_grid(h1,m1,s1,ms1,h2,m2,s2,ms2,context->subline,3,context->srt_counter); + wrote_something=1; + } + python_extract_g608_grid(h1,m1,s1,ms1,h2,m2,s2,ms2,context->subline,4,context->srt_counter); + return wrote_something; +} diff --git a/src/lib_ccx/ccx_encoders_sami.c b/src/lib_ccx/ccx_encoders_sami.c index d6913047..41c76aeb 100644 --- a/src/lib_ccx/ccx_encoders_sami.c +++ b/src/lib_ccx/ccx_encoders_sami.c @@ -23,7 +23,7 @@ int write_stringz_as_sami(char *string, struct encoder_ctx *context, LLONG ms_st } used = encode_line(context, context->buffer, (unsigned char *) str); - ret = __wrap_write (context->out->fh, context->buffer, used); + ret = write (context->out->fh, context->buffer, used); if(ret != used) { return ret; @@ -74,15 +74,15 @@ int write_stringz_as_sami(char *string, struct encoder_ctx *context, LLONG ms_st dbg_print(CCX_DMT_DECODER_608, "\r"); dbg_print(CCX_DMT_DECODER_608, "%s\n",context->subline); } - ret = __wrap_write(context->out->fh, el, u); + ret = write(context->out->fh, el, u); if(ret != u) goto end; - ret = __wrap_write(context->out->fh, context->encoded_br, context->encoded_br_length); + ret = write(context->out->fh, context->encoded_br, context->encoded_br_length); if(ret != context->encoded_br_length) goto end; - ret = __wrap_write(context->out->fh, context->encoded_crlf, context->encoded_crlf_length); + ret = write(context->out->fh, context->encoded_crlf, context->encoded_crlf_length); if(ret != context->encoded_crlf_length) goto end; @@ -95,7 +95,7 @@ int write_stringz_as_sami(char *string, struct encoder_ctx *context, LLONG ms_st dbg_print(CCX_DMT_DECODER_608, "\r%s\n", str); } used = encode_line (context, context->buffer,(unsigned char *) str); - ret = __wrap_write(context->out->fh, context->buffer, used); + ret = write(context->out->fh, context->buffer, used); if(ret != used) goto end; sprintf ((char *) str, @@ -105,7 +105,7 @@ int write_stringz_as_sami(char *string, struct encoder_ctx *context, LLONG ms_st { dbg_print(CCX_DMT_DECODER_608, "\r%s\n", str); } - ret = __wrap_write(context->out->fh, context->buffer, used); + ret = write(context->out->fh, context->buffer, used); if(ret != used) goto end; @@ -139,7 +139,7 @@ int write_cc_bitmap_as_sami(struct cc_subtitle *sub, struct encoder_ctx *context sprintf(buf, "

\r\n" , (unsigned long long)ms_start); - __wrap_write(context->out->fh, buf, strlen(buf)); + write(context->out->fh, buf, strlen(buf)); for (int i = sub->nb_data - 1; i >= 0; i--) { if (rect[i].ocr_text && *(rect[i].ocr_text)) @@ -149,22 +149,22 @@ int write_cc_bitmap_as_sami(struct cc_subtitle *sub, struct encoder_ctx *context token = strtok(rect[i].ocr_text, "\r\n"); sprintf(buf, "%s", token); token = strtok(NULL, "\r\n"); - __wrap_write(context->out->fh, buf, strlen(buf)); + write(context->out->fh, buf, strlen(buf)); if (i != 0) - __wrap_write(context->out->fh, context->encoded_br, context->encoded_br_length); - __wrap_write(context->out->fh, context->encoded_crlf, context->encoded_crlf_length); + write(context->out->fh, context->encoded_br, context->encoded_br_length); + write(context->out->fh, context->encoded_crlf, context->encoded_crlf_length); } } } sprintf(buf, "

\r\n"); - __wrap_write(context->out->fh, buf, strlen(buf)); + write(context->out->fh, buf, strlen(buf)); } else //we write an empty subtitle to clear the old one { sprintf(buf, "

 

\r\n\r\n" , (unsigned long long)ms_start); - __wrap_write(context->out->fh, buf, strlen(buf)); + write(context->out->fh, buf, strlen(buf)); } #endif @@ -221,7 +221,8 @@ int write_cc_buffer_as_sami(struct eia608_screen *data, struct encoder_ctx *cont dbg_print(CCX_DMT_DECODER_608, "\r%s\n", str); } used = encode_line(context, context->buffer,(unsigned char *) str); - __wrap_write (context->out->fh, context->buffer, used); + write (context->out->fh, context->buffer, used); + //python_extract_sami(startms,endms,context->buffer); for (int i=0;i<15;i++) { if (data->row_used[i]) @@ -232,11 +233,12 @@ int write_cc_buffer_as_sami(struct eia608_screen *data, struct encoder_ctx *cont dbg_print(CCX_DMT_DECODER_608, "\r"); dbg_print(CCX_DMT_DECODER_608, "%s\n",context->subline); } - __wrap_write (context->out->fh, context->subline, length); + write (context->out->fh, context->subline, length); + //python_extract_sami(startms,endms,context->buffer); wrote_something = 1; if (i!=14) - __wrap_write (context->out->fh, context->encoded_br, context->encoded_br_length); - __wrap_write (context->out->fh, context->encoded_crlf, context->encoded_crlf_length); + write (context->out->fh, context->encoded_br, context->encoded_br_length); + write (context->out->fh, context->encoded_crlf, context->encoded_crlf_length); } } sprintf ((char *) str,"

\r\n"); @@ -245,7 +247,7 @@ int write_cc_buffer_as_sami(struct eia608_screen *data, struct encoder_ctx *cont dbg_print(CCX_DMT_DECODER_608, "\r%s\n", str); } used = encode_line(context, context->buffer,(unsigned char *) str); - __wrap_write (context->out->fh, context->buffer, used); + write (context->out->fh, context->buffer, used); sprintf ((char *) str, "

 

\r\n\r\n", (unsigned long long)endms); @@ -254,6 +256,6 @@ int write_cc_buffer_as_sami(struct eia608_screen *data, struct encoder_ctx *cont dbg_print(CCX_DMT_DECODER_608, "\r%s\n", str); } used = encode_line(context, context->buffer,(unsigned char *) str); - __wrap_write (context->out->fh, context->buffer, used); + write (context->out->fh, context->buffer, used); return wrote_something; } diff --git a/src/lib_ccx/ccx_encoders_smptett.c b/src/lib_ccx/ccx_encoders_smptett.c index 7b0f6993..34a15fec 100644 --- a/src/lib_ccx/ccx_encoders_smptett.c +++ b/src/lib_ccx/ccx_encoders_smptett.c @@ -30,7 +30,6 @@ #include "utility.h" #include "ccx_encoders_helpers.h" - void write_stringz_as_smptett(char *string, struct encoder_ctx *context, LLONG ms_start, LLONG ms_end) { int used; @@ -55,7 +54,7 @@ void write_stringz_as_smptett(char *string, struct encoder_ctx *context, LLONG m dbg_print(CCX_DMT_DECODER_608, "\r%s\n", str); } used = encode_line(context, context->buffer, (unsigned char *) str); - __wrap_write (context->out->fh, context->buffer, used); + write (context->out->fh, context->buffer, used); // Scan for \n in the string and replace it with a 0 while (pos_r < len) { @@ -82,10 +81,10 @@ void write_stringz_as_smptett(char *string, struct encoder_ctx *context, LLONG m dbg_print(CCX_DMT_DECODER_608, "\r"); dbg_print(CCX_DMT_DECODER_608, "%s\n", context->subline); } - __wrap_write(context->out->fh, el, u); + write(context->out->fh, el, u); //write (wb->fh, encoded_br, encoded_br_length); - __wrap_write(context->out->fh, context->encoded_crlf, context->encoded_crlf_length); + write(context->out->fh, context->encoded_crlf, context->encoded_crlf_length); begin += strlen ((const char *) begin)+1; } @@ -95,14 +94,14 @@ void write_stringz_as_smptett(char *string, struct encoder_ctx *context, LLONG m dbg_print(CCX_DMT_DECODER_608, "\r%s\n", str); } used = encode_line(context, context->buffer, (unsigned char *) str); - __wrap_write(context->out->fh, context->buffer, used); + write(context->out->fh, context->buffer, used); sprintf ((char *) str, "

\n\n", h2, m2, s2, ms2); if (context->encoding != CCX_ENC_UNICODE) { dbg_print(CCX_DMT_DECODER_608, "\r%s\n", str); } used = encode_line(context, context->buffer, (unsigned char *) str); - __wrap_write (context->out->fh, context->buffer, used); + write (context->out->fh, context->buffer, used); sprintf ((char *) str, "

\n"); free(el); free(unescaped); @@ -141,12 +140,13 @@ int write_cc_bitmap_as_smptett(struct cc_subtitle *sub, struct encoder_ctx *cont millis_to_time(ms_start, &h1, &m1, &s1, &ms1); millis_to_time(ms_end - 1, &h2, &m2, &s2, &ms2); // -1 To prevent overlapping with next line. sprintf((char *)context->buffer, "

\n", h1, m1, s1, ms1, h2, m2, s2, ms2); - __wrap_write(context->out->fh, buf, strlen(buf)); + write(context->out->fh, buf, strlen(buf)); len = strlen(rect[i].ocr_text); - __wrap_write(context->out->fh, rect[i].ocr_text, len); - __wrap_write(context->out->fh, context->encoded_crlf, context->encoded_crlf_length); + //python_extract_time_based (h1,m1,s1,ms1,h2,m2,s2,ms2,rect[i].ocr_text); + write(context->out->fh, rect[i].ocr_text, len); + write(context->out->fh, context->encoded_crlf, context->encoded_crlf_length); sprintf(buf, "

\n"); - __wrap_write(context->out->fh, buf, strlen(buf)); + write(context->out->fh, buf, strlen(buf)); } } @@ -256,8 +256,8 @@ int write_cc_buffer_as_smptett(struct eia608_screen *data, struct encoder_ctx *c dbg_print(CCX_DMT_DECODER_608, "\r%s\n", str); } used = encode_line(context, context->buffer,(unsigned char *) str); - __wrap_write (context->out->fh, context->buffer, used); - + write (context->out->fh, context->buffer, used); + //python_extract_time_based(h1,m1,s1,ms1,h2,m2,s2,ms2,""); // Trimming subs because the position is defined by "tts:origin" int old_trim_subs = context->trim_subs; context->trim_subs=1; @@ -426,10 +426,11 @@ int write_cc_buffer_as_smptett(struct eia608_screen *data, struct encoder_ctx *c } - __wrap_write(context->out->fh, final, strlen(final)); + write(context->out->fh, final, strlen(final)); + //python_extract_time_based(h1,m1,s1,ms1,h2,m2,s2,ms2,context->subline); - __wrap_write(context->out->fh, context->encoded_crlf, context->encoded_crlf_length); + write(context->out->fh, context->encoded_crlf, context->encoded_crlf_length); context->trim_subs=old_trim_subs; sprintf ((char *) str,"