public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Andreas Oberritter <obi@linuxtv.org>
To: "Pascal Jürgens" <lists.pascal.juergens@googlemail.com>
Cc: linux-media@vger.kernel.org
Subject: Re: Simultaneous recordings from one frontend
Date: Wed, 09 Mar 2011 17:22:41 +0100	[thread overview]
Message-ID: <4D77A951.5010209@linuxtv.org> (raw)
In-Reply-To: <B7991825-5F55-4AA0-AB7B-BB2A968F7464@googlemail.com>

On 03/09/2011 03:20 PM, Pascal Jürgens wrote:
> SUMMARY: What's the best available tool for demultiplexing into multiple simultaneous recordings (files)?

The kernel. There's no need to do that in userspace.

Any(*) number of tools may open a demux simultaneously, set up a filter
for the first PID with DMX_OUT_TSDEMUX_TAP and add any(*) number of TS
PIDs with DMX_ADD_PID. Data has to be read from demux, not from the
limited and IMHO obsolete dvr device.

In simplified code for PAT, PMT PID 0x80, Video PID 0x100, Audio PID 0x101:

int fd = open("/dev/dvb/adapter0/demux0", O_RDWR);

struct dmx_pes_filter_params f = {
	.pid = 0, // PAT
	.input = DMX_IN_FRONTEND, // live TV
	.output = DMX_OUT_TSDEMUX_TAP, // TS packets!
	.pes_type = DMX_PES_OTHER, // no decoding
	.flags = DMX_IMMEDIATE_START,
};

uint16_t pid[] = { 0x80, 0x100, 0x101 };

ioctl(fd, DMX_SET_PES_FILTER, &f);
for (int i = 0; i < 3; i++)
	ioctl(fd, DMX_ADD_PID, &pid[i]);

ssize_t r;
unsigned char buf[N * 188];
while ((r = read(fd, buf, sizeof(buf)) >= 0)
	write(1, buf, r);	// write to stdout

close(fd);

If there's no tool using this interface yet, it's probably time to write
or modify one,

Regards,
Andreas

*) Depending on available system resources.

      parent reply	other threads:[~2011-03-09 16:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-09 14:20 Simultaneous recordings from one frontend Pascal Jürgens
2011-03-09 14:47 ` Guy Martin
2011-03-09 15:19   ` Pascal Jürgens
2011-03-09 16:22 ` Andreas Oberritter [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D77A951.5010209@linuxtv.org \
    --to=obi@linuxtv.org \
    --cc=linux-media@vger.kernel.org \
    --cc=lists.pascal.juergens@googlemail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox