Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
c9c85bef
Commit
c9c85bef
authored
Jun 09, 2006
by
Yoann Peronneau
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* proof of concept of drag & dropping a subtitle file while playing a video file. (Refs: #645)
parent
92ee23d3
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
74 additions
and
5 deletions
+74
-5
include/vlc_input.h
include/vlc_input.h
+2
-0
include/vlc_symbols.h
include/vlc_symbols.h
+3
-0
modules/gui/wxwidgets/interface.cpp
modules/gui/wxwidgets/interface.cpp
+20
-0
src/input/input.c
src/input/input.c
+41
-0
src/input/input_internal.h
src/input/input_internal.h
+2
-0
src/input/subtitles.c
src/input/subtitles.c
+6
-5
No files found.
include/vlc_input.h
View file @
c9c85bef
...
...
@@ -506,4 +506,6 @@ VLC_EXPORT( decoder_t *, input_DecoderNew, ( input_thread_t *, es_format_t *, vl
VLC_EXPORT
(
void
,
input_DecoderDelete
,
(
decoder_t
*
)
);
VLC_EXPORT
(
void
,
input_DecoderDecode
,(
decoder_t
*
,
block_t
*
)
);
VLC_EXPORT
(
vlc_bool_t
,
input_AddSubtitles
,
(
input_thread_t
*
,
char
*
,
vlc_bool_t
)
);
#endif
include/vlc_symbols.h
View file @
c9c85bef
...
...
@@ -513,6 +513,7 @@ struct module_symbols_t
int
(
*
__intf_UserOkayCancel_inner
)
(
vlc_object_t
*
,
const
char
*
,
const
char
*
);
int
(
*
__intf_UserStringInput_inner
)
(
vlc_object_t
*
,
const
char
*
,
const
char
*
,
char
**
);
void
(
*
playlist_NodesCreateForSD_inner
)
(
playlist_t
*
,
char
*
,
playlist_item_t
**
,
playlist_item_t
**
);
vlc_bool_t
(
*
input_AddSubtitles_inner
)
(
input_thread_t
*
,
char
*
,
vlc_bool_t
);
};
# if defined (__PLUGIN__)
# define aout_FiltersCreatePipeline (p_symbols)->aout_FiltersCreatePipeline_inner
...
...
@@ -980,6 +981,7 @@ struct module_symbols_t
# define __intf_UserOkayCancel (p_symbols)->__intf_UserOkayCancel_inner
# define __intf_UserStringInput (p_symbols)->__intf_UserStringInput_inner
# define playlist_NodesCreateForSD (p_symbols)->playlist_NodesCreateForSD_inner
# define input_AddSubtitles (p_symbols)->input_AddSubtitles_inner
# elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__)
/******************************************************************
* STORE_SYMBOLS: store VLC APIs into p_symbols for plugin access.
...
...
@@ -1450,6 +1452,7 @@ struct module_symbols_t
((p_symbols)->__intf_UserOkayCancel_inner) = __intf_UserOkayCancel; \
((p_symbols)->__intf_UserStringInput_inner) = __intf_UserStringInput; \
((p_symbols)->playlist_NodesCreateForSD_inner) = playlist_NodesCreateForSD; \
((p_symbols)->input_AddSubtitles_inner) = input_AddSubtitles; \
(p_symbols)->net_ConvertIPv4_deprecated = NULL; \
(p_symbols)->__playlist_ItemCopy_deprecated = NULL; \
(p_symbols)->playlist_ItemAddParent_deprecated = NULL; \
...
...
modules/gui/wxwidgets/interface.cpp
View file @
c9c85bef
...
...
@@ -1283,6 +1283,26 @@ bool DragAndDrop::OnDropFiles( wxCoord, wxCoord,
return
FALSE
;
}
/* If we drag & drop a subtitle file, add it on the fly */
if
(
filenames
.
GetCount
()
==
1
)
{
char
*
psz_utf8
=
wxDnDFromLocale
(
filenames
[
0
]
);
input_thread_t
*
p_input
=
(
input_thread_t
*
)
vlc_object_find
(
p_intf
,
VLC_OBJECT_INPUT
,
FIND_ANYWHERE
);
if
(
p_input
)
{
if
(
input_AddSubtitles
(
p_input
,
psz_utf8
,
VLC_TRUE
)
)
{
vlc_object_release
(
p_input
);
wxDnDLocaleFree
(
psz_utf8
);
vlc_object_release
(
p_playlist
);
return
TRUE
;
}
vlc_object_release
(
p_input
);
}
wxDnDLocaleFree
(
psz_utf8
);
}
for
(
size_t
i
=
0
;
i
<
filenames
.
GetCount
();
i
++
)
{
char
*
psz_utf8
=
wxDnDFromLocale
(
filenames
[
i
]
);
...
...
src/input/input.c
View file @
c9c85bef
...
...
@@ -2431,3 +2431,44 @@ static void MRLSections( input_thread_t *p_input, char *psz_source,
psz_source
,
*
pi_title_start
,
*
pi_chapter_start
,
*
pi_title_end
,
*
pi_chapter_end
);
}
/*****************************************************************************
* input_AddSubtitles: add a subtitles file and enable it
*****************************************************************************/
vlc_bool_t
input_AddSubtitles
(
input_thread_t
*
p_input
,
char
*
psz_subtitle
,
vlc_bool_t
b_check_extension
)
{
input_source_t
*
sub
;
vlc_value_t
count
;
vlc_value_t
list
;
if
(
b_check_extension
&&
!
subtitles_Filter
(
psz_subtitle
)
)
{
return
VLC_FALSE
;
}
var_Change
(
p_input
,
"spu-es"
,
VLC_VAR_CHOICESCOUNT
,
&
count
,
NULL
);
sub
=
InputSourceNew
(
p_input
);
if
(
!
InputSourceInit
(
p_input
,
sub
,
psz_subtitle
,
"subtitle"
,
VLC_FALSE
)
)
{
TAB_APPEND
(
p_input
->
i_slave
,
p_input
->
slave
,
sub
);
/* Select the ES */
if
(
!
var_Change
(
p_input
,
"spu-es"
,
VLC_VAR_GETLIST
,
&
list
,
NULL
)
)
{
if
(
count
.
i_int
==
0
)
count
.
i_int
++
;
/* if it was first one, there is disable too */
if
(
count
.
i_int
<
list
.
p_list
->
i_count
)
{
input_ControlPush
(
p_input
,
INPUT_CONTROL_SET_ES
,
&
list
.
p_list
->
p_values
[
count
.
i_int
]
);
}
var_Change
(
p_input
,
"spu-es"
,
VLC_VAR_FREELIST
,
&
list
,
NULL
);
}
}
return
VLC_TRUE
;
}
src/input/input_internal.h
View file @
c9c85bef
...
...
@@ -152,6 +152,8 @@ mtime_t input_ClockGetTS( input_thread_t *, input_clock_t *, mtime_t );
/* Subtitles */
char
**
subtitles_Detect
(
input_thread_t
*
,
char
*
path
,
char
*
fname
);
int
subtitles_Filter
(
const
char
*
);
void
MRLSplit
(
vlc_object_t
*
,
char
*
,
char
**
,
char
**
,
char
**
);
#endif
src/input/subtitles.c
View file @
c9c85bef
...
...
@@ -158,10 +158,11 @@ static int compare_sub_priority( const void *a, const void *b )
#endif
}
/* Utility function for scandir */
static
int
Filter
(
const
char
*
psz_dir_content
)
/*
* Check if a file ends with a subtitle extension
*/
int
subtitles_Filter
(
const
char
*
psz_dir_content
)
{
/* does it end with a subtitle extension? */
const
char
*
tmp
=
strrchr
(
psz_dir_content
,
'.'
);
if
(
tmp
==
NULL
)
return
0
;
...
...
@@ -344,8 +345,8 @@ char **subtitles_Detect( input_thread_t *p_this, char *psz_path,
continue
;
/* parse psz_src dir */
i_dir_content
=
utf8_scandir
(
psz_dir
,
&
ppsz_dir_content
,
Filter
,
NULL
);
i_dir_content
=
utf8_scandir
(
psz_dir
,
&
ppsz_dir_content
,
subtitles_Filter
,
NULL
);
if
(
i_dir_content
!=
-
1
)
{
...
...
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