Raw stream viewer

If you've made a patch to quick fix a bug or to add a new feature not yet in the main tree then post it here so others can try it out.
linuxsense
Posts: 374
Joined: Wed Nov 07, 2007 1:59 am
Location: Huntington Beach, California
Contact:

Post by linuxsense »

I figured I would add this for some other blokes future use...

To compile xlib_shm on my 64 bit Ubuntu 8.04 system I changed the Makefile to:

Code: Select all

X11PREFIX=/usr/X11R6

all: xlib_shm

xlib_shm.o: xlib_shm.c
	gcc -c xlib_shm.c -I$(X11PREFIX)/include -I/usr/lib64 -Wall

xlib_shm: xlib_shm.o
	gcc xlib_shm.o -L$(X11PREFIX)/lib -I/usr/lib64 -lGL -lX11 -lmysqlclient -Wall,-rpath=$(X11PREFIX)/lib -o xlib_shm

clean: 
	rm -f *.o *.core xlib_shm
I also changed the shared key default in xlib_shm.c to use 0x7a6d0000 instead of the default of 0x7a6d2000.

After those changes a 'make clean' followed by a 'make all' gets it built. Thanks to maciekc for this great tool.
craver84
Posts: 96
Joined: Sun Aug 31, 2008 7:35 am

Post by craver84 »

I'm using xlib_shm-gl with ZM 1.23.3 on my ubuntu 8.04 and it works great!

this is my command:
sudo xlib_shm-gl -m1 -m2 -m3 -k 0x7a6d0000

There is a problem I don't know how to solve it:
when I change the zm run state (restart, stop and start, or custom states) xlib_shm freezes and I can't close it by clicking on the X or mouse right click and close.

I need to change zm state using crontab during the day, so I'm tring to resolve this bug. can you help me? Thanks
craver84
Posts: 96
Joined: Sun Aug 31, 2008 7:35 am

Post by craver84 »

Ok, I resolved in this way, but it isn't the best way

crontab -e

Code: Select all

# m h  dom mon dow   command
00 22 * * * sudo /usr/bin/zmpkg.pl modect
00 22 * * * sudo killall -v xlib_shm-gl
00 22 * * * sudo xlib_shm-gl -m1 -m3 -m4 -k 0x7a6d0000

00 08 * * * sudo /usr/bin/zmpkg.pl monitor
00 08 * * * sudo killall -v xlib_shm-gl
00 08 * * * sudo xlib_shm-gl -m1 -m3 -m4 -k 0x7a6d0000
spookyspy
Posts: 3
Joined: Wed Oct 22, 2008 5:54 pm

question

Post by spookyspy »

Works fine real low cpu compared to http.

But how come that it has to be root to run the program?
Is that a ZM protection or is there a way to chmod a file to make it work?

gr,
Willem
linuxsense
Posts: 374
Joined: Wed Nov 07, 2007 1:59 am
Location: Huntington Beach, California
Contact:

Re: question

Post by linuxsense »

spookyspy wrote:Works fine real low cpu compared to http.

But how come that it has to be root to run the program?
Is that a ZM protection or is there a way to chmod a file to make it work?

gr,
Willem
You can run it via sudo, here is a little script I use to launch two viewers for my 'daytime' ZM profile:

Code: Select all

#!/bin/bash

# driveway
kdesudo "/home/dave/bin/xlib_shm -m7 -c 1 -w 320 -h 240" &

# the rest
kdesudo "/home/dave/bin/xlib_shm -m10 -m9 -m8 -m14 -w 640 -h 480" &
Something like that can be run by a normal user.
00goat
Posts: 5
Joined: Tue Oct 21, 2008 4:24 pm

Post by 00goat »

Having trouble compiling on xubuntu 6.06 (bluecherry) and zm 1.22.3. Using non-gl version due to intel integrated video. Tried .6.3, rolled back to .6.2 thinking it might be more suited to zm 1.22.2.

Code: Select all


~/Desktop/xlib_shm-0.6.2$ make
gcc -c xlib_shm.c -I/usr/X11R6/include
xlib_shm.c: In function ‘GetPortId’:
xlib_shm.c:182: warning: pointer targets in passing argument 3 of ‘XvQueryAdaptors’ differ in signedness
xlib_shm.c: In function ‘loadzmconfig’:
xlib_shm.c:234: warning: incompatible implicit declaration of built-in function ‘strcspn’
xlib_shm.c:238: warning: incompatible implicit declaration of built-in function ‘strspn’
xlib_shm.c:245: warning: incompatible implicit declaration of built-in function ‘strlen’
xlib_shm.c:253: warning: incompatible implicit declaration of built-in function ‘strchr’
xlib_shm.c:277: warning: incompatible implicit declaration of built-in function ‘strncpy’
xlib_shm.c: In function ‘main’:
xlib_shm.c:549: warning: pointer targets in passing argument 4 of ‘XvCreateImage’ differ in signedness
xlib_shm.c:636: warning: pointer targets in passing argument 6 of ‘XCreateImage’ differ in signedness
xlib_shm.c:763: warning: pointer targets in passing argument 6 of ‘XCreateImage’ differ in signedness
xlib_shm.c:873: warning: pointer targets in passing argument 6 of ‘XCreateImage’ differ in signedness
gcc xlib_shm.o -L/usr/X11R6/lib -lXv -lXext -lX11 -lmysqlclient -Wl,-rpath=/usr/X11R6/lib -o xlib_shm

