How to share variables between modules of VLC

Source: Internet
Author: User

When developing VLC, I want to use one module to access the data of another module. For example, I want to obtain some data from the network module and process the data from other modules, at this time, the two modules need to share some variables.
Check the source code of VLC and find that VLC has variables. h and variables. c used to process variables. It provides methods to create VLC variables, set VLC variables, change and destroy VLC variables.
When we want to generate a VLC variable, we use the var_create () function;
For example, if a variable is created in the UDP module,
Vlc_value_t valtemp;
Var_create (p_access, "var_test", vlc_var_string );
Valtemp. psz_string = "hello ";
Var_set (p_access, "var_test", valtemp );
In this way, a vlc_var_string variable named "var_test" is created and its value is set to "hello ".
After the creation, the exam asked: how do we access it in other modules?
For example, access this variable in marq. C as follows:
Vlc_value_t val_test;
Vlc_list_t * p_list;
Module_t * p_module;
Access_t * p_access;
Int I;
Val_test.psz_string = "";
P_list = vlc_list_find (p_filter-> p_vlc, vlc_object_access, find_anywhere );
For (I = 0; I <p_list-> I _count; I ++)
{
P_access = (access_t *) p_list-> p_values [I]. p_object;
// P_module = (module_t *) p_list-> p_values [I]. p_object;
If (var_get (p_access, "var_test", & val_test) = vlc_success)
{
Msg_dbg (p_filter, "=======:::: val_test =: % s", val_test.psz_string );
Break;
}
// P_intf = NULL;
}
Vlc_list_release (p_list );
In this way, we can get the value of "var_test" in the marq. c module.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.