Re: How to extract several PID's from a TS

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

 



Le Jeudi 30 Mars 2006 15:32, christophe a écrit :
> Hello,
> How can i extract several video and audio data packets from only on
> transport stream, using only one DVB card ?
> In fact i have a DVB-S emitter, emitting several PID multiplexed video
> sources (cameras), and i want to be able to watch them all at same time
> with only one receiver (my receiver is directly connected to my emitter,
> it works exactly the same way then with a satellite).
> Maybe i should use several /dev/dvb/adapter0/dvrx interfaces and tell the
> frontend to redirect the several video packets to each of them ?
> Is this possible ? Has anyone already done such a thing ?

Each TS packet header contains the PID of the stream it belongs to.
So you can easily filter what you want.
See the joined example.

-- 
Christophe Thommeret
/* A simple filter (stdin -> stdout) to extract a single stream from a
   multiplexed TS.  Specify the PID on the command-line */

#include <stdio.h>
#include <unistd.h>

int main(int argc, char **argv)
{
  int pid, pid1, pid2, n;
  unsigned char buf[188];

  pid1=atoi(argv[1]);
  if ( argc >2 ) pid2=atoi(argv[2]);
  else pid2 = -1;

  fprintf(stderr,"filtering PIDS : %d %d\n",pid1,pid2);

  for (;;) {
    n=fread(buf,1,188,stdin);
    if (n==188) {
      pid = (((buf[1] & 0x1f) << 8) | buf[2]);
      if (pid1==pid || pid2==pid ) fwrite(buf,1,188,stdout);
    }
  }
}
_______________________________________________

linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

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

  Powered by Linux