diff options
author | Andy Walls <awalls@radix.net> | 2009-12-30 22:26:49 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-02-26 13:10:29 -0500 |
commit | 540bab93b769c757e92f1bd5e980a2ef647d4e86 (patch) | |
tree | f615d7824cbc66d5b04312fa9c1515c8a642034c /drivers/media/video/cx18 | |
parent | efc0b127b2e0135053680cd0118856b051450009 (diff) |
V4L/DVB (13903): cx18: Encapsulate check for a stream being enabled into an inline function
Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx18')
-rw-r--r-- | drivers/media/video/cx18/cx18-streams.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/media/video/cx18/cx18-streams.c b/drivers/media/video/cx18/cx18-streams.c index 987a9308d938..9be603c00fb4 100644 --- a/drivers/media/video/cx18/cx18-streams.c +++ b/drivers/media/video/cx18/cx18-streams.c | |||
@@ -340,6 +340,11 @@ void cx18_streams_cleanup(struct cx18 *cx, int unregister) | |||
340 | } | 340 | } |
341 | } | 341 | } |
342 | 342 | ||
343 | static inline bool cx18_stream_enabled(struct cx18_stream *s) | ||
344 | { | ||
345 | return s->video_dev || s->dvb.enabled; | ||
346 | } | ||
347 | |||
343 | static void cx18_vbi_setup(struct cx18_stream *s) | 348 | static void cx18_vbi_setup(struct cx18_stream *s) |
344 | { | 349 | { |
345 | struct cx18 *cx = s->cx; | 350 | struct cx18 *cx = s->cx; |
@@ -547,7 +552,7 @@ int cx18_start_v4l2_encode_stream(struct cx18_stream *s) | |||
547 | int captype = 0; | 552 | int captype = 0; |
548 | struct cx18_api_func_private priv; | 553 | struct cx18_api_func_private priv; |
549 | 554 | ||
550 | if (s->video_dev == NULL && s->dvb.enabled == 0) | 555 | if (!cx18_stream_enabled(s)) |
551 | return -EINVAL; | 556 | return -EINVAL; |
552 | 557 | ||
553 | CX18_DEBUG_INFO("Start encoder stream %s\n", s->name); | 558 | CX18_DEBUG_INFO("Start encoder stream %s\n", s->name); |
@@ -705,7 +710,7 @@ void cx18_stop_all_captures(struct cx18 *cx) | |||
705 | for (i = CX18_MAX_STREAMS - 1; i >= 0; i--) { | 710 | for (i = CX18_MAX_STREAMS - 1; i >= 0; i--) { |
706 | struct cx18_stream *s = &cx->streams[i]; | 711 | struct cx18_stream *s = &cx->streams[i]; |
707 | 712 | ||
708 | if (s->video_dev == NULL && s->dvb.enabled == 0) | 713 | if (!cx18_stream_enabled(s)) |
709 | continue; | 714 | continue; |
710 | if (test_bit(CX18_F_S_STREAMING, &s->s_flags)) | 715 | if (test_bit(CX18_F_S_STREAMING, &s->s_flags)) |
711 | cx18_stop_v4l2_encode_stream(s, 0); | 716 | cx18_stop_v4l2_encode_stream(s, 0); |
@@ -717,7 +722,7 @@ int cx18_stop_v4l2_encode_stream(struct cx18_stream *s, int gop_end) | |||
717 | struct cx18 *cx = s->cx; | 722 | struct cx18 *cx = s->cx; |
718 | unsigned long then; | 723 | unsigned long then; |
719 | 724 | ||
720 | if (s->video_dev == NULL && s->dvb.enabled == 0) | 725 | if (!cx18_stream_enabled(s)) |
721 | return -EINVAL; | 726 | return -EINVAL; |
722 | 727 | ||
723 | /* This function assumes that you are allowed to stop the capture | 728 | /* This function assumes that you are allowed to stop the capture |
@@ -789,7 +794,7 @@ struct cx18_stream *cx18_handle_to_stream(struct cx18 *cx, u32 handle) | |||
789 | s = &cx->streams[i]; | 794 | s = &cx->streams[i]; |
790 | if (s->handle != handle) | 795 | if (s->handle != handle) |
791 | continue; | 796 | continue; |
792 | if (s->video_dev || s->dvb.enabled) | 797 | if (cx18_stream_enabled(s)) |
793 | return s; | 798 | return s; |
794 | } | 799 | } |
795 | return NULL; | 800 | return NULL; |