66 static PyObject * ifoinfo_get_audio_track(ifo_handle_t *vtsfile, int ttn, int id) {
67 char audioformat[7];
68 char audiolang[5];
69 int audiochannels;
70 int audiofreq;
71 int audioid;
72 audio_attr_t *attr;
73 pgc_t *pgc = vtsfile->vts_pgcit ? vtsfile->vts_pgcit->pgci_srp[ttn].pgc : NULL;
74
when treating unknown struct ifo_handle_t * from src/disc/ifomodule.c:67 as non-NULL
when treating unknown struct pgcit_t * from src/disc/ifomodule.c:74 as non-NULL
taking True path
when treating unknown struct pgcit_t * from src/disc/ifomodule.c:74 as non-NULL
when treating unknown struct pgci_srp_t * from src/disc/ifomodule.c:74 as non-NULL
75 if (!pgc || !vtsfile->vtsi_mat || (pgc->audio_control[id] & 0x8000) == 0)
76 return NULL;
when treating unknown struct pgc_t * from src/disc/ifomodule.c:74 as non-NULL
taking False path
when treating unknown struct vtsi_mat_t * from src/disc/ifomodule.c:76 as non-NULL
taking False path
taking True path
77
78 attr = &vtsfile->vtsi_mat->vts_audio_attr[id];
79
80 if ( attr->audio_format == 0
81 && attr->multichannel_extension == 0
82 && attr->lang_type == 0
83 && attr->application_mode == 0
84 && attr->quantization == 0
85 && attr->sample_frequency == 0
86 && attr->channels == 0
87 && attr->lang_extension == 0
88 && attr->unknown1 == 0
89 && attr->unknown1 == 0) {
90 return NULL;
91 }
92
93 audioid = pgc->audio_control[id] >> 8 & 7;
94
95 /* audio format */
96 switch (attr->audio_format) {
97 case 0:
98 snprintf(audioformat, 7, "0x2000");
99 audioid += 128; // AC3 ids start at 128
100 break;
101 case 2:
102 snprintf(audioformat, 7, "0x0050");
103 break;
104 case 3:
105 snprintf(audioformat, 5, "MP2A");
106 break;
107 case 4:
108 snprintf(audioformat, 7, "0x0001");
109 audioid += 160; // PCM ids start at 160
110 break;
111 case 6:
112 snprintf(audioformat, 7, "0x2001");
113 audioid += 136; // DTS ids start at 136
114 break;
115 default:
116 snprintf(audioformat, 7, "%02x%02x", 0, 0);
117 }
118
119 switch (attr->lang_type) {
120 case 0:
121 assert(attr->lang_code == 0 || attr->lang_code == 0xffff);
122 snprintf(audiolang, 5, "N/A");
123 break;
124 case 1:
125 snprintf(audiolang, 5, "%c%c", attr->lang_code>>8,
126 attr->lang_code & 0xff);
127 break;
128 default:
129 snprintf(audiolang, 5, "N/A");
130 }
131
132 switch(attr->sample_frequency) {
133 case 0:
134 audiofreq = 48000;
135 break;
136 case 1:
137 audiofreq = -1;
138 break;
139 default:
140 audiofreq = -1;
141 }
142
143 audiochannels = attr->channels + 1;
144
145 //AUDIOTRACK: ID=%i; LANG=%s; FORMAT=%s; CHANNELS=%i; FREQ=%ikHz
146 return Py_BuildValue("(issii)", audioid, audiolang, audioformat, audiochannels, audiofreq);
147 }
148