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 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
----

View File

@ -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)

View File

@ -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;

View File

@ -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)
{

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)
{
u32 timescale, i, sample_count, last_sdi = 0;
int status;
if((sample_count = gf_isom_get_sample_count(f, track)) < 1){
return 0;
@ -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;
}

View File

@ -277,6 +277,7 @@ void set_output_format (const char *format)
ccx_options.write_format=CCX_OF_NULL;
ccx_options.messages_target=0;
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");

View File

@ -223,7 +223,7 @@ void print_file_report(void)
switch (stream_mode)
{
case CCX_SM_TRANSPORT:
printf("transport_stream\n");
printf("Transport Stream\n");
printf("Program Count: %d\n", file_report.program_cnt);
@ -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,11 +272,29 @@ 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);
@ -287,7 +305,7 @@ void print_file_report(void)
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++)
{
@ -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]));
@ -358,6 +376,11 @@ void print_file_report(void)
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));
#undef Y_N

View File

@ -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