~ubuntu-branches/debian/sid/kodi/sid

« back to all changes in this revision

Viewing changes to lib/vgmstream/src/meta/spt_spd.c

  • Committer: Package Import Robot
  • Author(s): Balint Reczey
  • Date: 2015-08-18 14:16:59 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20150818141659-4lgq2pksj7918osz
Tags: 15.1+dfsg1-1
* New upstream release 15.0
  See http://www.kodi.tv/kodi-15-0-isengard-one-release-to-rule-them-all/
* Depend on libav.*-dev provided by src:ffmpeg
* Recommend udisks2 instead of udisks.
  Udisks has been removed from unstable but support for udisks2 is not
  implemented yet.
* Ship patch helping Jessie backports
* Refresh patches
* Eliminate __DATE__ macros from source to make build more reproducible
* Build-depend on libsdl2.*-dev instead of libsdl.*-dev
* Build-depend on libgif-dev
* Drop obsoleted fix of installed header's include paths
* Refresh include file list included by kodi-addons-dev
* Build depend on libcec (>= 3)
* Build-depend on groovy2 instead of groovy
* Sort build dependencies
* Fix packaging repository URL
* Remove removed files from debian/copyright
* Fix filenames with spaces in debian/copyright
* Ship TexturePacker in kodi-addons-dev in /usr/lib/kodi
* Build depend on libcec-platform-dev
* Stop using embedded gnulib modules in rsxs screensaver (Closes: #795813)
* Add missing copyright paragraphs to d/copyright
* Stop marking files as excluded which are removed from upstream tarball
  already
* Bump standards version to 3.9.6
* New upstream release 15.1
  See http://kodi.tv/kodi-15-1-isengard-maintenance-release/
* Move TexturePacker to kodi-bin
* Stop building TexturePacker statically

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#include "meta.h"
2
 
#include "../util.h"
3
 
 
4
 
/* SPT+SPT
5
 
 
6
 
   2008-11-27 - manakoAT : First try for splitted files...
7
 
*/
8
 
 
9
 
VGMSTREAM * init_vgmstream_spt_spd(STREAMFILE *streamFile) {
10
 
 
11
 
        VGMSTREAM * vgmstream = NULL;
12
 
    STREAMFILE * streamFileSPT = NULL;
13
 
    char filename[260];
14
 
        char filenameSPT[260];
15
 
        
16
 
        int i;
17
 
        int channel_count;
18
 
        int loop_flag;
19
 
 
20
 
    /* check extension, case insensitive */
21
 
    streamFile->get_name(streamFile,filename,sizeof(filename));
22
 
    if (strcasecmp("spd",filename_extension(filename))) goto fail;
23
 
 
24
 
 
25
 
        strcpy(filenameSPT,filename);
26
 
        strcpy(filenameSPT+strlen(filenameSPT)-3,"spt");
27
 
 
28
 
        streamFileSPT = streamFile->open(streamFile,filenameSPT,STREAMFILE_DEFAULT_BUFFER_SIZE);
29
 
 
30
 
 
31
 
        if (!streamFileSPT) goto fail;
32
 
        
33
 
        channel_count = read_32bitBE(0x00,streamFileSPT);
34
 
        loop_flag = read_32bitBE(0x04,streamFileSPT);
35
 
 
36
 
    /* build the VGMSTREAM */
37
 
    vgmstream = allocate_vgmstream(channel_count,loop_flag);
38
 
    if (!vgmstream) goto fail;
39
 
 
40
 
    /* fill in the vital statistics */
41
 
        vgmstream->channels = channel_count;
42
 
        vgmstream->sample_rate = read_32bitBE(0x08,streamFileSPT);
43
 
        vgmstream->num_samples=read_32bitBE(0x14,streamFileSPT)*14/16/channel_count;
44
 
        vgmstream->coding_type = coding_NGC_DSP;
45
 
        
46
 
        if(loop_flag) {
47
 
                vgmstream->loop_start_sample = 0;
48
 
                vgmstream->loop_end_sample = read_32bitBE(0x14,streamFileSPT)*14/16/channel_count;
49
 
        }       
50
 
 
51
 
        if (channel_count == 1) {
52
 
                vgmstream->layout_type = layout_none;
53
 
        } else if (channel_count == 2) {
54
 
                vgmstream->layout_type = layout_interleave;
55
 
                vgmstream->interleave_block_size=0x4000; /* Unknown now, never seen 2ch files in psd+spt */
56
 
        }
57
 
 
58
 
 
59
 
 
60
 
    vgmstream->meta_type = meta_SPT_SPD;
61
 
        
62
 
    /* open the file for reading */
63
 
    {
64
 
        for (i=0;i<channel_count;i++) {
65
 
                        /* Not sure, i'll put a fake value here for now */
66
 
            vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,0x8000);
67
 
            vgmstream->ch[i].offset = 0;
68
 
 
69
 
            if (!vgmstream->ch[i].streamfile) goto fail;
70
 
        }
71
 
    }
72
 
 
73
 
 
74
 
    
75
 
        if (vgmstream->coding_type == coding_NGC_DSP) {
76
 
        int i;
77
 
        for (i=0;i<16;i++) {
78
 
            vgmstream->ch[0].adpcm_coef[i] = read_16bitBE(0x20+i*2,streamFileSPT);
79
 
        }
80
 
        if (vgmstream->channels == 2) {
81
 
            for (i=0;i<16;i++) {
82
 
                vgmstream->ch[1].adpcm_coef[i] = read_16bitBE(0x40+i*2,streamFileSPT);
83
 
            }
84
 
        }
85
 
    }
86
 
 
87
 
 
88
 
        close_streamfile(streamFileSPT); streamFileSPT=NULL;
89
 
    return vgmstream;
90
 
 
91
 
    /* clean up anything we may have opened */
92
 
fail:
93
 
    if (streamFileSPT) close_streamfile(streamFileSPT);
94
 
    if (vgmstream) close_vgmstream(vgmstream);
95
 
    return NULL;
96
 
}