Stream Position Data in Xine
Now that Xine is up and running, it would be handy to be able to extract the stream position data from the application and display it elsewhere (on a status display, for instance). This way, we could see how much of the movie we've played, how much time remains, etc.
This is pretty easy, once you figure out where to look. In the xine-ui source, go into
Just below that, you should see where
Near the end of that function, replace the call to
Replace the call to
Run
Finally, Xine suppresses output to standard out (stdout) shortly after it prints its introductory banner/copyright data. The easiest way to prevent this is by prepending the
The first number is the current position in seconds in the current stream and the second is the length of the current stream, in seconds.
This is pretty easy, once you figure out where to look. In the xine-ui source, go into
src/xitk/stdctl.c
. In the function xine_stdctl_loop
, change the line:int secs, last_secs;
to int secs, last_secs, len_secs, stream_pos;
Just below that, you should see where
last_secs
is initialized to 1. Copy that line twice and replace last_secs
with len_secs
and stream_pos
.Near the end of that function, replace the call to
gui_xine_get_pos_length(...)
with gui_xine_get_pos_length( gGui->stream, &stream_pos, &secs, &len_secs )
. Divide len_secs
by 1000 afterwards, as is already done with secs
.Replace the call to
fprintf
with this: fprintf(stdout, "time\t%d\t%d\n", secs, len_secs)
.Run
make && make install
to deploy your changes.Finally, Xine suppresses output to standard out (stdout) shortly after it prints its introductory banner/copyright data. The easiest way to prevent this is by prepending the
--verbose
option to the command line. A slightly cleaner way (only cleaner in terms of the output) is to run make clean && make debug && make install_debug
to deploy your changes instead. If everything's working right, you should see a bunch of lines like this displayed on the screen:time 0 97
time 1 97
time 2 97
The first number is the current position in seconds in the current stream and the second is the length of the current stream, in seconds.
0 Comments:
Post a Comment
<< Home