/** * @brief Read a PNG file. * * @param fname filename (with path, but may lack extension) * @param img pointer suitable to store the image data * * @return 0 (ok), -1 (color depth too low), -2 (not accessible), * -5 (#pngRead() error) or -8 (#convert_ARGB() error) */ int bpRead(const char *fname, guiImage *img) { int r; fname = fExist(fname); if (!fname) return -2; r = pngRead(fname, img); if (r != 0) { mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[bitmap] read error #%d: %s\n", r, fname); return -5; } if (img->Bpp < 24) { mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[bitmap] bpp too low: %u\n", img->Bpp); return -1; } if (!convert_ARGB(img)) return -8; return 0; }
int bpRead( char * fname, txSample * bf ) { fname=fExist( fname ); if ( fname == NULL ) return -2; if ( pngRead( fname,bf ) ) { mp_dbg( MSGT_GPLAYER,MSGL_FATAL,"[bitmap] unknown file type ( %s )\n",fname ); return -5; } if ( bf->BPP < 24 ) { mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[bitmap] Sorry, only 24 and 32 bpp bitmaps are supported.\n" ); return -1; } if ( conv24to32( bf ) ) return -8; #ifdef WORDS_BIGENDIAN swab(bf->Image, bf->Image, bf->ImageSize); #endif bgr2rgb( bf ); Normalize( bf ); return 0; }
static void addwidget(skin_t *skin, window *win, const char *desc) { widget *mywidget; char *temp = calloc(1, strlen(desc) + 1); (skin->widgetcount)++; (skin->lastusedid)++; skin->widgets = realloc(skin->widgets, sizeof(widget *) * skin->widgetcount); mywidget = skin->widgets[(skin->widgetcount) - 1] = calloc(1, sizeof(widget)); mywidget->id = skin->lastusedid; mywidget->window = win->type; /* parse and fill widget specific info */ if(!strncmp(desc, "base", 4)) { int base = counttonextchar(desc, '=') + 1; mywidget->type = tyBase; mywidget->bitmap[0] = pngRead(skin, findnextstring(temp, desc, &base)); mywidget->wx = mywidget->x = atoi(findnextstring(temp, desc, &base)); mywidget->wy = mywidget->y = atoi(findnextstring(temp, desc, &base)); mywidget->wwidth = mywidget->width = atoi(findnextstring(temp, desc, &base)); mywidget->wheight = mywidget->height = atoi(findnextstring(temp, desc, &base)); win->base = mywidget; #ifdef DEBUG mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[SKIN] [ITEM] [BASE] %s %i %i %i %i\n", (mywidget->bitmap[0]) ? mywidget->bitmap[0]->name : NULL, mywidget->x, mywidget->y, mywidget->width, mywidget->height); #endif } else if(!strncmp(desc, "button", 6)) { int base = counttonextchar(desc, '=') + 1; int i; mywidget->type = tyButton; mywidget->bitmap[0] = pngRead(skin, findnextstring(temp, desc, &base)); mywidget->wx = mywidget->x = atoi(findnextstring(temp, desc, &base)); mywidget->wy = mywidget->y = atoi(findnextstring(temp, desc, &base)); mywidget->wwidth = mywidget->width = atoi(findnextstring(temp, desc, &base)); mywidget->wheight = mywidget->height = atoi(findnextstring(temp, desc, &base)); findnextstring(temp, desc, &base); /* Assign corresponding event to the widget */ mywidget->msg = evNone; for (i=0; i<evBoxs; i++) { if(!strcmp(temp, evNames[i].name)) { mywidget->msg = evNames[i].msg; break; } } #ifdef DEBUG mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[SKIN] [ITEM] [BUTTON] %s %i %i %i %i msg %i\n", (mywidget->bitmap[0]) ? mywidget->bitmap[0]->name : NULL, mywidget->x, mywidget->y, mywidget->width, mywidget->height, mywidget->msg); #endif } else if(!strncmp(desc, "hpotmeter", 9) || !strncmp(desc, "vpotmeter", 9)) { int base = counttonextchar(desc, '=') + 1; int i; /* hpotmeter = button, bwidth, bheight, phases, numphases, default, X, Y, width, height, message */ if(!strncmp(desc, "hpotmeter", 9)) mywidget->type = tyHpotmeter; else mywidget->type = tyVpotmeter; mywidget->bitmap[0] = pngRead(skin, findnextstring(temp, desc, &base)); mywidget->width = atoi(findnextstring(temp, desc, &base)); mywidget->height = atoi(findnextstring(temp, desc, &base)); mywidget->bitmap[1] = pngRead(skin, findnextstring(temp, desc, &base)); mywidget->phases = atoi(findnextstring(temp, desc, &base)); mywidget->value = atof(findnextstring(temp, desc, &base)); mywidget->x = mywidget->wx = atoi(findnextstring(temp, desc, &base)); mywidget->y = mywidget->wy = atoi(findnextstring(temp, desc, &base)); mywidget->wwidth = atoi(findnextstring(temp, desc, &base)); mywidget->wheight = atoi(findnextstring(temp, desc, &base)); findnextstring(temp, desc, &base); mywidget->msg = evNone; for (i=0; i<evBoxs; i++) { if(!strcmp(temp, evNames[i].name)) { mywidget->msg = evNames[i].msg; break; } } #ifdef DEBUG mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[SKIN] [ITEM] %s %s %i %i %s %i %f %i %i %i %i msg %i\n", (mywidget->type == tyHpotmeter) ? "[HPOTMETER]" : "[VPOTMETER]", (mywidget->bitmap[0]) ? mywidget->bitmap[0]->name : NULL, mywidget->width, mywidget->height, (mywidget->bitmap[1]) ? mywidget->bitmap[1]->name : NULL, mywidget->phases, mywidget->value, mywidget->wx, mywidget->wy, mywidget->wwidth, mywidget->wwidth, mywidget->msg); #endif } else if(!strncmp(desc, "potmeter", 8)) { int base = counttonextchar(desc, '=') + 1; int i; /* potmeter = phases, numphases, default, X, Y, width, height, message */ mywidget->type = tyPotmeter; mywidget->bitmap[0] = pngRead(skin, findnextstring(temp, desc, &base)); mywidget->phases = atoi(findnextstring(temp, desc, &base)); mywidget->value = atof(findnextstring(temp, desc, &base)); mywidget->wx = mywidget->x = atoi(findnextstring(temp, desc, &base)); mywidget->wy = mywidget->y = atoi(findnextstring(temp, desc, &base)); mywidget->wwidth = mywidget->width = atoi(findnextstring(temp, desc, &base)); mywidget->wheight = mywidget->height = atoi(findnextstring(temp, desc, &base)); findnextstring(temp, desc, &base); mywidget->msg = evNone; for (i=0; i<evBoxs; i++) { if(!strcmp(temp, evNames[i].name)) { mywidget->msg=evNames[i].msg; break; } } #ifdef DEBUG mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[SKIN] [ITEM] [POTMETER] %s %i %i %i %f %i %i msg %i\n", (mywidget->bitmap[0]) ? mywidget->bitmap[0]->name : NULL, mywidget->width, mywidget->height, mywidget->phases, mywidget->value, mywidget->x, mywidget->y, mywidget->msg); #endif } else if(!strncmp(desc, "menu", 4)) { int base = counttonextchar(desc, '=') + 1; int i; mywidget->type = tyMenu; mywidget->wx=atoi(findnextstring(temp, desc, &base)); mywidget->x=0; mywidget->wy=mywidget->y=atoi(findnextstring(temp, desc, &base)); mywidget->wwidth=mywidget->width=atoi(findnextstring(temp, desc, &base)); mywidget->wheight=mywidget->height=atoi(findnextstring(temp, desc, &base)); findnextstring(temp, desc, &base); mywidget->msg = evNone; for (i=0; i<evBoxs; i++) { if(!strcmp(temp, evNames[i].name)) { mywidget->msg = evNames[i].msg; break; } } #ifdef DEBUG mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[SKIN] [ITEM] [MENU] %i %i %i %i msg %i\n", mywidget->x, mywidget->y, mywidget->width, mywidget->height, mywidget->msg); #endif } else if(!strncmp(desc, "selected", 8)) { win->base->bitmap[1] = pngRead(skin, (char *) desc + 9); #ifdef DEBUG mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[SKIN] [ITEM] [BASE] added image %s\n", win->base->bitmap[1]->name); #endif } else if(!strncmp(desc, "slabel",6)) { int base = counttonextchar(desc, '=') + 1; unsigned int i; mywidget->type = tySlabel; mywidget->wx = mywidget->x = atoi(findnextstring(temp, desc, &base)); mywidget->wy = mywidget->y = atoi(findnextstring(temp, desc, &base)); findnextstring(temp, desc, &base); mywidget->font = NULL; for (i=0; i<skin->fontcount; i++) { if(!strcmp(temp, skin->fonts[i]->name)) { mywidget->font = skin->fonts[i]; break; } } mywidget->label = strdup(findnextstring(temp, desc, &base)); #ifdef DEBUG mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[SKIN] [ITEM] [SLABEL] %i %i %s %s\n", mywidget->x, mywidget->y, mywidget->font->name, mywidget->label); #endif } else if(!strncmp(desc, "dlabel", 6)) { int base = counttonextchar(desc, '=') + 1; unsigned int i; mywidget->type = tyDlabel; mywidget->wx = mywidget->x = atoi(findnextstring(temp, desc, &base)); mywidget->wy = mywidget->y = atoi(findnextstring(temp, desc, &base)); mywidget->length = atoi(findnextstring(temp, desc, &base)); mywidget->align = atoi(findnextstring(temp, desc, &base)); findnextstring(temp, desc, &base); mywidget->font = NULL; for (i=0; i<skin->fontcount; i++) { if(!strcmp(temp, skin->fonts[i]->name)) { mywidget->font=skin->fonts[i]; break; } } mywidget->label=strdup(findnextstring(temp, desc, &base)); #ifdef DEBUG mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[SKIN] [ITEM] [DLABEL] %i %i %i %i %s \"%s\"\n", mywidget->x, mywidget->y, mywidget->length, mywidget->align, mywidget->font->name, mywidget->label); #endif } free(temp); }
static void loadfonts(skin_t* skin) { unsigned int x; for (x=0; x<skin->fontcount; x++) { FILE *fp; int linenumber=0; char *filename; char *tmp = calloc(1, MAX_LINESIZE); char *desc = calloc(1, MAX_LINESIZE); filename = calloc(1, strlen(skin->skindir) + strlen(skin->fonts[x]->name) + 6); sprintf(filename, "%s\\%s.fnt", skin->skindir, skin->fonts[x]->name); if(!(fp = fopen(filename,"rb"))) { mp_msg(MSGT_GPLAYER, MSGL_ERR, "[FONT LOAD] Font not found \"%s\"\n", skin->fonts[x]->name); free(tmp); free(desc); free(filename); return; } while(!feof(fp)) { int pos = 0; unsigned int i; fgets(tmp, MAX_LINESIZE, fp); linenumber++; memset(desc, 0, MAX_LINESIZE); for (i=0; i<strlen(tmp); i++) { /* remove spaces and linebreaks */ if((tmp[i] == ' ') || (tmp[i] == '\n') || (tmp[i] == '\r')) continue; /* remove comments */ if((tmp[i] == ';') && ((i < 1) || (tmp[i-1] != '\"'))) { #ifdef DEBUG mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[FONT LOAD] Comment: %s", tmp + i + 1); #endif break; } desc[pos] = tmp[i]; pos++; } if(!strlen(desc)) continue; /* now we have "readable" output -> parse it */ if(!strncmp(desc, "image", 5)) { skin->fonts[x]->image = pngRead(skin, desc + 6); #ifdef DEBUG mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[FONT] [IMAGE] \"%s\"\n", desc + 6); #endif } else { int base = 4; if(*desc != '"') break; if(*(desc + 1) == 0) break; (skin->fonts[x]->charcount)++; skin->fonts[x]->chars = realloc(skin->fonts[x]->chars, sizeof(char_t *) *skin->fonts[x]->charcount); skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]=calloc(1, sizeof(char_t)); skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]->c = ((*(desc + 1) == '"') && (*(desc + 2) != '"')) ? ' ': *(desc + 1); if((*(desc + 1) == '"') && (*(desc + 2) != '"')) base = 3; skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]->x = atoi(findnextstring(tmp, desc, &base)); skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]->y = atoi(findnextstring(tmp, desc, &base)); skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]->width = atoi(findnextstring(tmp, desc, &base)); skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]->height = atoi(findnextstring(tmp, desc, &base)); #ifdef DEBUG mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[FONT] [CHAR] %c %i %i %i %i\n", skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]->c, skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]->x, skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]->y, skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]->width, skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]->height); #endif } } free(desc); free(filename); free(tmp); fclose(fp); } }
static void addwidget(skin_t *skin, window *win, const char *desc) { widget *mywidget; char *temp = calloc(1, strlen(desc) + 1); (skin->widgetcount)++; (skin->lastusedid)++; skin->widgets = realloc(skin->widgets, sizeof(widget *) * skin->widgetcount); mywidget = skin->widgets[(skin->widgetcount) - 1] = calloc(1, sizeof(widget)); mywidget->id = skin->lastusedid; mywidget->window = win->type; /* parse and fill widget specific info */ if(!strncmp(desc, "base", 4)) { int base = counttonextchar(desc, '=') + 1; mywidget->type = tyBase; mywidget->bitmap[0] = pngRead(skin, findnextstring(temp, desc, &base)); mywidget->wx = mywidget->x = atoi(findnextstring(temp, desc, &base)); mywidget->wy = mywidget->y = atoi(findnextstring(temp, desc, &base)); mywidget->wwidth = mywidget->width = atoi(findnextstring(temp, desc, &base)); mywidget->wheight = mywidget->height = atoi(findnextstring(temp, desc, &base)); win->base = mywidget; mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[SKIN] [ITEM] [BASE] %s %i %i %i %i\n", (mywidget->bitmap[0]) ? mywidget->bitmap[0]->name : NULL, mywidget->x, mywidget->y, mywidget->width, mywidget->height); } else if(!strncmp(desc, "button", 6)) { int base = counttonextchar(desc, '=') + 1; int i; mywidget->type = tyButton; mywidget->bitmap[0] = pngRead(skin, findnextstring(temp, desc, &base)); mywidget->wx = mywidget->x = atoi(findnextstring(temp, desc, &base)); mywidget->wy = mywidget->y = atoi(findnextstring(temp, desc, &base)); mywidget->wwidth = mywidget->width = atoi(findnextstring(temp, desc, &base)); mywidget->wheight = mywidget->height = atoi(findnextstring(temp, desc, &base)); findnextstring(temp, desc, &base); /* Assign corresponding event to the widget */ mywidget->msg = evNone; for (i=0; i<evBoxs; i++) { if(!strcmp(temp, evNames[i].name)) { // legacy skin_legacy("evSetURL", temp); mywidget->msg = evNames[i].msg; break; } } mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[SKIN] [ITEM] [BUTTON] %s %i %i %i %i msg %i\n", (mywidget->bitmap[0]) ? mywidget->bitmap[0]->name : NULL, mywidget->x, mywidget->y, mywidget->width, mywidget->height, mywidget->msg); } else if(!strncmp(desc, "hpotmeter", 9) || !strncmp(desc, "vpotmeter", 9) || !strncmp(desc, "rpotmeter", 9) || /* legacy */ !strncmp(desc, "potmeter", 8)) { int base = counttonextchar(desc, '=') + 1; int i, av_uninit(x0), av_uninit(y0), av_uninit(x1), av_uninit(y1); /* hpotmeter = button, bwidth, bheight, phases, numphases, default, X, Y, width, height, message */ if(!strncmp(desc, "vpotmeter", 9)) mywidget->type = tyVpotmeter; else if(!strncmp(desc, "rpotmeter", 9)) mywidget->type = tyRpotmeter; else mywidget->type = tyHpotmeter; if (*desc == 'p') { mywidget->bitmap[0] = NULL; mywidget->width = 0; mywidget->height = 0; // legacy skin_legacy("potmeter", "hpotmeter"); } else { mywidget->bitmap[0] = pngRead(skin, findnextstring(temp, desc, &base)); mywidget->width = atoi(findnextstring(temp, desc, &base)); mywidget->height = atoi(findnextstring(temp, desc, &base)); } mywidget->bitmap[1] = pngRead(skin, findnextstring(temp, desc, &base)); mywidget->phases = atoi(findnextstring(temp, desc, &base)); if (*desc == 'r') { x0 = atoi(findnextstring(temp, desc, &base)); y0 = atoi(findnextstring(temp, desc, &base)); x1 = atoi(findnextstring(temp, desc, &base)); y1 = atoi(findnextstring(temp, desc, &base)); } mywidget->value = atof(findnextstring(temp, desc, &base)); mywidget->x = mywidget->wx = atoi(findnextstring(temp, desc, &base)); mywidget->y = mywidget->wy = atoi(findnextstring(temp, desc, &base)); mywidget->wwidth = atoi(findnextstring(temp, desc, &base)); mywidget->wheight = atoi(findnextstring(temp, desc, &base)); findnextstring(temp, desc, &base); mywidget->msg = evNone; for (i=0; i<evBoxs; i++) { if(!strcmp(temp, evNames[i].name)) { // legacy skin_legacy("evSetURL", temp); mywidget->msg = evNames[i].msg; break; } } if (*desc == 'r') { mywidget->zeropoint = appRadian(mywidget, x0, y0); mywidget->arclength = appRadian(mywidget, x1, y1) - mywidget->zeropoint; if (mywidget->arclength < 0.0) mywidget->arclength += 2 * M_PI; // else check if radians of (x0,y0) and (x1,y1) only differ below threshold else if (mywidget->arclength < 0.05) mywidget->arclength = 2 * M_PI; } mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[SKIN] [ITEM] %s %s %i %i %s %i ", (mywidget->type == tyHpotmeter) ? "[HPOTMETER]" : (mywidget->type == tyVpotmeter) ? "[VPOTMETER]" : "[RPOTMETER]", (mywidget->bitmap[0]) ? mywidget->bitmap[0]->name : NULL, mywidget->width, mywidget->height, (mywidget->bitmap[1]) ? mywidget->bitmap[1]->name : NULL, mywidget->phases); if (*desc == 'r') mp_msg(MSGT_GPLAYER, MSGL_DBG2, "%i,%i %i,%i ", x0, y0, x1, y1); mp_msg(MSGT_GPLAYER, MSGL_DBG2, "%f %i %i %i %i msg %i\n", mywidget->value, mywidget->wx, mywidget->wy, mywidget->wwidth, mywidget->wwidth, mywidget->msg); if (mywidget->bitmap[0] == NULL || mywidget->width == 0 || mywidget->height == 0) { mywidget->bitmap[0] = mywidget->bitmap[1]; mywidget->width = mywidget->wwidth; mywidget->height = mywidget->wheight; } if (*desc == 'r') { mywidget->maxwh = FFMAX(mywidget->width, mywidget->height); // clickedinsidewidget() checks with width/height, so set it mywidget->width = mywidget->wwidth; mywidget->height = mywidget->wheight; } } else if(!strncmp(desc, "pimage", 6)) { int base = counttonextchar(desc, '=') + 1; int i; /* pimage = phases, numphases, default, X, Y, width, height, message */ mywidget->type = tyPimage; mywidget->bitmap[0] = pngRead(skin, findnextstring(temp, desc, &base)); mywidget->phases = atoi(findnextstring(temp, desc, &base)); mywidget->value = atof(findnextstring(temp, desc, &base)); mywidget->wx = mywidget->x = atoi(findnextstring(temp, desc, &base)); mywidget->wy = mywidget->y = atoi(findnextstring(temp, desc, &base)); mywidget->wwidth = mywidget->width = atoi(findnextstring(temp, desc, &base)); mywidget->wheight = mywidget->height = atoi(findnextstring(temp, desc, &base)); findnextstring(temp, desc, &base); mywidget->msg = evNone; for (i=0; i<evBoxs; i++) { if(!strcmp(temp, evNames[i].name)) { // legacy skin_legacy("evSetURL", temp); mywidget->msg=evNames[i].msg; break; } } mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[SKIN] [ITEM] [PIMAGE] %s %i %i %i %f %i %i msg %i\n", (mywidget->bitmap[0]) ? mywidget->bitmap[0]->name : NULL, mywidget->width, mywidget->height, mywidget->phases, mywidget->value, mywidget->x, mywidget->y, mywidget->msg); } else if(!strncmp(desc, "menu", 4)) { int base = counttonextchar(desc, '=') + 1; int i; mywidget->type = tyMenu; mywidget->wx=atoi(findnextstring(temp, desc, &base)); mywidget->x=0; mywidget->wy=mywidget->y=atoi(findnextstring(temp, desc, &base)); mywidget->wwidth=mywidget->width=atoi(findnextstring(temp, desc, &base)); mywidget->wheight=mywidget->height=atoi(findnextstring(temp, desc, &base)); findnextstring(temp, desc, &base); mywidget->msg = evNone; for (i=0; i<evBoxs; i++) { if(!strcmp(temp, evNames[i].name)) { // legacy skin_legacy("evSetURL", temp); mywidget->msg = evNames[i].msg; break; } } mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[SKIN] [ITEM] [MENU] %i %i %i %i msg %i\n", mywidget->x, mywidget->y, mywidget->width, mywidget->height, mywidget->msg); } else if(!strncmp(desc, "selected", 8)) { win->base->bitmap[1] = pngRead(skin, desc + 9); mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[SKIN] [ITEM] [BASE] added image %s\n", win->base->bitmap[1]->name); } else if(!strncmp(desc, "slabel",6)) { int base = counttonextchar(desc, '=') + 1; unsigned int i; mywidget->type = tySlabel; mywidget->wx = mywidget->x = atoi(findnextstring(temp, desc, &base)); mywidget->wy = mywidget->y = atoi(findnextstring(temp, desc, &base)); findnextstring(temp, desc, &base); mywidget->font = NULL; for (i=0; i<skin->fontcount; i++) { if(!strcmp(temp, skin->fonts[i]->name)) { mywidget->font = skin->fonts[i]; break; } } mywidget->label = strdup(findnextstring(temp, desc, &base)); mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[SKIN] [ITEM] [SLABEL] %i %i %s %s\n", mywidget->x, mywidget->y, mywidget->font->name, mywidget->label); } else if(!strncmp(desc, "dlabel", 6)) { int base = counttonextchar(desc, '=') + 1; unsigned int i; mywidget->type = tyDlabel; mywidget->wx = mywidget->x = atoi(findnextstring(temp, desc, &base)); mywidget->wy = mywidget->y = atoi(findnextstring(temp, desc, &base)); mywidget->length = atoi(findnextstring(temp, desc, &base)); mywidget->align = atoi(findnextstring(temp, desc, &base)); findnextstring(temp, desc, &base); mywidget->font = NULL; for (i=0; i<skin->fontcount; i++) { if(!strcmp(temp, skin->fonts[i]->name)) { mywidget->font=skin->fonts[i]; break; } } mywidget->label=strdup(findnextstring(temp, desc, &base)); // legacy skin_legacy("$l", mywidget->label); mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[SKIN] [ITEM] [DLABEL] %i %i %i %i %s \"%s\"\n", mywidget->x, mywidget->y, mywidget->length, mywidget->align, mywidget->font->name, mywidget->label); } free(temp); }