diff --git a/docs/CHANGES.TXT b/docs/CHANGES.TXT index 7172a8cf..28be3d65 100644 --- a/docs/CHANGES.TXT +++ b/docs/CHANGES.TXT @@ -9,6 +9,9 @@ version of CCExtractor. - Added DVB subtitles decoder, spupng in output - Added support for cdt2 media atoms in QT video files. Now multiple atoms in a single sample sequence are supported. +- Changed Makefile. +- Fixed some bugs. +- Added feature to print info about file's subtitles and streams. 0.69 ---- diff --git a/linux/Makefile b/linux/Makefile index 60a7ce29..1fe9a9c0 100644 --- a/linux/Makefile +++ b/linux/Makefile @@ -3,7 +3,7 @@ SHELL = /bin/sh CC = gcc CXX = g++ -CFLAGS = -g -Wall -std=gnu99 +CFLAGS = -O3 -std=gnu99 INCLUDE = -I../src/gpacmp4/ -I../src/libpng -I../src/zlib ALL_FLAGS = -Wno-write-strings -DGPAC_CONFIG_LINUX -D_FILE_OFFSET_BITS=64 LDFLAGS = -lm -zmuldefs @@ -40,6 +40,7 @@ CFLAGS+=-I/usr/local/include/tesseract -I/usr/local/include/leptonica CFLAGS+=-DENABLE_OCR LDFLAGS+= $(shell pkg-config --libs tesseract) endif + .PHONY: all all: objs_dir $(TARGET) diff --git a/src/ccextractor.h b/src/ccextractor.h index e4a5701f..7c9bdb61 100644 --- a/src/ccextractor.h +++ b/src/ccextractor.h @@ -174,6 +174,7 @@ struct file_report_t unsigned services708[63]; unsigned dvb_sub_pid[SUB_STREAMS_CNT]; unsigned tlt_sub_pid[SUB_STREAMS_CNT]; + unsigned mp4_cc_track_cnt; } file_report; diff --git a/src/file_functions.c b/src/file_functions.c index 58f37ecd..afb0f501 100644 --- a/src/file_functions.c +++ b/src/file_functions.c @@ -125,7 +125,11 @@ int switch_to_next_file (LLONG bytesinbuffer) if (ccx_options.input_source==CCX_DS_STDIN) { if (infd!=-1) // Means we had already processed stdin. So we're done. + { + if (ccx_options.print_file_reports) + print_file_report(); return 0; + } infd=0; mprint ("\n\r-----------------------------------------------------------------\n"); mprint ("\rReading from standard input\n"); @@ -134,7 +138,12 @@ int switch_to_next_file (LLONG bytesinbuffer) if (ccx_options.input_source==CCX_DS_NETWORK) { if (infd!=-1) // Means we have already bound a socket. + { + if (ccx_options.print_file_reports) + print_file_report(); + return 0; + } if (init_sockets()) return 1; infd=socket(AF_INET,SOCK_DGRAM,0); @@ -179,7 +188,6 @@ int switch_to_next_file (LLONG bytesinbuffer) { if (ccx_options.print_file_reports) print_file_report(); - close_input_file (); if (inputsize>0 && ((past+bytesinbuffer) < inputsize) && !processed_enough) { diff --git a/src/gpacmp4/mp4.c b/src/gpacmp4/mp4.c index fcb48fe5..9887d346 100644 --- a/src/gpacmp4/mp4.c +++ b/src/gpacmp4/mp4.c @@ -74,6 +74,7 @@ static int process_avc_sample(u32 timescale, GF_AVCConfig* c, GF_ISOSample* s) static int process_xdvb_track(const char* basename, GF_ISOFile* f, u32 track) { u32 timescale, i, sample_count, last_sdi = 0; + int status; if((sample_count = gf_isom_get_sample_count(f, track)) < 1){ return 0; @@ -340,7 +341,7 @@ int processmp4 (char *file) f = NULL; mprint ("ok\n"); - if(avc_track_count == 0){ + if(avc_track_count == 0){ mprint("Found no AVC track(s). ", file); }else{ mprint("Found %d AVC track(s). ", avc_track_count); @@ -350,5 +351,9 @@ int processmp4 (char *file) else mprint ("found no dedicated CC track(s).\n"); + file_report.mp4_cc_track_cnt = cc_track_count; + if (ccx_options.print_file_reports) + print_file_report(); + return 0; } diff --git a/src/params.c b/src/params.c index 962f6308..434469cd 100644 --- a/src/params.c +++ b/src/params.c @@ -274,9 +274,10 @@ void set_output_format (const char *format) } else if (strcmp (format,"report")==0) { - ccx_options.write_format=CCX_OF_NULL; + ccx_options.write_format=CCX_OF_NULL; ccx_options.messages_target=0; - ccx_options.print_file_reports=1; + ccx_options.print_file_reports=1; + ccx_options.ts_autoprogram=1; } else if (strcmp (format,"raw")==0) ccx_options.write_format=CCX_OF_RAW; @@ -406,8 +407,8 @@ void usage (void) mprint (" dvdauthor's spumux.\n"); mprint (" See \"Notes on spupng output format\"\n"); mprint (" null -> Don't produce any file output\n"); - mprint (" report -> Prints to stdout information about captions"); - mprint (" in specified input. Don't produce any file"); + mprint (" report -> Prints to stdout information about captions\n"); + mprint (" in specified input. Don't produce any file\n"); mprint (" output\n\n"); mprint (" Note: Teletext output can only be srt, txt or ttxt for now.\n\n"); diff --git a/src/params_dump.c b/src/params_dump.c index 3b5bc838..2e46aed0 100644 --- a/src/params_dump.c +++ b/src/params_dump.c @@ -219,15 +219,15 @@ void print_file_report(void) break; } - printf("StreamMode: "); + printf("Stream Mode: "); switch (stream_mode) { case CCX_SM_TRANSPORT: - printf("transport_stream\n"); + printf("Transport Stream\n"); - printf("ProgramCount: %d\n", file_report.program_cnt); + printf("Program Count: %d\n", file_report.program_cnt); - printf("ProgramNumbers: "); + printf("Program Numbers: "); for (int i = 0; i < pmt_array_length; i++) { if (pmt_array[i].program_number == 0) @@ -263,7 +263,7 @@ void print_file_report(void) break; case CCX_SM_PROGRAM: - printf("program_stream\n"); + printf("Program Stream\n"); break; case CCX_SM_ASF: printf("ASF\n"); @@ -272,22 +272,40 @@ void print_file_report(void) printf("WTV\n"); break; case CCX_SM_ELEMENTARY_OR_NOT_FOUND: - printf("not_found\n"); + printf("Not Found\n"); + break; + case CCX_SM_MP4: + printf("MP4\n"); + break; + case CCX_SM_MCPOODLESRAW: + printf("McPoodle's raw\n"); + break; + case CCX_SM_RCWT: + printf("BIN\n"); + break; + case CCX_SM_HEX_DUMP: + printf("Hex\n"); + break; + default: break; } - if (ccx_bufferdatatype == CCX_PES) + if (ccx_bufferdatatype == CCX_PES && + (stream_mode == CCX_SM_TRANSPORT || + stream_mode == CCX_SM_PROGRAM || + stream_mode == CCX_SM_ASF || + stream_mode == CCX_SM_WTV)) { printf("Width: %u\n", file_report.width); printf("Height: %u\n", file_report.height); - printf("AspectRatio: %s\n", aspect_ratio_types[file_report.aspect_ratio]); - printf("FrameRate: %s\n", framerates_types[file_report.frame_rate]); + printf("Aspect Ratio: %s\n", aspect_ratio_types[file_report.aspect_ratio]); + printf("Frame Rate: %s\n", framerates_types[file_report.frame_rate]); } if (file_report.program_cnt > 1) printf("//////// Program #%u: ////////\n", TS_program_number); - printf("DVB-Subtitles: "); + printf("DVB Subtitles: "); int j; for (j = 0; j < SUB_STREAMS_CNT; j++) { @@ -313,7 +331,7 @@ void print_file_report(void) { printf("Yes\n"); - printf("PagesWithSubtitles: "); + printf("Pages With Subtitles: "); for (int i = 0; i < MAX_TLT_PAGES; i++) { if (seen_sub_page[i] == 0) @@ -332,7 +350,7 @@ void print_file_report(void) if (cc_stats[0] > 0 || cc_stats[1] > 0) { - printf("XDSPresent: %s\n", Y_N(file_report.xds)); + printf("XDS: %s\n", Y_N(file_report.xds)); printf("CC1: %s\n", Y_N(file_report.cc_channels_608[0])); printf("CC2: %s\n", Y_N(file_report.cc_channels_608[1])); @@ -353,9 +371,14 @@ void print_file_report(void) } printf("\n"); - printf("PrimaryLanguagePresent: %s\n", Y_N(file_report.services708[1])); + printf("Primary Language Present: %s\n", Y_N(file_report.services708[1])); - printf("SecondaryLanguagePresent: %s\n", Y_N(file_report.services708[2])); + printf("Secondary Language Present: %s\n", Y_N(file_report.services708[2])); + } + + printf("MPEG-4 Timed Text: %s\n", Y_N(file_report.mp4_cc_track_cnt)); + if (file_report.mp4_cc_track_cnt) { + printf("MPEG-4 Timed Text tracks count: %d\n", file_report.mp4_cc_track_cnt); } memset(&file_report, 0, sizeof (struct file_report_t)); diff --git a/src/stream_functions.c b/src/stream_functions.c index 71a8e421..7ded520c 100644 --- a/src/stream_functions.c +++ b/src/stream_functions.c @@ -103,7 +103,8 @@ void detect_stream_type (void) stream_mode=CCX_SM_ELEMENTARY_OR_NOT_FOUND; } } - if (stream_mode==CCX_SM_ELEMENTARY_OR_NOT_FOUND && startbytes_avail>=4) // Still not found + if ((stream_mode==CCX_SM_ELEMENTARY_OR_NOT_FOUND || ccx_options.print_file_reports) + && startbytes_avail>=4) // Still not found { // Try for MP4 by looking for box signatures - this should happen very // early in the file according to specs