Programming :: VLC Control With Perl Sending Via Serial Connection?

Oct 6, 2010

My computer for a project I'm working on will be using Ubuntu with Perl and VLC from the repositories, if that matters at all. I'm not sure what I should/could use to accomplish this, but essentially I'm looking for Perl to be able to send predefined data via a serial connection based on the time within a song that VLC is playing.

A couple of the things that I've thought about after Googling a bit are SMPTE and subtitles/lyrics; I can't stop thinking that there's got so be a simple way that I'm just overlooking, though - most of the stuff I've found is for over-the-network applications, and that's overkill for this situation. All the subtitles/lyrics would have for text is hexadecimal values; all the SMPTE would do is keep Perl and VLC (playing audio) in-sync with each other. I would need either one or the other, but not both. Or, I could use something else...

I'm envisioning something like the setup below, I just don't know what else I need to make it happen.

Files:
song.mp3
timing.txt
script.pl

When I run "./script.pl song.mp3 timing.txt", VLC will open, and start playing "song.mp3", and the variable "$mils", for milliseconds elapsed, will be equal to zero. For each line in "timing.txt", the "script.pl" will assume the portion before an underscore is the "$time" for that line (time in milliseconds), and "script.pl" will assume that the portion after the underscore is the "$data", a three-byte hexadecimal value (such as "ff101f", or "011c00"), for that line.

I think that I will need to use two arrays, "@time" and "@data", such that the given line in "timing.txt" would read the same as printing: "$time[$line]".'_'."$data[$line]"."
" (if "$line" is the line number). My problem: jitter/stuttering playback. If VLC stumbles (which it sometimes does), and is a about half a second behind where it "should" be, but Perl didn't stumble, then I've got an out-of-sync issue.

Since Perl can't just count the time by itself to avoid synchronization issues, I've got two main ideas for getting this done: One way: Perl has to "read" where VLC is at, and use that as the "$mils" value. Then, if VLC delays/stubmles, so will Perl, but everything will still be in-sync. Alternative way: VLC has to "listen" to what Perl says "$mils" is at any given moment, essentially having Perl be in control of VLC's timing. This would make VLC "skip ahead" (to where it "should" be) if it starts to fall behind, thus keeping the two in sync.

I don't know which, if either, of these ways is best for my particular need. I would need "script.pl" to send "$data[$line]" over the serial connection when "$mils" == "$time[$line]". I already know how to send serial data from Perl, read files via Perl, and convert the hexadecimal number (if needed). I don't know how to "link" Perl and VLC so that they stay synchronized, and I am quite lost as to where to go from here.

View 5 Replies


ADVERTISEMENT

Programming :: Sending Mail To Mailing-lists In Perl?

Jan 25, 2011

Im creating a perl script that will be sending out mail to mailing-lists, but im not getting it to work. Its no problem getting the script to send mail to regular mail addresses, but it doesnt seem to handle to send mail to mailing lists. Im using the Net::SMTP perl module.how to send mail from a perl script to a mailing list (and not just regular mail addresses) ?

View 2 Replies View Related

Programming :: Configure Serial Port RS-232 To Use Flow Control?

Aug 2, 2010

how to configure serial port RS-232 to use flow control? The reason is without flow control is is not working properly(dala loss etc.) Im trying to run it as it is just with setting the flow control flag and Im sending my data via loop-back on the rs-232 to GTK TERM on the same computer... but when I enable IXON/IXOFF in GTK TERM, my sending program cant even open the port...

My current settings is:

Code:
struct termios termios_p;
//ferme_port();
tcgetattr(sc.fd, &termios_p);
termios_p.c_cflag = B9600;

[Code]....

View 2 Replies View Related

Programming :: Perl - Process Control As Different Users?

Jan 10, 2010

I need to control daemons like dhcp/bind from within a perl script. I could run the script as root to restart/stop/start the daemons however, this is not good for security.

What are the ways of controlling processes within perl as different users?

View 1 Replies View Related

Programming :: Perl's Foreach Loop Can't Use An Array Element As The Control Variable?

Jul 22, 2011

I'm reading "OReilly Learning Perl 5th Edition", and there are such words:Code:You can use an array element like $fred[2] in every place? where you could use any other scalavariable like $fred.At the bottom of the page, it explains the ? like this:Code:The most notable exception is that the control variable of a foreach loop, which you?ll see later in this chapter, must be a simple scalar.Since Perl has the save-and-restore mechanism for the control variable, why an array element can't be used as the control variable

