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.4 2001/06/07 22:25:42 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 /*****************************************************************************
27 *****************************************************************************/
31 #define MODULE_NAME dvd
33 #define MODULE_NAME dvdnocss
35 #include "modules_inner.h"
45 #include <netinet/in.h>
49 #include <sys/types.h>
52 #ifdef STRNCASECMP_IN_STRINGS_H
67 #include "input_dvd.h"
73 #include "modules_export.h"
75 /*****************************************************************************
77 *****************************************************************************/
86 /* The ISO 639 language codes.
87 * Language names with * prefix are not spelled in their own language
89 { " ", "Not Specified" },
91 { "ab", "*Abkhazian" },
92 { "af", "*Afrikaans" },
95 { "as", "*Assamese" },
97 { "az", "*Azerbaijani" },
99 { "be", "*Byelorussian" },
100 { "bg", "*Bulgarian" },
102 { "bi", "*Bislama" },
103 { "bn", "*Bengali; Bangla" },
104 { "bo", "*Tibetan" },
106 { "ca", "*Catalan" },
107 { "co", "*Corsican" },
108 { "cs", "*Czech(Ceske)" },
112 { "dz", "*Bhutani" },
115 { "eo", "*Esperanto" },
117 { "et", "*Estonian" },
119 { "fa", "*Persian" },
122 { "fo", "*Faroese" },
123 { "fr", "Francais" },
124 { "fy", "*Frisian" },
126 { "gd", "*Scots Gaelic" },
127 { "gl", "*Galician" },
128 { "gn", "*Guarani" },
129 { "gu", "*Gujarati" },
131 { "he", "*Hebrew" }, /* formerly iw */
133 { "hr", "Hrvatski" }, /* Croatian */
135 { "hy", "*Armenian" },
136 { "ia", "*Interlingua" },
137 { "id", "*Indonesian" }, /* formerly in */
138 { "ie", "*Interlingue" },
139 { "ik", "*Inupiak" },
140 { "in", "*Indonesian" }, /* replaced by id */
141 { "is", "Islenska" },
142 { "it", "Italiano" },
143 { "iu", "*Inuktitut" },
144 { "iw", "*Hebrew" }, /* replaced by he */
145 { "ja", "*Japanese" },
146 { "ji", "*Yiddish" }, /* replaced by yi */
147 { "jw", "*Javanese" },
148 { "ka", "*Georgian" },
150 { "kl", "*Greenlandic" },
151 { "km", "*Cambodian" },
152 { "kn", "*Kannada" },
154 { "ks", "*Kashmiri" },
155 { "ku", "*Kurdish" },
156 { "ky", "*Kirghiz" },
158 { "ln", "*Lingala" },
159 { "lo", "*Laothian" },
160 { "lt", "*Lithuanian" },
161 { "lv", "*Latvian, Lettish" },
162 { "mg", "*Malagasy" },
164 { "mk", "*Macedonian" },
165 { "ml", "*Malayalam" },
166 { "mn", "*Mongolian" },
167 { "mo", "*Moldavian" },
168 { "mr", "*Marathi" },
170 { "mt", "*Maltese" },
171 { "my", "*Burmese" },
174 { "nl", "Nederlands" },
176 { "oc", "*Occitan" },
177 { "om", "*(Afan) Oromo" },
179 { "pa", "*Punjabi" },
181 { "ps", "*Pashto, Pushto" },
182 { "pt", "Portugues" },
183 { "qu", "*Quechua" },
184 { "rm", "*Rhaeto-Romance" },
185 { "rn", "*Kirundi" },
186 { "ro", "*Romanian" },
187 { "ru", "*Russian" },
188 { "rw", "*Kinyarwanda" },
189 { "sa", "*Sanskrit" },
192 { "sh", "*Serbo-Croatian" },
193 { "si", "*Sinhalese" },
195 { "sl", "*Slovenian" },
199 { "sq", "*Albanian" },
200 { "sr", "*Serbian" },
201 { "ss", "*Siswati" },
202 { "st", "*Sesotho" },
203 { "su", "*Sundanese" },
205 { "sw", "*Swahili" },
210 { "ti", "*Tigrinya" },
211 { "tk", "*Turkmen" },
212 { "tl", "*Tagalog" },
213 { "tn", "*Setswana" },
215 { "tr", "*Turkish" },
220 { "uk", "*Ukrainian" },
223 { "vi", "*Vietnamese" },
224 { "vo", "*Volapuk" },
227 { "yi", "*Yiddish" }, /* formerly ji */
230 { "zh", "*Chinese" },
236 * Local tools to decode some data in ifo
239 /*****************************************************************************
240 * IfoLanguage: gives the long language name from the two-letters
242 *****************************************************************************/
243 char * IfoLanguage( u16 i_code )
247 while( memcmp( lang_tbl[i].p_code, &i_code, 2 ) &&
248 lang_tbl[i].p_lang_long[0] )
253 return lang_tbl[i].p_lang_long;
257 /****************************************************************************
259 ****************************************************************************/
260 void IfoPrintTitle( thread_dvd_data_t * p_dvd )
262 intf_WarnMsg( 5, "***************************************************" );
263 intf_WarnMsg( 5, "dvd info: title: %d", p_dvd->i_title );
264 intf_WarnMsg( 5, " vobstart at: %lld", p_dvd->i_start );
265 intf_WarnMsg( 5, " stream size: %lld", p_dvd->i_size );
266 intf_WarnMsg( 5, " number of chapters: %d", p_dvd->i_chapter_nb );
267 intf_WarnMsg( 5, " number of angles: %d", p_dvd->i_angle_nb );
268 intf_WarnMsg( 5, "***************************************************\n" );
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, "***********************************************" );
308 intf_WarnMsg( 5, "dvd info: video" );
309 intf_WarnMsg( 5, " compression: mpeg-%d", video.i_compression+1 );
310 intf_WarnMsg( 5, " tv system: %s Hz",
311 video.i_system ? "pal 625/50" : "ntsc 525/60" );
312 intf_WarnMsg( 5, " aspect ratio: %s", psz_ratio );
313 intf_WarnMsg( 5, " display mode: %s",
314 psz_perm_displ[video.i_perm_displ] );
315 intf_WarnMsg( 5, " line21-1: %s",
316 video.i_line21_1 ? "data present in GOP" : "" );
317 intf_WarnMsg( 5, " line21-2: %s",
318 video.i_line21_2 ? "data present in GOP" : "" );
319 intf_WarnMsg( 5, " source res: %s",
320 psz_source_res[video.i_source_res] );
321 intf_WarnMsg( 5, " letterboxed: %s",
322 video.i_letterboxed ? "yes" : "no" );
323 intf_WarnMsg( 5, " mode: %s",
324 video.i_mode ? "film (625/50 only)" : "camera");
325 intf_WarnMsg( 5, "***********************************************\n" );
329 /****************************************************************************
331 ****************************************************************************/
332 #define audio p_dvd->p_ifo->vts.manager_inf.p_audio_attr[i-1]
333 #define audio_status \
334 p_dvd->p_ifo->vts.title_unit.p_title[p_dvd->i_title_id-1].title.pi_audio_status[i-1]
335 void IfoPrintAudio( thread_dvd_data_t * p_dvd, int i )
338 if( audio_status.i_available )
340 char ppsz_mode[7][9] =
341 { "ac3", "unknown", "mpeg-1", "mpeg-2", "lpcm", "sdds", "dts" };
342 char ppsz_appl_mode[3][15] =
343 { "not specified", "karaoke", "surround sound" };
344 char psz_caption[25];
345 char ppsz_quant[4][10] =
346 { "16 bits", "20 bits", "24 bits", "drc" };
348 intf_WarnMsg( 5, "***********************************************" );
349 intf_WarnMsg( 5, "dvd info: audio %d" , i );
350 intf_WarnMsg( 5, " language: %s",
351 IfoLanguage( hton16( audio.i_lang_code ) ) );
352 intf_WarnMsg( 5, " mode: %s", ppsz_mode[audio.i_coding_mode & 0x7] );
353 intf_WarnMsg( 5, " channel(s): %d %s",
354 audio.i_num_channels + 1,
355 audio.i_multichannel_extension ? "ext." : "" );
356 intf_WarnMsg( 5, " sampling: %d Hz",
357 audio.i_sample_freq ? 96000 : 48000 );
358 intf_WarnMsg( 5, " appl_mode: %s",
359 ppsz_appl_mode[audio.i_appl_mode & 0x2] );
360 switch( audio.i_caption )
363 sprintf( psz_caption, "normal caption" );
366 sprintf( psz_caption, "directors comments" );
369 sprintf( psz_caption, " " );
372 intf_WarnMsg( 5, " caption: %s", psz_caption );
373 intf_WarnMsg( 5, " quantization: %s",
374 ppsz_quant[audio.i_quantization & 0x3] );
376 intf_WarnMsg( 5, " status: %x", audio_status.i_position );
377 intf_WarnMsg( 5, "***********************************************\n" );
385 /****************************************************************************
387 ****************************************************************************/
388 #define spu p_dvd->p_ifo->vts.manager_inf.p_spu_attr[i-1]
390 p_dvd->p_ifo->vts.title_unit.p_title[p_dvd->i_title_id-1].title.pi_spu_status[i-1]
392 void IfoPrintSpu( thread_dvd_data_t * p_dvd, int i )
394 if( spu_status.i_available )
396 intf_WarnMsg( 5, "***********************************************" );
397 intf_WarnMsg( 5, "dvd info: spu %d", i );
398 intf_WarnMsg( 5, " caption: %d", spu.i_caption );
399 intf_WarnMsg( 5, " language: %s",
400 IfoLanguage( hton16( spu.i_lang_code ) ) );
401 intf_WarnMsg( 5, " prefix: %x", spu.i_prefix );
403 intf_WarnMsg( 5, " status: 4:3 %x wide %x letter %x pan %x",
404 spu_status.i_position_43,
405 spu_status.i_position_wide,
406 spu_status.i_position_letter,
407 spu_status.i_position_pan );
408 intf_WarnMsg( 5, "***********************************************\n" );