[linux-dvb] szap-pmt.diff

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

 



On Sat, Jun 11, 2005 at 08:43:33PM +0200, Matthias Mueller wrote:
>  static int set_demux(int dmxfd, int pid, int audio, int dvr)
>  {
>     struct dmx_pes_filter_params pesfilter;
>  
> -   if (pid <= 0 || pid >= 0x1fff) /* ignore this pid to allow radio services */
> +   if (pid < 0 || pid >= 0x1fff) /* ignore this pid to allow radio services */
>  	   return TRUE;

Unfortunately there are channels.conf files which
use 0 for "no video/audio pid" which is OK since 0 is no valid
video/audio pid. You need to handle this in read_channels.

> -   pesfilter.pes_type = audio ? DMX_PES_AUDIO : DMX_PES_VIDEO;
> +   pesfilter.pes_type = audio;


> +int get_pmt(char *dmxdev, int sid)
> +{
> +   int patfd,count;
> +   int pmt=0;
> +   int patread=0;

How about some whitespace?

> +   int section_length;
> +   unsigned char buft[4096];
> +   unsigned char *buf = buft;
> +   struct dmx_sct_filter_params f;
> +
> +   memset(&f, 0, sizeof(f));
> +   f.pid = 0;
> +   f.filter.filter[0] = (uint8_t) 0x42;
> +   f.filter.filter[0] = 0xff;

Huh?
- you should rename this function to get_pmt_pid()
- the PAT has table_id 0, not 0x42
- the (uint8_t) cast is unnecessary
- you probably meant to set f.filter.mask[0], but luckily this
  error cancels out your previous one :-)

> @@ -230,10 +290,12 @@
>  static
>  int zap_to(unsigned int adapter, unsigned int frontend, unsigned int demux,
>        unsigned int sat_no, unsigned int freq, unsigned int pol,
> -      unsigned int sr, unsigned int vpid, unsigned int apid, int dvr)
> +      unsigned int sr, unsigned int vpid, unsigned int apid, int sid, 

This line adds trailing whitespace

> @@ -293,13 +374,30 @@
>  
>     if (diseqc(fefd, sat_no, pol, hiband))
>        if (do_tune(fefd, ifreq, sr))
> -	 if (set_demux(videofd, vpid, 0, dvr))
> -	    if (set_demux(audiofd, apid, 1, dvr))
> -	       result = TRUE;
> +	 if (set_demux(videofd, vpid, DMX_PES_OTHER, dvr))
> +	    if (set_demux(audiofd, apid, DMX_PES_OTHER, dvr)) {

Argh! This just disabled live decoding on FF cards :-(

> +	       if (pmt) {
> +	           pmtpid=get_pmt(dmxdev, sid);
> +		   if (pmtpid < 0) {
> +		      result = FALSE;
> +		   }
> +		   if (pmtpid == 0) {
> +		      fprintf(stderr,"couldn't find pmt for sid %04x\n",sid);
> +		      result = FALSE;
> +		   }
> +       	           if (set_demux(patfd, 0, DMX_PES_OTHER, dvr))
> +	              if (set_demux(pmtfd, pmtpid, DMX_PES_OTHER, dvr))

indentation

> +	                 result = TRUE;
> +		} else {
> +		  result = TRUE;
> +		}
> +	    }

> +			 unsigned int demux, int dvr, int pmt)

please rename "pmt" to something more descriptive, e.g. "rec_psi"


Johannes



[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux