~ubuntu-branches/debian/wheezy/vlc/wheezy

« back to all changes in this revision

Viewing changes to plugins/dvd/dvd_summary.c

Tags: upstream-0.7.2.final
Import upstream version 0.7.2.final

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*****************************************************************************
2
 
 * dvd_summary.c: set of functions to print options of selected title
3
 
 * found in .ifo.
4
 
 *****************************************************************************
5
 
 * Copyright (C) 1998-2001 VideoLAN
6
 
 * $Id: dvd_summary.c,v 1.11 2001/12/07 18:33:07 sam Exp $
7
 
 *
8
 
 * Author: St�phane Borel <stef@via.ecp.fr>
9
 
 *
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.
14
 
 * 
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.
19
 
 *
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
 
 *****************************************************************************/
24
 
 
25
 
#define MODULE_NAME dvd
26
 
#include "modules_inner.h"
27
 
 
28
 
/*****************************************************************************
29
 
 * Preamble
30
 
 *****************************************************************************/
31
 
#include "defs.h"
32
 
 
33
 
#include <stdio.h>
34
 
#include <stdlib.h>
35
 
 
36
 
#ifdef HAVE_UNISTD_H
37
 
#include <unistd.h>
38
 
#endif
39
 
 
40
 
#if !defined( WIN32 )
41
 
#include <netinet/in.h>
42
 
#endif
43
 
 
44
 
#include <fcntl.h>
45
 
#include <sys/types.h>
46
 
 
47
 
#include <string.h>
48
 
#ifdef STRNCASECMP_IN_STRINGS_H
49
 
#   include <strings.h>
50
 
#endif
51
 
#include <errno.h>
52
 
 
53
 
#ifdef GOD_DAMN_DMCA
54
 
#   include "dummy_dvdcss.h"
55
 
#else
56
 
#   include <videolan/dvdcss.h>
57
 
#endif
58
 
 
59
 
#include "common.h"
60
 
#include "intf_msg.h"
61
 
#include "threads.h"
62
 
#include "mtime.h"
63
 
#include "iso_lang.h"
64
 
#include "tests.h"
65
 
 
66
 
#include "input_dvd.h"
67
 
#include "dvd_ifo.h"
68
 
 
69
 
#include "debug.h"
70
 
 
71
 
#include "modules.h"
72
 
#include "modules_export.h"
73
 
 
74
 
 
75
 
/*
76
 
 * Local tools to decode some data in ifo
77
 
 */
78
 
 
79
 
/****************************************************************************
80
 
 * IfoPrintTitle
81
 
 ****************************************************************************/
82
 
void IfoPrintTitle( thread_dvd_data_t * p_dvd )
83
 
{
84
 
    intf_WarnMsg( 5, "dvd info: title: %d", p_dvd->i_title );
85
 
    intf_WarnMsg( 5, "    vobstart at: %d blocks", p_dvd->i_start );
86
 
    intf_WarnMsg( 5, "    stream size: %d blocks", p_dvd->i_size );
87
 
    intf_WarnMsg( 5, "    number of chapters: %d", p_dvd->i_chapter_nb );
88
 
    intf_WarnMsg( 5, "    number of angles: %d", p_dvd->i_angle_nb );
89
 
}
90
 
 
91
 
/****************************************************************************
92
 
 * IfoPrintVideo
93
 
 ****************************************************************************/
94
 
#define video p_dvd->p_ifo->vts.manager_inf.video_attr
95
 
void IfoPrintVideo( thread_dvd_data_t * p_dvd )
96
 
{
97
 
    char     psz_ratio[12];
98
 
    char     psz_perm_displ[4][23] =
99
 
             {
100
 
                "pan-scan & letterboxed",
101
 
                "pan-scan",
102
 
                "letterboxed",
103
 
                "not specified"
104
 
             };
105
 
    char     psz_source_res[4][28] =
106
 
             {
107
 
                "720x480 ntsc or 720x576 pal",
108
 
                "704x480 ntsc or 704x576 pal",
109
 
                "352x480 ntsc or 352x576 pal",
110
 
                "352x240 ntsc or 352x288 pal"
111
 
             };
112
 
 
113
 
 
114
 
    switch( video.i_ratio )
115
 
    {
116
 
    case 0:
117
 
        sprintf( psz_ratio, "4:3" );
118
 
        break;
119
 
    case 3:
120
 
        sprintf( psz_ratio, "16:9" );
121
 
        break;
122
 
    default:
123
 
        sprintf( psz_ratio, "undef" );
124
 
        break;
125
 
    }
126
 
 
127
 
    intf_WarnMsg( 5, "dvd info: video" );
128
 
    intf_WarnMsg( 5, "    compression: mpeg-%d", video.i_compression+1 );
129
 
    intf_WarnMsg( 5, "    tv system: %s Hz",
130
 
                     video.i_system ? "pal 625/50" : "ntsc 525/60" );
131
 
    intf_WarnMsg( 5, "    aspect ratio: %s", psz_ratio );
132
 
    intf_WarnMsg( 5, "    display mode: %s",
133
 
                     psz_perm_displ[video.i_perm_displ] );
134
 
    intf_WarnMsg( 5, "    line21-1: %s",
135
 
                     video.i_line21_1 ? "data present in GOP" : "" );
136
 
    intf_WarnMsg( 5, "    line21-2: %s",
137
 
                     video.i_line21_2 ? "data present in GOP" : "" );
138
 
    intf_WarnMsg( 5, "    source res: %s",
139
 
                     psz_source_res[video.i_source_res] );
140
 
    intf_WarnMsg( 5, "    letterboxed: %s",
141
 
                     video.i_letterboxed ? "yes" : "no" );
142
 
    intf_WarnMsg( 5, "    mode: %s",
143
 
                     video.i_mode ? "film (625/50 only)" : "camera");
144
 
}
145
 
