This commit is contained in:
Carlos Fernandez 2017-04-24 12:07:00 -07:00
commit adacb6235e
9 changed files with 83 additions and 12 deletions

5
.gitignore vendored
View File

@ -91,4 +91,7 @@ src/utf8proc/.dirstamp
src/zlib/.deps/ src/zlib/.deps/
src/zlib/.dirstamp src/zlib/.dirstamp
src/zvbi/.deps/ src/zvbi/.deps/
src/zvbi/.dirstamp src/zvbi/.dirstamp
# Arch
package_creators/*.pkg.tar.xz

View File

@ -89,6 +89,16 @@ More usage information can be found on our website:
# test your build # test your build
./ccextractor ./ccextractor
### Arch Linux
# make sure you have CCExtractor repository forked
# clone repository
sudo pacman -S git
git clone https://github.com/%USERNAME%/ccextractor.git # paste your github username
# building installation package (.pkg.tar.xz) or installing directly
cd ccextractor/package_creators
./arch.sh
### Windows ### Windows
Open the windows/ccextractor.sln file with Visual Studio (2015 at least), and build it. Configurations "(Debug|Release)-Full" includes dependent libraries which are used for OCR. Open the windows/ccextractor.sln file with Visual Studio (2015 at least), and build it. Configurations "(Debug|Release)-Full" includes dependent libraries which are used for OCR.

View File

@ -2,6 +2,7 @@
----------------- -----------------
- Fix: Prevent the OCR being initialized more than once (happened on multiprogram and - Fix: Prevent the OCR being initialized more than once (happened on multiprogram and
PAT changes) PAT changes)
- New: Added build/installation script for .pkg.tar.xz (Arch Linux).
0.85b (2017-1-26) 0.85b (2017-1-26)

22
package_creators/PKGBUILD Normal file
View File

@ -0,0 +1,22 @@
pkgname=ccextractor
pkgver=0.85
pkgrel=1
pkgdesc="A closed captions and teletext subtitles extractor for video streams."
arch=('i686' 'x86_64')
url="http://www.ccextractor.org"
license=('GPL')
depends=('gcc-libs' 'tesseract')
source=(
$pkgname-$pkgver.tar.gz
)
build() {
cd "$srcdir/$pkgname-$pkgver"
CC=gcc ./configure --enable-ocr --prefix="$pkgdir/usr/local"
make -j4
}
package() {
cd "$srcdir/$pkgname-$pkgver"
make install
}

30
package_creators/arch.sh Executable file
View File

@ -0,0 +1,30 @@
#!/bin/bash
./tarball.sh
retval=$?
if [ $retval -ne 0 ]; then
echo "Sorry, the package could not be created as the tarball building process failed with return code $retval"
rm -f ./*.tar.gz
exit $retval
fi
makepkg -g >> PKGBUILD
makepkg -sc
retval=$?
if [ $retval -ne 0 ]; then
echo "Sorry, the package could not be created as makepkg failed with return code $retval"
rm -rf ./*.tar.gz src
sed -i '$ d' PKGBUILD
exit $retval
fi
rm -f ./*.tar.gz
sed -i '$ d' PKGBUILD
read -p "Do you wish to install ccextractor? [y/N] " yn
case $yn in
[Yy]* ) if [ -x "$(command -v sudo)" ]; then
sudo pacman -U ./*.pkg.tar.xz;
else
su -c "pacman -U ./*.pkg.tar.xz";
fi
rm -f ./*.pkg.tar.xz;;
* ) exit;;
esac

View File

@ -27,4 +27,4 @@ rm -rf config.log
rm -rf aclocal.m4 rm -rf aclocal.m4
rm -rf build-conf rm -rf build-conf
rm -rf autom4te.cache rm -rf autom4te.cache
cd package_creators cd package_creators

View File

@ -1102,7 +1102,7 @@ int rcwt_loop(struct lib_ccx_ctx *ctx)
int caps = 0; int caps = 0;
LLONG result; LLONG result;
struct encoder_ctx *enc_ctx = update_encoder_list(ctx); struct encoder_ctx *enc_ctx = update_encoder_list(ctx);
struct Teletext *telctx;
// As BUFSIZE is a macro this is just a reminder // As BUFSIZE is a macro this is just a reminder
if (BUFSIZE < (3*0xFFFF + 10)) if (BUFSIZE < (3*0xFFFF + 10))
fatal (CCX_COMMON_EXIT_BUG_BUG, "BUFSIZE too small for RCWT caption block.\n"); fatal (CCX_COMMON_EXIT_BUG_BUG, "BUFSIZE too small for RCWT caption block.\n");
@ -1143,6 +1143,7 @@ int rcwt_loop(struct lib_ccx_ctx *ctx)
dec_ctx->private_data = telxcc_init(); dec_ctx->private_data = telxcc_init();
} }
dec_sub = &dec_ctx->dec_sub; dec_sub = &dec_ctx->dec_sub;
telctx =dec_ctx->private_data;
/* Set minimum and current pts since rcwt has correct time */ /* Set minimum and current pts since rcwt has correct time */
dec_ctx->timing->min_pts = 0; dec_ctx->timing->min_pts = 0;
@ -1155,9 +1156,10 @@ int rcwt_loop(struct lib_ccx_ctx *ctx)
{ {
result = buffered_read(ctx->demux_ctx, buf, TELETEXT_CHUNK_LEN); result = buffered_read(ctx->demux_ctx, buf, TELETEXT_CHUNK_LEN);
ctx->demux_ctx->past += result; ctx->demux_ctx->past += result;
if (result != TELETEXT_CHUNK_LEN) if (result != TELETEXT_CHUNK_LEN){
telxcc_dump_prev_page(telctx,dec_sub);
break; break;
}
tlt_read_rcwt(dec_ctx->private_data, buf, dec_sub); tlt_read_rcwt(dec_ctx->private_data, buf, dec_sub);
if(dec_sub->got_output == CCX_TRUE) if(dec_sub->got_output == CCX_TRUE)
{ {

View File

@ -215,7 +215,7 @@ void dinit_libraries( struct lib_ccx_ctx **ctx)
dvbsub_close_decoder(&dec_ctx->private_data); dvbsub_close_decoder(&dec_ctx->private_data);
//Test memory for teletext //Test memory for teletext
else if (dec_ctx->codec == CCX_CODEC_TELETEXT) else if (dec_ctx->codec == CCX_CODEC_TELETEXT)
telxcc_close(&dec_ctx->private_data, NULL); telxcc_close(&dec_ctx->private_data, &dec_ctx->dec_sub);
else if (dec_ctx->codec == CCX_CODEC_ISDB_CC) else if (dec_ctx->codec == CCX_CODEC_ISDB_CC)
delete_isdb_decoder(&dec_ctx->private_data); delete_isdb_decoder(&dec_ctx->private_data);

View File

@ -50,7 +50,7 @@ int _CRT_fmode = _O_BINARY;
#endif #endif
long long int last_pes_pts = 0; // PTS of last PES packet (debug purposes) long long int last_pes_pts = 0; // PTS of last PES packet (debug purposes)
static int de_ctr = 0; // a keeps count of packets with flag subtitle ON and data packets
typedef struct { typedef struct {
uint64_t show_timestamp; // show at timestamp (in ms) uint64_t show_timestamp; // show at timestamp (in ms)
uint64_t hide_timestamp; // hide at timestamp (in ms) uint64_t hide_timestamp; // hide at timestamp (in ms)
@ -956,7 +956,7 @@ void process_telx_packet(struct TeletextCtx *ctx, data_unit_t data_unit_id, tele
if (m == 0) m = 8; if (m == 0) m = 8;
y = (address >> 3) & 0x1f; y = (address >> 3) & 0x1f;
designation_code = (y > 25) ? unham_8_4(packet->data[0]) : 0x00; designation_code = (y > 25) ? unham_8_4(packet->data[0]) : 0x00;
uint8_t flag_subtitle;
if (y == 0) if (y == 0)
{ {
@ -984,7 +984,7 @@ void process_telx_packet(struct TeletextCtx *ctx, data_unit_t data_unit_id, tele
{ {
tlt_config.page = (m << 8) | (unham_8_4(packet->data[1]) << 4) | unham_8_4(packet->data[0]); tlt_config.page = (m << 8) | (unham_8_4(packet->data[1]) << 4) | unham_8_4(packet->data[0]);
mprint ("- No teletext page specified, first received suitable page is %03x, not guaranteed\n", tlt_config.page); mprint ("- No teletext page specified, first received suitable page is %03x, not guaranteed\n", tlt_config.page);
} }
// Page number and control bits // Page number and control bits
page_number = (m << 8) | (unham_8_4(packet->data[1]) << 4) | unham_8_4(packet->data[0]); page_number = (m << 8) | (unham_8_4(packet->data[1]) << 4) | unham_8_4(packet->data[0]);
@ -1003,18 +1003,19 @@ void process_telx_packet(struct TeletextCtx *ctx, data_unit_t data_unit_id, tele
ctx->transmission_mode = (transmission_mode_t) (unham_8_4(packet->data[7]) & 0x01); ctx->transmission_mode = (transmission_mode_t) (unham_8_4(packet->data[7]) & 0x01);
// FIXME: Well, this is not ETS 300 706 kosher, however we are interested in DATA_UNIT_EBU_TELETEXT_SUBTITLE only // FIXME: Well, this is not ETS 300 706 kosher, however we are interested in DATA_UNIT_EBU_TELETEXT_SUBTITLE only
if ((ctx->transmission_mode == TRANSMISSION_MODE_PARALLEL) && (data_unit_id != DATA_UNIT_EBU_TELETEXT_SUBTITLE)) return; if ((ctx->transmission_mode == TRANSMISSION_MODE_PARALLEL) && (data_unit_id != DATA_UNIT_EBU_TELETEXT_SUBTITLE) && !(de_ctr && flag_subtitle && ctx->receiving_data == YES)) return;
if ((ctx->receiving_data == YES) && ( if ((ctx->receiving_data == YES) && (
((ctx->transmission_mode == TRANSMISSION_MODE_SERIAL) && (PAGE(page_number) != PAGE(tlt_config.page))) || ((ctx->transmission_mode == TRANSMISSION_MODE_SERIAL) && (PAGE(page_number) != PAGE(tlt_config.page))) ||
((ctx->transmission_mode == TRANSMISSION_MODE_PARALLEL) && (PAGE(page_number) != PAGE(tlt_config.page)) && (m == MAGAZINE(tlt_config.page))))) ((ctx->transmission_mode == TRANSMISSION_MODE_PARALLEL) && (PAGE(page_number) != PAGE(tlt_config.page)) && (m == MAGAZINE(tlt_config.page)))))
{ {
ctx->receiving_data = NO; ctx->receiving_data = NO;
return; if(!(de_ctr && flag_subtitle))
return;
} }
// Page transmission is terminated, however now we are waiting for our new page // Page transmission is terminated, however now we are waiting for our new page
if (page_number != tlt_config.page) if (page_number != tlt_config.page && !(de_ctr && flag_subtitle && ctx->receiving_data == YES))
return; return;
@ -1037,6 +1038,7 @@ void process_telx_packet(struct TeletextCtx *ctx, data_unit_t data_unit_id, tele
ctx->page_buffer.hide_timestamp = 0; ctx->page_buffer.hide_timestamp = 0;
} }
process_page(ctx, &ctx->page_buffer, sub); process_page(ctx, &ctx->page_buffer, sub);
de_ctr = 0;
} }
ctx->page_buffer.show_timestamp = timestamp; ctx->page_buffer.show_timestamp = timestamp;
@ -1073,6 +1075,7 @@ void process_telx_packet(struct TeletextCtx *ctx, data_unit_t data_unit_id, tele
ctx->page_buffer.text[y][i] = packet->data[i]; ctx->page_buffer.text[y][i] = packet->data[i];
} }
ctx->page_buffer.tainted = YES; ctx->page_buffer.tainted = YES;
--de_ctr;
} }
else if ((m == MAGAZINE(tlt_config.page)) && (y == 26) && (ctx->receiving_data == YES)) else if ((m == MAGAZINE(tlt_config.page)) && (y == 26) && (ctx->receiving_data == YES))
{ {