Mailing List archive

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

[linux-dvb] Questions about new API



Dave Chapman writes:
 > I have been experimenting with the new API, and I have a question about how 
 > the new API is supposed to be used which I hope that someone on this list can 
 > answer.
 > 
 > As I understand it, if you want the DVB card to do something with the 
 > transport stream, then you have to use the demux API, and specify the 
 > destination of the individual PES packets to be either:
 > 
 > a) DMX_OUT_DECODER if you want the hardware to decode the data, or 
 > 
 > b) DMX_OUT_TAP / DMX_OUT_TS_TAP if you want your application to process or 
 > record the data.
 > 
 > My question concerns doing both of the above at the same time - how can I 
 > record or otherwise process a live stream whilst also directing it to the 
 > decoder?

Try the program test_dmx in the apps/test directory for sending a
stream to /dev/ost/dvr and the following (which should also be in the
CVS, but isn`t) for recording. The pids here are for n-tv. So you have
to be tuned to n-tv in order for it to work, or you have to add some
tuning code and set different pids. In any case, if you want to work
with the new linux dvb api you should check out the latest sources
from http://www.linuxtv.org/cvs.



/* 
 * test.c - Test program for DVB API
 *
 * Copyright (C) 2000 Ralph  Metzler <ralph@convergence.de>
 *                  & Marcus Metzler <marcus@convergence.de>
                      for convergence integrated media GmbH
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation; either version 2.1
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 */

#include <sys/ioctl.h>
#include <stdio.h>
#include <stdint.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <time.h>

#include <ost/dmx.h>
#include <ost/frontend.h>
#include <ost/sec.h>
#include <ost/video.h>


main()
{
  int ret;
  int len;
  struct secCommand scmd;
  struct secCmdSequence scmds;
  struct dmxPesFilterParams pesFilterParams; 
  struct dmxSctFilterParams secFilterParams; 
  struct qpskParameters qpsk;
  uint8_t buf[4096];

  int dvrout=open("qq", O_RDWR|O_CREAT);

  int fd_dvr=open("/dev/ost/dvr", O_RDONLY);
  int fd_frontend=open("/dev/ost/qpskfe", O_RDWR);
  int fd_sec=open("/dev/ost/sec", O_RDWR);
  int fd_demux=open("/dev/ost/demux", O_RDWR|O_NONBLOCK);
  int fd_demux2=open("/dev/ost/demux", O_RDWR|O_NONBLOCK);

  pesFilterParams.pid = 0xa2;
  pesFilterParams.input = DMX_IN_FRONTEND; 
  pesFilterParams.output = DMX_OUT_TS_TAP; 
  pesFilterParams.pesType = DMX_PES_VIDEO; 
  pesFilterParams.flags = DMX_IMMEDIATE_START;
  if (ioctl(fd_demux, DMX_SET_PES_FILTER, &pesFilterParams) < 0)  return(1); 
  printf("Video filter OK\n");

  printf("Audio filter size OK\n");
  pesFilterParams.pid = 0x60; 
  pesFilterParams.input = DMX_IN_FRONTEND; 
  pesFilterParams.output = DMX_OUT_TS_TAP; 
  pesFilterParams.pesType = DMX_PES_AUDIO; 
  pesFilterParams.flags = DMX_IMMEDIATE_START;
  if (ioctl(fd_demux2, DMX_SET_PES_FILTER, &pesFilterParams) < 0)   return(1); 
  printf("Audio filter OK\n");
  
  while (1) {
    len=read(fd_dvr, buf, 4096);
    if (len>0) write (dvrout, buf, len);
  }
}





--- 
Info:
To unsubscribe send a mail to listar@linuxtv.org with "unsubscribe linux-dvb" as subject.



Home | Main Index | Thread Index