When I tested the caption reading code, I first hard coded the image location. When that worked, I changed it to use gui_fselect_init()
in core/gui_fselect.h
to pick the image file. What I really wanted was to show the caption of the image currently displayed.
I looked in include/platform.h, which has get_target_dir_num()
and get_target_file_num()
. They seem to return the directory and the file numbers for the last photo taken. The implementation uses get_parameter_data()
. I turned on the “Debug parameters -> Show Parameter Data”, and paged through to see if any one looked like data for the current file name. Nothing.
I searched on the internet with all kinds of keywords. Finally I found a forum thread on detecting the existence of a RAW file of the currently viewed JPEG file. That code grabs the playback filename from memory, not properties. I immediately went to “Debug parameters -> Memory browser” to see if the same address stores the playback filename for my camera too. Nope. I browsed a bit, then realized that I would never find this manually.
I turned the task over to the trusty computer. Using core/gui_debug.c
as an example, I wrote a loop to look for a particular filename in memory. I loaded that program when the name matches the current file, and when it does not. Comparing the two, I found two addresses for storing the playback filename. Strange, I thought. Then I got the brilliant idea of trying a video. Just as I suspected, one address was for the AVI
file, the other for the THM
file. For photos, the two are the same.
That was the secret ingredient I needed for on-screen caption display. Modifying core/gui_osd.c
was relatively easy. I just followed the example for the clock display. Now I can browse my photos, with the caption right there, on the screen. Oh joy!