~medibuntu-maintainers/mplayer/medibuntu.precise

« back to all changes in this revision

Viewing changes to gui/skin/skin.c

  • Committer: Gauvain Pocentek
  • Date: 2012-03-06 11:59:12 UTC
  • mfrom: (66.1.15 precise)
  • Revision ID: gauvain@pocentek.net-20120306115912-h9d6kt9j0l532oo5
* Merge from Ubuntu:
  - put back faac support
  - recommends apport-hooks-medibuntu
  - change Maintainer, Uploaders & Vcs-* fields.
* New upstream snapshot
* upload to unstable
* Build against external libmpeg2
* drop 51_FTBFS_arm.patch again
* no longer build depend on libcdparanoia-dev on the Hurd
* Fix FTBFS on the hurd.
  Thanks to Samuel Thibault <sthibault@debian.org> (Closes: #654974)
* Fix FTBFS on arm
* New upstream snapshot, Closes: #650339, #643621, #481807
* Imported Upstream version 1.0~rc4+svn34492
* Bump standards version
* Bump dependency on libav >= 4:0.8~, Closes: #653887
* Fix build-indep
* Build mplayer-gui again, Closes: #568514
* Drop debian/all-lang-config-mak.sh, no longer needed
* include .dfsg1 in version number
* remove get-orig-source target
* no longer prune compiler flags from the environment
* No longer advertise nor build 3fdx, mga and dxr3 backends,
  Closes: #496106, #442181, #533546
* beautify mplayer version identification string
* Brown paperbag upload.
* Next try to fix build failure on sparce after recent binutils change.
* Brown paperbag upload.
* Really fix build failure on sparc after recent binutils change.
* Properly set Replaces/Conflicts on mplayer2{,-dbg} to avoid
  file overwrite errors.
* Adjust versioning of mplayer listed in the mplayer-dbg's Depends field.
* Fix build failure on sparc after recent binutils change.
* Urgency medium bumped because of RC-level bugfix
  and speeding up x264 transition.
* Update to my @debian.org email.
* Upload to unstable
* Enable joystick support on Linux only, Closes: #638408
* Rebuild fixes toolchain issue on arm, Closes: #637077
* New upstream snapshot
* following the discussion started by Diego Biurrun <diego@biurrun.de>
  in debian-devel, I have prepared a new packaging of 'mplayer'
  (with code that comes from CVS)
* the upstream tar.bz cannot be distributed by Debian, since it contains
   CSS code; so I am repackaging it 
* I have tried my best to address all known issues:
  - the package contains the detailed Copyright made by Diego Biurrun 
  - the package does not contain CSS code, or  AFAIK other code on which 
     there is active patent enforcement
  - there is a script  debian/cvs-changelog.sh  that shows all changes
     done to files included in this source.
    This should comply with GPLv2 sec 2.a  (in spirit if not in letter)
    For this reason, the source code contains CVS directories.
* needs   make (>= 3.80) for 'html-chunked-$(1)' in DOCS/xml/Makefile

* some corrections, as suggested Diego Biurrun
  - binary codecs should go into /usr/lib/codecs (upstream default)
  - better template 'mplayer/install_codecs'
  - an empty 'font=' in mplayer.conf breaks mplayer: postinst corrected
* correction in 'mplayer/cfgnote'
* better mplayer.postinst and mplayer.config

* New upstream release
* better debian/copyright file
* do not ship a skin
* New upstream release
* changed DEB_BUILD_OPTIONS to DEB_BUILD_CONFIGURE ,
  DEB_BUILD_OPTIONS is used as in debian policy
* use gcc-3.4
* changed xlibs-dev to a long list of dependencies, for Debian/etch
* try to adhere to  http://www.mplayerhq.hu/DOCS/tech/binary-packaging.txt
  (see README.Debian for details)
* removed dependency on xlibmesa-dev, disabled opengl
* New upstream release
* Simon McVittie <hacks@pseudorandom.co.uk> wonderful work:
- Work around Debian bug #267442 (glibc's sys/uio.h and gcc's altivec.h have
  conflicting uses for __vector) by re-ordering #includes
- Fix potential symlink attack in ./configure
- Disable support for binary codecs on platforms for which those codecs
  aren't available; also disable the corresponding Debconf note when it's
  inappropriate
- Changed Build-Depends: so it works in pbuilder
- Explicitly build-depend on libjpeg62-dev, libfontconfig1-dev,
  libungif4-dev 
- Tweak debian/rules to avoid certain errors being ignored
- Use --language=all
* provide a target  'debian/rules get-orig-source' 
  that recreates the orig.tar.gz ; then use the above orig.tar.gz
* rewrote some parts of debian/rules
* don't clean and recompile docs if upstream ships them
* mplayer-doc was shipping too much stuff
* translated man pages where not installed properly
* compile with libdv4-dev
* correct README.Debian
* Forgot build-dep on libtheora
* Must not depend on libxvidcore
* New upstream release
* new release.
* rc1 to become 0.90
* new pre-release
* new pre-release
* gtk bug fixed.
* new release.
* version bumped
* 0.60 pre2 release
* 0.60 pre-release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
17
 */
18
18
 
 
19
/**
 
20
 * @file
 
21
 * @brief Skin parser
 
22
 */
 
23
 
19
24
#include <stdio.h>
20
25
#include <string.h>
21
26
 
38
43
    int (*func)(char *in);
39
44
} _item;
40
45
 
 
46
char *skinDirInHome;
 
47
char *skinMPlayerDir;
 
48
 
41
49
static guiItems *skin;
42
50
 
43
51
static int linenumber;
48
56
static int *currWinItemIdx;
49
57
static wItem *currWinItems;
50
58
 
 
59
/**
 
60
 * @brief Display a skin error message.
 
61
 *
 
62
 * @param format format string
 
63
 * @param ... arguments
 
64
 */
51
65
static void skin_error(const char *format, ...)
52
66
{
53
67
    char p[512];
60
74
    gmp_msg(MSGT_GPLAYER, MSGL_ERR, MSGTR_SKIN_ERRORMESSAGE, linenumber, p);
61
75
}
62
76
 
 
77
/**
 
78
 * @brief Check whether a @a section definition has started.
 
79
 *
 
80
 * @param item name of the item to be put in a message in case of an error
 
81
 *
 
82
 * @return 1 (ok) or 0 (error)
 
83
 */
