2
2
* ifo.c: Dummy ifo demux to enable opening DVDs rips by double cliking on VIDEO_TS.IFO
3
3
*****************************************************************************
4
4
* Copyright (C) 2007 the VideoLAN team
5
* $Id: a4ede1f6d809d20d7fd1f37fc97246da9367330f $
5
* $Id: 54d29db9dd48790dcde3259038a19b0f0a403eec $
7
7
* Authors: Antoine Cellerier <dionoea @t videolan d.t org>
38
38
*****************************************************************************/
39
39
static int Demux( demux_t *p_demux);
40
static int DemuxDVD_VR( demux_t *p_demux);
40
41
static int Control( demux_t *p_demux, int i_query, va_list args );
42
43
/*****************************************************************************
47
48
demux_t *p_demux = (demux_t *)p_this;
49
char *psz_file = p_demux->psz_path + strlen( p_demux->psz_path )
50
- strlen( "VIDEO_TS.IFO" );
51
/* Valid filenamed are :
50
size_t len = strlen( p_demux->psz_path );
52
char *psz_file = p_demux->psz_path + len - strlen( "VIDEO_TS.IFO" );
53
/* Valid filenames are :
53
55
* - VTS_XX_X.IFO where X are digits
55
if( strlen( p_demux->psz_path ) > strlen( "VIDEO_TS.IFO" )
57
if( len > strlen( "VIDEO_TS.IFO" )
56
58
&& ( !strcasecmp( psz_file, "VIDEO_TS.IFO" )
57
59
|| (!strncasecmp( psz_file, "VTS_", 4 )
58
60
&& !strcasecmp( psz_file + strlen( "VTS_00_0" ) , ".IFO" ) ) ) )
64
66
if( i_peek != 8 || memcmp( p_peek, "DVDVIDEO", 8 ) )
65
67
return VLC_EGENERIC;
69
p_demux->pf_demux = Demux;
71
/* Valid filename for DVD-VR is VR_MANGR.IFO */
72
else if( len >= 12 && !strcmp( &p_demux->psz_path[len-12], "VR_MANGR.IFO" ) )
75
const uint8_t *p_peek;
76
i_peek = stream_Peek( p_demux->s, &p_peek, 8 );
78
if( i_peek != 8 || memcmp( p_peek, "DVD_RTR_", 8 ) )
81
p_demux->pf_demux = DemuxDVD_VR;
68
84
return VLC_EGENERIC;
70
86
// STANDARD_DEMUX_INIT_MSG( "found valid VIDEO_TS.IFO" )
71
87
p_demux->pf_control = Control;
72
p_demux->pf_demux = Demux;
74
89
return VLC_SUCCESS;
85
100
static int Demux( demux_t *p_demux )
89
input_item_t *p_input;
93
len = strlen( "dvd://" ) + strlen( p_demux->psz_path )
94
- strlen( "VIDEO_TS.IFO" );
95
psz_url = (char *)malloc( len+1 );
102
size_t len = strlen( "dvd://" ) + strlen( p_demux->psz_path )
103
- strlen( "VIDEO_TS.IFO" );
106
psz_url = malloc( len+1 );
96
109
snprintf( psz_url, len+1, "dvd://%s", p_demux->psz_path );
98
p_input = input_item_New( p_demux, psz_url, psz_url );
99
input_item_AddSubItem( p_current_input, p_input );
100
vlc_gc_decref( p_input );
102
HANDLE_PLAY_AND_RELEASE;
104
return 0; /* Needed for correct operation of go back */
111
input_item_t *p_current_input = GetCurrentItem(p_demux);
112
input_item_t *p_input = input_item_New( p_demux, psz_url, psz_url );
113
input_item_PostSubItem( p_current_input, p_input );
114
vlc_gc_decref( p_input );
116
vlc_gc_decref(p_current_input);
119
return 0; /* Needed for correct operation of go back */
122
static int DemuxDVD_VR( demux_t *p_demux )
124
char *psz_url = strdup( p_demux->psz_path );
129
size_t len = strlen( psz_url );
131
strncpy( psz_url + len - 12, "VR_MOVIE.VRO", 12 );
133
input_item_t *p_current_input = GetCurrentItem(p_demux);
134
input_item_t *p_input = input_item_New( p_demux, psz_url, psz_url );
135
input_item_PostSubItem( p_current_input, p_input );
137
vlc_gc_decref( p_input );
139
vlc_gc_decref(p_current_input);
142
return 0; /* Needed for correct operation of go back */
107
146
static int Control( demux_t *p_demux, int i_query, va_list args )