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



Ankit Kapasi wrote:
> I am currently using V4L2 0.2.8 and Linux Kernel 2.4.21-144.
  I asked for saa7134 driver version. Driver version from linuxtv is
outdated, I'm currently using saa7134 0.2.9 version (because it has been 
working for me since I downloaded it :), but you can download later 
versions from:

    http://dl.bytesex.org/releases/video4linux/ 

> 
> 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. 

  Oh!, that is because you are using an ASCII editor, MPEG files are
binary files, you need other tool, like emacs in binary mode or
hexcurse, to see their content. To see if it is a valid MPEG TS file you
must find a 0x47 (a G) at the very beginning of the file and each 188
bytes.

> 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?

  I don't know what current status of the driver is, the version I use
only allows to change or ask for the video input (I do not have tuner)

> 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);

  I suppose /dev/video is a link to /dev/video0
 
>     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?

  Well, when you have the input set, a simple cat of /dev/video1 must
output a valid transport stream, when you don't have any input to the
encoder a cat hangs until such an input is set.

> 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;
>         }
> 

  What do you expect this code to do? This code makes no sense for me,
refer to 

    http://v4l2spec.bytesex.org/spec/common.html

to see how to get and set video inputs.

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




Home | Main Index | Thread Index