63
84
static int section_item(char *item)
64
85
{
65
86
    if (!skin) {
70
91
    return 1;
71
92
}
72
93
 
 
94
/**
 
95
 * @brief Check whether a @a window definition has started.
 
96
 *
 
97
 * @param item name of the item to be put in a message in case of an error
 
98
 *
 
99
 * @return 1 (ok) or 0 (error)
 
100
 */
73
101
static int window_item(char *item)
74
102
{
75
103
    if (!currWinName[0]) {
80
108
    return 1;
81
109
}
82
110
 
 
111
/**
 
112
 * @brief Check whether a specific @a window definition has started.
 
113
 *
 
114
 * @param name name of the window to be checked
 
115
 *
 
116
 * @return 0 (ok) or 1 (error)
 
117
 */
83
118
static int in_window(char *name)
84
119
{
85
120
    if (strcmp(currWinName, name) == 0) {
90
125
    return 0;
91
126
}
92
127
 
93
 
int skinBPRead(char *fname, guiImage *bf)
 
128
/**
 
129
 * @brief Read a skin @a image file.
 
130
 *
 
131
 * @param fname filename (with path)
 
132
 * @param img pointer suitable to store the image data
 
133
 *
 
134
 * @return return code of #bpRead()
 
135
 */
 
136
int skinImageRead(char *fname, guiImage *img)
94
137
{
95
 
    int i = bpRead(fname, bf);
 
138
    int i = bpRead(fname, img);
96
139
 
97
140
    switch (i) {
98
141
    case -1:
115
158
    return i;
116
159
}
117
160
 
 
161
/**
 
162
 * @brief Get next free item in current @a window.
 
163
 *
 
164
 * @return pointer to next free item (ok) or NULL (error)
 
165
 */
118
166
static wItem *next_item(void)
119
167
{
120
168
    wItem *item = NULL;
128
176
    return item;
129
177
}
130
178
 
131
 
// section=movieplayer
 
179
/**
 
180
 * @brief Parse a @a section definition.
 
181
 *
 
182
 *        Syntax: section=movieplayer
 
183
 *
 
184
 * @param in definition to be analyzed
 
185
 *
 
186
 * @return 0 (ok) or 1 (error)
 
187
 */
132
188
static int item_section(char *in)
133
189
{
134
190
    if (skin) {
143
199
        return 1;
144
200
    }
145
201
 
146
 
    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]  section: %s\n", in);
 
202
    mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]  section: %s\n", in);
147
203
 
148
204
    return 0;
149
205
}
150
206
 
151
 
// end
 
207
/**
 
208
 * @brief Parse an @a end definition.
 
209
 *
 
210
 *        Syntax: end
 
211
 *
 
212
 * @param in definition to be analyzed
 
213
 *
 
214
 * @return 0 (ok) or 1 (error)
 
215
 */
152
216
static int item_end(char *in)
153
217
{
154
218
    char *space, *name;
155
219
 
156
 
#ifdef MP_DEBUG
 
220
    (void)in;
 
221
 
157
222
    if (currWinName[0]) {
158
223
        space = " ";
159
224
        name  = currWinName;
161
226
        space = "";
162
227
        name  = "section";
163
228
    }
164
 
#endif
165
 
 
166
 
    (void)in;
167
229
 
168
230
    if (!section_item("end"))
169
231
        return 1;
170
232
 
171
 
    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]  %send (%s)\n", space, name);
 
233
    mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]  %send (%s)\n", space, name);
172
234
 
173
235
    if (currWinName[0]) {
174
236
        currWinName[0] = 0;
181
243
    return 0;
182
244
}
183
245
 
184
 
// window=main|sub|playbar|menu
 
246
/**
 
247
 * @brief Parse a @a window definition.
 
248
 *
 
249
 *        Syntax: window=main|sub|playbar|menu
 
250
 *
 
251
 * @param in definition to be analyzed
 
252
 *
 
253
 * @return 0 (ok) or 1 (error)
 
254
 */
185
255
static int item_window(char *in)
186
256
{
187
257
    if (!section_item("window"))
217
287
 
218
288
    av_strlcpy(currWinName, in, sizeof(currWinName));
219
289
 
220
 
    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]   window: %s\n", currWinName);
 
290
    mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]   window: %s\n", currWinName);
221
291
 
222
292
    return 0;
223
293
}
224
294
 
225
 
// base=image,x,y[,width,height]
 
295
/**
 
296
 * @brief Parse a @a base definition.
 
297
 *
 
298
 *        Syntax: base=image,x,y[,width,height]
 
299
 *
 
300
 * @param in definition to be analyzed
 
301
 *
 
302
 * @return 0 (ok) or 1 (error)
 
303
 */
226
304
static int item_base(char *in)
227
305
{
228
306
    unsigned char fname[256];
244
322
    w = cutItemToInt(in, ',', 3);
245
323
    h = cutItemToInt(in, ',', 4);
246
324
 
247
 
    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]    image: %s", fname);
 
325
    mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]    image: %s", fname);
248
326
 
249
327
    currWin->type = itBase;
250
328
 
252
330
        currWin->x = x;
253
331
        currWin->y = y;
254
332
 
255
 
        mp_dbg(MSGT_GPLAYER, MSGL_DBG2, " %d,%d", x, y);
 
333
        mp_msg(MSGT_GPLAYER, MSGL_DBG2, " %d,%d", x, y);
256
334
    }
257
335
 
258
 
    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "\n");
 
336
    mp_msg(MSGT_GPLAYER, MSGL_DBG2, "\n");
259
337
 
260
338
    av_strlcpy(file, path, sizeof(file));
261
339
    av_strlcat(file, fname, sizeof(file));
262
340
 
263
 
    if (skinBPRead(file, &currWin->Bitmap) != 0)
 
341
    if (skinImageRead(file, &currWin->Bitmap) != 0)
264
342
        return 1;
265
343
 
