RetroArch/translation/ocr_driver.c

36 lines
776 B
C
Raw Normal View History

2018-01-17 14:00:57 -08:00
#include "ocr_driver.h"
static const ocr_driver_t *ocr_backends[] = {
#ifdef HAVE_TESSERACT
&ocr_tesseract,
#endif
&ocr_null,
NULL
};
static const ocr_driver_t *current_ocr_backend = NULL;
static void *ocr_data = NULL;
2018-01-17 14:00:57 -08:00
bool ocr_driver_init(void)
{
/*TODO: find name of active driver*/
ocr_data = NULL;
2018-01-17 14:00:57 -08:00
if (current_ocr_backend)
ocr_data = (*current_ocr_backend->init)();
return ocr_data != NULL;
2018-01-17 14:00:57 -08:00
}
void ocr_driver_free(void)
{
if (current_ocr_backend && ocr_data)
(*current_ocr_backend->free)(ocr_data);
2018-01-17 14:00:57 -08:00
}
char* ocr_driver_get_text(struct ocr_image_info image)
{
char* image_string = NULL;
if (current_ocr_backend && ocr_data)
image_string = (*current_ocr_backend->get_text)(ocr_data, image);
2018-01-17 14:00:57 -08:00
return image_string;
}