[linux-dvb] Using DVB as primary output device ?

Christophe Thommeret hftom at free.fr
Thu Mar 3 14:46:38 CET 2005


Le Jeudi 03 Mars 2005 13:39, jmmercy a écrit :
> Hi.
>
> Since my previous post, I found the dvb API which contains everything I
> need to understand tha various elements of the device driver. The
> documentation is daunting, though well made when you read it for the first
> time. My previous question still hold , is it possible to use to use card
> as the only video output device in a system ? Some of the API calls look
> quite usefull for that like the possibility to display a still picture
> (menus for example). Could someone give me a pointer to code examples
> showing how it is used for displaying, let's say an mpeg stream ? (I would
> prefer no to shuffle through mplayer code for that ...)
>
> Thanks in advance.

Should be something like that :

void setDemux(int fd,uint16_t pid, int type)
{
 struct dmx_pes_filter_params pesFilterParams;

 pesFilterParams.pid     = pid;
 pesFilterParams.input   = DMX_IN_DVR;
 pesFilterParams.output  = DMX_OUT_DECODER;
 if (type==1) pesFilterParams.pes_type = DMX_PES_VIDEO;
 if (type==2) pesFilterParams.pes_type = DMX_PES_AUDIO;
 pesFilterParams.flags   = DMX_IMMEDIATE_START;

  ioctl(fd, DMX_SET_PES_FILTER, &pesFilterParams)
}

void main()
{
 ...........
 ...........
 int fdDvr = open("/dev/dvb/adapter0/dvr0",O_WRONLY)
 int fdv = open("/dev/dvb/adapter0/demux0",O_RDWR)
 setDemux( fdv, vpid, 1);
 int fda = open("/dev/ost/demux",O_RDWR|O_NONBLOCK)
 setDemux( fda, apid, 2);

 while(1) {
  dataLen = read( fd_file, buf, len );
  int n=0;
  while( n<dataLen) n+= write(fdDvr,buf+n, dataLen-n);
 }
}


-- 
Christophe Thommeret




More information about the linux-dvb mailing list