266
344
    currWin->width  = currWin->Bitmap.Width;
273
351
        }
274
352
    }
275
353
 
276
 
    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     bitmap: %dx%d\n", currWin->width, currWin->height);
 
354
    mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     bitmap: %dx%d\n", currWin->width, currWin->height);
277
355
 
278
356
    if (!is_sub) {
279
357
#ifdef CONFIG_XSHAPE
281
359
            skin_error(MSGTR_SKIN_NotEnoughMemory);
282
360
            return 1;
283
361
        }
284
 
        mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     mask: %lux%lu\n", currWin->Mask.Width, currWin->Mask.Height);
 
362
        mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     mask: %lux%lu\n", currWin->Mask.Width, currWin->Mask.Height);
285
363
#else
286
364
        currWin->Mask.Image = NULL;
287
365
#endif
295
373
    return 0;
296
374
}
297
375
 
298
 
// background=R,G,B
 
376
/**
 
377
 * @brief Parse a @a background definition.
 
378
 *
 
379
 *        Syntax: background=R,G,B
 
380
 *
 
381
 * @param in definition to be analyzed
 
382
 *
 
383
 * @return 0 (ok) or 1 (error)
 
384
 */
299
385
static int item_background(char *in)
300
386
{
301
387
    if (!window_item("background"))
312
398
    currWin->G = cutItemToInt(in, ',', 1);
313
399
    currWin->B = cutItemToInt(in, ',', 2);
314
400
 
315
 
    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]    background color: #%02x%02x%02x\n", currWin->R, currWin->G, currWin->B);
 
401
    mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]    background color: #%02x%02x%02x\n", currWin->R, currWin->G, currWin->B);
316
402
 
317
403
    return 0;
318
404
}
319
405
 
320
 
// button=image,x,y,width,height,message
 
406
/**
 
407
 * @brief Parse a @a button definition.
 
408
 *
 
409
 *        Syntax: button=image,x,y,width,height,message
 
410
 *
 
411
 * @param in definition to be analyzed
 
412
 *
 
413
 * @return 0 (ok) or 1 (error)
 
414
 */
321
415
static int item_button(char *in)
322
416
{
323
417
    unsigned char fname[256];
348
442
        return 1;
349
443
    }
350
444
 
351
 
    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]    button image: %s %d,%d\n", fname, x, y);
352
 
    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     message: %s (#%d)\n", msg, message);
353
 
    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     size: %dx%d\n", w, h);
 
445
    mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]    button image: %s %d,%d\n", fname, x, y);
 
446
    mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     message: %s (#%d)\n", msg, message);
 
447
    mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     size: %dx%d\n", w, h);
354
448
 
355
449
    item = next_item();
356
450
 
374
468
        av_strlcpy(file, path, sizeof(file));
375
469
        av_strlcat(file, fname, sizeof(file));
376
470
 
377
 
        if (skinBPRead(file, &item->Bitmap) != 0)
 
471
        if (skinImageRead(file, &item->Bitmap) != 0)
378
472
            return 1;
379
473
 
380
 
        mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     (bitmap: %lux%lu)\n", item->Bitmap.Width, item->Bitmap.Height);
 
474
        mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     (bitmap: %lux%lu)\n", item->Bitmap.Width, item->Bitmap.Height);
381
475
    }
382
476
 
383
477
    return 0;
384
478
}
385
479
 
386
 
// selected=image
 
480
/**
 
481
 * @brief Parse a @a selected definition.
 
482
 *
 
483
 *        Syntax: selected=image
 
484
 *
 
485
 * @param in definition to be analyzed
 
486
 *
 
487
 * @return 0 (ok) or 1 (error)
 
488
 */
387
489
static int item_selected(char *in)
388
490
{
389
491
    unsigned char file[512];
399
501
    if (in_window("playbar"))
400
502
        return 1;
401
503
 
402
 
    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]    image selected: %s\n", in);
 
504
    mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]    image selected: %s\n", in);
403
505
 
404
506
    currItem       = &skin->menuSelected;
405
507
    currItem->type = itBase;
407
509
    av_strlcpy(file, path, sizeof(file));
