Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
073a4b90
Commit
073a4b90
authored
Dec 13, 2008
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved detection of multi-part files for rar.
parent
ea0b76fe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
67 additions
and
24 deletions
+67
-24
src/input/input.c
src/input/input.c
+67
-24
No files found.
src/input/input.c
View file @
073a4b90
...
@@ -2904,51 +2904,94 @@ static void AppendAttachment( int *pi_attachment, input_attachment_t ***ppp_atta
...
@@ -2904,51 +2904,94 @@ static void AppendAttachment( int *pi_attachment, input_attachment_t ***ppp_atta
* InputGetExtraFiles
* InputGetExtraFiles
* Autodetect extra input list
* Autodetect extra input list
*****************************************************************************/
*****************************************************************************/
static
void
InputGetExtraFiles
(
input_thread_t
*
p_input
,
static
void
InputGetExtraFilesPattern
(
input_thread_t
*
p_input
,
int
*
pi_list
,
char
***
pppsz_list
,
int
*
pi_list
,
char
***
pppsz_list
,
const
char
*
psz_access
,
const
char
*
psz_path
)
const
char
*
psz_path
,
const
char
*
psz_match
,
const
char
*
psz_format
,
int
i_start
,
int
i_stop
)
{
{
int
i_list
;
int
i_list
;
char
**
ppsz_list
;
char
**
ppsz_list
;
TAB_INIT
(
i_list
,
ppsz_list
);
TAB_INIT
(
i_list
,
ppsz_list
);
if
(
(
psz_access
&&
*
psz_access
&&
strcmp
(
psz_access
,
"file"
)
)
||
!
psz_path
)
char
*
psz_base
=
strdup
(
psz_path
);
goto
exit
;
if
(
!
psz_base
)
const
char
*
psz_ext
=
strrchr
(
psz_path
,
'.'
);
if
(
!
psz_ext
||
strcmp
(
psz_ext
,
".001"
)
)
goto
exit
;
goto
exit
;
char
*
psz_file
=
strdup
(
psz_path
);
/* Remove the extension */
if
(
!
psz_file
)
char
*
psz_end
=
&
psz_base
[
strlen
(
psz_base
)
-
strlen
(
psz_match
)];
goto
exit
;
assert
(
psz_end
>=
psz_base
);
*
psz_end
=
'\0'
;
/* Try to list
.xyz
files */
/* Try to list files */
for
(
int
i
=
2
;
i
<
999
;
i
++
)
for
(
int
i
=
i_start
;
i
<=
i_stop
;
i
++
)
{
{
char
*
psz_ext
=
strrchr
(
psz_file
,
'.'
);
struct
stat
st
;
struct
stat
st
;
char
*
psz_file
;
snprintf
(
psz_ext
,
5
,
".%.3d"
,
i
);
if
(
asprintf
(
&
psz_file
,
psz_format
,
psz_base
,
i
)
<
0
)
break
;
if
(
utf8_stat
(
psz_file
,
&
st
)
||
if
(
utf8_stat
(
psz_file
,
&
st
)
||
!
S_ISREG
(
st
.
st_mode
)
||
!
st
.
st_size
)
!
S_ISREG
(
st
.
st_mode
)
||
!
st
.
st_size
)
{
continue
;
free
(
psz_file
);
break
;
}
msg_Dbg
(
p_input
,
"Detected extra file `%s'"
,
psz_file
);
msg_Dbg
(
p_input
,
"Detected extra file `%s'"
,
psz_file
);
char
*
psz_tmp
=
strdup
(
psz_file
);
TAB_APPEND
(
i_list
,
ppsz_list
,
psz_file
);
if
(
psz_tmp
)
TAB_APPEND
(
i_list
,
ppsz_list
,
psz_tmp
);
}
}
free
(
psz_file
);
free
(
psz_base
);
exit:
exit:
*
pi_list
=
i_list
;
*
pi_list
=
i_list
;
*
pppsz_list
=
ppsz_list
;
*
pppsz_list
=
ppsz_list
;
}
}
static
void
InputGetExtraFiles
(
input_thread_t
*
p_input
,
int
*
pi_list
,
char
***
pppsz_list
,
const
char
*
psz_access
,
const
char
*
psz_path
)
{
static
const
struct
{
const
char
*
psz_match
;
const
char
*
psz_format
;
int
i_start
;
int
i_stop
;
}
p_pattern
[]
=
{
/* XXX the order is important */
{
".001"
,
"%s.%.3d"
,
2
,
999
},
{
".part1.rar"
,
"%s.part%.1d.rar"
,
2
,
9
},
{
".part01.rar"
,
"%s.part%.2d.rar"
,
2
,
99
,
},
{
".part001.rar"
,
"%s.part%.3d.rar"
,
2
,
999
},
{
".rar"
,
"%s.r%.2d"
,
1
,
99
},
{
NULL
,
NULL
,
0
,
0
}
};
TAB_INIT
(
*
pi_list
,
*
pppsz_list
);
if
(
(
psz_access
&&
*
psz_access
&&
strcmp
(
psz_access
,
"file"
)
)
||
!
psz_path
)
return
;
const
size_t
i_path
=
strlen
(
psz_path
);
for
(
int
i
=
0
;
p_pattern
[
i
].
psz_match
!=
NULL
;
i
++
)
{
const
size_t
i_ext
=
strlen
(
p_pattern
[
i
].
psz_match
);
if
(
i_path
<
i_ext
)
continue
;
if
(
!
strcmp
(
&
psz_path
[
i_path
-
i_ext
],
p_pattern
[
i
].
psz_match
)
)
{
InputGetExtraFilesPattern
(
p_input
,
pi_list
,
pppsz_list
,
psz_path
,
p_pattern
[
i
].
psz_match
,
p_pattern
[
i
].
psz_format
,
p_pattern
[
i
].
i_start
,
p_pattern
[
i
].
i_stop
);
return
;
}
}
}
/* */
/* */
static
void
input_ChangeState
(
input_thread_t
*
p_input
,
int
i_state
)
static
void
input_ChangeState
(
input_thread_t
*
p_input
,
int
i_state
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment