From: Xavier H. <xav...@bl...> - 2006-07-18 14:42:13
|
Mike Melanson wrote: >Xavier Hervy wrote: > > >>Hi! >>I'm a bit frustrated this last few days as I would lik to be able to >>seek in my http stream. >>I take a look at the input_http.c file and I should admit that most of >>the part is still a big mistery. >> >>First of all, http_plugin_seek exist so I was wondering what is the >>interst to have this function if the INPUT_CAP_SEEKABLE flag is not set >>? this function seems to be never called. >>Second of all, as I still believe in Santa Clos ;-), I put the seekable >>flag but unfortunally it still doesn't work. And xine is not able to >>read my stream at all now. It seems that the seek function is called >>several times even if I don't try to seek in the stream. In comparison, >>the input_file plugin, don't call the seek function as long as the user >>don't try to seek ( which seems to be obvious) >>I decide to replace the http_plugin_seek by: >>static off_t http_plugin_seek(input_plugin_t *this_gen, off_t offset, >>int origin) { >> http_input_plugin_t *this = (http_input_plugin_t *) this_gen; >> return this->curpos; >>} >> >>now my stream is playable, and the slide bar works in xine-ui. >>Before I try to implement a new http_plugin_seek function, I like to now: >>1 what is the purpose of the current function; >>2 why this function is called hundred times as long as the plugin is >>define as seekable? >> >>Ty to point me in the good direction >> >> > >It is theoretically possible to have an HTTP plugin that can seek >randomly as if it were reading a file from disk. xine's HTTP plugin does >not implement this yet. Right now, the plugin just connects to the >server and asks it to send the whole file over. The plugin consumes the >data as it comes in. It does have limited seeking capability currently >in that it can seek forward by discarding bytes until it reaches the >desired location. It can not presently seek backwards. > > Even with the fast forward, the seek function is not called. >There are at least 2 ways to implement random seeking in this case: > >1) Save the data to a temporary file on disk and operate on that file >instead of the network stream. > > That's what I currently use wget/xine to do this, it might be more a frontend implementation... The advantage with this solution is to be able to seek fully backward and partially forward (until the current downloaded file end) The inconvenient is I haven't always enough free space to save the file on the locale system. >2) Re-architect the whole plugin so that it plays games with the HTTP >protocol and asks the server to send chunked ranges at a time, rather >than send the whole file. > > I just finished a quick and very dirty fix to allow the seeking using HTTP protocol. however in my code I don't reuse the previous seeking code as I really don't see what he supposed to do. Xavier |