mp4 support

This commit is contained in:
Ruslan Kuchumov 2014-07-01 13:09:26 +00:00
parent 9d8bb65e2a
commit 7be2d231a8
8 changed files with 65 additions and 22 deletions

View File

@ -9,6 +9,9 @@ version of CCExtractor.
- Added DVB subtitles decoder, spupng in output - Added DVB subtitles decoder, spupng in output
- Added support for cdt2 media atoms in QT video files. Now multiple atoms in - Added support for cdt2 media atoms in QT video files. Now multiple atoms in
a single sample sequence are supported. a single sample sequence are supported.
- Changed Makefile.
- Fixed some bugs.
- Added feature to print info about file's subtitles and streams.
0.69 0.69
---- ----

View File

@ -3,7 +3,7 @@ SHELL = /bin/sh
CC = gcc CC = gcc
CXX = g++ CXX = g++
CFLAGS = -g -Wall -std=gnu99 CFLAGS = -O3 -std=gnu99
INCLUDE = -I../src/gpacmp4/ -I../src/libpng -I../src/zlib INCLUDE = -I../src/gpacmp4/ -I../src/libpng -I../src/zlib
ALL_FLAGS = -Wno-write-strings -DGPAC_CONFIG_LINUX -D_FILE_OFFSET_BITS=64 ALL_FLAGS = -Wno-write-strings -DGPAC_CONFIG_LINUX -D_FILE_OFFSET_BITS=64
LDFLAGS = -lm -zmuldefs LDFLAGS = -lm -zmuldefs
@ -40,6 +40,7 @@ CFLAGS+=-I/usr/local/include/tesseract -I/usr/local/include/leptonica
CFLAGS+=-DENABLE_OCR CFLAGS+=-DENABLE_OCR
LDFLAGS+= $(shell pkg-config --libs tesseract) LDFLAGS+= $(shell pkg-config --libs tesseract)
endif endif
.PHONY: all .PHONY: all
all: objs_dir $(TARGET) all: objs_dir $(TARGET)

View File

@ -174,6 +174,7 @@ struct file_report_t
unsigned services708[63]; unsigned services708[63];
unsigned dvb_sub_pid[SUB_STREAMS_CNT]; unsigned dvb_sub_pid[SUB_STREAMS_CNT];
unsigned tlt_sub_pid[SUB_STREAMS_CNT]; unsigned tlt_sub_pid[SUB_STREAMS_CNT];
unsigned mp4_cc_track_cnt;
} file_report; } file_report;

View File