View 1 Replies View Related

Hardware :: Reading Raw Codes From A Remote Control With A Tekram IR-210B Serial Dongle?

Oct 1, 2010

I need to read raw codes from various remote controls (for TVs, DVRs, etc). For that I use a Tekram IR-210B serial dongle. At least I try, since I can't put any meaning on the codes I get by reading /dev/ttyS0 . I tried various tricks, including reading /dev/ttyS0 as a stream, using the Linux irda stack, lirc, similar experiments with Windows 2000/XP too, but nothing seems to work (at least not as I am expecting). The technical documentation is non-existant, Tekram e-mail support doesn't answer (or returns non-existant user errors when it does), browsing the kernel file tekram.c didn't help either, so I'm kind of stuck.

Because I won't need this for more than a few days (or weeks at the very most), I don't need a rock-solid solution, what I need is nothing mode than read raw (presumably RC-5) codes from a few remote controls (2 of them being from mainstream brands, another one claiming to be universal). So if nothing else a dirty trick will perfectly do.

Ideally, a technical documention on how to get the raw codes from the remote controls is what I am looking for. Something that tells me what baud rate to use, which parity, number of stop bits, and how to decode the stream (as I suspect it doesn't contain the raw codes as-is). However, I will be happy with any advice you may have on where to look or what tricks I might try.

View 4 Replies View Related

Ubuntu :: Mikrotik - Control Access To Bind Mac Address With Ip Address And Control The Band Width For Individual Connection

Feb 14, 2011

i have a xeon machine with ubuntu os machine specification is 3gb RAM 3 scsi hard drives each 73gb it have two ethernet cards one ethernet card is connected with adsl modem and the second is connected with LAN. now what is mikrotik doing for me is control access to bind mac adress with ip adress and control the band width for induvisual conection.

View 2 Replies View Related

Ubuntu Multimedia :: PulseAudio Volume Control - Connection Failed:Connection Refused

Jul 4, 2010

I tried to finally set-up surround sound on my Ubuntu 10.04 machine and i was successful in doing so after a while of changing settings and tinkering. After doing so though, i was later in the day not able to get into the Pulseaudio Volume Control, therefore, everything is stuck where it is and i can't change anything. When i try to open Pulseaudio Volume Control i get the error message, Connection failed, Connection refused. My programs still play sound and i can control the sound of the programs through the programs, but i cant control the sound of the sorround sound now and my main sound bar only affects my stereo speakers, not the surround ones.

I believe this may have happened after the random disk check on restart, but i can't 100% confirm that and i'm not even sure if they are related. I still have sound, but i have no way to control the volume of my entire system at once. I did some looking around online and saw that others are having or had the same issue, and it was through different versions of Linux also. somehow reset everything so i can access PAVC and start over . I also tried steps listed in another thread here on the same topic, but they weren't working and it also seemed to be for older Ubuntu versions.

[Code]....

View 9 Replies View Related

Debian Configuration :: How To Set Up Serial Connection To Get Syslog?

Feb 7, 2010

I have been tol that for debugging purposes it is often useful to have a serial connection to a computer. I have some diskless workstations thats freezes during boot. I guess X has someting to do with this, but I'm not sure. Since the workstations are diskless, syslog is not stored locally so I cant se what is happening after the NiC stops working. When the worstation freezes, screen is going black, all lights on the keyboard turns on, lights on NiC is going black. It is not possible to ping the workstation.

View 1 Replies View Related

Networking :: Serial Connection Over Ethernet With C-Kermit?

Jul 30, 2009

I have a Sun server that could be only configured via serial interface. It has one serial port with a RJ 45 connector. Although my laptop has not serial interface. Is there a way to use C-Kermit or any software to establish a serial connection via the ethernet port. It should be some kind of virtual serial port that should transmit the information over the ethernet port, without encapsulating it in ethernet frames.

View 11 Replies View Related

General :: Connecting To A Serial /dev/ttyS2 Connection?

Jan 6, 2011

I have a Cisco Switch that is connected to my computer via serial. I simply want to configure the switch via the serial connection from within a terminal. I edited the /etc/inittab to include agetty for ttyS2 and ttyS3. The switch is hooked up to one of the two.

I ran

Code:

init q

to re-read the inittab

Ran a

Code:

ps -ef

and I can see the two agettys I also have run a dmesg to confirm that my computer has detected ttyS terminals. The requirements for the cisco switch connection are the following:

8 data bits
no parity
1 stop bit

[code]....

How do I connect to /dev/ttyS2 or /dev/ttyS3?

I've tried

Code:

agetty -8 115200 ttyS2 vt100

but it just hangs.

View 2 Replies View Related

Software :: Shutdown Of Server Over A Serial Connection?

Jan 18, 2010

We have an APC UPS connected to our main server via a serial cable, with the APC Powerchute Business Edition up and running nicely. We also have another server which is protected by the same UPS I started looking at an APC interface expander which would allow shutdown of multiple servers from the same UPS, however it appears it's not standard serial cables but a whole proprietory nightmare.possible to hook both servers up with a serial cable and have the master shut the other one down through a shell script? Both boxes are CentOS 5.4

View 5 Replies View Related

Ubuntu Networking :: Serial Cable Crossover Connection?

Oct 13, 2010

I've been reading too much and understanding too little. What I have: Lucid laptop & desktop. Both have ethernet > hub > internet. What I want: connect them directly by the serial ports so the laptop can access the desktop's drives, and the desktop can be retired from the internet. I've got an old DB-25 null-modem, last used for multiplayer Doom. The laptop's dock has DB-9, so the connections is desktop > null-modem > Belkin DB-25 - DB-9 cable > laptop.

I had hoped this post would get me somewhere:[URL].. No such luck. When I ping 'grin.local', the connection is through the internet. If I disconnect the hub, i cannot ping.

Dunno if there's something more I should do to enable serial connection in Lucid, or if my null-modem is no longer good. I'm also rather curious how "grin.local" manages a connection through my ISP's system. These are DHCP. Shouldn't that have required the full numerical IP?

(It's nothing to do with the hub. Checked that by connecting a third box to the hub. My ISP only hands out two IP. I couldn't ping the third box.)

View 5 Replies View Related

Networking :: Internet Connection Share Via Serial Port

Oct 20, 2009

Hello. I want to use my Debian box as an internet connection for a Win95 laptop. The laptop is old enough that the only port I have available to connect to the internet from is the serial port. I have heard that a serial port redirector will allow it to access the internet through my debian box, but I have no clue how to set one up. Any advice. Thanks

View 3 Replies View Related

Software :: View Oscilloscope Images Over Serial Connection?

Jan 23, 2009

Is there a program that will take images from an oscilloscope that I have connected via serial port?

View 5 Replies View Related

Software :: Connection Timed Out For Sending Mail With Evolution?

Jan 5, 2010

I am having alot of trouble setting up evolution to work with gmail. I am using pop for recieving mail and it's slow but still works. When I try to send mail with smtp.gmail.com I get the error message that the connection timed out. How can I set this up to send and recieve email?

View 6 Replies View Related

Programming :: Rs232 Serial Port Programming?

Jun 1, 2010

I have been working on writing a small rs232 driver like minicom for months. I am almost there, I have the interrupt service routine running, I can read() ok. However when I write(), it returns the number of characters written, 1, but nothing is actually written out the port. I researched termios, and they say that serial port programming is really messy in linux/unix.

I am probably not setting up the port parameters correctly, or my write() function is not doing what it is supposed to. As I said, write() is returning successful. Other comm programs run ok (picocom & gtkterm) on my hardware. I am running knoppix/debian on an ancient computer. I saw other guys using slackware.

View 14 Replies View Related

Programming :: Serial Port Programming String?

Nov 24, 2010

I have a serial port program which is reading a string .if(read(readfd,sResult,1)>0)where sResult is unsigned char sResult[10];if sResult is array of 10 then iam getting string perfectly but if iam making sResult only as unsigned char I am getting NULL value CODE BELOW

Code:
unsigned char sResult;
main()
{
readfd = open("/dev/ttyUSB0", O_RDONLY);
if (readfd == -1)
{
perror("READ: open_port: Unable to open /dev/ttyUSB0-

[Code]...

View 2 Replies View Related

General :: Configure Gmail For Sending Email - Connection Timed Out

Jun 23, 2010

I have a problem sending emails in the command line. I have introduced this command:

sendEmail -f my.account@gmail.com -t myself@domain.tld
-u this is the test tile -m "this is a test message"
-s smtp.gmail.com
-o tls=yes
-xu usernameonly -xp mypasswd

But then I received this message:
sendEmail[13230]: ERROR => Connection attempt to smtp.gmail.com:25 failed: IO::Socket::INET: connect: Connection timed out

View 1 Replies View Related

Networking :: Detecting Broken Connection Before Sending Data With Sockets?

Oct 28, 2010

I am writing a code in Python where a socket client changes data with the server. That works nice if the connection is up. However it is also supposed to work offline. So I need to be able to detect if the connection is up before sending data, but I was not able to do so. A summary of the code is like that:

Code:
try:
socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
socket.connect( (self.host, self.port) )
connected = True
except:
connected = False

if connected:
data = "some data byte"
try:
socket.send(data)
except:
connected=False
socket.close()

If I unplug the cable after the connection is ready then the socket sends data and does not detect the connection failure. What is amazing is that the client detects the connection failure just after the cable has been plugged again. Of course there is a loop in the code above and always that connected==False a new connection is made. How could the program detect the connection failure before sending data and then lead the code to an exception?

View 3 Replies View Related

Server :: Postfix And Amavist - Lost Connection While Sending End Of Data

May 24, 2010

Since today morning we are getting this error, could not track down the cause

We are running :
Postfix
Amavist and Clam

70A6C45A1CE: to=<actualemailid@yahoo.com>, relay=none, delay=0, status=deferred (delivery temporarily suspended: lost connection with 127.0.0.1[127.0.0.1] while sending end of data -- message may be sent more than once).

View 6 Replies View Related

Software :: IOException In Sending Request :: Connection Refused IN Oracle?

Oct 18, 2010

I am facing following problem when i want to start the databasewith enterprises manager .I search for the answer but nothing is workingI have install oracle 10g on fedora 12

View 1 Replies View Related

Security :: Hosts.Allow Vs. SSH / Sending Message Connection Closed By Remote Host?

May 29, 2010

I have set up SSH and redirected the ssh server to listen on another port other than 22 for a bit of added security.

Now in hosts.deny I have:

ALL : ALL

In hosts.allow I have:

SSH : ip_address_of_client

I can no longer connect. I get the message: ssh_exchange_identification: Connection closed by remote host.

When I change hosts.allow to read:

ALL : ip_address_of_client

I can successfully connect the server.

However, I only want to allow SSH access in hosts.allow. What is the correct syntax?

I have tried and failed with each one of these:

SSH : ip_address:port_number
SSH2 : ipaddress
sshfwd-portnumber : ip_address_of_client

View 2 Replies View Related

Fedora :: Install Perl With No Internet Connection?

Mar 24, 2011

Fresh installed Fedora 14, I need to make install the NIC driver from source. I downloaded rpm files for kernel-headers, kernel-devel, perl and perl-libs. Trying to install them, Perl asks for perl-libs and a few other lib files. And perl-libs ask for perl D:

how to off-line install perl?

View 2 Replies View Related

Programming :: Socket Programming In Module Perl

Jul 21, 2010

Where is the perl module for programming with sockets?

View 4 Replies View Related

Programming :: Sending Arp Packets In C / C++?

Apr 5, 2010

I'm looking for a way how to send an arp request / reply packet using C or C++. I've written an application that can send different crafted packages using jpcap (java), but I'm not a C expert (trying to learn). The reason for this is that I would like to port my java program to C to use it on a less powerful system that can't fully cope with the resource hungry VM

View 3 Replies View Related

Programming :: Get Serial EAGAIN Error

Apr 5, 2010

I use serial port. I get serial EAGAIN error. I open serial port with below settings.

do I have any error with settings.

static int fd=-1;
bool openPort(int baudrate, const char * ThePort) {
unsigned long BAUD;
struct termios port_settings;

[Code].....

View 3 Replies View Related

General :: Serial Port Programming Help

Apr 15, 2010

can we use inb() and outb() functions for serial port programming ??

View 5 Replies View Related

Programming :: C - Serial Port Won't Open?

Sep 1, 2010

I'm using C serial in a program to open and use a serial port but the port won't open for one reason or another. The program successfully runs on a different computer and when using RealTerm: Serial Capture Program, I can connect through the serial port with the same settings as I'm attempting through my c code. Anyone have any idea why it might be failing? I know this is still pretty vague, so let me know if there's other things I can tell you that might help to finding a solution

View 3 Replies View Related

Programming :: Switch Between Serial Protocols?

Jun 7, 2011

How to switch between serial protocols in c language? for example i need to switch between rs232 and rs422,(according to rs422 pinout)

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved