Compare commits

...

17 Commits
v0.71 ... v0.72

Author SHA1 Message Date
cfsmp3
7fa59a14f7 Updated MD 2014-08-12 17:15:39 +02:00
wforums
4e6c0352b0 XDS segfault fix
Fixes segfault on using TTXT + XDS
2014-08-12 10:39:01 +02:00
cfsmp3
cc7ebbc4d7 Replace g++ with gcc in OSX 2014-08-11 14:33:52 +02:00
Ruslan Kuchumov
7a74b815fa segfault on error fix 2014-08-09 21:23:27 +00:00
Ruslan Kuchumov
331038634d password bug fix 2014-08-09 21:17:41 +00:00
Ruslan Kuchumov
aa2c316093 Chris's patch 2014-08-09 20:52:15 +00:00
cfsmp3
3347f5d345 Version bump 2014-08-09 13:18:56 +02:00
cfsmp3
141792a299 Delete upgradelog. 2014-08-09 13:18:14 +02:00
cfsmp3
183e613981 Merge branch 'pr/n93_wforums' 2014-08-08 16:39:02 +02:00
wforums
19e2912a71 AVC fps fix
- Will now change current_fps based on AVC data (if present). Should fix
an issue with low fps video that was submitted.
2014-08-07 21:09:45 +02:00
wforums
dc82154a03 AVC fps fix
Changes.txt updated.
2014-08-07 21:09:31 +02:00
cfsmp3
2029dab3bf Merge branch 'pr/n92_anshul1912' 2014-08-05 21:24:08 +02:00
wforums
405d808d0b WTV fix
Fixed WTV
2014-08-04 21:10:17 +02:00
cfsmp3
ecc0714f48 Correction to text files 2014-07-29 10:12:22 +02:00
cfsmp3
26410b991d Version pump 2014-07-29 10:06:45 +02:00
cfsmp3
19b1bff7f4 Merge branch 'pr/n91_anshul1912'
Conflicts:
	docs/CHANGES.TXT
2014-07-29 09:28:28 +02:00
wforums
b765198d53 Updated for 0.71
-
2014-07-28 22:22:47 +02:00
13 changed files with 213 additions and 109 deletions

View File

