dvd_summary.c 6.68 KB
Newer Older
1
2
3
4
5
/*****************************************************************************
 * dvd_summary.c: set of functions to print options of selected title
 * found in .ifo.
 *****************************************************************************
 * Copyright (C) 1998-2001 VideoLAN
6
 * $Id: dvd_summary.c,v 1.19 2002/05/15 23:53:45 sam Exp $
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
 *
 * Author: Stphane Borel <stef@via.ecp.fr>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
 *****************************************************************************/

/*****************************************************************************
 * Preamble
 *****************************************************************************/
#include <stdio.h>
#include <stdlib.h>
Sam Hocevar's avatar
   
Sam Hocevar committed
30

Sam Hocevar's avatar
   
Sam Hocevar committed
31
32
#include <videolan/vlc.h>

Sam Hocevar's avatar
   
Sam Hocevar committed
33
#ifdef HAVE_UNISTD_H
Sam Hocevar's avatar
   
Sam Hocevar committed
34
#   include <unistd.h>
Sam Hocevar's avatar
   
Sam Hocevar committed
35
36
37
#endif

#if !defined( WIN32 )
Sam Hocevar's avatar
   
Sam Hocevar committed
38
#   include <netinet/in.h>
Sam Hocevar's avatar
   
Sam Hocevar committed
39
#endif
40
41
42
43
44
45
46
47
48
49

#include <fcntl.h>
#include <sys/types.h>

#include <string.h>
#ifdef STRNCASECMP_IN_STRINGS_H
#   include <strings.h>
#endif
#include <errno.h>

Sam Hocevar's avatar
   
Sam Hocevar committed
50
51
52
#ifdef GOD_DAMN_DMCA
#   include "dummy_dvdcss.h"
#else
Sam Hocevar's avatar
   
Sam Hocevar committed
53
#   include <dvdcss/dvdcss.h>
Sam Hocevar's avatar
   
Sam Hocevar committed
54
#endif
Sam Hocevar's avatar
   
Sam Hocevar committed
55

Stéphane Borel's avatar
   
Stéphane Borel committed
56
#include "dvd.h"
Sam Hocevar's avatar
   
Sam Hocevar committed
57
#include "dvd_ifo.h"
Sam Hocevar's avatar
   
Sam Hocevar committed
58
#include "iso_lang.h"
59
60
61
62
63
64
65
66
67
68

/*
 * Local tools to decode some data in ifo
 */

/****************************************************************************
 * IfoPrintTitle
 ****************************************************************************/
void IfoPrintTitle( thread_dvd_data_t * p_dvd )
{
Stéphane Borel's avatar
   
Stéphane Borel committed
69
    intf_WarnMsg( 5, "dvd info: title %d, %d chapter%s, %d angle%s",
Sam Hocevar's avatar
   
Sam Hocevar committed
70
71
72
                     p_dvd->i_title, p_dvd->i_chapter_nb,
                     (p_dvd->i_chapter_nb == 1) ? "" : "s",
                     p_dvd->i_angle_nb,
Stéphane Borel's avatar
   
Stéphane Borel committed
73
                     (p_dvd->i_angle_nb == 1) ? "" : "s" );
74
75
76
77
78
79
80
81
}

/****************************************************************************
 * IfoPrintVideo
 ****************************************************************************/
#define video p_dvd->p_ifo->vts.manager_inf.video_attr
void IfoPrintVideo( thread_dvd_data_t * p_dvd )
{
Sam Hocevar's avatar
   
Sam Hocevar committed
82
    char*    psz_perm_displ[4] =
83
84
85
86
87
88
             {
                "pan-scan & letterboxed",
                "pan-scan",
                "letterboxed",
                "not specified"
             };
Sam Hocevar's avatar
   
Sam Hocevar committed
89
    char*    psz_source_res[4] =
90
91
92
93
94
95
96
             {
                "720x480 ntsc or 720x576 pal",
                "704x480 ntsc or 704x576 pal",
                "352x480 ntsc or 352x576 pal",
                "352x240 ntsc or 352x288 pal"
             };

Stéphane Borel's avatar
   
Stéphane Borel committed
97
98
    intf_WarnMsg( 5, "dvd info: MPEG-%d video, %sHz, aspect ratio %s",
                     video.i_compression + 1,
Sam Hocevar's avatar
   
Sam Hocevar committed
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
                     video.i_system ? "pal 625 @50" : "ntsc 525 @60",
                     video.i_ratio ? (video.i_ratio == 3) ? "16:9"
                                                          : "unknown"
                                   : "4:3" );

    intf_WarnMsg( 5, "dvd info: display mode %s, %s, %s",
                     psz_perm_displ[video.i_perm_displ],
                     video.i_line21_1 ? "line21-1 data in GOP"
                                      : "no line21-1 data",
                     video.i_line21_2 ? "line21-2 data in GOP"
                                      : "no line21-2 data" );

    intf_WarnMsg( 5, "dvd info: source is %s, %sletterboxed, %s mode",
                     psz_source_res[video.i_source_res],
                     video.i_letterboxed ? "" : "not ",
                     video.i_mode ? "film (625/50 only)" : "camera" );
115
116
117
118
119
120
121
122
123
124
125
126
127
}
#undef video