408
510
    av_strlcat(file, in, sizeof(file));
409
511
 
410
 
    if (skinBPRead(file, &currItem->Bitmap) != 0)
 
512
    if (skinImageRead(file, &currItem->Bitmap) != 0)
411
513
        return 1;
412
514
 
413
515
    currItem->width  = currItem->Bitmap.Width;
414
516
    currItem->height = currItem->Bitmap.Height;
415
517
 
416
 
    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     bitmap: %dx%d\n", currItem->width, currItem->height);
 
518
    mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     bitmap: %dx%d\n", currItem->width, currItem->height);
417
519
 
418
520
    return 0;
419
521
}
420
522
 
421
 
// menu=x,y,width,height,message
 
523
/**
 
524
 * @brief Parse a @a menu definition.
 
525
 *
 
526
 *        Syntax: menu=x,y,width,height,message
 
527
 *
 
528
 * @param in definition to be analyzed
 
529
 *
 
530
 * @return 0 (ok) or 1 (error)
 
531
 */
422
532
static int item_menu(char *in)
423
533
{
424
534
    int x, y, w, h, message;
460
570
    item->height  = h;
461
571
    item->message = message;
462
572
 
463
 
    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]    item #%d: %d,%d %dx%d\n", *currWinItemIdx, x, y, w, h);
464
 
    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     message: %s (#%d)\n", msg, message);
 
573
    mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]    item #%d: %d,%d %dx%d\n", *currWinItemIdx, x, y, w, h);
 
574
    mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     message: %s (#%d)\n", msg, message);
465
575
 
466
576
    item->Bitmap.Image = NULL;
467
577
 
468
578
    return 0;
469
579
}
470
580
 
471
 
// hpotmeter=button,bwidth,bheight,phases,numphases,default,x,y,width,height,message
 
581
/**
 
582
 * @brief Parse a @a hpotmeter definition.
 
583
 *
 
584
 *        Syntax: hpotmeter=button,bwidth,bheight,phases,numphases,default,x,y,width,height,message
 
585
 *
 
586
 * @param in definition to be analyzed
 
587
 *
 
588
 * @return 0 (ok) or 1 (error)
 
589
 */
472
590
static int item_hpotmeter(char *in)
473
591
{
474
592
    unsigned char pfname[256];
504
622
        return 1;
505
623
    }
506
624
 
507
 
    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]    h/v potmeter image: %s %d,%d %dx%d\n", phfname, x, y, w, h);
508
 
    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     button image: %s %dx%d\n", pfname, pwidth, pheight);
509
 
    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     numphases: %d, default: %d%%\n", ph, d);
510
 
    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     message: %s (#%d)\n", buf, message);
 
625
    mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]    h/v potmeter image: %s %d,%d %dx%d\n", phfname, x, y, w, h);
 
626
    mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     button image: %s %dx%d\n", pfname, pwidth, pheight);
 
627
    mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     numphases: %d, default: %d%%\n", ph, d);
 
628
    mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     message: %s (#%d)\n", buf, message);
511
629
 
512
630
    item = next_item();
513
631
 
532
650
        av_strlcpy(buf, path, sizeof(buf));
533
651
        av_strlcat(buf, phfname, sizeof(buf));
534
652
 
535
 
        if (skinBPRead(buf, &item->Bitmap) != 0)
 
653
        if (skinImageRead(buf, &item->Bitmap) != 0)
536
654
            return 1;
537
655
 
538
 
        mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     (potmeter bitmap: %lux%lu)\n", item->Bitmap.Width, item->Bitmap.Height);
 
656
        mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     (potmeter bitmap: %lux%lu)\n", item->Bitmap.Width, item->Bitmap.Height);
539
657
    }
540
658
 
541
659
    item->Mask.Image = NULL;
544
662
        av_strlcpy(buf, path, sizeof(buf));
545
663
        av_strlcat(buf, pfname, sizeof(buf));
546
664
 
547
 
        if (skinBPRead(buf, &item->Mask) != 0)
 
665
        if (skinImageRead(buf, &item->Mask) != 0)
548
666
            return 1;
549
667
 
