int Container::url_write(void*h, unsigned char* buf, int size) { int retval = -1; try { URLProtocolHandler* handler = (URLProtocolHandler*) h; if (handler) retval = handler->url_write(buf, size); } catch (...) { retval = -1; } VS_LOG_TRACE("URLProtocolHandler[%p]->url_write(%p, %d) ==> %d", h, buf, size, retval); return retval; }
int64_t Container::url_seek(void*h, int64_t position, int whence) { int64_t retval = -1; try { URLProtocolHandler* handler = (URLProtocolHandler*) h; if (handler) retval = handler->url_seek(position, whence); } catch (...) { retval = -1; } VS_LOG_TRACE("URLProtocolHandler[%p]->url_seek(%p, %lld) ==> %d", h, position, whence, retval); return retval; }
URLProtocolHandler::SeekableFlags URLProtocolManager :: url_seekflags(void *h, const char* url, int flags) { URLProtocolHandler::SeekableFlags retval = URLProtocolHandler::SK_NOT_SEEKABLE; try { URLProtocolHandler* handler = URLProtocolManager::getHandler(h); retval = handler->url_seekflags(url, flags); } catch(...) { } return retval; }
int URLProtocolManager :: url_read(void *h, unsigned char* buf, int size) { int retval = -1; try { URLProtocolHandler* handler = URLProtocolManager::getHandler(h); retval = handler->url_read(buf, size); } catch(...) { retval = -1; } return retval; }
int64_t URLProtocolManager :: url_seek(void *h, int64_t position, int whence) { int64_t retval = -1; try { URLProtocolHandler* handler = URLProtocolManager::getHandler(h); retval = handler->url_seek(position, whence); } catch(...) { retval = -1; } return retval; }
/* * Here lie static functions that forward to the right class function in the protocol manager */ int URLProtocolManager :: url_open(void* h, const char* url, int flags) { int retval = -1; try { URLProtocolHandler* handler = URLProtocolManager::getHandler(h); retval = handler->url_open(url, flags); } catch (...) { retval = -1; } return retval; }
int URLProtocolManager :: url_close(void *h) { int retval = -1; try { URLProtocolHandler* handler = URLProtocolManager::getHandler(h); retval = handler->url_close(); // when we close that handler is no longer valid; you must re-open to re-use. delete handler; } catch (...) { retval = -1; } return retval; }