@@ -4,7 +4,7 @@ MAINTAINER = Marc Espie <espie@openbsd.org>
CATEGORIES = multimedia
COMMENT = closed caption subtitles extractor
HOMEPAGE = http://ccextractor.sourceforge.net/
V = 0.70
V = 0.71
DISTFILES = ccextractor.${V:S/.//}-src.zip
MASTER_SITES = ${MASTER_SITE_SOURCEFORGE:=ccextractor/}
DISTNAME = ccextractor-$V

View File

@@ -3,7 +3,12 @@ ccextractor
CCExtractor - Carlos' version (mainstream).
0.71
GSOC - 0.72
-----------
- Fix for WTV files with incorrect timing
- Added support for fps change using data from AVC video track in a H264 TS file.
GSOC - 0.71
-----------
- Added feature to receive captions in BIN format according to CCExtractor's own
protocol over TCP (-tcp port [-tcppassword password])

View File

@@ -1,4 +1,9 @@
0.71
0.72 - GSOC
-----------
- Fix for WTV files with incorrect timing
- Added support for fps change using data from AVC video track in a H264 TS file.
0.71 - GSOC
-----------
- Added feature to receive captions in BIN format according to CCExtractor's own
protocol over TCP (-tcp port [-tcppassword password])
@@ -6,7 +11,7 @@
online repository (-sendto host[:port])
- Added -stdin parameter for reading input stream from standard input
- Compilation in Cygwin using linux/Makefile
- Code tested with coverity for defect density 0.42
- Fix for .bin files when not using latin1 charset
- Correction of mp4 timing, when one timestamp points timing of two atom
0.70 - GSOC

View File

@@ -1,4 +1,4 @@
ccextractor, 0.63
ccextractor, 0.71
-----------------
Authors: Carlos Fernández (cfsmp3), Volker Quetschke.
Maintainer: cfsmp3
@@ -7,12 +7,17 @@ Lots of credit goes to other people, though:
McPoodle (author of the original SCC_RIP), Neuron2, and others (see source
code).
Home: http://ccextractor.sourceforge.net
Home: http://www.ccextractor.org
You can subscribe to new releases notifications at freshmeat:
http://freshmeat.net/projects/ccextractor
Google Summer of Code 2014 students
- Willem van iseghem
- Ruslan KuchumoV
- Anshul Maheshwari
License
-------
GPL 2.0.
@@ -67,21 +72,18 @@ If there are Spanish subtitles, one of them should work.
McPoodle's page
---------------
http://www.geocities.com/mcpoodle43/SCC_TOOLS/DOCS/SCC_TOOLS.HTML
http://www.theneitherworld.com/mcpoodle/SCC_TOOLS/DOCS/SCC_TOOLS.HTML
Essential CC related information and free (with source) tools.
Encoding
--------
This version, in both its Linux and Windows builds generates by
default Latin-1 encoded files. You can use -unicode and -utf8
if you prefer these encodings (usually it just depends on what
your specific player likes).
This has changed from the previous UTF-8 default which vobsub
can't handle.
default Unicode files. You can use -latin1 and -utf8 if you prefer
these encodings (usually it just depends on what your specific
player likes).
Future work
-----------
- Finish EIA-708 decoder
- Network support
- Please check www.ccextractor.org for news and future work.

View File

@@ -1 +1 @@
g++ -Dfopen64=fopen -Dopen64=open -Dlseek64=lseek -I../src/gpacmp4 -I ../src/libpng -I ../src/zlib -o ccextractor $(find ../src/ -name '*.cpp') $(find ../src/ -name '*.c')
gcc -std=gnu99 -Wno-write-strings -Dfopen64=fopen -Dopen64=open -Dlseek64=lseek -I../src/gpacmp4 -I ../src/libpng -I ../src/zlib -o ccextractor $(find ../src/ -name '*.cpp') $(find ../src/ -name '*.c')

View File

@@ -563,151 +563,223 @@ void seq_parameter_set_rbsp (unsigned char *seqbuf, unsigned char *seqend)
dvprint("SEQUENCE PARAMETER SET (bitlen: %lld)\n", q1.bitsleft);
tmp=u(&q1,8);
dvprint("profile_idc= %llX\n", tmp);
LLONG profile_idc = tmp;
dvprint("profile_idc= % 4lld (%#llX)\n",tmp,tmp);
tmp=u(&q1,1);
dvprint("constraint_set0_flag= %llX\n", tmp);
dvprint("constraint_set0_flag= % 4lld (%#llX)\n",tmp,tmp);
tmp=u(&q1,1);
dvprint("constraint_set1_flag= %llX\n", tmp);
dvprint("constraint_set1_flag= % 4lld (%#llX)\n",tmp,tmp);
tmp=u(&q1,1);
dvprint("constraint_set2_flag= %llX\n", tmp);
tmp=u(&q1,5);
dvprint("reserved= %llX\n", tmp);
dvprint("constraint_set2_flag= % 4lld (%#llX)\n",tmp,tmp);
tmp = u(&q1, 1);
dvprint("constraint_set3_flag= % 4lld (%#llX)\n",tmp,tmp);
tmp = u(&q1, 1);
dvprint("constraint_set4_flag= % 4lld (%#llX)\n",tmp,tmp);
tmp = u(&q1, 1);
dvprint("constraint_set5_flag= % 4lld (%#llX)\n",tmp,tmp);
tmp=u(&q1,2);
dvprint("reserved= % 4lld (%#llX)\n",tmp,tmp);
tmp=u(&q1,8);
dvprint("level_idc= %llX\n", tmp);
dvprint("level_idc= % 4lld (%#llX)\n",tmp,tmp);
seq_parameter_set_id = ue(&q1);
dvprint("seq_parameter_set_id= %llX\n", seq_parameter_set_id);
log2_max_frame_num = (int)ue(&q1)+4;
dvprint("log2_max_frame_num4= %X\n", log2_max_frame_num);
dvprint("seq_parameter_set_id= % 4lld (%#llX)\n", seq_parameter_set_id,seq_parameter_set_id);
if (profile_idc == 100 || profile_idc == 110 || profile_idc == 122
|| profile_idc == 244 || profile_idc == 44 || profile_idc == 83
|| profile_idc == 86 || profile_idc == 118 || profile_idc == 128){
LLONG chroma_format_idc = ue(&q1);
dvprint("chroma_format_idc= % 4lld (%#llX)\n", chroma_format_idc,chroma_format_idc);
if (chroma_format_idc == 3){
tmp = u(&q1, 1);
dvprint("separate_colour_plane_flag= % 4lld (%#llX)\n", tmp, tmp);
}
tmp = ue(&q1);
dvprint("bit_depth_luma_minus8= % 4lld (%#llX)\n", tmp, tmp);
tmp = ue(&q1);
dvprint("bit_depth_chroma_minus8= % 4lld (%#llX)\n", tmp, tmp);
tmp = u(&q1,1);
dvprint("qpprime_y_zero_transform_bypass_flag= % 4lld (%#llX)\n", tmp, tmp);
tmp = u(&q1, 1);
dvprint("seq_scaling_matrix_present_flag= % 4lld (%#llX)\n", tmp, tmp);
if (tmp == 1){
// WVI: untested, just copied from specs.
for (int i = 0; i < ((chroma_format_idc != 3) ? 8 : 12); i++){
tmp = u(&q1, 1);
dvprint("seq_scaling_list_present_flag[%d]= % 4lld (%#llX)\n",i,tmp, tmp);
if (tmp){
// We use a "dummy"/slimmed-down replacement here. Actual/full code can be found in the spec (ISO/IEC 14496-10:2012(E)) chapter 7.3.2.1.1.1 - Scaling list syntax
if (i < 6){
// Scaling list size 16
// TODO: replace with full scaling list implementation?
int nextScale = 8;
int lastScale = 8;
for (int j = 0; j < 16; j++){
if (nextScale != 0){
int64_t delta_scale = se(&q1);
nextScale = (lastScale + delta_scale + 256) % 256;
}
lastScale = (nextScale == 0) ? lastScale : nextScale;
}
// END of TODO
}
else {
// Scaling list size 64
// TODO: replace with full scaling list implementation?
int nextScale = 8;
int lastScale = 8;
for (int j = 0; j < 64; j++){
if (nextScale != 0){
int64_t delta_scale = se(&q1);
nextScale = (lastScale + delta_scale + 256) % 256;
}
lastScale = (nextScale == 0) ? lastScale : nextScale;
}
// END of TODO
}
}
}
}
}
log2_max_frame_num = (int)ue(&q1);
dvprint("log2_max_frame_num4_minus4= % 4d (%#X)\n", log2_max_frame_num,log2_max_frame_num);
log2_max_frame_num += 4; // 4 is added due to the formula.
pic_order_cnt_type = (int)ue(&q1);
dvprint("pic_order_cnt_type= %X\n", pic_order_cnt_type);
dvprint("pic_order_cnt_type= % 4d (%#X)\n", pic_order_cnt_type,pic_order_cnt_type);
if( pic_order_cnt_type == 0 )
{
log2_max_pic_order_cnt_lsb = (int)ue(&q1)+4;
dvprint("log2_max_pic_order_cnt_lsb= %X\n", log2_max_pic_order_cnt_lsb);
log2_max_pic_order_cnt_lsb = (int)ue(&q1);
dvprint("log2_max_pic_order_cnt_lsb_minus4= % 4d (%#X)\n", log2_max_pic_order_cnt_lsb,log2_max_pic_order_cnt_lsb);
log2_max_pic_order_cnt_lsb += 4; // 4 is added due to formula.
}
else if( pic_order_cnt_type == 1 )
{
// CFS: Untested, just copied from specs.
tmp= u(&q1,1);
dvprint("delta_pic_order_always_zero_flag= %llX\n", tmp);
dvprint("delta_pic_order_always_zero_flag= % 4lld (%#llX)\n",tmp,tmp);
tmp = se(&q1);
dvprint("offset_for_non_ref_pic= %llX\n", tmp);
dvprint("offset_for_non_ref_pic= % 4lld (%#llX)\n",tmp,tmp);
tmp = se(&q1);
dvprint("offset_for_top_to_bottom_field %llX\n", tmp);
dvprint("offset_for_top_to_bottom_field % 4lld (%#llX)\n",tmp,tmp);
LLONG num_ref_frame_in_pic_order_cnt_cycle = ue (&q1);
dvprint("num_ref_frame_in_pic_order_cnt_cycle %llX\n", num_ref_frame_in_pic_order_cnt_cycle);
dvprint("num_ref_frame_in_pic_order_cnt_cycle % 4lld (%#llX)\n", num_ref_frame_in_pic_order_cnt_cycle,num_ref_frame_in_pic_order_cnt_cycle);
for (int i=0; i<num_ref_frame_in_pic_order_cnt_cycle; i++)
{
tmp=se(&q1);
dvprint("offset_for_ref_frame [%d / %d] = %llX\n", i, num_ref_frame_in_pic_order_cnt_cycle, tmp);
}
dvprint("offset_for_ref_frame [%d / %d] = % 4lld (%#llX)\n", i, num_ref_frame_in_pic_order_cnt_cycle, tmp,tmp);
}
}
else
{
// CFS: Looks like nothing needs to be parsed for pic_order_cnt_type==2 ?
// fatal(EXIT_BUG_BUG, "AVC: pic_order_cnt_type > 1 is not yet supported.");
// Nothing needs to be parsed when pic_order_cnt_type == 2
}
tmp=ue(&q1);
dvprint("num_ref_frames= %llX\n", tmp);
dvprint("max_num_ref_frames= % 4lld (%#llX)\n",tmp,tmp);
tmp=u(&q1,1);
dvprint("gaps allowed= %llX\n", tmp);
dvprint("gaps_in_frame_num_value_allowed_flag= % 4lld (%#llX)\n",tmp,tmp);
tmp=ue(&q1);
dvprint("pic_width_in_mbs_minus1= %llX\n", tmp);
dvprint("pic_width_in_mbs_minus1= % 4lld (%#llX)\n",tmp,tmp);
tmp=ue(&q1);
dvprint("pic_height_in_map_units_minus1= %llX\n", tmp);
dvprint("pic_height_in_map_units_minus1= % 4lld (%#llX)\n",tmp,tmp);
frame_mbs_only_flag = (int)u(&q1,1);
dvprint("frame_mbs_only_flag= %X\n", frame_mbs_only_flag);
dvprint("frame_mbs_only_flag= % 4d (%#X)\n", frame_mbs_only_flag,frame_mbs_only_flag);
if ( !frame_mbs_only_flag )
{
tmp=u(&q1,1);
dvprint("mb_adaptive_fr_fi_flag= %llX\n", tmp);
dvprint("mb_adaptive_fr_fi_flag= % 4lld (%#llX)\n",tmp,tmp);
}
tmp=u(&q1,1);
dvprint("direct_8x8_inference_f= %llX\n", tmp);
dvprint("direct_8x8_inference_f= % 4lld (%#llX)\n",tmp,tmp);
tmp=u(&q1,1);
dvprint("frame_cropping_flag= %llX\n", tmp);
dvprint("frame_cropping_flag= % 4lld (%#llX)\n",tmp,tmp);
if ( tmp )
{
tmp=ue(&q1);
dvprint("frame_crop_left_offset= %llX\n", tmp);
dvprint("frame_crop_left_offset= % 4lld (%#llX)\n",tmp,tmp);
tmp=ue(&q1);
dvprint("frame_crop_right_offset= %llX\n", tmp);
dvprint("frame_crop_right_offset= % 4lld (%#llX)\n",tmp,tmp);
tmp=ue(&q1);
dvprint("frame_crop_top_offset= %llX\n", tmp);
dvprint("frame_crop_top_offset= % 4lld (%#llX)\n",tmp,tmp);
tmp=ue(&q1);
dvprint("frame_crop_bottom_offset= %llX\n", tmp);
dvprint("frame_crop_bottom_offset= % 4lld (%#llX)\n",tmp,tmp);
}
tmp=u(&q1,1);
dvprint("vui_parameters_present= %llX\n", tmp);
dvprint("vui_parameters_present= % 4lld (%#llX)\n",tmp,tmp);
if ( tmp )
{
dvprint("\nVUI parameters\n");
tmp=u(&q1,1);
dvprint("aspect_ratio_info_pres= %llX\n", tmp);
dvprint("aspect_ratio_info_pres= % 4lld (%#llX)\n",tmp,tmp);
if ( tmp )
{
tmp=u(&q1,8);
dvprint("aspect_ratio_idc= %llX\n", tmp);
dvprint("aspect_ratio_idc= % 4lld (%#llX)\n",tmp,tmp);
if ( tmp == 255 )
{
tmp=u(&q1,16);
dvprint("sar_width= %llX\n", tmp);
dvprint("sar_width= % 4lld (%#llX)\n",tmp,tmp);
tmp=u(&q1,16);
dvprint("sar_height= %llX\n", tmp);
dvprint("sar_height= % 4lld (%#llX)\n",tmp,tmp);
}
}
tmp=u(&q1,1);
dvprint("overscan_info_pres_flag= %llX\n", tmp);
dvprint("overscan_info_pres_flag= % 4lld (%#llX)\n",tmp,tmp);
if ( tmp )
{
tmp=u(&q1,1);
dvprint("overscan_appropriate_flag= %llX\n", tmp);
dvprint("overscan_appropriate_flag= % 4lld (%#llX)\n",tmp,tmp);
}
tmp=u(&q1,1);
dvprint("video_signal_type_present_flag= %llX\n", tmp);
dvprint("video_signal_type_present_flag= % 4lld (%#llX)\n",tmp,tmp);
if ( tmp )
{
tmp=u(&q1,3);
dvprint("video_format= %llX\n", tmp);
dvprint("video_format= % 4lld (%#llX)\n",tmp,tmp);
tmp=u(&q1,1);
dvprint("video_full_range_flag= %llX\n", tmp);
dvprint("video_full_range_flag= % 4lld (%#llX)\n",tmp,tmp);
tmp=u(&q1,1);
dvprint("colour_description_present_flag= %llX\n", tmp);
dvprint("colour_description_present_flag= % 4lld (%#llX)\n",tmp,tmp);
if ( tmp )
{
tmp=u(&q1,8);
dvprint("colour_primaries= %llX\n", tmp);
dvprint("colour_primaries= % 4lld (%#llX)\n",tmp,tmp);
tmp=u(&q1,8);
dvprint("transfer_characteristics= %llX\n", tmp);
dvprint("transfer_characteristics= % 4lld (%#llX)\n",tmp,tmp);
tmp=u(&q1,8);
dvprint("matrix_coefficients= %llX\n", tmp);
dvprint("matrix_coefficients= % 4lld (%#llX)\n",tmp,tmp);
}
}
tmp=u(&q1,1);
dvprint("chroma_loc_info_present_flag= %llX\n", tmp);
dvprint("chroma_loc_info_present_flag= % 4lld (%#llX)\n",tmp,tmp);
if ( tmp )
{
tmp=ue(&q1);
dvprint("chroma_sample_loc_type_top_field= %llX\n", tmp);
dvprint("chroma_sample_loc_type_top_field= % 4lld (%#llX)\n",tmp,tmp);
tmp=ue(&q1);
dvprint("chroma_sample_loc_type_bottom_field= %llX\n", tmp);
dvprint("chroma_sample_loc_type_bottom_field= % 4lld (%#llX)\n",tmp,tmp);
}
tmp=u(&q1,1);
dvprint("timing_info_present_flag= %llX\n", tmp);
dvprint("timing_info_present_flag= % 4lld (%#llX)\n",tmp,tmp);
if ( tmp )
{
tmp=u(&q1,32);
dvprint("num_units_in_tick= %llX\n", tmp);
LLONG num_units_in_tick = tmp;
dvprint("num_units_in_tick= % 4lld (%#llX)\n",tmp,tmp);
tmp=u(&q1,32);
dvprint("time_scale= %llX\n", tmp);
LLONG time_scale = tmp;
dvprint("time_scale= % 4lld (%#llX)\n",tmp,tmp);
tmp=u(&q1,1);
dvprint("fixed_frame_rate_flag= %llX\n", tmp);
int fixed_frame_rate_flag = (int) tmp;
dvprint("fixed_frame_rate_flag= % 4lld (%#llX)\n",tmp,tmp);
// Change: use num_units_in_tick and time_scale to calculate FPS. (ISO/IEC 14496-10:2012(E), page 397 & further)
if (fixed_frame_rate_flag){
double clock_tick = (double) num_units_in_tick / time_scale;
dvprint("clock_tick= %f\n", clock_tick);
current_fps = (double)time_scale / (2 * num_units_in_tick); // Based on formula D-2, p. 359 of the ISO/IEC 14496-10:2012(E) spec.
mprint("Changed fps using NAL to: %f\n", current_fps);
}
}
tmp=u(&q1,1);
dvprint("nal_hrd_parameters_present_flag= %llX\n", tmp);
dvprint("nal_hrd_parameters_present_flag= % 4lld (%#llX)\n",tmp,tmp);
if ( tmp )
{
dvprint ("nal_hrd. Not implemented for now. Hopefully not needed. Skiping rest of NAL\n");
@@ -728,13 +800,13 @@ void seq_parameter_set_rbsp (unsigned char *seqbuf, unsigned char *seqend)
if ( tmp || tmp1 )
{
tmp=u(&q1,1);
dvprint("low_delay_hrd_flag= %llX\n", tmp);
dvprint("low_delay_hrd_flag= % 4lld (%#llX)\n",tmp,tmp);
return;
}
tmp=u(&q1,1);
dvprint("pic_struct_present_flag= %llX\n", tmp);
dvprint("pic_struct_present_flag= % 4lld (%#llX)\n",tmp,tmp);
tmp=u(&q1,1);
dvprint("bitstream_restriction_flag= %llX\n", tmp);
dvprint("bitstream_restriction_flag= % 4lld (%#llX)\n",tmp,tmp);
// ..
// The hope was to find the GOP length in max_dec_frame_buffering, but
// it was not set in the testfile. Ignore the rest here, it's
@@ -772,11 +844,11 @@ void slice_header (unsigned char *heabuf, unsigned char *heaend, int nal_unit_ty
dvprint("\nSLICE HEADER\n");
tmp=ue(&q1);
dvprint("first_mb_in_slice= %llX\n", tmp);
dvprint("first_mb_in_slice= % 4lld (%#llX)\n",tmp,tmp);
slice_type=ue(&q1);
dvprint("slice_type= %llX\n", slice_type);
tmp=ue(&q1);
dvprint("pic_parameter_set_id= %llX\n", tmp);
dvprint("pic_parameter_set_id= % 4lld (%#llX)\n",tmp,tmp);
lastframe_num = frame_num;
int maxframe_num = (int) ((1<<log2_max_frame_num) - 1);
@@ -808,7 +880,7 @@ void slice_header (unsigned char *heabuf, unsigned char *heaend, int nal_unit_ty
if( nal_unit_type == 5 )
{
tmp=ue(&q1);
dvprint("idr_pic_id= %llX\n", tmp);
dvprint("idr_pic_id= % 4lld (%#llX)\n",tmp,tmp);
//TODO
}
if( pic_order_cnt_type == 0 )

View File

@@ -13,7 +13,7 @@
// compatibility across platforms
#include "platform.h"
#define VERSION "0.70"
#define VERSION "0.72"
extern int cc_buffer_saved; // Do we have anything in the CC buffer already?
extern int ccblocks_in_avc_total; // Total CC blocks found by the AVC code

View File

@@ -188,16 +188,19 @@ ssize_t write_block(int fd, char command, const char *buf, size_t buf_len)
fprintf(stderr, " ");
#endif
if ((rc = writen(fd, buf, buf_len)) < 0)
return -1;
else if (rc != (int) buf_len)
return 0;
nwritten += rc;
if (buf_len > 0)
{
if ((rc = writen(fd, buf, buf_len)) < 0)
return -1;
else if (rc != (int) buf_len)
return 0;
nwritten += rc;
}
#if DEBUG_OUT
if (buf != NULL)
{
fwrite(buf, sizeof(char), buf_len - 2, stderr);
fwrite(buf, sizeof(char), buf_len, stderr);
fprintf(stderr, " ");
}
#endif
@@ -335,9 +338,6 @@ int ask_passwd(int sd)
p++;
len = p - pw; /* without \n */
printf("\n");
fflush(stdout);
if (write_block(sd, PASSWORD, pw, len) < 0)
return -1;
@@ -478,11 +478,12 @@ int check_password(int fd, const char *pwd)
char c;
int rc;
size_t len = BUFFER_SIZE;
size_t len;
char buf[BUFFER_SIZE];
while(1)
{
len = BUFFER_SIZE;
#if DEBUG_OUT
fprintf(stderr, "[S] PASSWORD\n");
#endif
@@ -495,7 +496,7 @@ int check_password(int fd, const char *pwd)
if (c != PASSWORD)
return -1;
if (0 != strcmp(pwd, buf))
if (strlen(pwd) != len || strncmp(pwd, buf, len) != 0)
{
sleep(WRONG_PASSWORD_DELAY);
@@ -569,21 +570,25 @@ int tcp_bind(const char *port, int *family)
}
}
if (0 == bind(sockfd, p->ai_addr, p->ai_addrlen))
break;
if (bind(sockfd, p->ai_addr, p->ai_addrlen) < 0)
{
#if _WIN32
wprintf(L"bind() eror: %ld\n", WSAGetLastError());
closesocket(sockfd);
wprintf(L"bind() eror: %ld\n", WSAGetLastError());
closesocket(sockfd);
#else
mprint("bind() error: %s\n", strerror(errno));
close(sockfd);
mprint("bind() error: %s\n", strerror(errno));
close(sockfd);
#endif
if (p->ai_next != NULL)
mprint("trying next addres ...\n");
}
if (p->ai_next != NULL)
mprint("trying next addres ...\n");
*family = p->ai_family;
continue;
}
*family = p->ai_family;
break;
}
freeaddrinfo(ai);
@@ -883,12 +888,11 @@ int start_upd_srv(const char *addr_str, unsigned port)
struct sockaddr_in servaddr;
servaddr.sin_family = AF_INET;
servaddr.sin_addr.s_addr = addr;
servaddr.sin_port = htons(port);
if (IN_MULTICAST(addr))
servaddr.sin_addr.s_addr = addr;
servaddr.sin_addr.s_addr = htonl(addr);
else
servaddr.sin_addr.s_addr = INADDR_ANY;
servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
if (bind(sockfd, (struct sockaddr *)&servaddr, sizeof(servaddr)) != 0)
{
@@ -904,7 +908,7 @@ int start_upd_srv(const char *addr_str, unsigned port)
struct ip_mreq group;
group.imr_multiaddr.s_addr = htonl(addr);
group.imr_interface.s_addr = htonl(INADDR_ANY);
if (setsockopt(infd, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char *)&group, sizeof(group)) < 0)
if (setsockopt(sockfd, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char *)&group, sizeof(group)) < 0)
{
#if _WIN32
wprintf(L"setsockopt() error: %ld\n", WSAGetLastError());

View File

@@ -18,7 +18,7 @@ void params_dump(void)
mprint ("Network, UDP/%u",ccx_options.udpport);
else
{
mprint ("Network, %s:%d",ccx_options.udpport, ccx_options.udpport);
mprint ("Network, %s:%d",ccx_options.udpaddr, ccx_options.udpport);
}
break;
case CCX_DS_TCP:

View File

@@ -4,6 +4,7 @@
#define WTV_STREAM2 "\xA2\xC3\xD2\xC2\x7E\x9A\xDA\x11\x8B\xF7\x00\x07\xE9\x5E\xAD\x8D"
#define WTV_DATA "\x95\xC3\xD2\xC2\x7E\x9A\xDA\x11\x8B\xF7\x00\x07\xE9\x5E\xAD\x8D"
#define WTV_STREAM_VIDEO "\x76\x69\x64\x73\x00\x00\x10\x00\x80\x00\x00\xAA\x00\x38\x9B\x71"
#define WTV_STREAM_AUDIO "\x61\x75\x64\x73\x00\x00\x10\x00\x80\x00\x00\xAA\x00\x38\x9B\x71"
#define WTV_STREAM_MSTVCAPTION "\x89\x8A\x8B\xB8\x49\xB0\x80\x4C\xAD\xCF\x58\x98\x98\x5E\x22\xC1"
#define WTV_EOF "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
#define WTV_TIMING "\x5B\x05\xE6\x1B\x97\xA9\x49\x43\x88\x17\x1A\x65\x5A\x29\x8A\x97"
@@ -18,6 +19,9 @@
//Maximum size we will try and malloc for chunked_buffer. 100MB
#define WTV_MAX_ALLOC 1024*1024*100
#define WTV_CC_TIMESTAMP_MAGIC 1668330
#define WTV_CC_TIMESTAMP_MAGIC_THRESH 2 //Only switch to alt stream after THRESH magic numbers
struct wtv_chunked_buffer
{
uint64_t skip_chunks[256];

View File

@@ -297,6 +297,8 @@ int read_header(struct wtv_chunked_buffer *cb) {
LLONG get_data(struct wtv_chunked_buffer *cb) {
static int video_streams[32];
static int alt_stream; //Stream to use for timestamps if the cc stream has broken timestamps
static int use_alt_stream = 0;
static int num_streams=0;
while(1)
{
@@ -368,9 +370,12 @@ LLONG get_data(struct wtv_chunked_buffer *cb) {
video_streams[num_streams]=stream_id; // We keep a list of stream ids
num_streams++; // Even though there should only be 1
}
if (memcmp(stream_type, WTV_STREAM_AUDIO, 16))
alt_stream = stream_id;
len-=28;
}
if( !memcmp(guid, WTV_TIMING, 16 ) && check_stream_id(stream_id, video_streams, num_streams))
if (!memcmp(guid, WTV_TIMING, 16) && ((use_alt_stream < WTV_CC_TIMESTAMP_MAGIC_THRESH && check_stream_id(stream_id, video_streams, num_streams))
|| (use_alt_stream == WTV_CC_TIMESTAMP_MAGIC_THRESH && stream_id == alt_stream)))
{
// The WTV_TIMING GUID contains a timestamp for the given stream_id
dbg_print(CCX_DMT_PARSE, "WTV TIMING\n");
@@ -379,12 +384,18 @@ LLONG get_data(struct wtv_chunked_buffer *cb) {
int64_t time;
memcpy(&time, cb->buffer+0x8, 8); // Read the timestamp
dbg_print(CCX_DMT_PARSE, "TIME: %ld\n", time);
if(time!=-1) { // Ignore -1 timestamps
if (time != -1 && time != WTV_CC_TIMESTAMP_MAGIC) { // Ignore -1 timestamps
current_pts = time_to_pes_time(time); // Convert from WTV to PES time
pts_set = 1;
frames_since_ref_time = 0;
set_fts();
}
}
else if (time == WTV_CC_TIMESTAMP_MAGIC && stream_id != alt_stream) {
use_alt_stream++;
mprint("WARNING: %i WTV_CC_TIMESTAMP_MAGIC detected in cc timestamps. \n", use_alt_stream);
if (use_alt_stream == WTV_CC_TIMESTAMP_MAGIC_THRESH)
mprint("WARNING: WTV_CC_TIMESTAMP_MAGIC_THRESH reached. Switching to alt timestamps!\n");
}
len-=16;
}
if( !memcmp(guid, WTV_DATA, 16 )

View File

@@ -142,6 +142,7 @@ int write_xds_string(struct cc_subtitle *sub,char *p,size_t len)
data->xds_len = len;
data->cur_xds_packet_class = cur_xds_packet_class;
sub->nb_data++;
sub->type = CC_608;
sub->got_output = 1;
}

Binary file not shown.