Home > Software engineering >  Structure complex initialization of the array
Structure complex initialization of the array

Time:09-30

Typedef struct AVOption {
Const char * name;
Const char * help;
Int offset.
Enum AVOptionType type;


The union {
Int64_t i64;
Double DBL.
Const char * STR;
/* TODO those are unused now */
AVRational q;
} default_val;
Double min;///& lt; Minimum value for a valid option
Double Max;///& lt; Maximum value for a valid option

Int flags;
1///# define AV_OPT_FLAG_ENCODING_PARAM & lt; A generic parameter which can be set by the user for muxing or encoding
2///# define AV_OPT_FLAG_DECODING_PARAM & lt; A generic parameter which can be set by the user for demuxing or decoding
# if FF_API_OPT_TYPE_METADATA
4///# define AV_OPT_FLAG_METADATA & lt; Some data extracted or inserted into the file like the title, the comment,...
# endif
# define AV_OPT_FLAG_AUDIO_PARAM 8
# define AV_OPT_FLAG_VIDEO_PARAM 16
# define AV_OPT_FLAG_SUBTITLE_PARAM 32
# define AV_OPT_FLAG_EXPORT 64
# define AV_OPT_FLAG_READONLY 128
# define AV_OPT_FLAG_FILTERING_PARAM (1 & lt; <16)///& lt; A generic parameter which can be set by the user for filtering

Const char * unit;
} AVOption;


The static const AVOption options []={
{" preset ", "Set the encoding preset (cf. X264 - fullhelp)", OFFSET (preset), AV_OPT_TYPE_STRING, {STR="medium"}, 0, 0, VE},
{" most cerebral sci-film ", the "most cerebral sci-film encoding params (cf. X264 - fullhelp)", OFFSET (most cerebral sci-film), AV_OPT_TYPE_STRING, {0}, 0, 0, VE},
{" profile ", "Set profile restrictions (cf. X264 - fullhelp)", OFFSET (profile), AV_OPT_TYPE_STRING, {0}, 0, 0, VE},
{" fastfirstpass ", "the Use of fast Settings when encoding first pass", OFFSET (fastfirstpass), AV_OPT_TYPE_BOOL, {i64=1}, 0, 1, VE}}

Initialization. STR and. I64 error C2059: syntax error: "."

CodePudding user response:

Debugging FFmpeg appeared the problem, find good foundation is weak,

CodePudding user response:

Hold up, don't sink

CodePudding user response:

Fyi:
 # include & lt; stdio.h> 
# include & lt; stdlib.h>
Char buf [17].
The union U {
Unsigned short int aa;
Struct {
Unsigned int bb: 7;//(bit 0 to 6)
Unsigned int cc: 6;//(bit 7-12)
Unsigned int dd: 3;//(bit 13-15)
};
} u;
Void main () {
//BBBBBBBBBBBBBBBB
//iiiiiiiiiiiiiiii
//TTTTTTTTTTTTTTTT
//111111
//5432109876543210
//: : : : : : : : : : : : : : : :
U.a xe07f a=0;//1110000001111111
Printf (" bb==% d, cc==% d, dd==% d \ n ", u.b b, the u.c. c, u.d d);
U.b b=0 x41;
The u.c. c=0 x21;//DDDCCCCCCBBBBBBB
U.d d=5;//1011000011000001
Printf (" aa 4 x====0 x % % 016 s (2) \ n ", u.a a, itoa (u.a a, buf, 2));
}
//bb==127, cc==0, dd==7
//aa==0 xb0c1==1011000011000001 (2)

CodePudding user response:

Again for reference:
 # include & lt; stdio.h> 
# define field_offset (s, f) (int) (& amp; (((struct s *) (0)) - & gt; F))
Struct AD {int a; Char b [13]. Double c; };
# pragma pack (push)
The # pragma pack (1)
Struct A1 {int a; Char b [13]. Double c; };
# pragma pack (2)
Struct A2 {int a; Char b [13]. Double c; };
# pragma pack (4)
Struct A4 {int a; Char b [13]. Double c; };
# pragma pack (8)
Struct A8 {int a; Char b [13]. Double c; };
# pragma pack (16)
Struct A16 {int a; Char b [13]. Double c; };
# pragma pack (pop)
Int main () {
Printf (" AD. A % d \ n ", field_offset (AD, a));
Printf (" AD. B % d \ n ", field_offset (AD, b));
Printf (" AD. C % d \ n ", field_offset (AD, c));
Printf (" AD sizeof % d \ n ", sizeof (AD));
printf("\n");
Printf (" A1. A % d \ n ", field_offset (A1, a));
Printf (" A1. B % d \ n ", field_offset (A1, b));
Printf (" A1. C % d \ n ", field_offset (A1, c));
Printf (" A1 sizeof % d \ n ", sizeof (A1));
printf("\n");
Printf (" A2. A % d \ n ", field_offset (A2, a));
Printf (" A2. B % d \ n ", field_offset (A2, b));
Printf (" A2. C % d \ n ", field_offset (A2, c));
Printf (" A2 sizeof % d \ n ", sizeof (A2));
printf("\n");
Printf (" A4. A % d \ n ", field_offset (A4, a));
Printf (" A4. B % d \ n ", field_offset (A4, b));
Printf (" A4. C % d \ n ", field_offset (A4, c));
Printf (" A4 sizeof % d \ n ", sizeof (A4));
printf("\n");
Printf (" A8. A % d \ n ", field_offset (A8, a));
Printf (" A8. B % d \ n ", field_offset (A8, b));
Printf (" A8. C % d \ n ", field_offset (A8, c));
Printf (" A8 sizeof % d \ n ", sizeof (A8));
printf("\n");
Printf (" A16. A % d \ n ", field_offset A16, (a));
Printf (" A16. B % d \ n ", field_offset (A16, b));
Printf (" A16. C % d \ n ", field_offset (A16, c));
A16 sizeof printf (" % d \ n ", sizeof (A16));
printf("\n");
return 0;
}
//AD. A 0
//AD. B 4
//AD. 24 c
//AD sizeof 32
//
//A1. A 0
//A1. B 4
//A1. 17 c
//A1 sizeof 25
//
//A2. A 0
//A2. B 4
//A2. 18 c
//A2 sizeof 26
//
//A4. A 0
//A4. B 4
//A4. 20 c
//A4 sizeof 28
//
//A8. A 0
//A8. B 4
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related