I have a mediaplayer that can only read samba shared files. I would like to play http stream (from my dreambox for instance).
My idea is to share a folder on my linux. In this share, I will put a (fake?) file for each tv channel I want to be able to watch (ex : channel1.ts, channel2.ts ...).
The mediaplayer can only read these file as it should开发者_运维百科 with regular files. My need : do something that "listen" for access on these files so that when my mediaplayer access it, it fires a mencoder -oac copy -ovc copy -o channel1.ts http://path.to.the.broadcast.ts.
I tried using inotify on an empty file. It fires the mencoder well BUT the mediaplayer stops before encoding starts (because the file is empty so it reaches the end before it starts). Perhaps, have to fill 5s of video in order to buffer the read ?
Could be nice to use a "fifo" => I tried it, the mediaplayer waits, when I do the mencoder, the fifo starts growing, the mediaplayer plays it ! Yeahh !!!... BUT inotify seems not to react on a fifo... so I can't fire mencoder automatically.
Every suggestions welcome.
Basic points :
- The media player can ONLY reads regular files
- File must be in a samba shared folder
- Record must be "fired" on demand (when mediaplater try to access it)
- Could be nice to watch for "inactivity" in order to stop recording / emptying buffer file
It is not easy to formalise this question. I am a bit disapointed and I even't don't know what kind of search I could googelise for that.
Hope some gurus here will find something to do the trick
Cheers.
You might want to look at the techniques Hierarchical Storage Management and on-access Virus Scanners use, as they need to do similar interruption before the normal access.
e.g. Use Talpa to intercept open operations in the selected directory, and replace the file at that point.
精彩评论