diff options
author | Reinhard Nißl <rnissl@gmx.de> | 2007-04-12 22:33:26 +0200 |
---|---|---|
committer | Reinhard Nißl <rnissl@gmx.de> | 2007-04-12 22:33:26 +0200 |
commit | bd88a5c94af0af727680606a22ec9414fba68366 (patch) | |
tree | 2055855d7a19c531c9928397997aaa910266111f /src/xine-engine/xine.c | |
parent | b4304f243c6006eec3ca4b4ce2b19cfca703861a (diff) | |
download | xine-lib-bd88a5c94af0af727680606a22ec9414fba68366.tar.gz xine-lib-bd88a5c94af0af727680606a22ec9414fba68366.tar.bz2 |
Provide a function to query buffer usage.
This function shall be used to poll the number of remaining frames
from a certain point in time on until the reported numbers are all
0. At that point in time, the content on screen is identical to a
certain state of the stream, at which for example, a hardcopy may
be taken.
Diffstat (limited to 'src/xine-engine/xine.c')
-rw-r--r-- | src/xine-engine/xine.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index 612bf8dcc..9623668dc 100644 --- a/src/xine-engine/xine.c +++ b/src/xine-engine/xine.c @@ -2069,3 +2069,31 @@ int xine_stream_master_slave(xine_stream_t *master, xine_stream_t *slave, slave->master = master->master; return 1; } + +int _x_query_buffer_usage(xine_stream_t *stream, int *num_video_buffers, int *num_audio_buffers, int *num_video_frames, int *num_audio_frames) +{ + int ticket_acquired = -1; + + if (num_video_buffers) + *num_video_buffers = (stream->video_fifo ? stream->video_fifo->size(stream->video_fifo) : 0); + + if (num_audio_buffers) + *num_audio_buffers = (stream->audio_fifo ? stream->audio_fifo->size(stream->audio_fifo) : 0); + + if ((num_video_frames && stream->video_out) + || (num_audio_frames && stream->audio_out)) { + + ticket_acquired = stream->xine->port_ticket->acquire_nonblocking(stream->xine->port_ticket, 1); + } + + if (num_video_frames) + *num_video_frames = ((ticket_acquired && stream->video_out) ? stream->video_out->get_property(stream->video_out, VO_PROP_BUFS_IN_FIFO) : 0); + + if (num_audio_frames) + *num_audio_frames = ((ticket_acquired && stream->audio_out) ? stream->audio_out->get_property(stream->audio_out, AO_PROP_BUFS_IN_FIFO) : 0); + + if (ticket_acquired > 0) + stream->xine->port_ticket->release_nonblocking(stream->xine->port_ticket, 1); + + return ticket_acquired != 0; +} |