How get file size using gstreamer queries elements
Wes Miller
wmiller at sdr.com
Wed Jul 10 07:29:10 PDT 2013
I don't know any way for gstreamer to do file size watching. Would be a cool
thing to add to multisink, new-file-on-filesize, along with a
new-file-on-timer-interval.
However, assuming you are writing this as a program and not as a gst-launch
commandline:
One of the not so obvious bits of gst-knowledge is that the "thing" that
runs forever after a pipeline is started does not have to be an empty
g_main_loop. Yhe pipeline runs itself. The loop or whatever ater the
pipeline starts is there to keep YOUR program running.
You can code the g_main_loop with contents or write your own timer loop that
will run "forever" after the pipeline is started. It could be as simple as
while( !sleep(1) ); which would just keep doing 1 second sleeps forever, or
it could be a complicated loop that sleeps as long as you wish and then
checks the filesize.
while(1)
{
sleep( your_timeout );
if ( check_filesize() > MAX_FILE_SIZE ) then whatever();
}
This is based on the rash assumption that your OS of choice allows asking
for the filesize while the file is open in another thread/application.
Wes
--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/How-get-file-size-using-gstreamer-queries-elements-tp4660952p4660968.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
More information about the gstreamer-devel
mailing list