Hi, I started looking if it is possible to implement log callback in dvd-nav, mostly to get rid of those printf(stderr.. ) calls when it is used in vlc. Similar functionality exists in libav/ffmpeg/libx264 and implementation is pretty straighforward in that part and I can provide patch for it. Only thing that I was wondering, is the way to tell dvdnav to use callback. Dvdnav does not have init()-function and assumes that open() initializes dvdnav_t structure to given pointer. So should I introduce init() function that actually initializes the structure and allows to change that log-callback, or extend open to take callback pointer as parameter or some other way? Also pointers to archives is great if this issue is talked in some point allready (did not find anything when quickly googled). -- Ilkka Ollakka Prof: So the American government went to IBM to come up with a data encryption standard and they came up with ... Student: EBCDIC!"
On 02/24/2012 12:25 AM, Ilkka Ollakka wrote:
Hi,
I started looking if it is possible to implement log callback in dvd-nav, mostly to get rid of those printf(stderr.. ) calls when it is used in vlc. Similar functionality exists in libav/ffmpeg/libx264 and implementation is pretty straighforward in that part and I can provide patch for it.
Only thing that I was wondering, is the way to tell dvdnav to use callback. Dvdnav does not have init()-function and assumes that open() initializes dvdnav_t structure to given pointer.
So should I introduce init() function that actually initializes the structure and allows to change that log-callback, or extend open to take callback pointer as parameter or some other way?
Also pointers to archives is great if this issue is talked in some point allready (did not find anything when quickly googled).
I wouldn't do it as part of init at all. How about separate registration registration functions. e.g. dvdread_log_register(dvd_reader_t *reader, dvdread_log_callback_t callback_func); dvdnav_log_register(dvdnav_t *nav, dvdnav_log_callback_t callback_func); If the registration functions are not called, default logger sends to stderr. -- John GnuPG fingerprint: D0EC B3DB C372 D1F1 0B01 83F0 49F1 D7B2 60D4 D0F7
On Fri, Feb 24, 2012 at 07:36:27PM -0800, John Stebbins wrote:
I wouldn't do it as part of init at all. How about separate registration registration functions. e.g. dvdread_log_register(dvd_reader_t *reader, dvdread_log_callback_t callback_func); dvdnav_log_register(dvdnav_t *nav, dvdnav_log_callback_t callback_func);
If the registration functions are not called, default logger sends to stderr.
Ok, I think that is better idea. But this would require to remove log messages from open, as it would print them to stderr in that point. -- Ilkka Ollakka It is now pitch dark. If you proceed, you will likely fall into a pit.
participants (2)
-
Ilkka Ollakka -
John Stebbins