summaryrefslogtreecommitdiff
path: root/include/capture.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/capture.h')
-rw-r--r--include/capture.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/include/capture.h b/include/capture.h
new file mode 100644
index 0000000..928ed0c
--- /dev/null
+++ b/include/capture.h
@@ -0,0 +1,36 @@
+/*
+ * capture.h - capture API
+ */
+#ifndef PVR2_CAPTURE_H
+#define PVR2_CAPTURE_H
+
+#include "pvrusb2.h"
+
+typedef struct pvr2_capture pvr2_capture_t;
+
+/* USB stream health. short/zero completions and stalls indicate the
+ * encoder is not keeping up, which makes the player lag behind live. */
+typedef struct {
+ long packets; /* completed non-empty bulk transfers */
+ long short_xfer; /* completed, but fewer bytes than requested */
+ long zero_xfer; /* completed with 0 bytes */
+ long stall; /* LIBUSB_TRANSFER_STALL */
+ long overflow; /* LIBUSB_TRANSFER_OVERFLOW */
+ long errors; /* hard errors */
+} pvr2_capture_stats_t;
+
+pvr2_capture_t *pvr2_capture_new(pvr2_dev *p, pvr2_data_cb cb, void *user);
+int pvr2_capture_run(pvr2_capture_t *c);
+void pvr2_capture_stop(pvr2_capture_t *c);
+void pvr2_capture_free(pvr2_capture_t *c);
+void pvr2_capture_stats(pvr2_capture_t *c, pvr2_capture_stats_t *st);
+/* Tell the capture context which (type, subtype) the encoder was started
+ * with, so it can send CX2341X_ENC_STOP_CAPTURE (0x82) BEFORE switching
+ * USB streaming off -- the vendor order is STOP_CAPTURE then 0x37. Not
+ * calling it leaves the encoder holding the previous mode/buffer, which is
+ * what made a later mode switch (MPEG -> raw) come up stuck on the old
+ * buffer. */
+void pvr2_capture_set_enc_stop(pvr2_capture_t *c, uint32_t captype,
+ uint32_t subtype);
+
+#endif