Any thoughts? I've improved slightly from previous errors by upgrading some X11 libs, but it's still not quite there.

Thanks
maciekc
Posts: 150
Joined: Wed Feb 23, 2005 9:21 pm
Location: Czestochowa, POLAND

Re: question

Post by maciekc »

spookyspy wrote:Works fine real low cpu compared to http.

But how come that it has to be root to run the program?
Is that a ZM protection or is there a way to chmod a file to make it work?

gr,
Willem
You can run it as the user which zm is running without problems.
00goat
Posts: 5
Joined: Tue Oct 21, 2008 4:24 pm

Post by 00goat »

I did eventually get it working, and I'm quite pleased with the app. Are there any plans for further development of this? It seems like it would be a very useful component to add to the core app.
maciekc
Posts: 150
Joined: Wed Feb 23, 2005 9:21 pm
Location: Czestochowa, POLAND

Post by maciekc »

00goat wrote:I did eventually get it working, and I'm quite pleased with the app. Are there any plans for further development of this? It seems like it would be a very useful component to add to the core app.
Unfortunately I don't have much time for that.
It was written just because of my customer wishes.
I got all they needed and the development has stopped.
It should be completely rewritten in cpp to add some new features.
It would be great if someone can continue this project. Probably I won't. I just don't have time for it. Of course if there is some volunteer I will be happy to explain how it works.
User avatar
Lee Sharp
Posts: 1069
Joined: Sat Mar 31, 2007 9:18 pm
Location: Houston, TX

Post by Lee Sharp »

maciekc wrote:
00goat wrote:I did eventually get it working, and I'm quite pleased with the app. Are there any plans for further development of this? It seems like it would be a very useful component to add to the core app.
Unfortunately I don't have much time for that.
It was written just because of my customer wishes.
I got all they needed and the development has stopped.
It should be completely rewritten in cpp to add some new features.
It would be great if someone can continue this project. Probably I won't. I just don't have time for it. Of course if there is some volunteer I will be happy to explain how it works.
If someone does want to pick it up, and can do a few things for me, we may be able to help support the project. Things like web space, dev boxes, and perhaps even laughably small amounts of cash. :D
gola10
Posts: 150
Joined: Wed Nov 01, 2006 3:16 pm
Location: Panama

Post by gola10 »

Found on xlib_shm-0.6.3-gl.tar.bz2 a script called start_monitor
-------------- script --------------------------
#!/bin/bash
RUN="./xlib_shm -m1 -b2"
PID=`pidof xlib_shm`

while :
do
PREV_CPU=`cat /proc/$PID/stat 2> /dev/null | cut -f14 -d" "`
sleep 2
CURR_CPU=`cat /proc/$PID/stat 2> /dev/null | cut -f14 -d" "`
if [ -z $CURR_CPU ]
then
PREV_CPU=0
CURR_CPU=0
fi
if [ $PREV_CPU = $CURR_CPU ]
then
PID=`pidof xlib_shm`
if [ -n "$PID" ]
then
kill -9 $PID
fi
$RUN &
PID=`pidof xlib_shm`
fi
done
-----------------------------------------------------

I has seen that this script keeps xlib_shm running for ever. I has been rebooting the computer to stop it. I am sure there is another way to stop it but have no idea about script programming .
What i really need is to start and stop it by pressing the same keyboard key. I has found the way on KDE to assign a key to a script so this part is solved.
Now, how do i modify this script so that if running, it will stop (by pressing the key) and if not runnjing, it will start (by pressing the key the same key)
50cc
Posts: 82
Joined: Sun Mar 23, 2008 12:01 pm
Location: The Netherlands

Post by 50cc »

Brilliant!!! :D

Downloaded and compiled it into our Ubuntu 8.04 server. Works excellently!

Posted a howto on my new network admin blog:
http://selfmadenetadmin.blogspot.com/20 ... iewer.html
User avatar
Lee Sharp
Posts: 1069
Joined: Sat Mar 31, 2007 9:18 pm
Location: Houston, TX

Post by Lee Sharp »

There are debs out, and they work well. However, you need to set the shared memory key manually for 1.23 as they were compiled for 1.22. Go to http://packages.medianix.net/pool/main/x/ to find them.

Launch with commands like;
xlib_shm -m1 -m2 -m3 -m4 -k 0x7a6d0000
or
xlib_shm -m1 -m2 -m3 -m4 -m5 -m6 -m7 -m8 -c3 -k 0x7a6d0000
utasc
Posts: 3
Joined: Mon Sep 22, 2008 8:29 am

it works on a headless server?

Post by utasc »

as title i have zm 1.23.3 on a ubuntu 8.04 headless server.
can i view remotely my cam exporting dislpay on other linux box?

regards
jameswilson
Posts: 5111
Joined: Wed Jun 08, 2005 8:07 pm
Location: Midlands UK

Post by jameswilson »

not with shared mem viewer.
You may be able to use shared mem viewer on the headless box (would require x) and use x forwarding to another box
James Wilson

Disclaimer: The above is pure theory and may work on a good day with the wind behind it. etc etc.
http://www.securitywarehouse.co.uk
Post Reply