~ubuntu-branches/debian/sid/vorbis-tools/sid

« back to all changes in this revision

Viewing changes to ogg123/callbacks.c

  • Committer: Bazaar Package Importer
  • Author(s): Jesus Climent
  • Date: 2005-04-10 09:22:24 UTC
  • mfrom: (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20050410092224-xtukpa3qghghhjje
Tags: 1.0.1-1.3
* Authorized NMU.
* Modified alsa to mention alsa09 (although the device might be nowadays
  alsa, back, since alsa1.0 has been already released). (Closes: #258286)
* Modified the manpage/help message for vorbiscomment to make it a bit more
  userfiendly: Closes: #252531.
* Added oggdec to the long description field, so that it triggers apt-cache
  searches: Closes: #274894.
* Typos in manpages: Closes: #302150.
* Escaped dashes in manpage: Closes: #264365.
* Quiet option is actually with -Q, not -q (Closes: #211289) Reported
  upstream but patched for Debian.
* Change input.wav with inputfile, since we accept flac-formated files:
  Closes: #262509.
* Translation bits:
  * Updated translation hu.po: Closes: #272037.
  * French translation correction: Encodage -> Codage (Closes: #248431).
  * debian/rules: remove .gmo's to avoid clash with uploaded tarball.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 *                                                                  *
12
12
 ********************************************************************
13
13
 
14
 
 last mod: $Id: callbacks.c,v 1.3 2001/12/26 14:22:26 segher Exp $
 
14
 last mod: $Id: callbacks.c,v 1.9 2003/09/05 19:25:30 volsung Exp $
15
15
 
16
16
 ********************************************************************/
17
17
 
19
19
#include <string.h>
20
20
 
21
21
#include "callbacks.h"
 
22
#include "i18n.h"
22
23
 
23
24
#define WARNING_VERBOSITY 2
24
25
#define INFO_VERBOSITY    3
41
42
  audio_device_t *current;
42
43
  ao_sample_format format;
43
44
 
44
 
  /* We DO NOT want to get cancelled part way through this and have our
45
 
     audio devices in an unknown state */
46
 
  pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
47
 
 
48
 
 
49
45
  close_audio_devices (reopen_arg->devices);
50
46
  
51
47
  /* Record audio device settings and open the devices */
65
61
                                     current->options);
66
62
    else
67
63
      current->device = ao_open_file(current->driver_id, current->filename,
68
 
                                     0, &format, current->options);
 
64
                                     1 /*overwrite*/, &format, 
 
65
                                     current->options);
69
66
    
70
67
    /* Report errors */
71
68
    if (current->device == NULL) {
72
69
      switch (errno) {
73
70
      case AO_ENODRIVER:
74
 
        status_error("Error: Device not available.\n");
 
71
        status_error(_("Error: Device not available.\n"));
75
72
        break;
76
73
      case AO_ENOTLIVE:
77
 
        status_error("Error: %s requires an output filename to be specified with -f.\n", info->short_name);
 
74
        status_error(_("Error: %s requires an output filename to be specified with -f.\n"), info->short_name);
78
75
        break;
79
76
      case AO_EBADOPTION:
80
 
        status_error("Error: Unsupported option value to %s device.\n",
 
77
        status_error(_("Error: Unsupported option value to %s device.\n"),
81
78
                     info->short_name);
82
79
        break;
83
80
      case AO_EOPENDEVICE:
84
 
        status_error("Error: Cannot open device %s.\n",
 
81
        status_error(_("Error: Cannot open device %s.\n"),
85
82
                     info->short_name);
86
83
        break;
87
84
      case AO_EFAIL:
88
 
        status_error("Error: Device %s failure.\n", info->short_name);
 
85
        status_error(_("Error: Device %s failure.\n"), info->short_name);
89
86
        break;
90
87
      case AO_ENOTFILE:
91
 
        status_error("Error: An output file cannot be given for %s device.\n", info->short_name);
 
88
        status_error(_("Error: An output file cannot be given for %s device.\n"), info->short_name);
92
89
        break;
93
90
      case AO_EOPENFILE:
94
 
        status_error("Error: Cannot open file %s for writing.\n",
 
91
        status_error(_("Error: Cannot open file %s for writing.\n"),
95
92
                     current->filename);
96
93
        break;
97
94
      case AO_EFILEEXISTS:
98
 
        status_error("Error: File %s already exists.\n", current->filename);
 
95
        status_error(_("Error: File %s already exists.\n"), current->filename);
99
96
        break;
100
97
      default:
101
 
        status_error("Error: This error should never happen.  Panic!\n");
 
98
        status_error(_("Error: This error should never happen (%d).  Panic!\n"), errno);
102
99
        break;
103
100
      }
104
101
         
112
109
  /* Cleanup argument */
113
110
  free(reopen_arg->format);
114
111
  free(reopen_arg);
115
 
  
116
 
  pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);  
117
112
}
118
113
 
119
114
 
123
118
  audio_reopen_arg_t *arg;
124
119
 
125
120
  if ( (arg = malloc(sizeof(audio_reopen_arg_t))) == NULL ) {
126
 
    status_error("Error: Out of memory in new_audio_reopen_arg().\n");
 
121
    status_error(_("Error: Out of memory in new_audio_reopen_arg().\n"));
127
122
    exit(1);
128
123
  }  
129
124
  
130
125
  if ( (arg->format = malloc(sizeof(audio_format_t))) == NULL ) {
131
 
    status_error("Error: Out of memory in new_audio_reopen_arg().\n");
 
126
    status_error(_("Error: Out of memory in new_audio_reopen_arg().\n"));
132
127
    exit(1);
133
128
  }  
134
129
  
160
155
  free(stats_arg->data_source_statistics);
161
156
  free(stats_arg->decoder_statistics);
162
157
  free(stats_arg);
 
158
  free(buffer_stats);
163
159
}
164
160
 
165
161
 
171
167
  print_statistics_arg_t *arg;
172
168
 
173
169
  if ( (arg = malloc(sizeof(print_statistics_arg_t))) == NULL ) {
174
 
    status_error("Error: Out of memory in new_print_statistics_arg().\n");
 
170
    status_error(_("Error: Out of memory in new_print_statistics_arg().\n"));
175
171
    exit(1);
176
172
  }  
177
173
  
230
226
  status_message_arg_t *arg;
231
227
 
232
228
  if ( (arg = malloc(sizeof(status_message_arg_t))) == NULL ) {
233
 
    status_error("Error: Out of memory in new_status_message_arg().\n");
 
229
    status_error(_("Error: Out of memory in new_status_message_arg().\n"));
234
230
    exit(1);
235
231
  }  
236
232
  
276
272
     straight from the vsnprintf() man page.  We do this here because
277
273
     we might need to reinit ap several times. */
278
274
  if ((sm_arg->message = malloc (size)) == NULL) {
279
 
    status_error("Error: Out of memory in decoder_buffered_metadata_callback().\n");
 
275
    status_error(_("Error: Out of memory in decoder_buffered_metadata_callback().\n"));
280
276
    exit(1);
281
277
  }
282
278
  
295
291
    else           /* glibc 2.0 */
296
292
      size *= 2;  /* twice the old size */
297
293
    if ((sm_arg->message = realloc (sm_arg->message, size)) == NULL) {
298
 
      status_error("Error: Out of memory in decoder_buffered_metadata_callback().\n");
 
294
      status_error(_("Error: Out of memory in decoder_buffered_metadata_callback().\n"));
299
295
      exit(1);
300
296
    }
301
297
  }
332
328
     straight from the vsnprintf() man page.  We do this here because
333
329
     we might need to reinit ap several times. */
334
330
  if ((sm_arg->message = malloc (size)) == NULL) {
335
 
    status_error("Error: Out of memory in decoder_buffered_metadata_callback().\n");
 
331
    status_error(_("Error: Out of memory in decoder_buffered_metadata_callback().\n"));
336
332
    exit(1);
337
333
  }
338
334
  
351
347
    else           /* glibc 2.0 */
352
348
      size *= 2;  /* twice the old size */
353
349
    if ((sm_arg->message = realloc (sm_arg->message, size)) == NULL) {
354
 
      status_error("Error: Out of memory in decoder_buffered_metadata_callback().\n");
 
350
      status_error(_("Error: Out of memory in decoder_buffered_metadata_callback().\n"));
355
351
      exit(1);
356
352
    }
357
353
  }
358
354
 
 
355
  sm_arg->verbosity = verbosity;
359
356
  buffer_append_action_at_end(buf, &status_message_action, sm_arg);
360
357
}