~ubuntu-branches/ubuntu/wily/bluez/wily

« back to all changes in this revision

Viewing changes to sbc/sbcdec.c

ImportĀ upstreamĀ versionĀ 4.81

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 *
3
3
 *  Bluetooth low-complexity, subband codec (SBC) decoder
4
4
 *
5
 
 *  Copyright (C) 2004-2009  Marcel Holtmann <marcel@holtmann.org>
 
5
 *  Copyright (C) 2008-2010  Nokia Corporation
 
6
 *  Copyright (C) 2004-2010  Marcel Holtmann <marcel@holtmann.org>
6
7
 *
7
8
 *
8
9
 *  This program is free software; you can redistribute it and/or modify
47
48
{
48
49
        unsigned char buf[BUF_SIZE], *stream;
49
50
        struct stat st;
50
 
        off_t filesize;
51
51
        sbc_t sbc;
52
 
        int fd, ad, pos, streamlen, framelen, count, len;
 
52
        int fd, ad, pos, streamlen, framelen, count;
 
53
        size_t len;
53
54
        int format = AFMT_S16_BE, frequency, channels;
54
55
        ssize_t written;
55
56
 
59
60
                return;
60
61
        }
61
62
 
62
 
        filesize = st.st_size;
63
63
        stream = malloc(st.st_size);
64
64
 
65
65
        if (!stream) {
187
187
                if (count + len >= BUF_SIZE) {
188
188
                        fprintf(stderr,
189
189
                                "buffer size of %d is too small for decoded"
190
 
                                " data (%d)\n", BUF_SIZE, len + count);
 
190
                                " data (%lu)\n", BUF_SIZE, (unsigned long) (len + count));
191
191
                        exit(1);
192
192
                }
193
193
 
220
220
static void usage(void)
221
221
{
222
222
        printf("SBC decoder utility ver %s\n", VERSION);
223
 
        printf("Copyright (c) 2004-2009  Marcel Holtmann\n\n");
 
223
        printf("Copyright (c) 2004-2010  Marcel Holtmann\n\n");
224
224
 
225
225
        printf("Usage:\n"
226
226
                "\tsbcdec [options] file(s)\n"
259
259
                        break;
260
260
 
261
261
                case 'd':
262
 
                        if (output)
263
 
                                free(output);
 
262
                        free(output);
264
263
                        output = strdup(optarg);
265
264
                        tofile = 0;
266
265
                        break;
267
266
 
268
267
                case 'f' :
269
 
                        if (output)
270
 
                                free(output);
 
268
                        free(output);
271
269
                        output = strdup(optarg);
272
270
                        tofile = 1;
273
271
                        break;
289
287
        for (i = 0; i < argc; i++)
290
288
                decode(argv[i], output ? output : "/dev/dsp", tofile);
291
289
 
292
 
        if (output)
293
 
                free(output);
 
290
        free(output);
294
291
 
295
292
        return 0;
296
293
}