#define MATCH_PER_TYPE_OPT(name, type,outvar, fmtctx, mediatype)\
{\
int i;\
for (i = 0; i < o->nb_ ## name; i++) {\
char *spec = o->name[i].specifier;\
if (!strcmp(spec, mediatype))\
outvar = o->name[i].u.type;\
}\
}
MATCH_PER_TYPE_OPT(codec_names, str, video_codec_name, ic, "v"); =>
{
int i;
for(i = 0; i < o->nb_codec_names; i++) {
char* spec =o->codec_names[i].specifier;
if(!strcmp(spec, “v”)) video_codec_name= o->codec_names[i].u.str;
}
}
MATCH_PER_TYPE_OPT(codec_names, str, audio_codec_name, ic, "a"); =>
{
int i;
for(i = 0; i < o->nb_codec_names; i++) {
char* spec =o->codec_names[i].specifier;
if(!strcmp(spec, “a”)) audio_codec_name= o->codec_names[i].u.str;
}
}
MATCH_PER_TYPE_OPT(codec_names, str,subtitle_codec_name, ic, "s"); =>
{
int i;
for(i = 0; i < o->nb_codec_names; i++) {
char* spec =o->codec_names[i].specifier;
if(!strcmp(spec, “v”)) subtitle_codec_name= o->codec_names[i].u.str;
}
}