1
+ // This is an internal definition, not exposed in the public header.
2
+ struct media_lib_session {
3
+ // Must be the first field for polymorphism.
4
+ media_lib_session_vtable_t * vtable ;
5
+
6
+ // Pointer to the parent library instance.
7
+ media_lib_instance_t * instance ;
8
+
9
+ // Session configuration (common)
10
+ media_lib_type_t media_type ; // MEDIA_LIB_TYPE_VIDEO or MEDIA_LIB_TYPE_AUDIO
11
+ media_lib_session_type_t session_role ; // Receiver or transmitter
12
+ media_lib_buffer_ownership_t ownership ; // Buffer ownership mode
13
+
14
+ // Common session parameters (from base config)
15
+ size_t buffer_size ;
16
+ uint32_t num_buffers ;
17
+ char address [256 ]; // Alternatively, store a pointer if dynamically allocated.
18
+ uint16_t port ;
19
+ uint32_t timeout_ms ;
20
+
21
+ /* Media type-specific data */
22
+ union {
23
+ struct {
24
+ /* Video-specific fields: width, height, format, etc. */
25
+ } video ;
26
+ struct {
27
+ /* Audio-specific fields: sample rate, channels, format, etc. */
28
+ } audio ;
29
+ } media ;
30
+
31
+ // Callback functions and user data.
32
+ media_lib_transmit_callback_t tx_callback ;
33
+ void * tx_callback_user_data ;
34
+ media_lib_receive_callback_t rx_callback ;
35
+ void * rx_callback_user_data ;
36
+
37
+ // Internal state for managing the session.
38
+ // For example: buffer pool pointer, current state flags, connection handles, etc.
39
+ void * internal_data ;
40
+
41
+ // Statistics for monitoring performance.
42
+ media_lib_session_stats_t stats ;
43
+ };
0 commit comments