[FEAT] Remove share module (#1737)

* replaced nanomsg with nanomsg_sys

* feat: Share Module - squash commits

* Share Module: Added Documentation

* Share Module: Removed Sharing Service

* Share: formatting issues

* Share: failing CI

* Share: failing CI

* Share: Removed protobuf

* Share Module: Update CHANGES.txt

* Share Module: Update Cargo.lock

* Share Module: Update CHANGES.txt

* Share Module: Update Cargo.toml

* Share Module: Update Cargo.toml
This commit is contained in:
Deepnarayan Sett
2025-08-24 23:23:44 +05:30
committed by GitHub
parent 25a447d42e
commit 4b5f68a6a4
40 changed files with 16 additions and 5716 deletions

2
.gitignore vendored
View File

@@ -106,8 +106,6 @@ src/lib_hash/.deps/
src/lib_hash/.dirstamp
src/libpng/.deps/
src/libpng/.dirstamp
src/protobuf-c/.deps/
src/protobuf-c/.dirstamp
src/utf8proc/.deps/
src/utf8proc/.dirstamp
src/zlib/.deps/

View File

@@ -1,5 +1,6 @@
1.0 (to be released)
-----------------
- Removed the Share Module
- Fix: Regression failures on DVD files
- Fix: Segmentation faults on MP4 files with CEA-708 captions
- Refactor: Remove API structures from ccextractor

View File

@@ -13,7 +13,7 @@ Step 2) create a separate directory where you want to build the target.
Step 3) make the build system using cmake. Params in [] are optional and have
been explained later in the document.
~> cmake [-DWITH_FFMPEG=ON] [-DWITH_OCR=ON] [-DWITH_SHARING=ON]
~> cmake [-DWITH_FFMPEG=ON] [-DWITH_OCR=ON]
[-DWITH_HARDSUBX=ON] ../src/
Step 4) Compile the code.
@@ -29,9 +29,6 @@ cmake -DWITH_FFMPEG=ON ../src/
If you want to build CCExtractor with OCR you need to pass
cmake -DWITH_OCR=ON ../src/
If you want to build CCExtractor with Sharing and Translating service:
cmake -DWITH_SHARING=ON ../src/
If you want to build CCExtractor with HARDSUBX support
cmake -DWITH_HARDSUBX=ON ../src/

View File

@@ -123,10 +123,6 @@ ccextractor_SOURCES = \
../src/lib_ccx/ccx_gxf.c \
../src/lib_ccx/ccx_gxf.h \
../src/lib_ccx/ccx_mp4.h \
../src/lib_ccx/ccx_share.c \
../src/lib_ccx/ccx_share.h \
../src/lib_ccx/ccx_sub_entry_message.pb-c.c \
../src/lib_ccx/ccx_sub_entry_message.pb-c.h \
../src/lib_ccx/compile_info.h \
../src/lib_ccx/compile_info_real.h \
../src/lib_ccx/configuration.c \
@@ -206,8 +202,6 @@ ccextractor_SOURCES = \
../src/thirdparty/utf8proc/utf8proc.h \
../src/thirdparty/lib_hash/sha2.c \
../src/thirdparty/lib_hash/sha2.h \
../src/thirdparty/protobuf-c/protobuf-c.c \
../src/thirdparty/protobuf-c/protobuf-c.h \
../src/lib_ccx/zvbi/bcd.h \
../src/lib_ccx/zvbi/bit_slicer.c \
../src/lib_ccx/zvbi/bit_slicer.h \
@@ -272,7 +266,7 @@ endif
ccextractor_CFLAGS = -std=gnu99 -Wno-write-strings -Wno-pointer-sign -D_FILE_OFFSET_BITS=64 -DVERSION_FILE_PRESENT -DFT2_BUILD_LIBRARY -DGPAC_DISABLE_VTT -DGPAC_DISABLE_OD_DUMP -DGPAC_DISABLE_REMOTERY -DNO_GZIP
ccextractor_CPPFLAGS =-I../src/lib_ccx/ -I/usr/include/ -I../src/thirdparty/libpng/ -I../src/thirdparty/zlib/ -I../src/lib_ccx/zvbi/ -I../src/thirdparty/lib_hash/ -I../src/thirdparty/protobuf-c/ -I../src/thirdparty -I../src/ -I../src/thirdparty/freetype/include/
ccextractor_CPPFLAGS =-I../src/lib_ccx/ -I/usr/include/ -I../src/thirdparty/libpng/ -I../src/thirdparty/zlib/ -I../src/lib_ccx/zvbi/ -I../src/thirdparty/lib_hash/ -I../src/thirdparty -I../src/ -I../src/thirdparty/freetype/include/
ccextractor_LDADD=-lm -lpthread -ldl -lgpac

View File

@@ -35,13 +35,12 @@ if [ "$bit_os" == "64" ]
then
BLD_FLAGS="$BLD_FLAGS -DGPAC_64_BITS"
fi
BLD_INCLUDE="-I../src -I /usr/include/leptonica/ -I /usr/include/tesseract/ -I../src/lib_ccx/ -I /usr/include/gpac/ -I../src/thirdparty/libpng -I../src/thirdparty/zlib -I../src/lib_ccx/zvbi -I../src/thirdparty/lib_hash -I../src/thirdparty/protobuf-c -I../src/thirdparty -I../src/thirdparty/freetype/include"
BLD_INCLUDE="-I../src -I /usr/include/leptonica/ -I /usr/include/tesseract/ -I../src/lib_ccx/ -I /usr/include/gpac/ -I../src/thirdparty/libpng -I../src/thirdparty/zlib -I../src/lib_ccx/zvbi -I../src/thirdparty/lib_hash -I../src/thirdparty -I../src/thirdparty/freetype/include"
SRC_LIBPNG="$(find ../src/thirdparty/libpng/ -name '*.c')"
SRC_ZLIB="$(find ../src/thirdparty/zlib/ -name '*.c')"
SRC_CCX="$(find ../src/lib_ccx/ -name '*.c')"
SRC_GPAC="$(find /usr/include/gpac/ -name '*.c')"
SRC_HASH="$(find ../src/thirdparty/lib_hash/ -name '*.c')"
SRC_PROTOBUF="$(find ../src/thirdparty/protobuf-c/ -name '*.c')"
SRC_UTF8PROC="../src/thirdparty/utf8proc/utf8proc.c"
SRC_FREETYPE="../src/thirdparty/freetype/autofit/autofit.c
../src/thirdparty/freetype/base/ftbase.c
@@ -84,7 +83,7 @@ SRC_FREETYPE="../src/thirdparty/freetype/autofit/autofit.c
../src/thirdparty/freetype/type1/type1.c
../src/thirdparty/freetype/type42/type42.c
../src/thirdparty/freetype/winfonts/winfnt.c"
BLD_SOURCES="../src/ccextractor.c $SRC_CCX $SRC_GPAC $SRC_ZLIB $SRC_LIBPNG $SRC_HASH $SRC_PROTOBUF $SRC_UTF8PROC $SRC_FREETYPE"
BLD_SOURCES="../src/ccextractor.c $SRC_CCX $SRC_GPAC $SRC_ZLIB $SRC_LIBPNG $SRC_HASH $SRC_UTF8PROC $SRC_FREETYPE"
BLD_LINKER="$BLD_LINKER -lm -zmuldefs -l tesseract -l leptonica -lpthread -ldl -lgpac"
echo "Running pre-build script..."

View File

@@ -4,8 +4,7 @@ SRC_ZLIB="$(find ../src/thirdparty/zlib/ -name '*.c')"
SRC_ZVBI="$(find ../src/thirdparty/zvbi/ -name '*.c')"
SRC_CCX="$(find ../src/lib_ccx/ -name '*.c')"
SRC_HASH="$(find ../src/thirdparty/lib_hash/ -name '*.c')"
SRC_PROTOBUF="$(find ../src/thirdparty/protobuf-c/ -name '*.c')"
SRC_UTF8PROC="../src/utf8proc/utf8proc.c"
BLD_SOURCES="../src/ccextractor.c ../src/ccextractorapi_wrap.c $SRC_CCX $SRC_ZLIB $SRC_ZVBI $SRC_LIBPNG $SRC_HASH $SRC_PROTOBUF $SRC_UTF8PROC"
BLD_SOURCES="../src/ccextractor.c ../src/ccextractorapi_wrap.c $SRC_CCX $SRC_ZLIB $SRC_ZVBI $SRC_LIBPNG $SRC_HASH $SRC_UTF8PROC"
python setup.py $BLD_SOURCES

