Alternative view: by date.
While investigating the case of some packages responsible for
uninstallability on the s390x architecture, I stumbled upon one
FTBFS on a single architecture, reported as
#673590 (<insert some nice words
about software shipping with a decent testsuite>).
Given the int versus size_t question was asked, I grabbed this old
(it’s UNIX!) reference:
64-bit and Data Size Neutrality.
Among other things, it describes the “everything is 32-bit” to “64-bit is becoming the new standard” slow conversion process, where keeping compatibility with existing applications was a high priority. It has a nice description of so-called C data models, making it possible to refer to them quickly: LP32 and ILP32 in the 32-bit world; ILP64, LLP64, and LP64 in the 64-bit world. I won’t go into detail here, this page has a nice table and lots of explanations about pros and cons for those.
(On a personal note, I discovered those on xorg-devel@ when I saw
patches floating around, which were about optimizing data sizes for
this or that data model, by picking the right types.)
While standards may be boring, this page makes it really easy to understand which data types to use, to ensure the best 32/64-bit compatibility possible. It’s even full of dos and don’ts. See the second half (Porting Issues) for details.
Keeping an eye on something with a webcam is really easy: just a
matter of setting up for example (c)vlc to multicast from
/dev/videoX to the network, and done.
Example:
# Streaming:
cvlc v4l2:///dev/video0 --no-audio --sout "#transcode{vcodec=mp2v,vb=3072}:std{access=udp,mux=ts,dst=224.0.0.1}"
# Playing, possibly on a remote machine:
vlc udp://@224.0.0.1:1234
Notes:
v4l2vs.v4ldepending on the distribution (sidvs.squeeze).- Triple slash needed, two for the
v4l[2]://part, one for the device (/dev/video0). - Why this address? See Wikipedia’s Multicast address article.
Possible problems:
- If switches don’t have IGMP snooping enabled, throwing multicast at them turns it into plain broadcast. In other words: instead of having packets sent to the hosts subscribed to that multicast address, everyone gets those packets, polluting the network.
- Trying to stream from multiple devices may fail, due to USB
bandwidth issues. At least that can be seen with two random
devices using the
uvcvideomodule, gettingNo space left on devicewhen the second (c)vlc is started.
Where to go from here:
- fswebcam to the rescue! It can
capture a frame from a given device. The following options are
particularly useful:
--resolutionto request a specific resolution (the device will fall back to another resolution if the requested one is unavailable);--framesto specify the number of frames to capture (lower noise, but possibly higher blurriness). - A tiny python wrapper around it makes it possible to set various
webcams, with different options (number of frames, delay between
two captures, resolution), operating at the same time thanks to the
help of the
threadingmodule. To avoid encountering the same bandwidth issue, a tiny lock ensures a singlefswebcaminstance runs at a time. - That also makes it possible to save all images as
videoX-timestamp.jpgand to “log”rotate them after a while, for further viewing/reviewing during a given time window. Thanks to ImageMagick, it’s also trivial to process the captured images:
# Only keep a rectangle of width W, height H, starting at the point (X,Y): convert -crop WxH+X+Y capture.jpg capture.jpg # Include a timestamp on the top-left corner: convert -box white -font Fixed -draw "text 2,12 \"$timestamp\"" capture.jpg capture.jpgKeeping a
videoX-current.jpgsymlink for each/dev/videoXdevice is trivial.- Add to that a lightweight webserver and a single page showing the most recent capture for each device thanks to the symlinks, with a meta refresh of say 5 seconds, and tada! Keeping an eye on multiple things at once. Of course that’s not a real video, but that can fulfill some needs.