@@ -6,6 +6,7 @@ License: GPL 2.0
66#include "ccextractor.h"
77#include <stdio.h>
88#include <locale.h>
9+ #include <ccx_encoders_helpers.h>
910
1011volatile int terminate_asap = 0 ;
1112
@@ -138,10 +139,27 @@ int start_ccx()
138139#endif
139140 terminate_asap = 0 ;
140141
142+ #ifdef ENABLE_SHARING
143+ if (ccx_options .translate_enabled && ctx -> num_input_files > 1 )
144+ {
145+ mprint ("[share] WARNING: simultaneous translation of several input files is not supported yet\n" );
146+ ccx_options .translate_enabled = 0 ;
147+ ccx_options .sharing_enabled = 0 ;
148+ }
149+ if (ccx_options .translate_enabled )
150+ {
151+ mprint ("[share] launching translate service\n" );
152+ ccx_share_launch_translator (ccx_options .translate_langs , ccx_options .translate_key );
153+ }
154+ #endif // ENABLE_SHARING
141155 ret = 0 ;
142156 while (switch_to_next_file (ctx , 0 ))
143157 {
144158 prepare_for_new_file (ctx );
159+ #ifdef ENABLE_SHARING
160+ if (ccx_options .sharing_enabled )
161+ ccx_share_start (ctx -> basefilename );
162+ #endif // ENABLE_SHARING
145163
146164 stream_mode = ctx -> demux_ctx -> get_stream_mode (ctx -> demux_ctx );
147165 // Disable sync check for raw formats - they have the right timeline.
@@ -293,6 +311,14 @@ int start_ccx()
293311 dec_ctx -> timing -> fts_now = 0 ;
294312 dec_ctx -> timing -> fts_max = 0 ;
295313
314+ #ifdef ENABLE_SHARING
315+ if (ccx_options .sharing_enabled )
316+ {
317+ ccx_share_stream_done (ctx -> basefilename );
318+ ccx_share_stop ();
319+ }
320+ #endif // ENABLE_SHARING
321+
296322 if (dec_ctx -> total_pulldownframes )
297323 mprint ("incl. pulldown frames: %s (%u frames at %.2ffps)\n" ,
298324 print_mstime_static ((LLONG )(dec_ctx -> total_pulldownframes * 1000 / current_fps )),
@@ -391,6 +417,7 @@ int start_ccx()
391417 dinit_libraries (& ctx );
392418
393419 if (!ret )
420+ webvtt_write_minimal_header ();
394421 mprint ("\nNo captions were found in input.\n" );
395422
396423 print_end_msg ();
0 commit comments