View File

@@ -95,10 +95,6 @@ ccextractor_SOURCES = \
../src/lib_ccx/ccx_gxf.c \
../src/lib_ccx/ccx_gxf.h \
../src/lib_ccx/ccx_mp4.h \
../src/lib_ccx/ccx_share.c \
../src/lib_ccx/ccx_share.h \
../src/lib_ccx/ccx_sub_entry_message.pb-c.c \
../src/lib_ccx/ccx_sub_entry_message.pb-c.h \
../src/lib_ccx/compile_info.h \
../src/lib_ccx/compile_info_real.h \
../src/lib_ccx/configuration.c \
@@ -178,8 +174,6 @@ ccextractor_SOURCES = \
../src/thirdparty/utf8proc/utf8proc.h \
../src/thirdparty/lib_hash/sha2.c \
../src/thirdparty/lib_hash/sha2.h \
../src/thirdparty/protobuf-c/protobuf-c.c \
../src/thirdparty/protobuf-c/protobuf-c.h \
../src/lib_ccx/zvbi/bcd.h \
../src/lib_ccx/zvbi/bit_slicer.c \
../src/lib_ccx/zvbi/bit_slicer.h \
@@ -247,7 +241,7 @@ ccextractor_CFLAGS = -std=gnu99 -Wno-write-strings -Wno-pointer-sign -D_FILE_OFF
ccextractor_LDFLAGS = $(shell pkg-config --libs gpac)
GPAC_CPPFLAGS = $(shell pkg-config --cflags gpac)
ccextractor_CPPFLAGS =-I../src/lib_ccx/ -I../src/thirdparty/libpng/ -I../src/thirdparty/zlib/ -I../src/lib_ccx/zvbi/ -I../src/thirdparty/lib_hash/ -I../src/thirdparty/protobuf-c/ -I../src/thirdparty -I../src/ -I../src/thirdparty/freetype/include/
ccextractor_CPPFLAGS =-I../src/lib_ccx/ -I../src/thirdparty/libpng/ -I../src/thirdparty/zlib/ -I../src/lib_ccx/zvbi/ -I../src/thirdparty/lib_hash/ -I../src/thirdparty -I../src/ -I../src/thirdparty/freetype/include/
ccextractor_CPPFLAGS += $(GPAC_CPPFLAGS)
ccextractor_CPPFLAGS += $(FFMPEG_CPPFLAGS)

View File

@@ -2,12 +2,11 @@
cd `dirname $0`
BLD_FLAGS="-std=gnu99 -Wno-write-strings -Wno-pointer-sign -D_FILE_OFFSET_BITS=64 -DVERSION_FILE_PRESENT -Dfopen64=fopen -Dopen64=open -Dlseek64=lseek -DFT2_BUILD_LIBRARY -DGPAC_DISABLE_VTT -DGPAC_DISABLE_OD_DUMP -DGPAC_DISABLE_REMOTERY -DNO_GZIP -DDISABLE_RUST"
[[ $1 = "OCR" ]] && BLD_FLAGS="$BLD_FLAGS -DENABLE_OCR"
BLD_INCLUDE="-I../src/ -I../src/lib_ccx -I../src/lib_hash -I../src/thirdparty/libpng -I../src/thirdparty -I../src/thirdparty/protobuf-c -I../src/thirdparty/zlib -I../src/thirdparty/freetype/include `pkg-config --cflags --silence-errors gpac`"
BLD_INCLUDE="-I../src/ -I../src/lib_ccx -I../src/lib_hash -I../src/thirdparty/libpng -I../src/thirdparty -I../src/thirdparty/zlib -I../src/thirdparty/freetype/include `pkg-config --cflags --silence-errors gpac`"
[[ $1 = "OCR" ]] && BLD_INCLUDE="$BLD_INCLUDE `pkg-config --cflags --silence-errors tesseract`"
SRC_CCX="$(find ../src/lib_ccx -name '*.c')"
SRC_LIB_HASH="$(find ../src/thirdparty/lib_hash -name '*.c')"
SRC_LIBPNG="$(find ../src/thirdparty/libpng -name '*.c')"
SRC_PROTOBUF="$(find ../src/thirdparty/protobuf-c -name '*.c')"
SRC_UTF8="../src/thirdparty/utf8proc/utf8proc.c"
SRC_ZLIB="$(find ../src/thirdparty/zlib -name '*.c')"
SRC_FREETYPE="../src/thirdparty/freetype/autofit/autofit.c \
@@ -51,7 +50,7 @@ SRC_FREETYPE="../src/thirdparty/freetype/autofit/autofit.c \
../src/thirdparty/freetype/type1/type1.c \
../src/thirdparty/freetype/type42/type42.c \
../src/thirdparty/freetype/winfonts/winfnt.c"
BLD_SOURCES="../src/ccextractor.c $SRC_API $SRC_CCX $SRC_LIB_HASH $SRC_LIBPNG $SRC_PROTOBUF $SRC_UTF8 $SRC_ZLIB $SRC_ZVBI $SRC_FREETYPE"
BLD_SOURCES="../src/ccextractor.c $SRC_API $SRC_CCX $SRC_LIB_HASH $SRC_LIBPNG $SRC_UTF8 $SRC_ZLIB $SRC_ZVBI $SRC_FREETYPE"
BLD_LINKER="-lm -liconv -lpthread -ldl `pkg-config --libs --silence-errors tesseract` `pkg-config --libs --silence-errors gpac`"
[[ $1 = "OCR" ]] && BLD_LINKER="$BLD_LINKER `pkg-config --libs --silence-errors tesseract` `pkg-config --libs --silence-errors lept`"

View File

@@ -4,11 +4,10 @@ cc_binary(
"ccextractor.h"],
deps = [
"//src/lib_ccx:lib_ccx",
"//src/thirdparty/protobuf-c:protobuf-c",
"//src/thirdparty/zlib:zlib",
"//src/thirdparty/freetype:freetype"
],
copts = [ "-Isrc/thirdparty/protobuf-c", "-Isrc/thirdparty/libpng", "-Isrc" ]
copts = [ "-Isrc/thirdparty/libpng", "-Isrc" ]
)
exports_files (["ccextractor.h"], ["//src/lib_ccx:__pkg__"])

View File

@@ -5,7 +5,6 @@ include (CTest)
option (WITH_FFMPEG "Build using FFmpeg demuxer and decoder" OFF)
option (WITH_OCR "Build with OCR (Optical Character Recognition) feature" OFF)
option (WITH_SHARING "Build with sharing and translation support" OFF)
option (WITH_HARDSUBX "Build with support for burned-in subtitles" OFF)
option (WITHOUT_RUST "Build without Rust library" OFF)
@@ -52,7 +51,6 @@ include_directories(${PROJECT_SOURCE_DIR})
include_directories(${PROJECT_SOURCE_DIR}/lib_ccx)
include_directories(${PROJECT_SOURCE_DIR}/lib_ccx/zvbi)
include_directories(${PROJECT_SOURCE_DIR}/thirdparty)
include_directories(${PROJECT_SOURCE_DIR}/thirdparty/protobuf-c)
include_directories(${PROJECT_SOURCE_DIR}/thirdparty/lib_hash)
include_directories(${PROJECT_SOURCE_DIR}/thirdparty/libpng)
@@ -72,7 +70,6 @@ include_directories(${PROJECT_SOURCE_DIR}/thirdparty/zlib)
include_directories(${PROJECT_SOURCE_DIR}/thirdparty/freetype/include)
aux_source_directory(${PROJECT_SOURCE_DIR}/thirdparty/lib_hash/ SOURCEFILE)
aux_source_directory(${PROJECT_SOURCE_DIR}/thirdparty/libpng/ SOURCEFILE)
aux_source_directory(${PROJECT_SOURCE_DIR}/thirdparty/protobuf-c/ SOURCEFILE)
aux_source_directory(${PROJECT_SOURCE_DIR}/thirdparty/zlib/ SOURCEFILE)
aux_source_directory(${PROJECT_SOURCE_DIR}/lib_ccx/zvbi/ SOURCEFILE)
@@ -206,21 +203,6 @@ if (PKG_CONFIG_FOUND AND WITH_OCR)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DENABLE_OCR")
endif (PKG_CONFIG_FOUND AND WITH_OCR)
########################################################
# Build with CC sharing and translation support
########################################################
if (PKG_CONFIG_FOUND AND WITH_SHARING)
pkg_check_modules (NANOMSG REQUIRED libnanomsg)
set (EXTRA_LIBS ${EXTRA_LIBS} ${NANOMSG_STATIC_LIBRARIES})
include_directories ("${PROJECT_SOURCE_DIR}/thirdparty/protobuf-c/")
aux_source_directory ("${PROJECT_SOURCE_DIR}/thirdparty/protobuf-c/" SOURCEFILE)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DENABLE_SHARING")
endif (PKG_CONFIG_FOUND AND WITH_SHARING)
########################################################
# Build for hardsubx using avformat, avutil, avcodec and
# swscale

