File tree Expand file tree Collapse file tree 3 files changed +29
-4
lines changed Expand file tree Collapse file tree 3 files changed +29
-4
lines changed Original file line number Diff line number Diff line change @@ -42,11 +42,31 @@ INSTLALL_PROGRAM = $(INSTLALL)
4242DESTDIR = /usr/bin
4343
4444ifeq ($(ENABLE_OCR ) ,yes)
45- CFLAGS+ =-I/usr/local/include/tesseract -I/usr/local/include/leptonica
4645CFLAGS+ =-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")
4955endif
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+
5070ifeq ($(ENABLE_FFMPEG ) ,yes)
5171CFLAGS+ =-DENABLE_FFMPEG
5272CFLAGS+ = $(shell pkg-config --cflags libavcodec)
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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}
7272void * init_ocr (int lang_index )
7373{
You can’t perform that action at this time.
0 commit comments