forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[media] media: v4l-core add enable/disable source common interfaces
Add a new interfaces to be used by v4l-core to invoke enable source and disable_source handlers in the media_device. The enable_source helper function invokes the enable_source handler to find media source entity connected to the entity and check is it is available or busy. If source is available, link is activated and pipeline is started. The disable_source helper function invokes the disable_source handler to deactivate and stop the pipeline. Signed-off-by: Shuah Khan <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
- Loading branch information
Showing
3 changed files
with
100 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
* Media Controller ancillary functions | ||
* | ||
* Copyright (c) 2016 Mauro Carvalho Chehab <[email protected]> | ||
* Copyright (C) 2016 Shuah Khan <[email protected]> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
|
@@ -16,7 +17,10 @@ | |
|
||
#include <linux/module.h> | ||
#include <media/media-entity.h> | ||
#include <media/media-device.h> | ||
#include <media/v4l2-fh.h> | ||
#include <media/v4l2-mc.h> | ||
#include <media/videobuf2-core.h> | ||
|
||
int v4l2_mc_create_media_graph(struct media_device *mdev) | ||
|
||
|
@@ -182,3 +186,34 @@ int v4l2_mc_create_media_graph(struct media_device *mdev) | |
return 0; | ||
} | ||
EXPORT_SYMBOL_GPL(v4l2_mc_create_media_graph); | ||
|
||
int v4l_enable_media_source(struct video_device *vdev) | ||
{ | ||
struct media_device *mdev = vdev->entity.graph_obj.mdev; | ||
int ret; | ||
|
||
if (!mdev || !mdev->enable_source) | ||
return 0; | ||
ret = mdev->enable_source(&vdev->entity, &vdev->pipe); | ||
if (ret) | ||
return -EBUSY; | ||
return 0; | ||
} | ||
EXPORT_SYMBOL_GPL(v4l_enable_media_source); | ||
|
||
void v4l_disable_media_source(struct video_device *vdev) | ||
{ | ||
struct media_device *mdev = vdev->entity.graph_obj.mdev; | ||
|
||
if (mdev && mdev->disable_source) | ||
mdev->disable_source(&vdev->entity); | ||
} | ||
EXPORT_SYMBOL_GPL(v4l_disable_media_source); | ||
|
||
int v4l_vb2q_enable_media_source(struct vb2_queue *q) | ||
{ | ||
struct v4l2_fh *fh = q->owner; | ||
|
||
return v4l_enable_media_source(fh->vdev); | ||
} | ||
EXPORT_SYMBOL_GPL(v4l_vb2q_enable_media_source); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters