diff options
author | Zaheer Abbas Merali <zaheerabbas@merali.org> | 2006-11-07 14:46:56 +0000 |
---|---|---|
committer | Zaheer Abbas Merali <zaheerabbas@merali.org> | 2006-11-07 14:46:56 +0000 |
commit | 303b9278c7c6a403f9f268b8e6557cb87548010e (patch) | |
tree | c1da66360b9d8862c9ea89f6031dd680fb084f9b /sys/dvb | |
parent | de0a7a01a1c7c7335b1d2f453d48dd283965fc8c (diff) | |
download | gst-plugins-bad-303b9278c7c6a403f9f268b8e6557cb87548010e.tar.gz gst-plugins-bad-303b9278c7c6a403f9f268b8e6557cb87548010e.tar.bz2 gst-plugins-bad-303b9278c7c6a403f9f268b8e6557cb87548010e.zip |
sys/dvb/gstdvbsrc.*: Force PAT to always be in the filter.
Original commit message from CVS:
2006-11-07 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* sys/dvb/gstdvbsrc.c: (read_device), (gst_dvbsrc_create),
(gst_dvbsrc_output_frontend_stats), (gst_dvbsrc_tune),
(gst_dvbsrc_set_pes_filter):
* sys/dvb/gstdvbsrc.h:
Force PAT to always be in the filter.
Try to continue reading after failing 10 times.
Diffstat (limited to 'sys/dvb')
-rw-r--r-- | sys/dvb/gstdvbsrc.c | 62 | ||||
-rw-r--r-- | sys/dvb/gstdvbsrc.h | 1 |
2 files changed, 41 insertions, 22 deletions
diff --git a/sys/dvb/gstdvbsrc.c b/sys/dvb/gstdvbsrc.c index 2c830fa2..2a16bdda 100644 --- a/sys/dvb/gstdvbsrc.c +++ b/sys/dvb/gstdvbsrc.c @@ -73,7 +73,7 @@ static GstElementDetails dvbsrc_details = { * </para> * <para> * <programlisting> - * gst-launch dvbsrc modulation="QAM 64" trans-mode=8k bandwidth=8MHz freq=514000000 code-rate-lp=AUTO code-rate-hp=2/3 guard=4 hierarchy=0 pids=256:257 ! flutsdemux crc-check=false name=demux es-pids=256:257 ! queue max-size-buffers=0 max-size-time=0 ! flumpeg2vdec ! xvimagesink sync=false demux. ! queue max-size-buffers=0 max-size-time=0 ! flump3dec ! alsasink sync=false + * gst-launch dvbsrc modulation="QAM 64" trans-mode=8k bandwidth=8 freq=514000000 code-rate-lp=AUTO code-rate-hp=2/3 guard=4 hierarchy=0 pids=256:257 ! flutsdemux crc-check=false name=demux es-pids=256:257 ! queue max-size-buffers=0 max-size-time=0 ! flumpeg2vdec ! xvimagesink sync=false demux. ! queue max-size-buffers=0 max-size-time=0 ! flump3dec ! alsasink sync=false * </programlisting> * This pipeline captures a partial transport stream from dvb card 0 that is a DVB-T card for a program at tuned frequency 514000000 and pids of 256:257 with other parameters as seen in the pipeline and outputs the program with the pids 256 and 257. The reason the sinks have to be set to * have sync=false is due to bug #340482. @@ -773,7 +773,7 @@ read_device (int fd, const char *fd_name, int size) int count = 0; struct pollfd pfd[1]; int ret_val = 0; - int attempts = 0; + guint attempts = 0; const int TIMEOUT = 100; GstBuffer *buf = gst_buffer_new_and_alloc (size); @@ -797,12 +797,11 @@ read_device (int fd, const char *fd_name, int size) if (tmp < 0) { GST_WARNING ("Unable to read from device: %s (%d)", fd_name, errno); attempts += 1; - if (attempts == MAX_ATTEMPTS) { + if (attempts % 10 == 0) { GST_WARNING - ("Unable to read from device after too many attempts: %s", - fd_name); - - goto fail; + ("Unable to read from device after %u attempts: %s", + attempts, fd_name); + gst_dvbsrc_output_frontend_stats (src); } } else @@ -814,9 +813,10 @@ read_device (int fd, const char *fd_name, int size) attempts += 1; GST_INFO ("Reading from device %s timedout (%d)", fd_name, attempts); - if (attempts == MAX_ATTEMPTS) { - GST_WARNING ("Unable to read from device: %s (%d)", fd_name, errno); - goto fail; + if (attempts % 10 == 0) { + GST_WARNING ("Unable to read after %u attempts from device: %s (%d)", + attempts, fd_name, errno); + gst_dvbsrc_output_frontend_stats (src); } } else if (errno == -EINTR) { // poll interrupted ; @@ -826,13 +826,6 @@ read_device (int fd, const char *fd_name, int size) GST_BUFFER_SIZE (buf) = count; GST_BUFFER_TIMESTAMP (buf) = GST_CLOCK_TIME_NONE; - goto end; - -fail: - gst_buffer_unref (buf); - buf = NULL; - -end: return buf; } @@ -846,8 +839,10 @@ gst_dvbsrc_create (GstPushSrc * element, GstBuffer ** buf) GstDvbSrc *object = NULL; g_return_val_if_fail (GST_IS_DVBSRC (element), GST_FLOW_ERROR); - g_return_val_if_fail (buf != NULL, GST_FLOW_ERROR); object = GST_DVBSRC (element); + GST_LOG ("buf: 0x%x fd_dvr: %d", buf, object->fd_dvr); + + g_return_val_if_fail (buf != NULL, GST_FLOW_ERROR); //g_object_get(G_OBJECT(object), "blocksize", &buffer_size, NULL); buffer_size = DEFAULT_BUFFER_SIZE; @@ -1187,7 +1182,7 @@ gst_dvbsrc_set_pes_filter (GstDvbSrc * object) for (i = 0; i < MAX_FILTERS; i++) { if (object->pids[i] == 0) - continue; + break; fd = &object->fd_filters[i]; pid = object->pids[i]; @@ -1209,7 +1204,32 @@ gst_dvbsrc_set_pes_filter (GstDvbSrc * object) pes_filter.pid, pes_filter.pes_type); if (ioctl (*fd, DMX_SET_PES_FILTER, &pes_filter) < 0) - g_warning ("Error setting PES filter on %s: %s", object->demux_dev, - strerror (errno)); + GST_WARNING_OBJECT (object, "Error setting PES filter on %s: %s", + object->demux_dev, strerror (errno)); } + /* always have PAT in the filter if we haven't used all our filter slots */ + if (object->pids[0] != 8192 && i < MAX_FILTERS) { + /* pid 8192 means get whole ts */ + pes_filter.pid = 0; + pes_filter.input = DMX_IN_FRONTEND; + pes_filter.output = DMX_OUT_TS_TAP; + pes_filter.pes_type = DMX_PES_OTHER; + pes_filter.flags = DMX_IMMEDIATE_START; + + fd = &object->fd_filters[i]; + close (*fd); + if ((*fd = open (object->demux_dev, O_RDWR)) < 0) { + GST_WARNING_OBJECT ("Error opening demuxer: %s (%s)", + strerror (errno), object->demux_dev); + } else { + GST_INFO_OBJECT (object, "Setting pes-filter, pid = %d, type = %d", + pes_filter.pid, pes_filter.pes_type); + + if (ioctl (*fd, DMX_SET_PES_FILTER, &pes_filter) < 0) + GST_WARNING_OBJECT (object, "Error setting PES filter on %s: %s", + object->demux_dev, strerror (errno)); + } + } + + } diff --git a/sys/dvb/gstdvbsrc.h b/sys/dvb/gstdvbsrc.h index 3edb903a..4c1ecccd 100644 --- a/sys/dvb/gstdvbsrc.h +++ b/sys/dvb/gstdvbsrc.h @@ -22,7 +22,6 @@ extern "C" #define IPACKS 2048 #define TS_SIZE 188 #define IN_SIZE TS_SIZE*10 -#define MAX_ATTEMPTS 10 /* limit timeouts for poll */ #define DEFAULT_DEVICE "/dev/dvb/adapter0" #define DEFAULT_SYMBOL_RATE 0 |