Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > More E-Book Readers > iRex

Notices

Reply
 
Thread Tools Search this Thread
Old 02-07-2010, 02:07 PM   #31
luite
Connoisseur
luite has a complete set of Star Wars action figures.luite has a complete set of Star Wars action figures.luite has a complete set of Star Wars action figures.
 
Posts: 82
Karma: 256
Join Date: Feb 2010
Location: Netherlands
Device: dr1000
Here are the sources for the djvu plugin. I basically copied the pdf plugin (from firmware version 1.7) and reimplemented just enough of the poppler API with djvulibre to make it work with the rest of the plugin (the new files are src/pdf_doc.cpp and inc/pdf_doc.h ).

I haven't changed the names of the files or classes. Most files are unchanged, and the changes in the other files are small (changing ".pdf" extension to ".djvu", poppler includes to "pdf_doc.h").

The source is slighly different from the last (0.1.3) binary release. I also removed the dependency on poppler and included only the 'goo' library. This should make it easier to port to the dr800 and the upcoming dr1000 firmware that will use the adobe pdf viewer instead of poppler.
Attached Files
File Type: gz djvu-plugin-src-0.1.4pre.tar.gz (102.6 KB, 190 views)
luite is offline   Reply With Quote
Old 02-07-2010, 10:04 PM   #32
luite
Connoisseur
luite has a complete set of Star Wars action figures.luite has a complete set of Star Wars action figures.luite has a complete set of Star Wars action figures.
 
Posts: 82
Karma: 256
Join Date: Feb 2010
Location: Netherlands
Device: dr1000
Quote:
Originally Posted by Gertjan View Post
I don't know what happens there but it looks like your plugin reports that it uses a "high level" interface which is incorrect. If you provide source code of the plugin we can see what's going on.
I have tried it in the debugger and if I change the return value of uds::PluginMgr::has_high_level_interface (called by uds::PluginMgr::try_to_create_document) it seems to work fine indeed.

But how exactly does uds determine whether a plugin uses the high or the low level interface? I have searched all documentation and the document-viewer-plugins source code, and tried tracing through the relevant functions in the debugger (uds::PluginMgr::create_wrapper_library seemed relevant) but haven't been able to find out.
luite is offline   Reply With Quote
Advert
Old 02-09-2010, 01:42 PM   #33
luite
Connoisseur
luite has a complete set of Star Wars action figures.luite has a complete set of Star Wars action figures.luite has a complete set of Star Wars action figures.
 
Posts: 82
Karma: 256
Join Date: Feb 2010
Location: Netherlands
Device: dr1000
Isn't there anyone who can answer this? It's rather difficult to find out these things without source code or documentation. Perhaps I should ask on the irex forum instead? I really want my plugin to behave correctly before the next update.

By the way, I've been working on adding text search. It's not done yet and I'll be rather busy for the next few weeks, but it is coming
luite is offline   Reply With Quote
Old 02-10-2010, 09:57 AM   #34
Mackx
Guru
Mackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to behold
 
Posts: 999
Karma: 19985
Join Date: Dec 2008
Location: Netherlands
Device: iRex DR1000S
Quote:
Originally Posted by luite View Post
Isn't there anyone who can answer this? It's rather difficult to find out these things without source code or documentation. Perhaps I should ask on the irex forum instead? I really want my plugin to behave correctly before the next update.

By the way, I've been working on adding text search. It's not done yet and I'll be rather busy for the next few weeks, but it is coming
The plug-ins seem to be 'com-like' components implementing different functionality. So when UDS want to know if a feature is supported it can query for a specific interface. The Plugins add 'supported' interfaces with a call to g_instances_table.add_interface<TheInterface>(this );

If I look at the differences between the image-plugin and pdf-plug and look at the functionality for which mobipocket might be used. Then I suspect the following call:
g_instances_table.add_interface<IPluginDocMarker>( this); in document_impl.cpp.
I am not sure if this interface is also needed for search functionality.

Note: this is only a guess
Mackx is offline   Reply With Quote
Old 02-10-2010, 12:05 PM   #35
luite
Connoisseur
luite has a complete set of Star Wars action figures.luite has a complete set of Star Wars action figures.luite has a complete set of Star Wars action figures.
 
Posts: 82
Karma: 256
Join Date: Feb 2010
Location: Netherlands
Device: dr1000
Quote:
Originally Posted by Mackx View Post
If I look at the differences between the image-plugin and pdf-plug and look at the functionality for which mobipocket might be used. Then I suspect the following call:
g_instances_table.add_interface<IPluginDocMarker>( this); in document_impl.cpp.
I am not sure if this interface is also needed for search functionality.
I think the PDF plugin also uses the low level interface, and my plugin has exactly the same supported interfaces and behaviour (unless I unknowingly changed something important).

The IPluginDocMarker interface seems to be used for the table of contents and bookmarks and doesn't seem relevant for the decision whether the plugin uses the high or the low level interface.

All interface objects are accessed through an IPluginUnknown query_interface call, implemented in plugin_impl/library_impl.cpp. The only interface actually queried is IPluginLibrary, so I think uds doesn't know about the other interfaces supported by the plugin, at this stage.

The IPluginLibrary interface has three methods: create_document (for the low level interface), create_reader (for the high level interface) and is_supported_document. Of these, only is_supported_document is called by uds before it goes wrong. is_supported_document returns PLUGIN_TRUE if the file has a .djvu extension.

The comments in the IPluginLibrary header file are the only references to the high and low level interfaces I could find, but there isn't any information about when either of them is used. I have tried to set the function pointer of create_reader explicitly to 0 (NULL), but that didn't seem to help.
luite is offline   Reply With Quote
Advert
Old 02-11-2010, 06:29 AM   #36
luite
Connoisseur
luite has a complete set of Star Wars action figures.luite has a complete set of Star Wars action figures.luite has a complete set of Star Wars action figures.
 
Posts: 82
Karma: 256
Join Date: Feb 2010
Location: Netherlands
Device: dr1000
Just a small update: I got the search function working. The code is still quite messy, and I still need to check if I properly allocate and free memory everywhere (ahh, the curse of C++), but it will probably be included in the next update. (after the mobipocket issue is resolved)
luite is offline   Reply With Quote
Old 02-11-2010, 07:18 AM   #37
owl123
Addict
owl123 doesn't litterowl123 doesn't litterowl123 doesn't litter
 
Posts: 234
Karma: 214
Join Date: Nov 2008
Device: Galaxy Note 3, Galaxy NotePro 12.2, InkBook
Great news, luite! Can't wait to get it.
owl123 is offline   Reply With Quote
Old 02-11-2010, 01:45 PM   #38
luite
Connoisseur
luite has a complete set of Star Wars action figures.luite has a complete set of Star Wars action figures.luite has a complete set of Star Wars action figures.
 
Posts: 82
Karma: 256
Join Date: Feb 2010
Location: Netherlands
Device: dr1000
Quote:
Originally Posted by owl123 View Post
Great news, luite! Can't wait to get it.
I hope to upload it soon, unfortunately the iRex guys here don't seem to be in such a hurry to provide the information about the interfaces.

The text search seems to work fine now, I found the source of the memory leak and fixed it. Dictionary lookup also works (but only with my unofficially patched uds).

I now want to add outline (table of contents) support to the plugin, but I can't find a djvu file with a table of contents on archive.org. Can anyone provide one or a few files with a good table of contents? (no illegal files please)

If you are unsure, you can check your file with djvused from djvulibre:
djvused -e print-outline filename.djvu
luite is offline   Reply With Quote
Old 02-11-2010, 02:58 PM   #39
Gertjan
ex-IRX developer
Gertjan doesn't litterGertjan doesn't litterGertjan doesn't litter
 
Gertjan's Avatar
 
Posts: 158
Karma: 224
Join Date: Oct 2008
Device: Irex DR800S, DR1000S, iLiad
Quote:
Originally Posted by luite View Post
I think the PDF plugin also uses the low level interface, and my plugin has exactly the same supported interfaces and behaviour (unless I unknowingly changed something important).
Yes, it should work like the PDF plugin. I planned to pull your plugin through a debugger to see what's happening, but ran into some issue cross-compiling the djvu libraries. I'll try later, unless someone can provide binaries.

I hope you understand that, although we're willing, we have limited resources to support community efforts. We don't want to delay all those wonderful new features we're working on.
Gertjan is offline   Reply With Quote
Old 02-11-2010, 05:12 PM   #40
luite
Connoisseur
luite has a complete set of Star Wars action figures.luite has a complete set of Star Wars action figures.luite has a complete set of Star Wars action figures.
 
Posts: 82
Karma: 256
Join Date: Feb 2010
Location: Netherlands
Device: dr1000
Quote:
Originally Posted by Gertjan View Post
Yes, it should work like the PDF plugin. I planned to pull your plugin through a debugger to see what's happening, but ran into some issue cross-compiling the djvu libraries. I'll try later, unless someone can provide binaries.
Here are some binaries, created using the latest DR1000 SDK with:
tar -xzvf djvulibre-3.5.22.tar.gz
cd djvulibre-3.5.22
./configure --host=arm-poky-linux-gnueabi --prefix=/usr
make
make install DESTDIR=/home/user/djvulibre
cd /home/user/djvulibre
tar -czf djvulibre-dr1000-bin.tar.gz usr

if you have installed the poky toolchain in the location described in the documentation, install with:
sudo tar -xzvf djvulibre-dr1000-bin.tar.gz -C /usr/local/poky/eabi-glibc/arm/arm-poky-linux-gnueabi/