@ -125,7 +125,11 @@ int switch_to_next_file (LLONG bytesinbuffer)
if (ccx_options.input_source==CCX_DS_STDIN) if (ccx_options.input_source==CCX_DS_STDIN)
{ {
if (infd!=-1) // Means we had already processed stdin. So we're done. if (infd!=-1) // Means we had already processed stdin. So we're done.
{
if (ccx_options.print_file_reports)
print_file_report();
return 0; return 0;
}
infd=0; infd=0;
mprint ("\n\r-----------------------------------------------------------------\n"); mprint ("\n\r-----------------------------------------------------------------\n");
mprint ("\rReading from standard input\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 (ccx_options.input_source==CCX_DS_NETWORK)
{ {
if (infd!=-1) // Means we have already bound a socket. if (infd!=-1) // Means we have already bound a socket.
{
if (ccx_options.print_file_reports)
print_file_report();
return 0; return 0;
}
if (init_sockets()) if (init_sockets())
return 1; return 1;
infd=socket(AF_INET,SOCK_DGRAM,0); infd=socket(AF_INET,SOCK_DGRAM,0);
@ -179,7 +188,6 @@ int switch_to_next_file (LLONG bytesinbuffer)
{ {
if (ccx_options.print_file_reports) if (ccx_options.print_file_reports)
print_file_report(); print_file_report();
close_input_file (); close_input_file ();
if (inputsize>0 && ((past+bytesinbuffer) < inputsize) && !processed_enough) if (inputsize>0 && ((past+bytesinbuffer) < inputsize) && !processed_enough)
{ {

View File

@ -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) static int process_xdvb_track(const char* basename, GF_ISOFile* f, u32 track)
{ {
u32 timescale, i, sample_count, last_sdi = 0; u32 timescale, i, sample_count, last_sdi = 0;
int status; int status;
if((sample_count = gf_isom_get_sample_count(f, track)) < 1){ if((sample_count = gf_isom_get_sample_count(f, track)) < 1){
return 0; return 0;
@ -350,5 +351,9 @@ int processmp4 (char *file)
else else
mprint ("found no dedicated CC track(s).\n"); 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; return 0;
} }

View File

@ -277,6 +277,7 @@ void set_output_format (const char *format)
ccx_options.write_format=CCX_OF_NULL; ccx_options.write_format=CCX_OF_NULL;
ccx_options.messages_target=0; 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) else if (strcmp (format,"raw")==0)
ccx_options.write_format=CCX_OF_RAW; ccx_options.write_format=CCX_OF_RAW;
@ -406,8 +407,8 @@ void usage (void)
mprint (" dvdauthor's spumux.\n"); mprint (" dvdauthor's spumux.\n");
mprint (" See \"Notes on spupng output format\"\n"); mprint (" See \"Notes on spupng output format\"\n");
mprint (" null -> Don't produce any file output\n"); mprint (" null -> Don't produce any file output\n");
mprint (" report -> Prints to stdout information about captions"); mprint (" report -> Prints to stdout information about captions\n");
mprint (" in specified input. Don't produce any file"); mprint (" in specified input. Don't produce any file\n");
mprint (" output\n\n"); mprint (" output\n\n");
mprint (" Note: Teletext output can only be srt, txt or ttxt for now.\n\n"); mprint (" Note: Teletext output can only be srt, txt or ttxt for now.\n\n");

View File

@ -219,15 +219,15 @@ void print_file_report(void)
break; break;
} }
printf("StreamMode: "); printf("Stream Mode: ");
switch (stream_mode) switch (stream_mode)
{ {
case CCX_SM_TRANSPORT: 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++) for (int i = 0; i < pmt_array_length; i++)
{ {
if (pmt_array[i].program_number == 0) if (pmt_array[i].program_number == 0)
@ -263,7 +263,7 @@ void print_file_report(void)
break; break;
case CCX_SM_PROGRAM: case CCX_SM_PROGRAM:
printf("program_stream\n"); printf("Program Stream\n");
break; break;
case CCX_SM_ASF: case CCX_SM_ASF:
printf("ASF\n"); printf("ASF\n");
@ -272,22 +272,40 @@ void print_file_report(void)
printf("WTV\n"); printf("WTV\n");
break; break;
case CCX_SM_ELEMENTARY_OR_NOT_FOUND: 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; 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("Width: %u\n", file_report.width);
printf("Height: %u\n", file_report.height); printf("Height: %u\n", file_report.height);
printf("AspectRatio: %s\n", aspect_ratio_types[file_report.aspect_ratio]); printf("Aspect Ratio: %s\n", aspect_ratio_types[file_report.aspect_ratio]);
printf("FrameRate: %s\n", framerates_types[file_report.frame_rate]); printf("Frame Rate: %s\n", framerates_types[file_report.frame_rate]);
} }
if (file_report.program_cnt > 1) if (file_report.program_cnt > 1)
printf("//////// Program #%u: ////////\n", TS_program_number); printf("//////// Program #%u: ////////\n", TS_program_number);
printf("DVB-Subtitles: "); printf("DVB Subtitles: ");
int j; int j;
for (j = 0; j < SUB_STREAMS_CNT; j++) for (j = 0; j < SUB_STREAMS_CNT; j++)
{ {
@ -313,7 +331,7 @@ void print_file_report(void)
{ {
printf("Yes\n"); printf("Yes\n");
printf("PagesWithSubtitles: "); printf("Pages With Subtitles: ");
for (int i = 0; i < MAX_TLT_PAGES; i++) for (int i = 0; i < MAX_TLT_PAGES; i++)
{ {
if (seen_sub_page[i] == 0) if (seen_sub_page[i] == 0)
@ -332,7 +350,7 @@ void print_file_report(void)
if (cc_stats[0] > 0 || cc_stats[1] > 0) 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("CC1: %s\n", Y_N(file_report.cc_channels_608[0]));
printf("CC2: %s\n", Y_N(file_report.cc_channels_608[1])); printf("CC2: %s\n", Y_N(file_report.cc_channels_608[1]));
@ -353,9 +371,14 @@ void print_file_report(void)
} }
printf("\n"); 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)); memset(&file_report, 0, sizeof (struct file_report_t));

View File

@ -103,7 +103,8 @@ void detect_stream_type (void)
stream_mode=CCX_SM_ELEMENTARY_OR_NOT_FOUND; 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 // Try for MP4 by looking for box signatures - this should happen very
// early in the file according to specs // early in the file according to specs