Skip to content

Commit b7d2754

Browse files
committed
Merge branch 'pr/n130_anshul1912'
2 parents b7616fc + 94675b2 commit b7d2754

File tree

3 files changed

+29
-4
lines changed

3 files changed

+29
-4
lines changed

linux/Makefile

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,31 @@ INSTLALL_PROGRAM = $(INSTLALL)
4242
DESTDIR = /usr/bin
4343

4444
ifeq ($(ENABLE_OCR),yes)
45-
CFLAGS+=-I/usr/local/include/tesseract -I/usr/local/include/leptonica
4645
CFLAGS+=-DENABLE_OCR
47-
LDFLAGS+= $(shell pkg-config --libs tesseract)
48-
LDFLAGS+= $(shell pkg-config --libs lept)
46+
TESS_LDFLAGS+= $(shell pkg-config --libs tesseract)
47+
LEPT_LDFLAGS+= $(shell pkg-config --libs lept)
48+
49+
#error checking of library are there or not
50+
ifeq ($(TESS_LDFLAGS),$(EMPTY))
51+
$(error **ERROR** "tesseract not found")
52+
else
53+
#TODO print the version of library found
54+
$(info "tesseract found")
4955
endif
56+
ifeq ($(LEPT_LDFLAGS),$(EMPTY))
57+
$(error **ERROR** "leptonica not found")
58+
else
59+
#TODO print the version of library found
60+
$(info "Leptonica found")
61+
endif
62+
63+
CFLAGS += $(shell pkg-config --cflags tesseract)
64+
CFLAGS += $(shell pkg-config --cflags lept)
65+
LDFLAGS += $(TESS_LDFLAGS)
66+
LDFLAGS += $(LEPT_LDFLAGS)
67+
endif
68+
69+
5070
ifeq ($(ENABLE_FFMPEG),yes)
5171
CFLAGS+=-DENABLE_FFMPEG
5272
CFLAGS+= $(shell pkg-config --cflags libavcodec)

src/lib_ccx/dvb_subtitle_decoder.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,11 @@ void* dvbsub_init_decoder(struct dvb_config* cfg)
435435

436436
#ifdef ENABLE_OCR
437437
ctx->ocr_ctx = init_ocr(ctx->lang_index);
438+
if(!ctx->ocr_ctx)
439+
{
440+
freep(&ctx);
441+
return NULL;
442+
}
438443
#endif
439444
ctx->version = -1;
440445

src/lib_ccx/ocr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ static void delete_ocr (struct ocrCtx* ctx)
6767
{
6868
TessBaseAPIEnd(ctx->api);
6969
TessBaseAPIDelete(ctx->api);
70-
freep(ctx);
70+
freep(&ctx);
7171
}
7272
void* init_ocr(int lang_index)
7373
{

0 commit comments

Comments
 (0)