#undef video
146
 
 
147
 
/****************************************************************************
148
 
 * IfoPrintAudio
149
 
 ****************************************************************************/
150
 
#define audio p_dvd->p_ifo->vts.manager_inf.p_audio_attr[i-1]
151
 
#define audio_status \
152
 
    p_dvd->p_ifo->vts.title_unit.p_title[p_dvd->i_title_id-1].title.pi_audio_status[i-1]
153
 
void IfoPrintAudio( thread_dvd_data_t * p_dvd, int i )
154
 
{
155
 
 
156
 
    if( audio_status.i_available )
157
 
    {
158
 
        char    ppsz_mode[7][9] =
159
 
                { "ac3", "unknown", "mpeg-1", "mpeg-2", "lpcm", "sdds", "dts" };
160
 
        char    ppsz_appl_mode[3][15] =
161
 
                { "not specified", "karaoke", "surround sound" };
162
 
        char    psz_caption[25];
163
 
        char    ppsz_quant[4][10] =
164
 
                { "16 bits", "20 bits", "24 bits", "drc" };
165
 
    
166
 
        intf_WarnMsg( 5, "dvd info: audio %d" , i );
167
 
        intf_WarnMsg( 5, "    language: %s", 
168
 
                         DecodeLanguage( hton16( audio.i_lang_code ) ) );
169
 
        intf_WarnMsg( 5, "    mode: %s", ppsz_mode[audio.i_coding_mode & 0x7] );
170
 
        intf_WarnMsg( 5, "    channel(s): %d %s",
171
 
                         audio.i_num_channels + 1,
172
 
                         audio.i_multichannel_extension ? "ext." : "" );
173
 
        intf_WarnMsg( 5, "    sampling: %d Hz",
174
 
                         audio.i_sample_freq ? 96000 : 48000 );
175
 
        intf_WarnMsg( 5, "    appl_mode: %s",
176
 
                         ppsz_appl_mode[audio.i_appl_mode & 0x2] );
177
 
        switch( audio.i_caption )
178
 
        {
179
 
        case 1:
180
 
            sprintf( psz_caption, "normal caption" );
181
 
            break;
182
 
        case 3:
183
 
            sprintf( psz_caption, "directors comments" );
184
 
            break;
185
 
        default:
186
 
            sprintf( psz_caption, " " );
187
 
            break;
188
 
        }
189
 
        intf_WarnMsg( 5, "    caption: %s", psz_caption );
190
 
        intf_WarnMsg( 5, "    quantization: %s",
191
 
                         ppsz_quant[audio.i_quantization & 0x3] );
192
 
    
193
 
        intf_WarnMsg( 5, "    status: %x", audio_status.i_position );
194
 
    }
195
 
 
196
 
 
197
 
}
198
 
#undef audio_status
199
 
#undef audio
200
 
 
201
 
/****************************************************************************
202
 
 * IfoPrintSpu
203
 
 ****************************************************************************/
204
 
#define spu p_dvd->p_ifo->vts.manager_inf.p_spu_attr[i-1]
205
 
#define spu_status \
206
 
    p_dvd->p_ifo->vts.title_unit.p_title[p_dvd->i_title_id-1].title.pi_spu_status[i-1]
207
 
 
208
 
void IfoPrintSpu( thread_dvd_data_t * p_dvd, int i )
209
 
{
210
 
    if( spu_status.i_available )
211
 
    {
212
 
        intf_WarnMsg( 5, "dvd info: spu %d", i );
213
 
        intf_WarnMsg( 5, "    caption: %d", spu.i_caption );
214
 
        intf_WarnMsg( 5, "    language: %s",
215
 
                         DecodeLanguage( hton16( spu.i_lang_code ) ) );
216
 
        intf_WarnMsg( 5, "    prefix: %x", spu.i_prefix );
217
 
 
218
 
        intf_WarnMsg( 5, "    status: 4:3 %x wide %x letter %x pan %x",
219
 
            spu_status.i_position_43,
220
 
            spu_status.i_position_wide,
221
 
            spu_status.i_position_letter,
222
 
            spu_status.i_position_pan );
223
 
    }
224
 
 
225
 
}
226
 
#undef spu_status
227
 
#undef spu