1 /**************************************************************************/
2 /* */
3 /* Copyright (c) Microsoft Corporation. All rights reserved. */
4 /* */
5 /* This software is licensed under the Microsoft Software License */
6 /* Terms for Microsoft Azure RTOS. Full text of the license can be */
7 /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
8 /* and in the root directory of this software. */
9 /* */
10 /**************************************************************************/
11
12 /**************************************************************************/
13 /**************************************************************************/
14 /** */
15 /** USBX Component */
16 /** */
17 /** Device Video Class */
18 /** */
19 /**************************************************************************/
20 /**************************************************************************/
21
22 #define UX_SOURCE_CODE
23
24
25 /* Include necessary system files. */
26
27 #include "ux_api.h"
28 #include "ux_device_class_video.h"
29 #include "ux_device_stack.h"
30
31
32 /**************************************************************************/
33 /* */
34 /* FUNCTION RELEASE */
35 /* */
36 /* _ux_device_class_video_stream_get PORTABLE C */
37 /* 6.1.11 */
38 /* AUTHOR */
39 /* */
40 /* Chaoqiong Xiao, Microsoft Corporation */
41 /* */
42 /* DESCRIPTION */
43 /* */
44 /* This function get the stream instance of Video class. */
45 /* */
46 /* INPUT */
47 /* */
48 /* video Address of video class */
49 /* instance */
50 /* stream_index Stream instance index 0 based */
51 /* stream Pointer to buffer to fill */
52 /* pointer to stream instance */
53 /* */
54 /* OUTPUT */
55 /* */
56 /* Completion Status */
57 /* */
58 /* CALLS */
59 /* */
60 /* _ux_utility_thread_delete Delete thread used */
61 /* _ux_utility_memory_free Free used local memory */
62 /* */
63 /* CALLED BY */
64 /* */
65 /* Video Class */
66 /* */
67 /* RELEASE HISTORY */
68 /* */
69 /* DATE NAME DESCRIPTION */
70 /* */
71 /* 04-25-2022 Chaoqiong Xiao Initial Version 6.1.11 */
72 /* */
73 /**************************************************************************/
_ux_device_class_video_stream_get(UX_DEVICE_CLASS_VIDEO * video,ULONG stream_index,UX_DEVICE_CLASS_VIDEO_STREAM ** stream)74 UINT _ux_device_class_video_stream_get(UX_DEVICE_CLASS_VIDEO *video,
75 ULONG stream_index, UX_DEVICE_CLASS_VIDEO_STREAM **stream)
76 {
77
78
79 /* Sanity check. */
80 if (video == UX_NULL)
81 return(UX_ERROR);
82
83 /* Index validation. */
84 if (stream_index >= video -> ux_device_class_video_streams_nb)
85 return(UX_ERROR);
86
87 /* Store the stream instance found. */
88 if (stream)
89 *stream = video -> ux_device_class_video_streams + stream_index;
90
91 /* Return completion status. */
92 return(UX_SUCCESS);
93 }
94