First, looked at the hard solution code, found that there are similar to the definition of this way:
typedef void (*exec_ref_pic_marking_adaptive_mmco_func) (
GstVaapiDecoderH264 *decoder,
GstVaapiPictureH264 *picture,
Gsth264refpicmarking *ref_pic_marking
);
static const Exec_ref_pic_marking_adaptive_mmco_func mmco_funcs[] = {
Null
Exec_ref_pic_marking_adaptive_mmco_1,
Exec_ref_pic_marking_adaptive_mmco_2,
Exec_ref_pic_marking_adaptive_mmco_3,
Exec_ref_pic_marking_adaptive_mmco_4,
Exec_ref_pic_marking_adaptive_mmco_5,
Exec_ref_pic_marking_adaptive_mmco_6,
};
The use of this method may not be a lot of use, then the following to see how this approach is used:
1 First, the problem relates to the TypeDef void (*FUNCPTR) (void) problem;
To illustrate:
Defines a function pointer type.
For example, the following three functions are available:
void Hello (void) {printf ("Hello!");}
void bye (void) {printf ("Good-bye!") "); }
void ok (void) {printf ("OK! "); }
typdef void (*funcptr) (void);
In this way, a general function is constructed.
You can do this when you use it:
void speak (int id)
{
Funcptr Words[3] = {&hello, &bye, &ok};
Funcptr fun = Words[id];
(*fun) ();
}
If so, speak (0) will show "Hello!" ”
Speak (1) It will show "good-bye!" ”
Speak (2) it will show "OK!" ", from here, you can better understand the beginning of a piece of code, first define a pointer to a function containing three parameters (*decoder,*picture,*ref_pic_marking), and a return type of void, preceded by a typedef, Description Exec_ref_pic_marking_adaptive_mmco_func is an alias of this type, so an array is defined using the alias, and the function of that type is called by the array, respectively.
Second, to give a simple example:
typedef int (*callback) (char *p);
Pointer variable name: CallBack
1.*callback:callback is a pointer
2. (*callback) (): Point to a function
3. (*callback) (char *p): This function has one parameter, type char*
4.int (*callback) (char *p): This function has a return value, type int
Remember, the following semicolon must not forget Oh ~ ~
Summary: Callback is a pointer to a function that has a char* type parameter and returns an int type of data
There is a typedef in front, so now callback is this type of alias.
about typedef void (*FUNCPTR) (void) issues