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
33464f10
Commit
33464f10
authored
Jan 26, 2004
by
Gildas Bazin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* src/input/*, modules/demux/util/sub.[ch]: cleanup and fixed memory leaks.
parent
361dab55
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
29 deletions
+23
-29
modules/demux/util/sub.c
modules/demux/util/sub.c
+6
-16
modules/demux/util/sub.h
modules/demux/util/sub.h
+2
-1
src/input/input.c
src/input/input.c
+4
-3
src/input/subtitles.c
src/input/subtitles.c
+11
-9
No files found.
modules/demux/util/sub.c
View file @
33464f10
...
...
@@ -2,7 +2,7 @@
* sub.c
*****************************************************************************
* Copyright (C) 1999-2003 VideoLAN
* $Id: sub.c,v 1.4
2 2004/01/26 20:02:15
gbazin Exp $
* $Id: sub.c,v 1.4
3 2004/01/26 20:26:54
gbazin Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
...
...
@@ -270,6 +270,7 @@ static int sub_open( subtitle_demux_t *p_sub, input_thread_t *p_input,
p_sub
->
p_es
=
NULL
;
p_sub
->
i_subtitles
=
0
;
p_sub
->
subtitle
=
NULL
;
p_sub
->
p_vobsub_file
=
0
;
p_sub
->
p_input
=
p_input
;
if
(
!
psz_name
||
!*
psz_name
)
...
...
@@ -423,22 +424,11 @@ static int sub_open( subtitle_demux_t *p_sub, input_thread_t *p_input,
if
(
p_sub
->
i_subtitles
>=
i_max
)
{
i_max
+=
128
;
if
(
p_sub
->
subtitle
)
if
(
!
(
p_sub
->
subtitle
=
realloc
(
p_sub
->
subtitle
,
sizeof
(
subtitle_t
)
*
i_max
)
)
)
{
if
(
!
(
p_sub
->
subtitle
=
realloc
(
p_sub
->
subtitle
,
sizeof
(
subtitle_t
)
*
i_max
)
)
)
{
msg_Err
(
p_sub
,
"out of memory"
);
return
VLC_ENOMEM
;
}
}
else
{
if
(
!
(
p_sub
->
subtitle
=
malloc
(
sizeof
(
subtitle_t
)
*
i_max
)
)
)
{
msg_Err
(
p_sub
,
"out of memory"
);
return
VLC_ENOMEM
;
}
msg_Err
(
p_sub
,
"out of memory"
);
return
VLC_ENOMEM
;
}
}
if
(
pf_read_subtitle
(
p_sub
,
&
txt
,
...
...
modules/demux/util/sub.h
View file @
33464f10
...
...
@@ -2,7 +2,7 @@
* sub.h
*****************************************************************************
* Copyright (C) 2001-2003 VideoLAN
* $Id: sub.h,v 1.1
3 2004/01/26 20:02:15
gbazin Exp $
* $Id: sub.h,v 1.1
4 2004/01/26 20:26:54
gbazin Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
...
...
@@ -159,6 +159,7 @@ static inline void subtitle_Close( subtitle_demux_t *p_sub )
msg_Info
(
p_sub
,
"subtitle stopped"
);
if
(
p_sub
)
{
p_sub
->
pf_close
(
p_sub
);
vlc_object_detach
(
p_sub
);
if
(
p_sub
->
p_module
)
{
...
...
src/input/input.c
View file @
33464f10
...
...
@@ -4,7 +4,7 @@
* decoders.
*****************************************************************************
* Copyright (C) 1998-2004 VideoLAN
* $Id: input.c,v 1.27
8 2004/01/26 20:02:15
gbazin Exp $
* $Id: input.c,v 1.27
9 2004/01/26 20:26:54
gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
...
...
@@ -837,13 +837,14 @@ static int InitThread( input_thread_t * p_input )
char
**
tmp2
=
tmp
;
for
(
i
=
0
;
*
tmp2
!=
NULL
;
i
++
)
{
if
(
(
p_sub
=
subtitle_New
(
p_input
,
*
tmp2
++
,
if
(
(
p_sub
=
subtitle_New
(
p_input
,
*
tmp2
,
i_microsecondperframe
,
i
)
)
)
{
TAB_APPEND
(
p_input
->
p_sys
->
i_sub
,
p_input
->
p_sys
->
sub
,
p_sub
);
}
free
(
*
tmp2
++
);
}
free
(
tmp
);
free
(
tmp
);
}
es_out_Control
(
p_input
->
p_es_out
,
ES_OUT_SET_ACTIVE
,
VLC_TRUE
);
...
...
src/input/subtitles.c
View file @
33464f10
...
...
@@ -2,7 +2,7 @@
* subtitles.c
*****************************************************************************
* Copyright (C) 2003-2004 VideoLAN
* $Id: subtitles.c,v 1.
9 2004/01/26 19:20:10
gbazin Exp $
* $Id: subtitles.c,v 1.
10 2004/01/26 20:26:54
gbazin Exp $
*
* Authors: Derk-Jan Hartman <hartman at videolan.org>
* This is adapted code from the GPL'ed MPlayer (http://mplayerhq.hu)
...
...
@@ -243,7 +243,8 @@ char **subtitles_Detect( input_thread_t *p_this, char *psz_path,
if
(
strcmp
(
sub_exts
[
i
],
tmp_fname_ext
)
==
0
)
{
b_found
=
1
;
msg_Dbg
(
p_this
,
"found a possible subtitle: %s"
,
de
->
d_name
);
msg_Dbg
(
p_this
,
"found a possible subtitle: %s"
,
de
->
d_name
);
break
;
}
}
...
...
@@ -252,12 +253,13 @@ char **subtitles_Detect( input_thread_t *p_this, char *psz_path,
if
(
b_found
)
{
int
i_prio
=
0
;
if
(
!
i_prio
&&
strcmp
(
tmp_fname_trim
,
f_fname_trim
)
==
0
)
if
(
!
i_prio
&&
!
strcmp
(
tmp_fname_trim
,
f_fname_trim
)
)
{
/* matches the movie name exactly */
i_prio
=
4
;
}
if
(
!
i_prio
&&
(
tmp
=
strstr
(
tmp_fname_trim
,
f_fname_trim
)
)
)
if
(
!
i_prio
&&
(
tmp
=
strstr
(
tmp_fname_trim
,
f_fname_trim
)
)
)
{
/* contains the movie name */
tmp
+=
strlen
(
f_fname_trim
);
...
...
@@ -281,17 +283,18 @@ char **subtitles_Detect( input_thread_t *p_this, char *psz_path,
if
(
i_prio
>=
fuzzy
.
i_int
)
{
sprintf
(
tmpresult
,
"%s%s"
,
j
==
0
?
f_dir
:
psz_path
,
de
->
d_name
);
msg_Dbg
(
p_this
,
"autodetected subtitle: %s with priority %d"
,
de
->
d_name
,
i_prio
);
sprintf
(
tmpresult
,
"%s%s"
,
j
==
0
?
f_dir
:
psz_path
,
de
->
d_name
);
msg_Dbg
(
p_this
,
"autodetected subtitle: %s with "
"priority %d"
,
de
->
d_name
,
i_prio
);
if
(
(
f
=
fopen
(
tmpresult
,
"rt"
)
)
)
{
fclose
(
f
);
result
[
i_sub_count
].
priority
=
i_prio
;
result
[
i_sub_count
].
psz_fname
=
strdup
(
tmpresult
);
result
[
i_sub_count
].
psz_fname
=
strdup
(
tmpresult
);
i_sub_count
++
;
}
}
}
if
(
i_sub_count
>=
MAX_SUBTITLE_FILES
)
break
;
}
...
...
@@ -323,4 +326,3 @@ char **subtitles_Detect( input_thread_t *p_this, char *psz_path,
free
(
result
);
return
result2
;
}
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