View File

@@ -138,27 +138,10 @@ int start_ccx()
#endif
terminate_asap = 0;
#ifdef ENABLE_SHARING
if (ccx_options.translate_enabled && ctx->num_input_files > 1)
{
mprint("[share] WARNING: simultaneous translation of several input files is not supported yet\n");
ccx_options.translate_enabled = 0;
ccx_options.sharing_enabled = 0;
}
if (ccx_options.translate_enabled)
{
mprint("[share] launching translate service\n");
ccx_share_launch_translator(ccx_options.translate_langs, ccx_options.translate_key);
}
#endif // ENABLE_SHARING
ret = 0;
while (switch_to_next_file(ctx, 0))
{
prepare_for_new_file(ctx);
#ifdef ENABLE_SHARING
if (ccx_options.sharing_enabled)
ccx_share_start(ctx->basefilename);
#endif // ENABLE_SHARING
stream_mode = ctx->demux_ctx->get_stream_mode(ctx->demux_ctx);
// Disable sync check for raw formats - they have the right timeline.
@@ -310,14 +293,6 @@ int start_ccx()
dec_ctx->timing->fts_now = 0;
dec_ctx->timing->fts_max = 0;
#ifdef ENABLE_SHARING
if (ccx_options.sharing_enabled)
{
ccx_share_stream_done(ctx->basefilename);
ccx_share_stop();
}
#endif // ENABLE_SHARING
if (dec_ctx->total_pulldownframes)
mprint("incl. pulldown frames: %s (%u frames at %.2ffps)\n",
print_mstime_static((LLONG)(dec_ctx->total_pulldownframes * 1000 / current_fps)),

View File

@@ -19,7 +19,6 @@
#include "lib_ccx/ccx_common_option.h"
#include "lib_ccx/ccx_mp4.h"
#include "lib_ccx/hardsubx.h"
#include "lib_ccx/ccx_share.h"
#ifdef WITH_LIBCURL
CURL *curl;
CURLcode res;

View File

@@ -6,16 +6,14 @@ cc_library(
hdrs = glob (["*.h", "zvbi/*.h", "*.xbm"]) + [ "//src:ccextractor.h" ],
visibility = ["//visibility:public"],
deps = [
"//src/thirdparty/protobuf-c:protobuf-c",
"//src/thirdparty/libpng:libpng",
"//src/thirdparty/freetype:freetype",
"//src/thirdparty/lib_hash:lib_hash",
"//src/thirdparty/utf8proc:utf8proc",
],
includes = [ "thirdparty/protobuf-c", "thirdparty/libpng", "." ,
includes = [ "thirdparty/libpng", "." ,
"thirdparty/freetype/include" ],
copts = [ "-Isrc/thirdparty/protobuf-c",
"-Isrc/thirdparty/libpng",
copts = [ "-Isrc/thirdparty/libpng",
"-Isrc/",
"-Isrc/thirdparty/freetype",
"-Isrc/thirdparty/lib_hash",

View File

@@ -56,9 +56,6 @@ if (WITH_OCR)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DENABLE_OCR")
endif (WITH_OCR)
if (WITH_SHARING)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DENABLE_SHARING")
endif (WITH_SHARING)
aux_source_directory ("${PROJECT_SOURCE_DIR}/lib_ccx/" SOURCEFILE)

View File

@@ -58,9 +58,6 @@ enum ccx_debug_message_types
CCX_DMT_LEVENSHTEIN = 0x1000, // Levenshtein distance calculations
CCX_DMT_DVB = 0x2000, // DVB
CCX_DMT_DUMPDEF = 0x4000 // Dump defective TS packets
#ifdef ENABLE_SHARING
CCX_DMT_SHARE = 0x8000, // Extracted captions sharing service
#endif //ENABLE_SHARING
};
// AVC NAL types

View File

@@ -151,13 +151,6 @@ void init_options(struct ccx_s_options *options)
options->settings_dtvcc.services_enabled, 0,
CCX_DTVCC_MAX_SERVICES * sizeof(options->settings_dtvcc.services_enabled[0]));
#ifdef ENABLE_SHARING
options->sharing_enabled = 0;
options->sharing_url = NULL;
options->translate_enabled = 0;
options->translate_key = NULL;
options->translate_langs = NULL;
#endif // ENABLE_SHARING
#ifdef WITH_LIBCURL
options->curlposturl = NULL;
#endif

View File

@@ -198,17 +198,6 @@ struct ccx_s_options // Options from user parameters
#ifdef WITH_LIBCURL
char *curlposturl;
#endif
#ifdef ENABLE_SHARING
//CC sharing
int sharing_enabled;
char *sharing_url;
//Translating
int translate_enabled;
char *translate_langs;
char *translate_key;
#endif
};
extern struct ccx_s_options ccx_options;

View File

@@ -8,9 +8,6 @@
#include "ccx_encoders_xds.h"
#include "ccx_encoders_helpers.h"
#include "ccextractor.h"
#ifdef ENABLE_SHARING
#include "ccx_share.h"
#endif // ENABLE_SHARING
#ifdef WIN32
int fsync(int fd)
@@ -1094,11 +1091,6 @@ int encode_sub(struct encoder_ctx *context, struct cc_subtitle *sub)
context = change_filename(context);
#ifdef ENABLE_SHARING
if (ccx_options.sharing_enabled)
ccx_share_send(sub);
#endif // ENABLE_SHARING
if (context->sbs_enabled)
{
// Write to a buffer that is later s+plit to generate split

View File

@@ -27,10 +27,6 @@
#define LOG_DEBUG(...)
#endif
#ifdef ENABLE_SHARING
#include "ccx_share.h"
#endif // ENABLE_SHARING
//---------------------------
// BEGIN of #BUG639
// HACK: this is workaround for https://github.com/CCExtractor/ccextractor/issues/639

View File

@@ -9,10 +9,6 @@
#include "ccx_encoders_helpers.h"
#include "lib_ccx.h"
#ifdef ENABLE_SHARING
#include "ccx_share.h"
#endif // ENABLE_SHARING
int write_cc_bitmap_as_transcript(struct cc_subtitle *sub, struct encoder_ctx *context)
{
int ret = 0;

View File

@@ -1,322 +0,0 @@
//
// Created by Oleg Kisselef (olegkisselef at gmail dot com) on 6/21/15
//
#include <stdio.h>
#include <stdlib.h>
#include "ccx_share.h"
#include "ccx_common_option.h"
#include "ccx_decoders_structs.h"
#include "lib_ccx.h"
#ifdef ENABLE_SHARING
#include <nanomsg/nn.h>
#include <nanomsg/pubsub.h>
ccx_share_service_ctx ccx_share_ctx;
void ccx_sub_entry_msg_cleanup(CcxSubEntryMessage *msg)
{
for (int i = 0; i < msg->n_lines; i++)
{
free(msg->lines[i]);
}
free(msg->lines);
free(msg->stream_name);
}
void ccx_sub_entry_msg_print(CcxSubEntryMessage *msg)
{
if (!msg)
{
dbg_print(CCX_DMT_SHARE, "[share] print(!msg)\n");
return;
}
dbg_print(CCX_DMT_SHARE, "\n[share] sub msg #%lu\n", msg->counter);
dbg_print(CCX_DMT_SHARE, "[share] name: %s\n", msg->stream_name);
dbg_print(CCX_DMT_SHARE, "[share] start: %llu\n", msg->start_time);
dbg_print(CCX_DMT_SHARE, "[share] end: %llu\n", msg->end_time);
dbg_print(CCX_DMT_SHARE, "[share] lines count: %d\n", msg->n_lines);
if (!msg->lines)
{
dbg_print(CCX_DMT_SHARE, "[share] no lines allocated\n");
return;
}
dbg_print(CCX_DMT_SHARE, "[share] lines:\n");
for (unsigned int i = 0; i < msg->n_lines; i++)
{
if (!msg->lines[i])
{
dbg_print(CCX_DMT_SHARE, "[share] line[%d] is not allocated\n", i);
}
dbg_print(CCX_DMT_SHARE, "[share] %s\n", msg->lines[i]);
}
}
void ccx_sub_entries_init(ccx_sub_entries *entries)
{
entries->count = 0;
entries->messages = NULL;
}
void ccx_sub_entries_cleanup(ccx_sub_entries *entries)
{
for (int i = 0; i < entries->count; i++)
{
ccx_sub_entry_msg_cleanup(entries->messages + i);
}
free(entries->messages);
entries->messages = NULL;
entries->count = 0;
}
void ccx_sub_entries_print(ccx_sub_entries *entries)
{
dbg_print(CCX_DMT_SHARE, "[share] ccx_sub_entries_print (%u entries)\n", entries->count);
for (int i = 0; i < entries->count; i++)
{
ccx_sub_entry_msg_print(entries->messages + i);
}
}
ccx_share_status ccx_share_start(const char *stream_name) // TODO add stream
{
dbg_print(CCX_DMT_SHARE, "[share] ccx_share_start: starting service\n");
// TODO for multiple files we have to move creation to ccx_share_init
ccx_share_ctx.nn_sock = nn_socket(AF_SP, NN_PUB);
if (ccx_share_ctx.nn_sock < 0)
{
perror("[share] ccx_share_start: can't nn_socket()\n");
fatal(EXIT_NOT_CLASSIFIED, "In ccx_share_start: can't nn_socket().");
}
if (!ccx_options.sharing_url)
{
ccx_options.sharing_url = strdup("tcp://*:3269");
}
dbg_print(CCX_DMT_SHARE, "[share] ccx_share_start: url=%s\n", ccx_options.sharing_url);
ccx_share_ctx.nn_binder = nn_bind(ccx_share_ctx.nn_sock, ccx_options.sharing_url);
if (ccx_share_ctx.nn_binder < 0)
{
perror("[share] ccx_share_start: can't nn_bind()\n");
fatal(EXIT_NOT_CLASSIFIED, "In ccx_share_start: can't nn_bind()");
}
int linger = -1;
int rc = nn_setsockopt(ccx_share_ctx.nn_sock, NN_SOL_SOCKET, NN_LINGER, &linger, sizeof(int));
if (rc < 0)
{
perror("[share] ccx_share_start: can't nn_setsockopt()\n");
fatal(EXIT_NOT_CLASSIFIED, "In ccx_share_start: can't nn_setsockopt()");
}
// TODO remove path from stream name to minimize traffic (/?)
ccx_share_ctx.stream_name = strdup(stream_name ? stream_name : "unknown");
sleep(1); // We have to sleep a while, because it takes some time for subscribers to subscribe
return CCX_SHARE_OK;
}
ccx_share_status ccx_share_stop()
{
dbg_print(CCX_DMT_SHARE, "[share] ccx_share_stop: stopping service\n");
nn_shutdown(ccx_share_ctx.nn_sock, ccx_share_ctx.nn_binder);
free(ccx_share_ctx.stream_name);
return CCX_SHARE_OK;
}
ccx_share_status ccx_share_send(struct cc_subtitle *sub)
{
dbg_print(CCX_DMT_SHARE, "[share] ccx_share_send: sending\n");
ccx_sub_entries entries;
ccx_sub_entries_init(&entries);
_ccx_share_sub_to_entries(sub, &entries);
ccx_sub_entries_print(&entries);
dbg_print(CCX_DMT_SHARE, "[share] entry obtained:\n");
for (unsigned int i = 0; i < entries.count; i++)
{
dbg_print(CCX_DMT_SHARE, "[share] ccx_share_send: _sending %u\n", i);
// TODO prevent sending empty messages
if (_ccx_share_send(entries.messages + i) != CCX_SHARE_OK)
{
dbg_print(CCX_DMT_SHARE, "[share] can't send message\n");
return CCX_SHARE_FAIL;
}
}
ccx_sub_entries_cleanup(&entries);
return CCX_SHARE_OK;
}
ccx_share_status _ccx_share_send(CcxSubEntryMessage *msg)
{
dbg_print(CCX_DMT_SHARE, "[share] _ccx_share_send\n");
size_t len = ccx_sub_entry_message__get_packed_size(msg);
void *buf = malloc(len);
dbg_print(CCX_DMT_SHARE, "[share] _ccx_share_send: packing\n");
ccx_sub_entry_message__pack(msg, buf);
dbg_print(CCX_DMT_SHARE, "[share] _ccx_share_send: sending\n");
int sent = nn_send(ccx_share_ctx.nn_sock, buf, len, 0);
if (sent != len)
{
free(buf);
dbg_print(CCX_DMT_SHARE, "[share] _ccx_share_send: len=%zd sent=%d\n", len, sent);
return CCX_SHARE_FAIL;
}
free(buf);
dbg_print(CCX_DMT_SHARE, "[share] _ccx_share_send: sent\n");
return CCX_SHARE_OK;
}
ccx_share_status ccx_share_stream_done(char *stream_name)
{
CcxSubEntryMessage msg = CCX_SUB_ENTRY_MESSAGE__INIT;
msg.eos = 1;
msg.stream_name = strdup(stream_name);
msg.counter = 0;
msg.start_time = 0;
msg.end_time = 0;
msg.n_lines = 0;
msg.lines = NULL;
if (_ccx_share_send(&msg) != CCX_SHARE_OK)
{
ccx_sub_entry_msg_cleanup(&msg);
dbg_print(CCX_DMT_SHARE, "[share] can't send message\n");
return CCX_SHARE_FAIL;
}
ccx_sub_entry_msg_cleanup(&msg);
return CCX_SHARE_OK;
}
ccx_share_status _ccx_share_sub_to_entries(struct cc_subtitle *sub, ccx_sub_entries *entries)
{
dbg_print(CCX_DMT_SHARE, "\n[share] _ccx_share_sub_to_entry\n");
if (sub->type == CC_608)
{
dbg_print(CCX_DMT_SHARE, "[share] CC_608\n");
struct eia608_screen *data;
unsigned int nb_data = sub->nb_data;
for (data = sub->data; nb_data; nb_data--, data++)
{
dbg_print(CCX_DMT_SHARE, "[share] data item\n");
if (data->format == SFORMAT_XDS)
{
dbg_print(CCX_DMT_SHARE, "[share] XDS. Skipping\n");
continue;
}
if (!data->start_time)
{
dbg_print(CCX_DMT_SHARE, "[share] No start time. Skipping\n");
break;
}
entries->messages = realloc(entries->messages, ++entries->count * sizeof(CcxSubEntryMessage));
if (!entries->messages)
{
fatal(EXIT_NOT_ENOUGH_MEMORY, "In _ccx_share_sub_to_entry: Not enough memory to store sub-entry-messages\n");
}
unsigned int entry_index = entries->count - 1;
CcxSubEntryMessage msg = CCX_SUB_ENTRY_MESSAGE__INIT;
entries->messages[entry_index] = msg;
entries->messages[entry_index].n_lines = 0;
for (int i = 0; i < 15; i++)
{
if (data->row_used[i])
{
entries->messages[entry_index].n_lines++;
}
}
if (!entries->messages[entry_index].n_lines)
{ // Prevent writing empty screens. Not needed in .srt
dbg_print(CCX_DMT_SHARE, "[share] buffer is empty\n");
dbg_print(CCX_DMT_SHARE, "[share] done\n");
return CCX_SHARE_OK;
}
entries->messages[entry_index].lines = (char **)malloc(entries->messages[entry_index].n_lines * sizeof(char *));
if (!entries->messages[entry_index].lines)
{
fatal(EXIT_NOT_ENOUGH_MEMORY, "In _ccx_share_sub_to_entry: Out of memory for entries->messages[entry_index].lines\n");
}
dbg_print(CCX_DMT_SHARE, "[share] Copying %u lines\n", entries->messages[entry_index].n_lines);
int i = 0, j = 0;
while (i < 15)
{
if (data->row_used[i])
{
entries->messages[entry_index].lines[j] =
(char *)malloc((strnlen((char *)data->characters[i], 32) + 1) * sizeof(char));
if (!entries->messages[entry_index].lines[j])
{
fatal(EXIT_NOT_ENOUGH_MEMORY,
"In _ccx_share_sub_to_entry: Out of memory for entries->messages[entry_index].lines[j]\n");
}
strncpy(entries->messages[entry_index].lines[j], (char *)data->characters[i], 32);
entries->messages[entry_index].lines[j][strnlen((char *)data->characters[i], 32)] = '\0';
dbg_print(CCX_DMT_SHARE, "[share] line (len=%zd): %s\n",
strlen(entries->messages[entry_index].lines[j]),
entries->messages[entry_index].lines[j]);
j++;
}
i++;
}
entries->messages[entry_index].eos = 0;
entries->messages[entry_index].start_time = data->start_time;
entries->messages[entry_index].end_time = data->end_time;
entries->messages[entry_index].counter = ++ccx_share_ctx.counter;
dbg_print(CCX_DMT_SHARE, "[share] item done\n");
}
}
if (sub->type == CC_BITMAP)
{
dbg_print(CCX_DMT_SHARE, "[share] CC_BITMAP. Skipping\n");
}
if (sub->type == CC_RAW)
{
dbg_print(CCX_DMT_SHARE, "[share] CC_RAW. Skipping\n");
}
if (sub->type == CC_TEXT)
{
dbg_print(CCX_DMT_SHARE, "[share] CC_TEXT. Skipping\n");
}
dbg_print(CCX_DMT_SHARE, "[share] done\n");
return CCX_SHARE_OK;
}
ccx_share_status ccx_share_launch_translator(char *langs, char *auth)
{
if (!langs)
{
fatal(EXIT_NOT_CLASSIFIED, "In ccx_share_launch_translator: Launching translator failed as target languages are not specified\n");
}
if (!auth)
{
fatal(EXIT_NOT_CLASSIFIED, "In ccx_share_launch_translator: Launching translator failed as no auth data is provided\n");
}
char buf[1024];
#ifdef _WIN32
sprintf(buf, "start cctranslate -s=extractor -l=%s -k=%s", langs, auth);
#else
sprintf(buf, "./cctranslate -s=extractor -l=%s -k=%s &", langs, auth);
#endif
dbg_print(CCX_DMT_SHARE, "[share] launching translator: \"%s\"\n", buf);
system(buf);
return CCX_SHARE_OK;
}
#endif // ENABLE_SHARING

View File

@@ -1,51 +0,0 @@
//
// Created by Oleg Kisselef (olegkisselef at gmail dot com) on 6/21/15
//
#ifndef CCEXTRACTOR_CCX_SHARE_H
#define CCEXTRACTOR_CCX_SHARE_H
#include "ccx_common_platform.h"
#include "ccx_common_structs.h"
#include "ccx_sub_entry_message.pb-c.h"
#include "lib_ccx.h"
#ifdef ENABLE_SHARING
typedef struct _ccx_sub_entries {
CcxSubEntryMessage *messages;
unsigned int count;
} ccx_sub_entries;
typedef struct _ccx_share_service_ctx {
LLONG counter;
char *stream_name;
int nn_sock;
int nn_binder;
} ccx_share_service_ctx;
extern ccx_share_service_ctx ccx_share_ctx;
typedef enum _ccx_share_status {
CCX_SHARE_OK = 0,
CCX_SHARE_FAIL
} ccx_share_status;
void ccx_sub_entry_message_cleanup(CcxSubEntryMessage *);
void ccx_sub_entry_message_print(CcxSubEntryMessage *);
void ccx_sub_entries_init(ccx_sub_entries *);
void ccx_sub_entries_cleanup(ccx_sub_entries *);
void ccx_sub_entries_print(ccx_sub_entries *);
ccx_share_status ccx_share_launch_translator(char *langs, char *google_api_key);
ccx_share_status ccx_share_start(const char *);
ccx_share_status ccx_share_stop();
ccx_share_status ccx_share_send(struct cc_subtitle *);
ccx_share_status ccx_share_stream_done(char *);
ccx_share_status _ccx_share_sub_to_entries(struct cc_subtitle *, ccx_sub_entries *);
ccx_share_status _ccx_share_send(CcxSubEntryMessage *);
#endif //ENABLE_SHARING
#endif //CCEXTRACTOR_CCX_SHARE_H

View File

@@ -1,154 +0,0 @@
/* Generated by the protocol buffer compiler. DO NOT EDIT! */
/* Generated from: ccx_sub_entry_message.proto */
/* Do not generate deprecated warnings for self */
#ifndef PROTOBUF_C__NO_DEPRECATED
#define PROTOBUF_C__NO_DEPRECATED
#endif
#include "ccx_sub_entry_message.pb-c.h"
#ifdef ENABLE_SHARING
void ccx_sub_entry_message__init(CcxSubEntryMessage *message)
{
static CcxSubEntryMessage init_value = CCX_SUB_ENTRY_MESSAGE__INIT;
*message = init_value;
}
size_t ccx_sub_entry_message__get_packed_size(const CcxSubEntryMessage *message)
{
assert(message->base.descriptor == &ccx_sub_entry_message__descriptor);
return protobuf_c_message_get_packed_size((const ProtobufCMessage *)(message));
}
size_t ccx_sub_entry_message__pack(const CcxSubEntryMessage *message,
uint8_t *out)
{
assert(message->base.descriptor == &ccx_sub_entry_message__descriptor);
return protobuf_c_message_pack((const ProtobufCMessage *)message, out);
}
size_t ccx_sub_entry_message__pack_to_buffer(const CcxSubEntryMessage *message,
ProtobufCBuffer *buffer)
{
assert(message->base.descriptor == &ccx_sub_entry_message__descriptor);
return protobuf_c_message_pack_to_buffer((const ProtobufCMessage *)message, buffer);
}
CcxSubEntryMessage *
ccx_sub_entry_message__unpack(ProtobufCAllocator *allocator,
size_t len,
const uint8_t *data)
{
return (CcxSubEntryMessage *)
protobuf_c_message_unpack(&ccx_sub_entry_message__descriptor,
allocator, len, data);
}
void ccx_sub_entry_message__free_unpacked(CcxSubEntryMessage *message,
ProtobufCAllocator *allocator)
{
assert(message->base.descriptor == &ccx_sub_entry_message__descriptor);
protobuf_c_message_free_unpacked((ProtobufCMessage *)message, allocator);
}
static const ProtobufCFieldDescriptor ccx_sub_entry_message__field_descriptors[6] =
{
{
"eos",
1,
PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_INT32,
0, /* quantifier_offset */
offsetof(CcxSubEntryMessage, eos),
NULL,
NULL,
0, /* flags */
0, NULL, NULL /* reserved1,reserved2, etc */
},
{
"stream_name",
2,
PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_STRING,
0, /* quantifier_offset */
offsetof(CcxSubEntryMessage, stream_name),
NULL,
NULL,
0, /* flags */
0, NULL, NULL /* reserved1,reserved2, etc */
},
{
"counter",
3,
PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_INT64,
0, /* quantifier_offset */
offsetof(CcxSubEntryMessage, counter),
NULL,
NULL,
0, /* flags */
0, NULL, NULL /* reserved1,reserved2, etc */
},
{
"start_time",
4,
PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_INT64,
0, /* quantifier_offset */
offsetof(CcxSubEntryMessage, start_time),
NULL,
NULL,
0, /* flags */
0, NULL, NULL /* reserved1,reserved2, etc */
},
{
"end_time",
5,
PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_INT64,
0, /* quantifier_offset */
offsetof(CcxSubEntryMessage, end_time),
NULL,
NULL,
0, /* flags */
0, NULL, NULL /* reserved1,reserved2, etc */
},
{
"lines",
7,
PROTOBUF_C_LABEL_REPEATED,
PROTOBUF_C_TYPE_STRING,
offsetof(CcxSubEntryMessage, n_lines),
offsetof(CcxSubEntryMessage, lines),
NULL,
NULL,
0, /* flags */
0, NULL, NULL /* reserved1,reserved2, etc */
},
};
static const unsigned ccx_sub_entry_message__field_indices_by_name[] = {
2, /* field[2] = counter */
4, /* field[4] = end_time */
0, /* field[0] = eos */
5, /* field[5] = lines */
3, /* field[3] = start_time */
1, /* field[1] = stream_name */
};
static const ProtobufCIntRange ccx_sub_entry_message__number_ranges[2 + 1] =
{
{1, 0},
{7, 5},
{0, 6}};
const ProtobufCMessageDescriptor ccx_sub_entry_message__descriptor =
{
PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC,
"ccx_sub_entry_message",
"CcxSubEntryMessage",
"CcxSubEntryMessage",
"",
sizeof(CcxSubEntryMessage),
6,
ccx_sub_entry_message__field_descriptors,
ccx_sub_entry_message__field_indices_by_name,
2, ccx_sub_entry_message__number_ranges,
(ProtobufCMessageInit)ccx_sub_entry_message__init,
NULL, NULL, NULL /* reserved[123] */
};
#endif // ENABLE_SHARING

View File

@@ -1,81 +0,0 @@
/* Generated by the protocol buffer compiler. DO NOT EDIT! */
/* Generated from: ccx_sub_entry_message.proto */
#ifndef PROTOBUF_C_ccx_5fsub_5fentry_5fmessage_2eproto__INCLUDED
#define PROTOBUF_C_ccx_5fsub_5fentry_5fmessage_2eproto__INCLUDED
#include "protobuf-c.h"
#include "lib_ccx.h"
#ifdef ENABLE_SHARING
PROTOBUF_C__BEGIN_DECLS
#if PROTOBUF_C_VERSION_NUMBER < 1000000
# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers.
#elif 1001001 < PROTOBUF_C_MIN_COMPILER_VERSION
# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c.
#endif
typedef struct _CcxSubEntryMessage CcxSubEntryMessage;
/* --- enums --- */
/* --- messages --- */
struct _CcxSubEntryMessage
{
ProtobufCMessage base;
int32_t eos;
char *stream_name;
int64_t counter;
int64_t start_time;
int64_t end_time;
size_t n_lines;
char **lines;
};
#define CCX_SUB_ENTRY_MESSAGE__INIT \
{ PROTOBUF_C_MESSAGE_INIT (&ccx_sub_entry_message__descriptor) \
, 0, NULL, 0, 0, 0, 0,NULL }
/* CcxSubEntryMessage methods */
void ccx_sub_entry_message__init
(CcxSubEntryMessage *message);
size_t ccx_sub_entry_message__get_packed_size
(const CcxSubEntryMessage *message);
size_t ccx_sub_entry_message__pack
(const CcxSubEntryMessage *message,
uint8_t *out);
size_t ccx_sub_entry_message__pack_to_buffer
(const CcxSubEntryMessage *message,
ProtobufCBuffer *buffer);
CcxSubEntryMessage *
ccx_sub_entry_message__unpack
(ProtobufCAllocator *allocator,
size_t len,
const uint8_t *data);
void ccx_sub_entry_message__free_unpacked
(CcxSubEntryMessage *message,
ProtobufCAllocator *allocator);
/* --- per-message closures --- */
typedef void(*CcxSubEntryMessage_Closure)
(const CcxSubEntryMessage *message,
void *closure_data);
/* --- services --- */
/* --- descriptors --- */
extern const ProtobufCMessageDescriptor ccx_sub_entry_message__descriptor;
PROTOBUF_C__END_DECLS
#endif //ENABLE_SHARING
#endif /* PROTOBUF_C_ccx_5fsub_5fentry_5fmessage_2eproto__INCLUDED */

View File

@@ -1,8 +0,0 @@
message ccx_sub_entry_message {
required int32 eos = 1;
required string stream_name = 2;
required int64 counter = 3;
required int64 start_time = 4;
required int64 end_time = 5;
repeated string lines = 7;
}

View File

@@ -1,5 +1,4 @@
#include <png.h>
#include "protobuf-c.h"
#include "zlib.h"
#include "gpac/setup.h"
#include "gpac/version.h"
@@ -825,9 +824,6 @@ void print_usage(void)
mprint(" --dumpdef: Hex-dump defective TS packets.\n");
mprint(" --investigate-packets: If no CC packets are detected based on the PMT, try\n");
mprint(" to find data in all packets by scanning.\n");
#ifdef ENABLE_SHARING
mprint(" -sharing-debug: Print extracted CC sharing service messages\n");
#endif // ENABLE_SHARING
mprint("\n");
mprint("Teletext related options:\n");
@@ -878,18 +874,6 @@ void print_usage(void)
mprint(" --no-progress-bar: Suppress the output of the progress bar\n");
mprint(" --quiet: Don't write any message.\n");
mprint("\n");
#ifdef ENABLE_SHARING
mprint("Sharing extracted captions via TCP:\n");
mprint(" --enable-sharing: Enables real-time sharing of extracted captions\n");
mprint(" --sharing-url: Set url for sharing service in nanomsg format. Default: \"tcp://*:3269\"\n");
mprint("\n");
mprint("CCTranslate application integration:\n");
mprint(" --translate: Enable Translation tool and set target languages\n");
mprint(" in csv format (e.g. --translate ru,fr,it\n");
mprint(" --translate-auth: Set Translation Service authorization data to make translation possible\n");
mprint(" In case of Google Translate API - API Key\n");
#endif // ENABLE_SHARING
mprint("Burned-in subtitle extraction:\n");
mprint(" --hardsubx : Enable the burned-in subtitle extraction subsystem.\n");
mprint("\n");
@@ -1085,7 +1069,6 @@ void version(char *location)
mprint(" libGPAC Version: %s\n", GPAC_VERSION);
mprint(" zlib: %s\n", ZLIB_VERSION);
mprint(" utf8proc Version: %s\n", (const char *)utf8proc_version());
mprint(" protobuf-c Version: %s\n", (const char *)protobuf_c_version());
mprint(" libpng Version: %s\n", PNG_LIBPNG_VER_STRING);
mprint(" FreeType \n");
mprint(" libhash\n");
@@ -2327,13 +2310,6 @@ int parse_parameters(struct ccx_s_options *opt, int argc, char *argv[])
tlt_config.verbose = 1;
continue;
}
#ifdef ENABLE_SHARING
if (strcmp(argv[i], "--sharing-debug") == 0)
{
opt->debug_mask |= CCX_DMT_SHARE;
continue;
}
#endif // ENABLE_SHARING
if (strcmp(argv[i], "--fullbin") == 0)
{
opt->fullbin = 1;
@@ -2831,55 +2807,6 @@ int parse_parameters(struct ccx_s_options *opt, int argc, char *argv[])
}
#endif // WITH_LIBCURL
#ifdef ENABLE_SHARING
if (strcmp(argv[i], "--enable-sharing") == 0)
{
opt->sharing_enabled = 1;
continue;
}
if (strcmp(argv[i], "--sharing-url") == 0)
{
if (i < argc - 1)
{
i++;
opt->sharing_url = argv[i];
continue;
}
else
{
fatal(EXIT_MALFORMED_PARAMETER, "--sharing-url has no argument.\n");
}
}
if (strcmp(argv[i], "--translate") == 0)
{
if (i < argc - 1)
{
i++;
opt->translate_enabled = 1;
opt->sharing_enabled = 1;
opt->translate_langs = argv[i];
continue;
}
else
{
fatal(EXIT_MALFORMED_PARAMETER, "--translate has no argument.\n");
}
}
if (strcmp(argv[i], "--translate-auth") == 0)
{
if (i < argc - 1)
{
i++;
opt->translate_key = argv[i];
continue;
}
else
{
fatal(EXIT_MALFORMED_PARAMETER, "--translate-auth has no argument.\n");
}
}
#endif // ENABLE_SHARING
fatal(EXIT_INCOMPATIBLE_PARAMETERS, "Error: Parameter %s not understood.\n", argv[i]);
}

4
src/rust/Cargo.lock generated
View File

@@ -613,9 +613,9 @@ dependencies = [
[[package]]
name = "libc"
version = "0.2.170"
version = "0.2.175"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "875b3680cb2f8f71bdcf9a30f38d48282f5d3c95cbf9b3fa57269bb5d5c06828"
checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543"
[[package]]
name = "libloading"

View File

@@ -34,7 +34,6 @@ bindgen = "0.64.0"
pkg-config = "0.3.32"
[features]
enable_sharing = []
wtv_debug = []
enable_ffmpeg = []
with_libcurl = []

View File

@@ -18,13 +18,11 @@ num_enum = "0.6.1"
[features]
default = [
"enable_sharing",
"wtv_debug",
"enable_ffmpeg",
"debug",
"with_libcurl",
]
enable_sharing = []
wtv_debug = []
enable_ffmpeg = []
debug_out = []

View File

@@ -520,19 +520,6 @@ pub struct Options {
#[cfg(feature = "with_libcurl")]
pub curlposturl: Option<Url>,
//CC sharing
#[cfg(feature = "enable_sharing")]
pub sharing_enabled: bool,
#[cfg(feature = "enable_sharing")]
pub sharing_url: Option<Url>,
#[cfg(feature = "enable_sharing")]
//Translating
pub translate_enabled: bool,
#[cfg(feature = "enable_sharing")]
pub translate_langs: Option<String>,
#[cfg(feature = "enable_sharing")]
pub translate_key: Option<String>,
}
impl Default for Options {
@@ -634,11 +621,6 @@ impl Default for Options {
DebugMessageFlag::VERBOSE,
),
curlposturl: Default::default(),
sharing_enabled: Default::default(),
sharing_url: Default::default(),
translate_enabled: Default::default(),
translate_langs: Default::default(),
translate_key: Default::default(),
}
}
}

View File

@@ -86,9 +86,6 @@ bitflags! {
const DVB = 0x2000;
/// Dump defective TS packets
const DUMP_DEF = 0x4000;
/// Extracted captions sharing service
#[cfg(feature = "enable_sharing")]
const SHARE = 0x8000;
}
}

View File

@@ -1,4 +1,3 @@
use cfg_if::cfg_if;
use clap::{Parser, ValueEnum};
use strum_macros::Display;
@@ -26,13 +25,6 @@ const TRANSCRIPT_OPTIONS: &str = "Transcript customizing options";
const COMMUNICATION_PROTOCOL: &str = "Communication with other programs and console output";
const BURNEDIN_SUBTITLE_EXTRACTION: &str = "Burned-in subtitle extraction";
cfg_if! {
if #[cfg(feature = "enable_sharing")] {
const SHARING_EXTRACTED_CAPTIONS: &str = "Sharing extracted captions via TCP";
const CCTRANSLATE_INTEGRATION: &str = "CCTranslate application integration";
}
}
#[derive(Debug, Parser)]
#[command(name = "CCExtractor")]
#[command(author = "Carlos Fernandez Sanz, Volker Quetschke.")]
@@ -818,10 +810,6 @@ pub struct Args {
/// to find data in all packets by scanning.
#[arg(long, verbatim_doc_comment, help_heading=OUTPUT_AFFECTING_DEBUG_DATA)]
pub investigate_packets: bool,
#[cfg(feature = "enable_sharing")]
/// Print extracted CC sharing service messages
#[arg(long, verbatim_doc_comment, help_heading=OUTPUT_AFFECTING_DEBUG_DATA)]
pub sharing_debug: bool,
/// Use this page for subtitles (if this parameter
/// is not used, try to autodetect). In Spain the
/// page is always 888, may vary in other countries.
@@ -874,23 +862,6 @@ pub struct Args {
/// Don't write any message.
#[arg(long, verbatim_doc_comment, help_heading=COMMUNICATION_PROTOCOL)]
pub quiet: bool,
#[cfg(feature = "enable_sharing")]
/// Enables real-time sharing of extracted captions
#[arg(long, verbatim_doc_comment, help_heading=SHARING_EXTRACTED_CAPTIONS)]
pub enable_sharing: bool,
#[cfg(feature = "enable_sharing")]
/// Set url for sharing service in nanomsg format. Default: tcp://*:3269
#[arg(long, value_name="url", verbatim_doc_comment, help_heading=SHARING_EXTRACTED_CAPTIONS)]
pub sharing_url: Option<String>,
#[cfg(feature = "enable_sharing")]
/// Enables real-time sharing of extracted captions
#[arg(long, value_name="languages", verbatim_doc_comment, help_heading=CCTRANSLATE_INTEGRATION)]
pub translate: Option<String>,
#[cfg(feature = "enable_sharing")]
/// Set Translation Service authorization data to make translation possible
/// In case of Google Translate API - API Key
#[arg(long, verbatim_doc_comment, help_heading=CCTRANSLATE_INTEGRATION)]
pub translate_auth: Option<String>,
/// Enable the burned-in subtitle extraction subsystem.
///
/// NOTE: This is needed to use the below burned-in

View File

@@ -222,21 +222,6 @@ pub unsafe fn copy_from_rust(ccx_s_options: *mut ccx_s_options, options: Options
string_to_c_char(&options.curlposturl.as_ref().unwrap_or_default().as_str());
}
}
#[cfg(feature = "enable_sharing")]
{
(*ccx_s_options).sharing_enabled = options.sharing_enabled as _;
if options.sharing_url.is_some() {
(*ccx_s_options).sharing_url =
string_to_c_char(&options.sharing_url.as_ref().unwrap().as_str());
}
(*ccx_s_options).translate_enabled = options.translate_enabled as _;
if options.translate_langs.is_some() {
(*ccx_s_options).translate_langs = string_to_c_char(&options.translate_langs.unwrap());
}
if options.translate_key.is_some() {
(*ccx_s_options).translate_key = string_to_c_char(&options.translate_key.unwrap());
}
}
}
impl CType2<ccx_s_teletext_config, &Options> for TeletextConfig {

View File

@@ -2,7 +2,6 @@
pub mod bitstream;
pub mod time;
use crate::ccx_options;
use lib_ccxr::util::log::*;
use lib_ccxr::util::{bits::*, levenshtein::*};

View File

@@ -1124,15 +1124,6 @@ impl OptionsExt for Options {
tlt_config.verbose = true;
}
#[cfg(feature = "enable_sharing")]
{
if args.sharing_debug {
self.debug_mask =
DebugMessageMask::new(DebugMessageFlag::SHARE, DebugMessageFlag::VERBOSE);
tlt_config.verbose = true;
}
}
if args.fullbin {
self.fullbin = true;
}
@@ -1425,27 +1416,6 @@ impl OptionsExt for Options {
}
}
#[cfg(feature = "enable_sharing")]
{
if args.enable_sharing {
self.sharing_enabled = true;
}
if let Some(ref sharingurl) = args.sharing_url {
self.sharing_url = Some(sharingurl.to_string().parse().unwrap());
}
if let Some(ref translate) = args.translate {
self.translate_enabled = true;
self.sharing_enabled = true;
self.translate_langs = Some(translate.to_string());
}
if let Some(ref translateauth) = args.translate_auth {
self.translate_key = Some(translateauth.to_string());
}
}
if self.demux_cfg.auto_stream == StreamMode::Mp4 && self.input_source == DataSource::Stdin {
fatal!(
cause = ExitCause::IncompatibleParameters;

View File

@@ -1,16 +0,0 @@
cc_library(
name = "protobuf-c",
srcs = ["protobuf-c.c"],
hdrs = ["protobuf-c.h"],
visibility = ["//visibility:public"],
)
cc_test(
name = "protobuf-c_test",
srcs = ["protobuf-c_test.cc"],
deps = [":protobuf-c"]
)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -15,8 +15,6 @@
<ClInclude Include="..\src\ccextractor.h" />
<ClInclude Include="..\src\lib_ccx\ccx_encoders_structs.h" />
<ClInclude Include="..\src\lib_ccx\ccx_common_option.h" />
<ClInclude Include="..\src\lib_ccx\ccx_share.h" />
<ClInclude Include="..\src\lib_ccx\ccx_sub_entry_message.pb-c.h" />
<ClInclude Include="..\src\lib_ccx\compile_info.h" />
<ClInclude Include="..\src\lib_ccx\avc_functions.h" />
<ClInclude Include="..\src\lib_ccx\ccx_common_char_encoding.h" />
@@ -42,7 +40,6 @@
<ClInclude Include="..\src\lib_ccx\teletext.h" />
<ClInclude Include="..\src\lib_ccx\utility.h" />
<ClInclude Include="..\src\thirdparty\lib_hash\sha2.h" />
<ClInclude Include="..\src\thirdparty\protobuf-c\protobuf-c.h" />
<ClInclude Include="..\src\thirdparty\utf8proc\utf8proc.h" />
<ClInclude Include="..\src\thirdparty\win_iconv\iconv.h" />
<ClInclude Include="..\src\thirdparty\win_spec_incld\dirent.h" />
@@ -104,8 +101,6 @@
<ClCompile Include=" ..\src\lib_ccx\ccx_encoders_webvtt.c" />
<ClCompile Include=" ..\src\lib_ccx\ccx_encoders_xds.c" />
<ClCompile Include=" ..\src\lib_ccx\ccx_gxf.c" />
<ClCompile Include=" ..\src\lib_ccx\ccx_share.c" />
<ClCompile Include=" ..\src\lib_ccx\ccx_sub_entry_message.pb-c.c" />
<ClCompile Include=" ..\src\lib_ccx\cc_bitstream.c" />
<ClCompile Include=" ..\src\lib_ccx\configuration.c" />
<ClCompile Include=" ..\src\lib_ccx\dvb_subtitle_decoder.c" />
@@ -138,7 +133,6 @@
<ClCompile Include=" ..\src\lib_ccx\utility.c" />
<ClCompile Include=" ..\src\lib_ccx\wtv_functions.c" />
<ClCompile Include=" ..\src\thirdparty\lib_hash\sha2.c" />
<ClCompile Include=" ..\src\thirdparty\protobuf-c\protobuf-c.c" />
<ClCompile Include=" ..\src\thirdparty\utf8proc\utf8proc.c" />
<ClCompile Include=" ..\src\thirdparty\win_iconv\win_iconv.c" />
<ClCompile Include=" ..\src\lib_ccx\zvbi\bit_slicer.c" />
@@ -183,9 +177,6 @@
<ClCompile Include=" ..\src\thirdparty\freetype\type42\type42.c" />
<ClCompile Include=" ..\src\thirdparty\freetype\winfonts\winfnt.c" />
</ItemGroup>
<ItemGroup>
<None Include=" ..\src\lib_ccx\ccx_sub_entry_message.proto" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{0F0063C4-BCBC-4379-A6D5-84A5669C940A}</ProjectGuid>
<RootNamespace>ccextractor</RootNamespace>
@@ -250,7 +241,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>
..\src\thirdparty\freetype\include;..\src;..\src\thirdparty\win_spec_incld;..\src\lib_ccx;..\src\thirdparty\lib_hash;..\src\lib_ccx\zvbi;..\src\thirdparty\protobuf-c;..\src\thirdparty\win_iconv;..\src\thirdparty\;..\src;$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\include;
..\src\thirdparty\freetype\include;..\src;..\src\thirdparty\win_spec_incld;..\src\lib_ccx;..\src\thirdparty\lib_hash;..\src\lib_ccx\zvbi;..\src\thirdparty\win_iconv;..\src\thirdparty\;..\src;$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\include;
"C:\Program Files\GPAC\sdk\include";%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>
SEGMENT_BY_FILE_TIME;ENABLE_HARDSUBX;FT2_BUILD_LIBRARY;GPAC_DISABLE_VTT;GPAC_DISABLE_OD_DUMP;ENABLE_OCR;WIN32;_DEBUG;_CONSOLE;_FILE_OFFSET_BITS=64;GPAC_DISABLE_REMOTERY;GPAC_DISABLE_ZLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -297,7 +288,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>
..\src\thirdparty\freetype\include;..\src;..\src\thirdparty\win_spec_incld;..\src\lib_ccx;..\src\thirdparty\lib_hash;..\src\lib_ccx\zvbi;..\src\thirdparty\protobuf-c;..\src\thirdparty\win_iconv;..\src\thirdparty\;..\src;$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\include;
..\src\thirdparty\freetype\include;..\src;..\src\thirdparty\win_spec_incld;..\src\lib_ccx;..\src\thirdparty\lib_hash;..\src\lib_ccx\zvbi;..\src\thirdparty\win_iconv;..\src\thirdparty\;..\src;$(VCPKG_ROOT)\installed\$(VCPKG_DEFAULT_TRIPLET)\include;
"C:\Program Files\GPAC\sdk\include";%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>
ENABLE_HARDSUBX;FT2_BUILD_LIBRARY;GPAC_DISABLE_VTT;GPAC_DISABLE_OD_DUMP;VERSION_FILE_PRESENT;ENABLE_OCR;WIN32;NDEBUG;_CONSOLE;_FILE_OFFSET_BITS=64;GPAC_DISABLE_REMOTERY;GPAC_DISABLE_ZLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@@ -70,12 +70,6 @@
<Filter Include="Header Files\lib_ccx">
<UniqueIdentifier>{7ef5506d-d575-4661-84a1-dbbb99780e32}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\protobuf-c">
<UniqueIdentifier>{3c0bdb0a-e3f8-4fc4-a27b-b795ed32c965}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\protobuf-c">
<UniqueIdentifier>{fce551b0-7304-4677-8e66-61b475fdb924}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\utf8proc">
<UniqueIdentifier>{6e23dd8b-166b-4a80-92e2-194e7b6e6c86}</UniqueIdentifier>
</Filter>
@@ -165,12 +159,6 @@
<ClInclude Include="..\src\lib_ccx\ccx_common_option.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\lib_ccx\ccx_share.h">
<Filter>Header Files\lib_ccx</Filter>
</ClInclude>
<ClInclude Include="..\src\lib_ccx\ccx_sub_entry_message.pb-c.h">
<Filter>Header Files\lib_ccx</Filter>
</ClInclude>
<ClInclude Include="..\src\lib_ccx\lib_ccx.h">
<Filter>Header Files\lib_ccx</Filter>
</ClInclude>
@@ -186,9 +174,6 @@
<ClInclude Include="..\src\thirdparty\lib_hash\sha2.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\thirdparty\protobuf-c\protobuf-c.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\thirdparty\utf8proc\utf8proc.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -383,12 +368,6 @@
<ClCompile Include=" ..\src\lib_ccx\ccx_gxf.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include=" ..\src\lib_ccx\ccx_share.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include=" ..\src\lib_ccx\ccx_sub_entry_message.pb-c.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include=" ..\src\lib_ccx\cc_bitstream.c">
<Filter>Source Files</Filter>
</ClCompile>
@@ -485,9 +464,6 @@
<ClCompile Include=" ..\src\thirdparty\lib_hash\sha2.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include=" ..\src\thirdparty\protobuf-c\protobuf-c.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include=" ..\src\thirdparty\utf8proc\utf8proc.c">
<Filter>Source Files</Filter>
</ClCompile>
@@ -618,7 +594,4 @@
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include=" ..\src\lib_ccx\ccx_sub_entry_message.proto" />
</ItemGroup>
</Project>