/****************************************************************************
 * IfoPrintAudio
 ****************************************************************************/
#define audio p_dvd->p_ifo->vts.manager_inf.p_audio_attr[i-1]
#define audio_status \
    p_dvd->p_ifo->vts.title_unit.p_title[p_dvd->i_title_id-1].title.pi_audio_status[i-1]
void IfoPrintAudio( thread_dvd_data_t * p_dvd, int i )
{
    if( audio_status.i_available )
    {
128
129
130
131
        char* ppsz_mode[8] =
            { "AC3", "unknown", "MPEG", "MPEG-2", "LPCM", "SDDS", "DTS", "" };
        char* ppsz_appl_mode[4] =
            { "no application specified", "karaoke", "surround sound", "" };
Sam Hocevar's avatar
   
Sam Hocevar committed
132
        char* ppsz_quant[4] =
133
            { "16 bits", "20 bits", "24 bits", "drc" };
134
    
Sam Hocevar's avatar
   
Sam Hocevar committed
135
136
        intf_WarnMsg( 5, "dvd info: audio %d (%s) is %s, "
                         "%d%s channel%s, %dHz, %s", i,
137
                         DecodeLanguage( audio.i_lang_code ),
Sam Hocevar's avatar
   
Sam Hocevar committed
138
                         ppsz_mode[audio.i_coding_mode & 0x7],
139
                         audio.i_num_channels + 1,
Sam Hocevar's avatar
   
Sam Hocevar committed
140
141
142
                         audio.i_multichannel_extension ? " ext." : "",
                         audio.i_num_channels ? "s" : "",
                         audio.i_sample_freq ? 96000 : 48000,
143
                         ppsz_appl_mode[audio.i_appl_mode & 0x3] );
144

Sam Hocevar's avatar
   
Sam Hocevar committed
145
146
147
148
149
150
151
        intf_WarnMsg( 5, "dvd info: %s, quantization %s, status %x",
                         (audio.i_caption == 1) ? "normal caption"
                           : (audio.i_caption == 3) ? "directors comments"
                               : "unknown caption",
                         ppsz_quant[audio.i_quantization & 0x3],
                         audio_status.i_position );
    }
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
}
#undef audio_status
#undef audio

/****************************************************************************
 * IfoPrintSpu
 ****************************************************************************/
#define spu p_dvd->p_ifo->vts.manager_inf.p_spu_attr[i-1]
#define spu_status \
    p_dvd->p_ifo->vts.title_unit.p_title[p_dvd->i_title_id-1].title.pi_spu_status[i-1]

void IfoPrintSpu( thread_dvd_data_t * p_dvd, int i )
{
    if( spu_status.i_available )
    {
Sam Hocevar's avatar
   
Sam Hocevar committed
167
168
        intf_WarnMsg( 5, "dvd info: spu %d (%s), caption %d "
                         "prefix %x, modes [%s%s%s%s ]", i,
169
                         DecodeLanguage( spu.i_lang_code ),
Sam Hocevar's avatar
   
Sam Hocevar committed
170
171
172
173
174
                         spu.i_caption, spu.i_prefix,
                         spu_status.i_position_43 ? " 4:3" : "",
                         spu_status.i_position_wide ? " wide" : "",
                         spu_status.i_position_letter ? " letter" : "",
                         spu_status.i_position_pan ? " pan" : "" );
175
176
177
178
    }
}
#undef spu_status
#undef spu