Merge branch 'devel' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux...
[sfrench/cifs-2.6.git] / drivers / media / video / cx18 / cx18-dvb.c
index afc694e7bdb297f672944c3ba66b828aae6b16ad..4542e2e5e3d76323668ee9b1f3b5132dfeaf090c 100644 (file)
@@ -23,6 +23,8 @@
 #include "cx18-dvb.h"
 #include "cx18-io.h"
 #include "cx18-streams.h"
+#include "cx18-queue.h"
+#include "cx18-scb.h"
 #include "cx18-cards.h"
 #include "s5h1409.h"
 #include "mxl5005s.h"
@@ -300,3 +302,24 @@ static int dvb_register(struct cx18_stream *stream)
 
        return ret;
 }
+
+void cx18_dvb_work_handler(struct cx18 *cx)
+{
+       struct cx18_buffer *buf;
+       struct cx18_stream *s = &cx->streams[CX18_ENC_STREAM_TYPE_TS];
+
+       while ((buf = cx18_dequeue(s, &s->q_full)) != NULL) {
+               if (s->dvb.enabled)
+                       dvb_dmx_swfilter(&s->dvb.demux, buf->buf,
+                                        buf->bytesused);
+
+               cx18_enqueue(s, buf, &s->q_free);
+               cx18_buf_sync_for_device(s, buf);
+               if (s->handle == CX18_INVALID_TASK_HANDLE) /* FIXME: improve */
+                       continue;
+
+               cx18_vapi(cx, CX18_CPU_DE_SET_MDL, 5, s->handle,
+                      (void __iomem *)&cx->scb->cpu_mdl[buf->id] - cx->enc_mem,
+                      1, buf->id, s->buf_size);
+       }
+}