Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[mpeg2] Re: Trying to get an Mpeg TS to work



I am currently using V4L2 0.2.8 and Linux Kernel 2.4.21-144. 

I make the cat call from the command line and output to a file. When it is
finished running, I look at the file attributes and it has a large value.
Then I try and view it in pico and file is blank, but the scroll bar is
active, suggesting that something is there, but I have no idea what. 

Also while working on this, I looked at the documentation for saa7134-ts.c
and noticed that the values in the VIDIOC_S_FMT command are hardcoded in for
PAL; I need to use NTSC, is there anyway to change that?

This is the basic structure of my program. Again thanks for the help

    //Define video capture device and open.
    device = "/dev/video";
    mpeg = "/dev/video1";
    card = open(device, O_RDWR);
    mpg = open(mpeg, O_RDWR);

    set the input (on card)
    Set the tuner (on card)
    Attempt setting the standard (mpg and card)
    
    What do I do next? I have thought about putting a streamon command in.
do you need that?

This is some of the important sections of the code
    input.type = V4L2_INPUT_TYPE_TUNER;
    if (ioctl(card, VIDIOC_ENUMINPUT, &input) < 0) {
        perror("ENUMINPUT");
    }
    if (ioctl(card, VIDIOC_S_INPUT, &input) < 0) {
        perror("VIDIOC_S_INPUT");
    }
    if (input.index != 2) {
        printf("Must set input index to 2.\n");
        input.index = 2;
    }
    input.type = V4L2_INPUT_TYPE_TUNER;
    if (ioctl(card, VIDIOC_ENUMINPUT, &input) < 0) {
        perror("ENUMINPUT");
        }
    if (ioctl(card, VIDIOC_S_INPUT, &input) < 0) {
        perror("VIDIOC_S_INPUT");
    }

    tuner.index = input.tuner;
    for (i=0; i < 4; i++) { 
         tuner.reserved[i] = 0;
    }
        
    if (ioctl(card, VIDIOC_G_TUNER, &tuner) < 0) {
        perror("VIDIOC_G_TUNER");
    }
    tuner.type |= V4L2_TUNER_ANALOG_TV;
    if (ioctl(card, VIDIOC_S_TUNER, &tuner) < 0) {
         perror("VIDIOC_S_TUNER");
     }

       if (ioctl(card, VIDIOC_S_STD, &std.id) < 0) {
            perror("VIDIOC_S_STD");
            //return -1;
        }

-----Original Message-----
From: mpeg2-bounce@linuxtv.org [mailto:mpeg2-bounce@linuxtv.org] On Behalf
Of Samuel Rivas
Sent: Tuesday, April 20, 2004 3:01 AM
To: mpeg2@linuxtv.org
Subject: [mpeg2] Re: Trying to get an Mpeg TS to work

Ankit Kapasi wrote:
> 
>    I am currently a student attempting to implement a system that takes
>    in an NTSC video signal and then encodes it into MPEG2 stream. I have
>    a couple of questions and as much detail as you can provide would be
>    greatly appreciated.
> 
>    One thing is,l do I need to open a video0 and a video1? I am currently
>    opening video0 to set the video input format and set the tuning
>    frequency and then opening another device (video1) to access the TS
>    stream. However when I run this program that runs the tscap.c program
>    (included with MPEX drivers), I get an error which is "Not a TS"
 
  You are doing it in the correct way, /dev/video0 is for the video for
linux API and /dev/video1 returns a MPEG transport stream
> 
>    I have also tried the "cat /dev/video1" command I get a large file
>    that appears empty. It has a size but I cant see anytihg in it.

  What do you mean with "I can't see anything in it"? Perhaps you are
facing with one old problem of the driver that makes it to return
nothing but zeros. Try downloading a later version.

-- 
 ---------------------
|	Samuel        |
 ---------------------






Home | Main Index | Thread Index