1 /*****************************************************************************
2 * dvd_summary.c: set of functions to print options of selected title
4 *****************************************************************************
5 * Copyright (C) 1998-2001 VideoLAN
6 * $Id: dvd_summary.c,v 1.8 2001/08/06 13:28:00 sam Exp $
8 * Author: Stéphane Borel <stef@via.ecp.fr>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
23 *****************************************************************************/
25 #define MODULE_NAME dvd
26 #include "modules_inner.h"
28 /*****************************************************************************
30 *****************************************************************************/
41 #include <netinet/in.h>
45 #include <sys/types.h>
48 #ifdef STRNCASECMP_IN_STRINGS_H
54 # include "dummy_dvdcss.h"
56 # include <videolan/dvdcss.h>
69 #include "input_dvd.h"
75 #include "modules_export.h"
77 /*****************************************************************************
79 *****************************************************************************/
88 /* The ISO 639 language codes.
89 * Language names with * prefix are not spelled in their own language
91 { " ", "Not Specified" },
93 { "ab", "*Abkhazian" },
94 { "af", "*Afrikaans" },
97 { "as", "*Assamese" },
99 { "az", "*Azerbaijani" },
100 { "ba", "*Bashkir" },
101 { "be", "*Byelorussian" },
102 { "bg", "*Bulgarian" },
104 { "bi", "*Bislama" },
105 { "bn", "*Bengali; Bangla" },
106 { "bo", "*Tibetan" },
108 { "ca", "*Catalan" },
109 { "co", "*Corsican" },
110 { "cs", "*Czech(Ceske)" },
114 { "dz", "*Bhutani" },
117 { "eo", "*Esperanto" },
119 { "et", "*Estonian" },
121 { "fa", "*Persian" },
124 { "fo", "*Faroese" },
125 { "fr", "Francais" },
126 { "fy", "*Frisian" },
128 { "gd", "*Scots Gaelic" },
129 { "gl", "*Galician" },
130 { "gn", "*Guarani" },
131 { "gu", "*Gujarati" },
133 { "he", "*Hebrew" }, /* formerly iw */
135 { "hr", "Hrvatski" }, /* Croatian */
137 { "hy", "*Armenian" },
138 { "ia", "*Interlingua" },
139 { "id", "*Indonesian" }, /* formerly in */
140 { "ie", "*Interlingue" },
141 { "ik", "*Inupiak" },
142 { "in", "*Indonesian" }, /* replaced by id */
143 { "is", "Islenska" },
144 { "it", "Italiano" },
145 { "iu", "*Inuktitut" },
146 { "iw", "*Hebrew" }, /* replaced by he */
147 { "ja", "*Japanese" },
148 { "ji", "*Yiddish" }, /* replaced by yi */
149 { "jw", "*Javanese" },
150 { "ka", "*Georgian" },
152 { "kl", "*Greenlandic" },
153 { "km", "*Cambodian" },
154 { "kn", "*Kannada" },
156 { "ks", "*Kashmiri" },
157 { "ku", "*Kurdish" },
158 { "ky", "*Kirghiz" },
160 { "ln", "*Lingala" },
161 { "lo", "*Laothian" },
162 { "lt", "*Lithuanian" },
163 { "lv", "*Latvian, Lettish" },
164 { "mg", "*Malagasy" },
166 { "mk", "*Macedonian" },
167 { "ml", "*Malayalam" },
168 { "mn", "*Mongolian" },
169 { "mo", "*Moldavian" },
170 { "mr", "*Marathi" },
172 { "mt", "*Maltese" },
173 { "my", "*Burmese" },
176 { "nl", "Nederlands" },
178 { "oc", "*Occitan" },
179 { "om", "*(Afan) Oromo" },
181 { "pa", "*Punjabi" },
183 { "ps", "*Pashto, Pushto" },
184 { "pt", "Portugues" },
185 { "qu", "*Quechua" },
186 { "rm", "*Rhaeto-Romance" },
187 { "rn", "*Kirundi" },
188 { "ro", "*Romanian" },
189 { "ru", "*Russian" },
190 { "rw", "*Kinyarwanda" },
191 { "sa", "*Sanskrit" },
194 { "sh", "*Serbo-Croatian" },
195 { "si", "*Sinhalese" },
197 { "sl", "*Slovenian" },
201 { "sq", "*Albanian" },
202 { "sr", "*Serbian" },
203 { "ss", "*Siswati" },
204 { "st", "*Sesotho" },
205 { "su", "*Sundanese" },
207 { "sw", "*Swahili" },
212 { "ti", "*Tigrinya" },
213 { "tk", "*Turkmen" },
214 { "tl", "*Tagalog" },
215 { "tn", "*Setswana" },
217 { "tr", "*Turkish" },
222 { "uk", "*Ukrainian" },
225 { "vi", "*Vietnamese" },
226 { "vo", "*Volapuk" },
229 { "yi", "*Yiddish" }, /* formerly ji */
232 { "zh", "*Chinese" },
238 * Local tools to decode some data in ifo
241 /*****************************************************************************
242 * IfoLanguage: gives the long language name from the two-letters
244 *****************************************************************************/
245 char * IfoLanguage( u16 i_code )
249 while( memcmp( lang_tbl[i].p_code, &i_code, 2 ) &&
250 lang_tbl[i].p_lang_long[0] )
255 return lang_tbl[i].p_lang_long;
259 /****************************************************************************
261 ****************************************************************************/
262 void IfoPrintTitle( thread_dvd_data_t * p_dvd )
264 intf_WarnMsg( 5, "dvd info: title: %d", p_dvd->i_title );
265 intf_WarnMsg( 5, " vobstart at: %d blocks", p_dvd->i_start );
266 intf_WarnMsg( 5, " stream size: %d blocks", p_dvd->i_size );
267 intf_WarnMsg( 5, " number of chapters: %d", p_dvd->i_chapter_nb );
268 intf_WarnMsg( 5, " number of angles: %d", p_dvd->i_angle_nb );
271 /****************************************************************************
273 ****************************************************************************/
274 #define video p_dvd->p_ifo->vts.manager_inf.video_attr
275 void IfoPrintVideo( thread_dvd_data_t * p_dvd )
278 char psz_perm_displ[4][23] =
280 "pan-scan & letterboxed",
285 char psz_source_res[4][28] =
287 "720x480 ntsc or 720x576 pal",
288 "704x480 ntsc or 704x576 pal",
289 "352x480 ntsc or 352x576 pal",
290 "352x240 ntsc or 352x288 pal"
294 switch( video.i_ratio )
297 sprintf( psz_ratio, "4:3" );
300 sprintf( psz_ratio, "16:9" );
303 sprintf( psz_ratio, "undef" );
307 intf_WarnMsg( 5, "dvd info: video" );
308 intf_WarnMsg( 5, " compression: mpeg-%d", video.i_compression+1 );
309 intf_WarnMsg( 5, " tv system: %s Hz",
310 video.i_system ? "pal 625/50" : "ntsc 525/60" );
311 intf_WarnMsg( 5, " aspect ratio: %s", psz_ratio );
312 intf_WarnMsg( 5, " display mode: %s",
313 psz_perm_displ[video.i_perm_displ] );
314 intf_WarnMsg( 5, " line21-1: %s",
315 video.i_line21_1 ? "data present in GOP" : "" );
316 intf_WarnMsg( 5, " line21-2: %s",
317 video.i_line21_2 ? "data present in GOP" : "" );
318 intf_WarnMsg( 5, " source res: %s",
319 psz_source_res[video.i_source_res] );
320 intf_WarnMsg( 5, " letterboxed: %s",
321 video.i_letterboxed ? "yes" : "no" );
322 intf_WarnMsg( 5, " mode: %s",
323 video.i_mode ? "film (625/50 only)" : "camera");
327 /****************************************************************************
329 ****************************************************************************/
330 #define audio p_dvd->p_ifo->vts.manager_inf.p_audio_attr[i-1]
331 #define audio_status \
332 p_dvd->p_ifo->vts.title_unit.p_title[p_dvd->i_title_id-1].title.pi_audio_status[i-1]
333 void IfoPrintAudio( thread_dvd_data_t * p_dvd, int i )
336 if( audio_status.i_available )
338 char ppsz_mode[7][9] =
339 { "ac3", "unknown", "mpeg-1", "mpeg-2", "lpcm", "sdds", "dts" };
340 char ppsz_appl_mode[3][15] =
341 { "not specified", "karaoke", "surround sound" };
342 char psz_caption[25];
343 char ppsz_quant[4][10] =
344 { "16 bits", "20 bits", "24 bits", "drc" };
346 intf_WarnMsg( 5, "dvd info: audio %d" , i );
347 intf_WarnMsg( 5, " language: %s",
348 IfoLanguage( hton16( audio.i_lang_code ) ) );
349 intf_WarnMsg( 5, " mode: %s", ppsz_mode[audio.i_coding_mode & 0x7] );
350 intf_WarnMsg( 5, " channel(s): %d %s",
351 audio.i_num_channels + 1,
352 audio.i_multichannel_extension ? "ext." : "" );
353 intf_WarnMsg( 5, " sampling: %d Hz",
354 audio.i_sample_freq ? 96000 : 48000 );
355 intf_WarnMsg( 5, " appl_mode: %s",
356 ppsz_appl_mode[audio.i_appl_mode & 0x2] );
357 switch( audio.i_caption )
360 sprintf( psz_caption, "normal caption" );
363 sprintf( psz_caption, "directors comments" );
366 sprintf( psz_caption, " " );
369 intf_WarnMsg( 5, " caption: %s", psz_caption );
370 intf_WarnMsg( 5, " quantization: %s",
371 ppsz_quant[audio.i_quantization & 0x3] );
373 intf_WarnMsg( 5, " status: %x", audio_status.i_position );
381 /****************************************************************************
383 ****************************************************************************/
384 #define spu p_dvd->p_ifo->vts.manager_inf.p_spu_attr[i-1]
386 p_dvd->p_ifo->vts.title_unit.p_title[p_dvd->i_title_id-1].title.pi_spu_status[i-1]
388 void IfoPrintSpu( thread_dvd_data_t * p_dvd, int i )
390 if( spu_status.i_available )
392 intf_WarnMsg( 5, "dvd info: spu %d", i );
393 intf_WarnMsg( 5, " caption: %d", spu.i_caption );
394 intf_WarnMsg( 5, " language: %s",
395 IfoLanguage( hton16( spu.i_lang_code ) ) );
396 intf_WarnMsg( 5, " prefix: %x", spu.i_prefix );
398 intf_WarnMsg( 5, " status: 4:3 %x wide %x letter %x pan %x",
399 spu_status.i_position_43,
400 spu_status.i_position_wide,
401 spu_status.i_position_letter,
402 spu_status.i_position_pan );