~ubuntu-branches/ubuntu/maverick/vdr-plugin-mp3/maverick

« back to all changes in this revision

Viewing changes to player-mplayer.c

  • Committer: Bazaar Package Importer
  • Author(s): Tobias Grimm
  • Date: 2010-03-28 15:09:21 UTC
  • mfrom: (2.1.6 sid)
  • Revision ID: james.westby@ubuntu.com-20100328150921-3kti802cqh0pe1hl
Tags: 0.10.2-3
* Build-depend on vdr-dev >= 1.6.0-16
* Minor debian/copyright update

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * MP3/MPlayer plugin to VDR (C++)
3
3
 *
4
 
 * (C) 2001-2007 Stefan Huelswitt <s.huelswitt@gmx.de>
 
4
 * (C) 2001-2009 Stefan Huelswitt <s.huelswitt@gmx.de>
5
5
 *
6
6
 * This code is free software; you can redistribute it and/or
7
7
 * modify it under the terms of the GNU General Public License
80
80
  Lock();
81
81
  if(Absolute && Volume==0) mute=true;
82
82
  else {
83
 
#if APIVERSNUM>=10401
84
 
#if APIVERSNUM==10401
85
 
#warning Caution! This code does not work with VDR 1.4.1 and 1.4.1-1. You can ignore this warning if you are using VDR 1.4.1-2 or later.
86
 
#endif
87
83
    if(!Absolute)
88
84
      volume+=Volume;
89
85
    else
90
 
#endif
91
86
      volume=Volume;
92
87
    if(volume>0) mute=false;
93
88
    }
186
181
    modified=global=false;
187
182
    free(resfile); resfile=0;
188
183
    delete resobj; resobj=new cFileObj(file);
189
 
    char *s;
190
 
    asprintf(&s,file->Subdir() ? "%s/%s":"%s",file->Source()->BaseDir(),file->Subdir());
 
184
    char *s=aprintf(file->Subdir() ? "%s/%s":"%s",file->Source()->BaseDir(),file->Subdir());
191
185
    if(MPlayerSetup.ResumeMode==1 || 
192
186
       (access(s,W_OK) && (errno==EACCES || errno==EROFS))) {
193
187
      global=true;
328
322
      if(slave) {
329
323
        Play(); // MPlayer ignores "quit" while paused
330
324
        MPlayerControl("quit");
331
 
        int until=time_ms()+3000; // wait some time until MPlayer is gone
 
325
        cTimeMs until(3000); // wait some time until MPlayer is gone
332
326
        d(printf("mplayer: waiting for child exit"))
333
327
        while(Active()) {
334
 
          if(time_ms()>until) {
 
328
          if(until.TimedOut()) {
335
329
            kill(pid,SIGKILL); // kill it anyways
336
330
            d(printf(" SIGKILL"))
337
331
            break;
338
332
            }
339
 
          SLEEP(250);
 
333
          cCondWait::SleepMs(250);
340
334
          d(printf(".")) d(fflush(stdout))
341
335
          }
342
336
        d(printf("\n"))
403
397
    else aid[0]=0;
404
398
    snprintf(cmd,sizeof(cmd),"%s \"%s\" %s%s",MPlayerCmd,fname,MPlayerSetup.SlaveMode?"SLAVE":"",aid);
405
399
    free(fname);
 
400
    // give index of primary dvb adapter device to mplayer via environment variable
 
401
    char dvb[4];
 
402
    snprintf(dvb,sizeof(dvb),"%d",cDevice::PrimaryDevice()->CardIndex()+1);
 
403
    setenv("DVB_DEVICE",dvb,1);
406
404
    execle("/bin/sh","sh","-c",cmd,(char *)0,environ);
407
405
    esyslog("ERROR: exec failed for %s: (%d) %s",cmd,errno,strerror(errno));
408
406
    exit(127);
586
584
    va_list ap;
587
585
    va_start(ap,format);
588
586
    char *buff=0;
589
 
    vasprintf(&buff,format,ap);
 
587
    if(vasprintf(&buff,format,ap)<0);
590
588
    Lock();
591
589
    // check for writeable pipe i.e. prevent broken pipe signal
592
590
    if(!brokenPipe) {