550
 
        mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     (button bitmap: %lux%lu)\n", item->Mask.Width, item->Mask.Height);
 
668
        mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     (button bitmap: %lux%lu)\n", item->Mask.Width, item->Mask.Height);
551
669
    }
552
670
 
553
671
    return 0;
554
672
}
555
673
 
556
 
// vpotmeter=button,bwidth,bheight,phases,numphases,default,x,y,width,height,message
 
674
/**
 
675
 * @brief Parse a @a vpotmeter definition.
 
676
 *
 
677
 *        Syntax: vpotmeter=button,bwidth,bheight,phases,numphases,default,x,y,width,height,message
 
678
 *
 
679
 * @param in definition to be analyzed
 
680
 *
 
681
 * @return 0 (ok) or 1 (error)
 
682
 */
557
683
static int item_vpotmeter(char *in)
558
684
{
559
685
    int r;
569
695
    return r;
570
696
}
571
697
 
572
 
// potmeter=phases,numphases,default,x,y,width,height,message
 
698
/**
 
699
 * @brief Parse a @a potmeter definition.
 
700
 *
 
701
 *        Syntax: potmeter=phases,numphases,default,x,y,width,height,message
 
702
 *
 
703
 * @param in definition to be analyzed
 
704
 *
 
705
 * @return 0 (ok) or 1 (error)
 
706
 */
573
707
static int item_potmeter(char *in)
574
708
{
575
709
    unsigned char phfname[256];
601
735
        return 1;
602
736
    }
603
737
 
604
 
    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]    potmeter image: %s %d,%d %dx%d\n", phfname, x, y, w, h);
605
 
    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     numphases: %d, default: %d%%\n", ph, d);
606
 
    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     message: %s (#%d)\n", buf, message);
 
738
    mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]    potmeter image: %s %d,%d %dx%d\n", phfname, x, y, w, h);
 
739
    mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     numphases: %d, default: %d%%\n", ph, d);
 
740
    mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     message: %s (#%d)\n", buf, message);
607
741
 
608
742
    item = next_item();
609
743
 
625
759
        av_strlcpy(buf, path, sizeof(buf));
626
760
        av_strlcat(buf, phfname, sizeof(buf));
627
761
 
628
 
        if (skinBPRead(buf, &item->Bitmap) != 0)
 
762
        if (skinImageRead(buf, &item->Bitmap) != 0)
629
763
            return 1;
630
764
 
631
 
        mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     (bitmap: %lux%lu)\n", item->Bitmap.Width, item->Bitmap.Height);
 
765
        mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     (bitmap: %lux%lu)\n", item->Bitmap.Width, item->Bitmap.Height);
632
766
    }
633
767
 
634
768
    return 0;
635
769
}
636
770
 
637
 
// font=fontfile
 
771
/**
 
772
 * @brief Parse a @a font definition.
 
773
 *
 
774
 *        Syntax: font=fontfile
 
775
 *
 
776
 * @param in definition to be analyzed
 
777
 *
 
778
 * @return 0 (ok) or 1 (error)
 
779
 */
638
780
static int item_font(char *in)
639
781
{
640
782
    char fnt[256];
667
809
        return 1;
668
810
    }
669
811
 
670
 
    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]    font: %s (#%d)\n", fnt, fntFindID(fnt));
 
812
    mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]    font: %s (#%d)\n", fnt, fntFindID(fnt));
671
813
 
672
814
    return 0;
673
815
}
674
816
 
675
 
// slabel=x,y,fontfile,"text"
 
817
/**
 
818
 * @brief Parse a @a slabel definition.
 
819
 *
 
820
 *        Syntax: slabel=x,y,fontfile,"text"
 
821
 *
 
822
 * @param in definition to be analyzed
 
823
 *
 
824
 * @return 0 (ok) or 1 (error)
 
825
 */
676
826
static int item_slabel(char *in)
677
827
{
678
828
    int x, y, id;
694
844
    cutItem(in, txt, ',', 3);
695
845
    cutItem(txt, txt, '"', 1);
696
846
 
697
 
    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]    slabel: \"%s\"\n", txt);
