Just released Video-Xine-0.14.
Finally bit the bullet and split all of the Xine modules into separate files. Based on the XS examples, I had been concerned that only one file could bootstrap a shared object at a time (which would do some damage to the term "shared object").
The tipping point was implementing Xine's on-screen display, which really needed a full doc page all to itself.
There's a minor compatibility break here-- instead of exporting huge numbers of constants into your namespace by default, I've put the constants into their related submodules. Since as far as I know the only user of Video::Xine so far is PlaybackMachine (which I'm releasing an update on tomorrow), this is OK.
In the "because we can" department, I'm working on some new things things for Video::Xine.
I've got text overlays working. (Journals can be very helpful-- I was just writing "but I need a way of specifying the font without giving a full path to a TrueType document", then realized I should try using just "serif".) That would seem enough for a release.
Implementing bitmap overlays will be a bit more interesting, because I'd need to specify an in-memory bitmap. I'll almost certainly need to implement it alongside a module to load and save bitmap images, such as Image::Magick, Imager, or Prima.
Xine frequently uses a callback architecture for things like delivering events and log messages. I currently work around this by using event queues, but it's worth a try to implement them properly.
Back when I tried this before (2002-2003), most perls were not compiled for multithreading, and I was desperately trying to get things done in time for BayCon.
How to call a specific named subroutine seems clear enough, but unless I start getting clever I don't see a way to call a method on a specific object without static storage-- and I don't want to use static storage, since I want to be able to run multiple Xines and streams at the same time.
After some interest from RockBochs, I've done some more work in making Video::PlaybackMachine easy to install.
A quick refresher: Video::PlaybackMachine is a video playback scheduler which can be used to create the video feed for a television station. It's available on CPAN.
This new release doesn't offer anything new in terms of features, but irons out a number of wrinkles in the install process.
Now the PM will display text-based slides, like "Up Next" fillframes.
The rest of this entry is in fact drivel, since I'm jabbering about unreleased code. (Not officially released; please e-mail if me
The primary to-do items at this point are either ease-of-use or are architectural refactorings.
Got tired of working around a thrown-together Xine/Xwindows interface, and am writing a proper interface to Xine which will (I hope) let me do the actual window management in Tk and/or Gtk.
I've already gotten it to the point of being able to play music files. The next trick is hooking in an X11 driver, which is causing me to pore over perlguts to find out how to do things like C structures.
(The last one really shouldn't be necessary, but I've found memory leaks in Xine which only become apparent after you play for about eight hours straight. I'd imagine that other players may have similar problems, and I don't want to be at the mercy of others' memory leaks.)
In theory I should be able to walk into the BCTV room, hook up the computer, start playback, head for the bar, and come back at the end of the weekend when the Con is over. (Yeah, right.)
Except... one thing I'd really like to do is have onscreen schedules. I'd like to be able to generate a PNG which shows the next five shows and their start times, then display it onscreen as a slide.
My options are:
So it looks like I'll try SVGs again, then try GD to see if I can get it running quickly.
So my questions: Are there any easy ways of creating the kind of formatted-text-in-graphics that I'm looking for? I'm happy to have the system call a non-Perl command line utility, or even do a little XS work. The requirements: I need to be able to format tabular text against a background.
Second question: anyone have any suggestions for a better name? "The Playback Machine" sounds like a Xine-type movie player. "TV Station In A Box" lacks coolness. "The Twonky" is cool, appropriate, and taken by the Twonky Media Server.
Today my Prius arrived at the local dealership. I'd been waiting for it since about last May.
I've got to say that the biggest pleasure is in using something extremely well-designed. The keyless entry and ignition system, so that you don't need to fumble for keys in the rain. The built-in Bluetooth. This is a car built by engineers who worked hard to understand how people actually use their cars.
And, of course, the hybrid drive system. When this car stops at a stoplight, it stops. No idle motor. Nothing is consumed. I could probably wedge the brake pedal, leave it there for a week, and then get back in and drive away without any problems. Most people measure efficiency in terms of miles per gallon, but consider how much time, in the course of our driving careers, we spend stopped at stoplights, stop signs, in traffic, or in drive-throughs.
So after six hours I still love it. Of course, it's been raining steadily all evening, so I've only gotten to drive it around a bit and sit around in the driveway making "vroom vroom" noises.
Ok, I didn't make "vroom vroom" noises. But only because I was imagining it in electric mode.
Of course, it has only a subset of the features I originally envisioned for it-- but that's mostly because those features proved a poor match. It's enough of a challenge getting the basic features working.
And the basic features are:
Simple enough stuff, it seems, but to do this I've needed to write a Perl interface to Xine, a simple X fullscreen interface, and integrate Imlib2 and POE with both of those. I've needed to write an object system that automatically calculates the appropriate amounts of time to play different types of fill content. Not a lot of ground-breaking CS research here, but some exacting busy-work if nothing else.
My current roadblock: playing music alongside slides. I display the slides using X and Imlib2 and control all scheduling with POE. My original plan was to use SDL to play background music, but something about my POE functions do not sit well with SDL. I'm suspecting that POE's and SDL's select() or alarm() calls are interfering somehow, but can't confirm this.
My current solution is to fork off a subprocess that plays the music using SDL. Irritating, though, since in having a subprocess I'm at an increased risk of the music keeping playing when a movie is going on.
Wish me luck...
Update: Eventually, I wound up using Xine itself as a music player. I essentially restart Xine with a null video driver and play only audio. It has the advantage of not requiring any additional packages. Playing Xine also seems slightly more reliable.
A little while ago, I was at a meeting where someone asked for help working on a web application. After the meeting, I approached him to find out if I could help. I briefly ran over my credentials, and said that I primarily worked in Perl right now. He said that the application was currently in PHP, but he would perhaps be interested in rewriting it in Perl. Some other folks jumped into the conversation, and some interesting ideas were surfacing, when someone I didn't know walked into the conversation and started lecturing me. The conversation went something like this, condensed down:
She: Perl is terrible. You should leave it in PHP.
She: PHP has feature X.
Me: I'm sorry, but I don't know PHP--
She: You should learn it. Its syntax is simple, very similar to C. Perl is unreadable.
Me: I don't want to argue about languages.
She: No, it's true! I have lots of experience.
Me: (tiredly) I was just offering to help, I don't care what--
She: Perl is unmaintainable.
Me: I don't c--
She: I've had to work on too many crappy Perl scripts.
Me: So have I.
At that point I decided that I had enough to do already, and quietly made my departure.
My point is not that she was wrong. She wasn't. It's possible to write hideous scripts in Perl. In fact, it's possible to write hideous, unmaintainable scripts in any language worth knowing. I've written some scripts so difficult to deal with that I had to stop development for months just to go back and refactor my own code until I understood it again.
Instead, I've got two points. First, language advocacy is really, really irritating. To me, it's like jingoism-- "the way I do things is better than anyone else's, and I want to squelch anyone who does things otherwise!" Perl language advocacy is as irritating as any other kind. This person was trying to convert me to the One True Way of PHP, which no doubt has its advantages and disadvantages. I was just trying to help accomplish a task. If, instead, she had offered to help me learn PHP, I would have been more receptive. I can be as guilty of overevangelism as anyone else. "Use strict or die!"
Secondly, Perl does have a reputation for being as unintelligible as a cartoon swear. The more often we have people that don't pay attention to code readability, the more anti-Perl zealots we create. Irritating as it is, we need to listen to our critics.
Imagine that you're a science fiction fan staying at a hotel for the BayCon convention. It's late at night, so there are no exhibits to attend. You don't want to go to sleep, because you want to attend a party in an hour or so. So you flip on the TV and tune into the convention's in-house (well, in-hotel) station, BCTV. It's playing an old (or fan-produced) science fiction movie. Perfect.
Now imagine that you're on the delivery end for BCTV. You don't have a fancy control room; instead you have a regular hotel room with a cable dropped in allowing you to broadcast. You've put together a long tape of movies, but since half your content didn't arrive until the last minute, you're stuck in your room frantically trying to edit tapes together. You can't sleep at night. You can't enjoy the convention in the daytime. You're trapped in the control room.
This looks like a job for Perl.
Using POE, a video digitizer card, and an IR controller, I'm developing a system that will allow us to let BCTV run itself. I've created a program that allows us to create program schedules and play digital and analog content automatically. It's designed to handle everything from preplanned, pre-digitized content to VCR tapes pressed frantically into my hands at midnight.
Will it be everything I hope for it? Probably not. The first version will probably flicker between programs, since I'm using external processes for most of this. I'm having troubles getting the IR port running to control the external VCR. And I made the mistake of buying a video digitizer card that's only sorta-kinda supported under Linux.
However, the work progresses. I'm at the edge of creating a module that will automatically create text titles, such as "Up Next" screens and Con schedules. I'll be documenting what I run into here, so that people doing similar projects can learn from my mistakes.