then compiled the plugin using:
tar -xzvf djvu-plugin-src-0.1.4pre.tar.gz
cd djvu-plugin
autoreconf --install
./configure --host=arm-poky-linux-gnueabi --enable-debug
make

This does result in some error about creating libuds-plugin-djvu.la, because there seems to be something wrong with the location of libjpeg in /usr/local/poky/eabi-glibc/arm/arm-poky-linux-gnueabi/usr/lib/libdjvulibre.la. The .so file is created anyway, so I didn't bother to fix this. the directory plugin_impl/.libs should contain the required libuds-plugin-djvu.so now. I haven't tested 'make install' functionality for the plugin, because my own scripts directly copy this file to /usr/lib/uds in the emulator. If you have run the installer script from binary release 0.1.3, you should have the other required files on the emulator already.

I hope this is what you need. Note that this is all built using the 1.7 SDK and emulator. The interfaces for the DR800 (and possibly the latest DR1000 firmware as well) are slightly different, so it will probably not load if you use a newer version.

Quote:
I hope you understand that, although we're willing, we have limited resources to support community efforts. We don't want to delay all those wonderful new features we're working on.
Yes I understand, I really appreciate your help. I didn't expect that you needed to compile or run it at all. When you said something about the plugin reporting whether to use the low level interface, I thought that it would be something along the lines of an easy single line change. Perhaps I was being a bit too optimistic

By the way, my guess is that if you remove .pdf from the hardcoded extensions in uds, it will also try to load the pdf plugin using this code path and it will fail in exactly the same way. It's just a guess, but you may not need to compile the djvu plugin after all to see what is wrong.
Attached Files
File Type: gz djvulibre-dr1000-bin.tar.gz (1.16 MB, 175 views)
luite is offline   Reply With Quote
Old 02-12-2010, 10:06 AM   #41
Gertjan
ex-IRX developer
Gertjan doesn't litterGertjan doesn't litterGertjan doesn't litter
 
Gertjan's Avatar
 
Posts: 158
Karma: 224
Join Date: Oct 2008
Device: Irex DR800S, DR1000S, iLiad
Thanks Luite. I happened to have tried with a slightly earlier version of djvulibre which appears to be broken. Now that I got it running, I found that the cause of the loading issue is, unfortunately, a bug in UDS (v1.5~v1.7).

When the Mobipocket plugin is loaded before the DJVU plugin, this accidentally leaves the 'high level interface' bit set and opening a file will fail because of this. As the plugins are loaded in the order that they appear on the file system, DJVU is likely to be the last since it is added later. You might try to work out a way around this by fiddling with the Mobipocket plugin file to make it appear _after_ the DJVU plugin in the file system. Sorry I can't be more helpful.
Gertjan is offline   Reply With Quote
Old 02-12-2010, 12:31 PM   #42
luite
Connoisseur
luite has a complete set of Star Wars action figures.luite has a complete set of Star Wars action figures.luite has a complete set of Star Wars action figures.
 
Posts: 82
Karma: 256
Join Date: Feb 2010
Location: Netherlands
Device: dr1000
Thanks Gertjan for verifying this. I'll see if I can work around it somehow. Perhaps by overwriting UDS with a patched version (I already have one that I used for testing dictionary lookups on the emulator), after checking the firmware version of course.
luite is offline   Reply With Quote
Old 02-13-2010, 02:19 PM   #43
luite
Connoisseur
luite has a complete set of Star Wars action figures.luite has a complete set of Star Wars action figures.luite has a complete set of Star Wars action figures.
 
Posts: 82
Karma: 256
Join Date: Feb 2010
Location: Netherlands
Device: dr1000
Table of contents support is done now, only supports absolute page numbers at the moment (so no image file names). I still need to do a little more testing on my reader.

I have tested the search function the last few days and it seems to work fine. Rotated pages are also supported now (annoyingly, djvulibre automatically rotates page images that have the rotation flag set, but it doesn't move the bounding boxes for the words accordingly. The bouding boxes are used for highlighting search words and for dictionary lookup).

Next update soon (I'll probably open a new topic because this one is mostly about the uds problems now, and bump the version number to 0.2.0, because of the changed installation scripts)
luite is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
DjVu Plugin for DR1000 - version 0.2 luite iRex 30 10-18-2010 03:49 PM
Beta testers wanted mtravellerh PocketBook 47 09-15-2010 04:22 PM
Wanted: DjVu Plugin for DR800 martienne iRex 14 06-07-2010 05:57 PM
Beta testers wanted: MobileRead goes Unicode Alexander Turcic Announcements 0 08-12-2009 10:28 AM


All times are GMT -4. The time now is 07:36 AM.


MobileRead.com is a privately owned, operated and funded community.