[gst-devel] Problem Trying To Use v4l2src

Kulecz, Walter (JSC-SK)[WYLE LABORATORIES] walter.kulecz-1 at nasa.gov
Tue Aug 25 22:08:23 CEST 2009


>On Sat, 2009-08-22 at 01:28 +0100, Tim-Philipp Müller wrote:

>> Have you tried setting v4l2src to PAUSED or PLAYING state before doing
>> the cast to GST_TUNER(), like I suggested?
>
>That should've read 'READY or PAUSED'.

Thanks a lot.  Sorry it took me so long to get back to this.

Setting it to 'PAUSED' is what allows the interface method functions to be accessed.

I've attached HelloVideo.c which is just the basic gstreamer "HelloWorld.c" audio player example modified to for:  v4l2src ! queue ! ffmpegcolorspace ! xvimagesink.  Perhaps it'll save someone else some hassles.  Do with it what you will.


Seems to work OK for now.  But I still see two issues.
First is an apparently bogus error warning, shown in this dump of the console output:

wally at voms:~$ ./HelloVideo
Norm: PAL @ 25/1 fps
Norm: PAL-BG @ 25/1 fps
Norm: PAL-I @ 25/1 fps
Norm: PAL-DK @ 25/1 fps
Norm: NTSC @ 30000/1001 fps
Norm: SECAM @ 25/1 fps
Norm: SECAM-DK @ 25/1 fps
Norm: SECAM-L @ 25/1 fps
Norm: SECAM-Lc @ 25/1 fps
Norm: PAL-M @ 30000/1001 fps
Norm: PAL-Nc @ 25/1 fps
Norm: PAL-60 @ 30000/1001 fps
Previous Norm: PAL

(HelloVideo:17735): GLib-GObject-WARNING **: IA__g_object_notify: object class `GstV4l2Src' has no property named `norm'
Current Norm: NTSC

Chan: Composite1
Chan: Television
Chan: S-Video

Capturing from v4l2src plugin
Running...
Error: Output window was closed
Returned, stopping playback
Deleting pipeline


The second issue is if my VCR is idle (tape not playing) the pipeline fails to start with:

"Error:  Failed trying to get video frames from device: /dev/video0"


But if the tape is playing it works, I can then stop the tape and the pipeline continues to display  the recorder's "blue screen" status.  This one is a bit more inconvenient as we run in two modes, live where it won't be a problem since the cameras are on before the program would start, and archive where old tapes are analyzed and the tape rarely  if ever playing when the program is started.

I'd assume the gst_element_set_state(pipeline, GST_STATE_PLAYING) returns some status I could loop on if no video, or quit on if the window is closed, but it seems the return codes are just a generic success or failure.  So my question becomes is there a better way then working on the bus_call() function in the sample application to interpret the error and restart the loop if the error is simply a lack of video frames because the recorder is stopped?


This whole thread would never have happened if things like

  GstTunerNorm *ntsc=gst_tuner_find_norm_by_name (tuner, "NTSC");  
  if(ntsc) gst_tuner_set_norm (tuner, ntsc); else g_print("Can't set NTSC!\n");

and

  GstTunerChannel *composite=gst_tuner_find_channel_by_name(tuner, "Composite1");
  if(composite) gst_tuner_set_channel(tuner, composite); else g_print("Can't select Composite1 input!\n");

were documented with v4l2src along with the recipe of casts needed to allow access to the gsttuner interface.  

I know that "introspective" objects are trendy these days, but I don't see the point as the documentation needed for this "self-discovery" to actually work is far greater than just listing the possibilities and adding to it as features grow, and returning "not supported" errors for things a specific class instance can't support.  The whole "interface" thing seems a kludge around not having multiple inheritance in GObjects.

The video for Linux stuff seems to have lost something in the translation, as "channel" is (or should be) what frequency (station) the television tuner input is tuned to, whereas selection of S-Video, Composite, Tuner, etc. input sources should not really be part of the TV channel selection/definition code which in the case of NTSC is now defunct for over the air broadcasts anyways.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: HelloVideo.c
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20090825/57973fdd/attachment.asc>


More information about the gstreamer-devel mailing list