473,385 Members | 1,341 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Managing a file buffer

Hi,

I have an application that reads video from a socket and saves it to a file,
which I then play using GStreamer. The major problem with this approach is
that the file keeps getting bigger and bigger until the disk is full ;-)

What I'd like to do is have a buffer, say 5MB in size, which I can point
GStreamer at. So every time I write 60K to the tail of the file, I'd need to
remove 60K from the head of the file.

How can I achieve this in Python? I looked at truncate() but it seems to do
the opposite of what I want.

Thanks in advance,
David.

--
David Johnson
www.david-web.co.uk
Apr 9 '07 #1
2 4594
In <ma***************************************@python. org>, David Johnson
wrote:
What I'd like to do is have a buffer, say 5MB in size, which I can point
GStreamer at. So every time I write 60K to the tail of the file, I'd need to
remove 60K from the head of the file.
You can't remove data from the head of a file. At least not without
moving all following data "down", but then the file pointer within
`gstreamer` is wrong. Can't `gstreamer` be fed through a pipe?

Ciao,
Marc 'BlackJack' Rintsch
Apr 9 '07 #2
David Johnson wrote:
I have an application that reads video from a socket and saves it to a
file, which I then play using GStreamer. The major problem with this
approach is that the file keeps getting bigger and bigger until the disk
is full ;-)

What I'd like to do is have a buffer, say 5MB in size, which I can point
GStreamer at. So every time I write 60K to the tail of the file, I'd need
to remove 60K from the head of the file.
A named pipe may be useful to you, depending on your buffering requirements,
and assuming gstreamer can play from one.

e.g. http://www2.linuxjournal.com/article/2156

You can create a named pipe from python.

Jeremy

--
Jeremy Sanders
http://www.jeremysanders.net/
Apr 9 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: travis ray | last post by:
Hi, I have an extension in which a file object is created in python and passed down to a c extension which attempts to read from it or write to it. Writing to the file pointer seems to work...
7
by: tgh003 | last post by:
I would be interested to hear how others are managing their javascript (.js) files from the original code vs the obfuscated version they publish to their site/webapp. I currently manage 2 files,...
20
by: cylin | last post by:
Dear all, I open a binary file and want to write 0x00040700 to this file. how can I set write buffer? --------------------------------------------------- typedef unsigned char UCHAR; int...
0
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen....
0
by: Ed L. | last post by:
We have ia64 box running HP-UX B.11.23, 16GB of RAM, and we'll eventually have 10-20 high volume clusters installed. We could definitely use all the RAM caching DB data. On our Linux boxes, we...
21
by: EdUarDo | last post by:
Hi all, I'm not a newbie with C, but I don't use it since more than 5 years... I'm trying to read a text file which has doubles in it: 1.0 1.1 1.2 1.3 1.4 2.0 2.1 2.2 2.3 2.4 I'm doing...
2
by: Bonzol | last post by:
vb.net 2003 Windows application We have a Client/Server system set up by communicating through a TCPClient object. The server loops continuously using a tcplistener device and each time a client...
1
AdrianH
by: AdrianH | last post by:
Assumptions I am assuming that you know or are capable of looking up the functions I am to describe here and have some remedial understanding of C programming. FYI Although I have called this...
24
by: Bill | last post by:
Hello, I'm trying to output buffer content to a file. I either get an access violation error, or crazy looking output in the file depending on which method I use to write the file. Can anyone...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.