public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] DVB-APPS: azap gets -p argument
@ 2011-03-05  2:16 Christian Ulrich
  2011-03-15 12:11 ` Janne Grunau
  0 siblings, 1 reply; 9+ messages in thread
From: Christian Ulrich @ 2011-03-05  2:16 UTC (permalink / raw)
  To: linux-media

[-- Attachment #1: Type: text/plain, Size: 270 bytes --]

Hey there,

I've written a patch against the latest version of azap in the hg
repository during the work of my Archos Gen8 DVB-T / ATSC project.

Details of patch:
- add -p argument from tzap to azap
- thus ts streaming to dvr0 includes the pat/pmt

Best regards,
Chris

[-- Attachment #2: azap_patpmt.patch --]
[-- Type: application/octet-stream, Size: 2977 bytes --]

--- linuxtv-dvb-apps/util/szap/azap.c.orig	2011-03-04 11:43:00.133757001 +0100
+++ linuxtv-dvb-apps/util/szap/azap.c	2011-03-05 02:15:31.289756443 +0100
@@ -171,7 +171,7 @@
 
 
 int parse(const char *fname, const char *channel,
-	  struct dvb_frontend_parameters *frontend, int *vpid, int *apid)
+	  struct dvb_frontend_parameters *frontend, int *vpid, int *apid, int *sid)
 {
 	int fd;
 	int err;
@@ -204,6 +204,9 @@
 	if ((err = try_parse_int(fd, apid, "Audio PID")))
 		return -6;
 
+	if ((err = try_parse_int(fd, sid, "Service ID")))
+		return -7;
+
 	close(fd);
 
 	return 0;
@@ -266,7 +269,7 @@
 }
 
 
-static const char *usage = "\nusage: %s [-a adapter_num] [-f frontend_id] [-d demux_id] [-c conf_file] [-r] <channel name>\n\n";
+static const char *usage = "\nusage: %s [-a adapter_num] [-f frontend_id] [-d demux_id] [-c conf_file] [-r] [-p] <channel name>\n\n";
 
 
 int main(int argc, char **argv)
@@ -276,11 +279,13 @@
 	char *confname = NULL;
 	char *channel = NULL;
 	int adapter = 0, frontend = 0, demux = 0, dvr = 0;
-	int vpid, apid;
+	int vpid, apid, sid, pmtpid = 0;
+	int pat_fd, pmt_fd;
 	int frontend_fd, audio_fd, video_fd;
 	int opt;
+	int rec_psi = 0;
 
-	while ((opt = getopt(argc, argv, "hrn:a:f:d:c:")) != -1) {
+	while ((opt = getopt(argc, argv, "hrpn:a:f:d:c:")) != -1) {
 		switch (opt) {
 		case 'a':
 			adapter = strtoul(optarg, NULL, 0);
@@ -294,6 +299,9 @@
 		case 'r':
 			dvr = 1;
 			break;
+		case 'p':
+			rec_psi = 1;
+			break;
 		case 'c':
 			confname = optarg;
 			break;
@@ -333,7 +341,7 @@
 
 	memset(&frontend_param, 0, sizeof(struct dvb_frontend_parameters));
 
-	if (parse (confname, channel, &frontend_param, &vpid, &apid))
+	if (parse (confname, channel, &frontend_param, &vpid, &apid, &sid))
 		return -1;
 
 	if ((frontend_fd = open(FRONTEND_DEV, O_RDWR)) < 0) {
@@ -344,6 +352,29 @@
 	if (setup_frontend (frontend_fd, &frontend_param) < 0)
 		return -1;
 
+
+        if (rec_psi) {
+            pmtpid = get_pmt_pid(DEMUX_DEV, sid);
+            if (pmtpid <= 0) {
+                fprintf(stderr,"couldn't find pmt-pid for sid %04x\n",sid);
+                return -1;
+            }
+
+            if ((pat_fd = open(DEMUX_DEV, O_RDWR)) < 0) {
+                perror("opening pat demux failed");
+                return -1;
+            }
+            if (set_pesfilter(pat_fd, 0, DMX_PES_OTHER, dvr) < 0)
+                return -1;
+
+            if ((pmt_fd = open(DEMUX_DEV, O_RDWR)) < 0) {
+                perror("opening pmt demux failed");
+                return -1;
+            }
+            if (set_pesfilter(pmt_fd, pmtpid, DMX_PES_OTHER, dvr) < 0)
+                return -1;
+        }
+
         if ((video_fd = open(DEMUX_DEV, O_RDWR)) < 0) {
                 PERROR("failed opening '%s'", DEMUX_DEV);
                 return -1;
@@ -363,6 +394,8 @@
 
 	check_frontend (frontend_fd);
 
+        close (pat_fd);
+        close (pmt_fd);
 	close (audio_fd);
 	close (video_fd);
 	close (frontend_fd);

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-09-15 17:16 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-05  2:16 [PATCH] DVB-APPS: azap gets -p argument Christian Ulrich
2011-03-15 12:11 ` Janne Grunau
2011-03-15 12:23   ` Christian Ulrich
2011-03-15 12:32     ` Janne Grunau
2011-03-15 13:50       ` Oliver Endriss
2011-04-04 11:05         ` Janne Grunau
2011-04-06  6:39           ` Oliver Endriss
2011-04-06  7:15             ` Janne Grunau
2011-09-15 17:09               ` Christian Ulrich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox