mirror of
https://github.com/DigitalDevices/dddvb.git
synced 2025-03-01 10:35:23 +00:00
adapt to newer kernel version
This commit is contained in:
parent
0c328cd989
commit
3cc98a4995
@ -167,17 +167,14 @@ int dvb_vb2_init(struct dvb_vb2_ctx *ctx, const char *name, int nonblocking)
|
|||||||
|
|
||||||
memset(ctx, 0, sizeof(struct dvb_vb2_ctx));
|
memset(ctx, 0, sizeof(struct dvb_vb2_ctx));
|
||||||
q->type = DVB_BUF_TYPE_CAPTURE;
|
q->type = DVB_BUF_TYPE_CAPTURE;
|
||||||
/**capture type*/
|
|
||||||
q->is_output = 0;
|
|
||||||
/**only mmap is supported currently*/
|
/**only mmap is supported currently*/
|
||||||
q->io_modes = VB2_MMAP;
|
q->io_modes = VB2_MMAP;
|
||||||
q->drv_priv = ctx;
|
q->drv_priv = ctx;
|
||||||
q->buf_struct_size = sizeof(struct dvb_buffer);
|
q->buf_struct_size = sizeof(struct dvb_buffer);
|
||||||
q->min_buffers_needed = 1;
|
q->min_queued_buffers = 1;
|
||||||
q->ops = &dvb_vb2_qops;
|
q->ops = &dvb_vb2_qops;
|
||||||
q->mem_ops = &vb2_vmalloc_memops;
|
q->mem_ops = &vb2_vmalloc_memops;
|
||||||
q->buf_ops = &dvb_vb2_buf_ops;
|
q->buf_ops = &dvb_vb2_buf_ops;
|
||||||
q->num_buffers = 0;
|
|
||||||
ret = vb2_core_queue_init(q);
|
ret = vb2_core_queue_init(q);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
ctx->state = DVB_VB2_STATE_NONE;
|
ctx->state = DVB_VB2_STATE_NONE;
|
||||||
@ -355,12 +352,13 @@ int dvb_vb2_reqbufs(struct dvb_vb2_ctx *ctx, struct dmx_requestbuffers *req)
|
|||||||
int dvb_vb2_querybuf(struct dvb_vb2_ctx *ctx, struct dmx_buffer *b)
|
int dvb_vb2_querybuf(struct dvb_vb2_ctx *ctx, struct dmx_buffer *b)
|
||||||
{
|
{
|
||||||
struct vb2_queue *q = &ctx->vb_q;
|
struct vb2_queue *q = &ctx->vb_q;
|
||||||
|
struct vb2_buffer *vb2 = vb2_get_buffer(q, b->index);
|
||||||
|
|
||||||
if (b->index >= q->num_buffers) {
|
if (!vb2) {
|
||||||
dprintk(1, "[%s] buffer index out of range\n", ctx->name);
|
dprintk(1, "[%s] invalid buffer index\n", ctx->name);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
vb2_core_querybuf(&ctx->vb_q, b->index, b);
|
vb2_core_querybuf(&ctx->vb_q, vb2, b);
|
||||||
dprintk(3, "[%s] index=%d\n", ctx->name, b->index);
|
dprintk(3, "[%s] index=%d\n", ctx->name, b->index);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -370,7 +368,7 @@ int dvb_vb2_expbuf(struct dvb_vb2_ctx *ctx, struct dmx_exportbuffer *exp)
|
|||||||
struct vb2_queue *q = &ctx->vb_q;
|
struct vb2_queue *q = &ctx->vb_q;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = vb2_core_expbuf(&ctx->vb_q, &exp->fd, q->type, exp->index,
|
ret = vb2_core_expbuf(&ctx->vb_q, &exp->fd, q->type, q->bufs[exp->index],
|
||||||
0, exp->flags);
|
0, exp->flags);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dprintk(1, "[%s] index=%d errno=%d\n", ctx->name,
|
dprintk(1, "[%s] index=%d errno=%d\n", ctx->name,
|
||||||
@ -385,13 +383,14 @@ int dvb_vb2_expbuf(struct dvb_vb2_ctx *ctx, struct dmx_exportbuffer *exp)
|
|||||||
int dvb_vb2_qbuf(struct dvb_vb2_ctx *ctx, struct dmx_buffer *b)
|
int dvb_vb2_qbuf(struct dvb_vb2_ctx *ctx, struct dmx_buffer *b)
|
||||||
{
|
{
|
||||||
struct vb2_queue *q = &ctx->vb_q;
|
struct vb2_queue *q = &ctx->vb_q;
|
||||||
|
struct vb2_buffer *vb2 = vb2_get_buffer(q, b->index);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (b->index >= q->num_buffers) {
|
if (!vb2) {
|
||||||
dprintk(1, "[%s] buffer index out of range\n", ctx->name);
|
dprintk(1, "[%s] invalid buffer index\n", ctx->name);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
ret = vb2_core_qbuf(&ctx->vb_q, b->index, b, NULL);
|
ret = vb2_core_qbuf(&ctx->vb_q, vb2, b, NULL);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dprintk(1, "[%s] index=%d errno=%d\n", ctx->name,
|
dprintk(1, "[%s] index=%d errno=%d\n", ctx->name,
|
||||||
b->index, ret);
|
b->index, ret);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user