698
 
    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     pos: %d,%d\n", x, y);
 
847
    mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]    slabel: \"%s\"\n", txt);
 
848
    mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     pos: %d,%d\n", x, y);
699
849
 
700
850
    id = fntFindID(fnt);
701
851
 
704
854
        return 1;
705
855
    }
706
856
 
707
 
    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     font: %s (#%d)\n", fnt, id);
 
857
    mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     font: %s (#%d)\n", fnt, id);
708
858
 
709
859
    item = next_item();
710
860
 
727
877
    return 0;
728
878
}
729
879
 
730
 
// dlabel=x,y,width,align,fontfile,"text"
 
880
/**
 
881
 * @brief Parse a @a dlabel definition.
 
882
 *
 
883
 *        Syntax: dlabel=x,y,width,align,fontfile,"text"
 
884
 *
 
885
 * @param in definition to be analyzed
 
886
 *
 
887
 * @return 0 (ok) or 1 (error)
 
888
 */
731
889
static int item_dlabel(char *in)
732
890
{
733
891
    int x, y, w, a, id;
751
909
    cutItem(in, txt, ',', 5);
752
910
    cutItem(txt, txt, '"', 1);
753
911
 
754
 
    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]    dlabel: \"%s\"\n", txt);
755
 
    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     pos: %d,%d\n", x, y);
756
 
    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     width: %d, align: %d\n", w, a);
 
912
    mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]    dlabel: \"%s\"\n", txt);
 
913
    mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     pos: %d,%d\n", x, y);
 
914
    mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     width: %d, align: %d\n", w, a);
757
915
 
758
916
    id = fntFindID(fnt);
759
917
 
762
920
        return 1;
763
921
    }
764
922
 
765
 
    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     font: %s (#%d)\n", fnt, id);
 
923
    mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     font: %s (#%d)\n", fnt, id);
766
924
 
767
925
    item = next_item();
768
926
 
786
944
    return 0;
787
945
}
788
946
 
789
 
// decoration=enable|disable
 
947
/**
 
948
 * @brief Parse a @a decoration definition.
 
949
 *
 
950
 *        Syntax: decoration=enable|disable
 
951
 *
 
952
 * @param in definition to be analyzed
 
953
 *
 
954
 * @return 0 (ok) or 1 (error)
 
955
 */
790
956
static int item_decoration(char *in)
791
957
{
792
958
    if (!window_item("decoration"))
808
974
 
809
975
    skin->mainDecoration = (strcmp(in, "enable") == 0);
810
976
 
811
 
    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]    decoration: %s\n", in);
 
977
    mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]    decoration: %s\n", in);
812
978
 
813
979
    return 0;
814
980
}
815
981
 
 
982
/**
 
983
 * @brief Parsing functions responsible for skin item definitions.
 
984
 */
816
985
static _item skinItem[] = {
817
986
    { "background", item_background },
818
987
    { "base",       item_base       },
831
1000
    { "window",     item_window     }
832
1001
};
833
1002
 
 
1003
/**
 
1004
 * @brief Build the skin file path for a skin name.
 
1005
 *
 
1006
 * @param dir skins directory
 
1007
 * @param sname name of the skin
 
1008
 *
 
1009
 * @return skin file path
 
1010
 *
 
1011
 * @note As a side effect, variable #path gets set to the skin path.
 
1012
 */
834
1013
static char *setname(char *dir, char *sname)
835
1014
{
836
1015
    static char skinfname[512];
845
1024
    return skinfname;
846
1025
}
847
1026
 
 
1027
/**
 
1028
 * @brief Read and parse a skin.
 
1029
 *
 
1030
 * @param sname name of the skin
 
1031
 *
 
1032
 * @return 0 (ok), -1 (skin file not found or not readable) or -2 (parsing error)
 
1033
 */
848
1034
int skinRead(char *sname)
849
1035
{
850
1036
    char *skinfname;
865
1051
        }
866
1052
    }
867
1053
 
868
 
    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] configuration file: %s\n", skinfname);
 
1054
    mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin] configuration file: %s\n", skinfname);
869
1055
 
870
1056
    appFreeStruct();
871
1057