Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

stephen (1260)

stephen
  (email not shown publicly)

See my homenode on PerlMonks [perlmonks.org].

Journal of stephen (1260)

Tuesday January 22, 2008
10:14 AM

New Video::Xine release

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.

Sunday January 20, 2008
06:13 PM

Xines To Come

In the "because we can" department, I'm working on some new things things for Video::Xine.

1. Overlays.

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.

2. Callbacks

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.

Hmm...

Wednesday December 26, 2007
08:23 PM

Revivifying Video::PlaybackMachine

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.

Sunday April 24, 2005
04:04 PM

Entracte

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.

Structural to-dos:

  • Create a central state machine whose job is to reflect overall system state. So, this machine concentrates on knowing: are we currently playing a movie? Are we playing a fill video? The Filler then becomes a sub-state-machine underneath it.
  • Split out the "DB" module into submodules to form a better rear tier.
  • Make the Filler module into a state machine as described above.
Friday March 25, 2005
12:11 AM

In XS

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.

Saturday March 19, 2005
05:43 PM

Status Update, and Question for the Community Minds

So Playback Machine, the TV station in a box, is essentially ready to rock and roll. Basic functionality includes:
  • It plays things back at the right times.
  • Whenever it isn't doing anything else, it plays some kind of filler-- either a short film or music with slides.
  • It provides a usable (if plain) web interface, so that we can change the schedule on the fly.
  • It restarts itself every four hours, between playing things, so that any memory leak in the player gets cleaned up.

(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:

  1. SVGs. Nearly custom-designed for the purpose. I can define nice bounding boxes. I tried this last year and got incredibly ugly results. Try again?
  2. Image::Magick. Common, easy to install, available as an RPM. However, its interface assumes that you're writing a simple annotation, and so I can't really do the kind of cell-based word wrapping I need.
  3. Image::Imlib2. I'm already using Imlib2's C interface to load and display slides, so there's some dependency efficiency. There's no RPM, though (I'd like to distribute this eventually as an RPM, so I'm watching my dependencies closely) and I'd need to implement my own word-wrapping code. Possible, though.
  4. GD. Looks like there's already a CPAN class out there for the kind of aligned text I'd like to produce. It'd add yet another C library dependency, but I should be able to live with that.

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.

Monday February 28, 2005
01:30 AM

Prius Madness

Ahh, glorious...

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.

12:43 AM

The Playback Machine

In a previous entry, I talked about the Playback Machine, a "television station in a box" system I've put together to animate the convention TV feed for BayCon. Well, after about two years of on-and-off work, it's finally ready-- or at least working reliably.

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:

  1. Being able to schedule a movie for a particular time and have the system play it back at that time.
  2. Playing short movies and slides whenever nothing else is playing.
  3. Stability-- we need to play content nonstop for three days.

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.

Thursday February 13, 2003
04:35 PM

Language Advocacy Considered Harmful

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.
Me: Um...
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.

Tuesday January 28, 2003
02:59 PM

BCTV: The Project

[ #10244 ]

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.