Commit 1083d47a authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

Use input_AddSlave instead of input_AddSubtitleOSD

parent b6bbe81d
......@@ -38,6 +38,7 @@
#include <vlc_modules.h>
#include <vlc_input.h>
#include <vlc_vout.h>
#include <vlc_url.h>
#include "libvlc_internal.h"
#include "media_player_internal.h"
......@@ -402,8 +403,14 @@ int libvlc_video_set_subtitle_file( libvlc_media_player_t *p_mi,
if( p_input_thread )
{
if( !input_AddSubtitle( p_input_thread, psz_subtitle, true ) )
b_ret = true;
char* psz_mrl = vlc_path2uri( psz_subtitle, NULL );
if( psz_mrl )
{
if( !input_AddSlave( p_input_thread, SLAVE_TYPE_SPU, psz_mrl,
true, false ) )
b_ret = true;
free( psz_mrl );
}
vlc_object_release( p_input_thread );
}
return b_ret;
......
......@@ -608,12 +608,15 @@ static int BossCallback(vlc_object_t *p_this, const char *psz_var,
NSUInteger count = [paths count];
for (int i = 0; i < count ; i++) {
const char *path = [[[paths objectAtIndex:i] path] UTF8String];
msg_Dbg(getIntf(), "loading subs from %s", path);
char *mrl = vlc_path2uri([[[paths objectAtIndex:i] path] UTF8String], NULL);
if (!mrl)
continue;
msg_Dbg(getIntf(), "loading subs from %s", mrl);
int i_result = input_AddSubtitleOSD(p_input, path, true, true);
int i_result = input_AddSlave(p_input, SLAVE_TYPE_SPU, mrl, true, true);
if (i_result != VLC_SUCCESS)
msg_Warn(getIntf(), "unable to load subtitles from '%s'", path);
msg_Warn(getIntf(), "unable to load subtitles from '%s'", mrl);
free(mrl);
}
vlc_object_release(p_input);
}
......
......@@ -606,15 +606,12 @@
{
input_thread_t *p_input = pl_CurrentInput(getIntf());
if (isSubtitle && array.count == 1 && p_input) {
char *path = vlc_uri2path([[[array firstObject] objectForKey:@"ITEM_URL"] UTF8String]);
if (path) {
int i_result = input_AddSubtitleOSD(p_input, path, true, true);
free(path);
if (i_result == VLC_SUCCESS) {
vlc_object_release(p_input);
return;
}
int i_result = input_AddSlave(p_input, SLAVE_TYPE_SPU,
[[[array firstObject] objectForKey:@"ITEM_URL"] UTF8String],
true, true);
if (i_result == VLC_SUCCESS) {
vlc_object_release(p_input);
return;
}
}
......
......@@ -806,8 +806,7 @@ void DialogsProvider::loadSubtitlesFile()
free( path2 );
foreach( const QString &qsUrl, qsl )
{
if( input_AddSubtitleOSD( p_input, qtu( toNativeSeparators( QUrl( qsUrl ).toLocalFile() ) ),
true, true ) )
if( input_AddSlave( p_input, SLAVE_TYPE_SPU, qtu( qsUrl ), true, true ) )
msg_Warn( p_intf, "unable to load subtitles from '%s'",
qtu( qsUrl ) );
}
......
......@@ -1452,9 +1452,8 @@ void MainInterface::dropEventPlay( QDropEvent *event, bool b_play, bool b_playli
/* D&D of a subtitles file, add it on the fly */
if( mimeData->urls().count() == 1 && THEMIM->getIM()->hasInput() )
{
if( !input_AddSubtitleOSD( THEMIM->getInput(),
qtu( toNativeSeparators( mimeData->urls()[0].toLocalFile() ) ),
true, true ) )
if( !input_AddSlave( THEMIM->getInput(), SLAVE_TYPE_SPU,
qtu( mimeData->urls()[0].toString() ), true, true ) )
{
event->accept();
return;
......
......@@ -264,12 +264,8 @@ void TopWindow::processEvent( EvtDragDrop &rEvtDragDrop )
if( files.size() == 1 && pInput != NULL )
{
std::list<std::string>::const_iterator it = files.begin();
char* psz_file = vlc_uri2path( it->c_str() );
if( psz_file )
{
is_subtitle = !input_AddSubtitleOSD( pInput, psz_file, true, true );
free( psz_file );
}
is_subtitle = !input_AddSlave( pInput, SLAVE_TYPE_SPU,
it->c_str(), true, true );
}
if( !is_subtitle )
{
......
......@@ -232,7 +232,12 @@ static int vlclua_input_add_subtitle( lua_State *L )
if( !lua_isstring( L, 1 ) )
return luaL_error( L, "vlc.input.add_subtitle() usage: (path)" );
const char *psz_path = luaL_checkstring( L, 1 );
input_AddSubtitle( p_input, psz_path, false );
char* psz_mrl = vlc_path2uri( psz_path, NULL );
if( psz_mrl )
{
input_AddSlave( p_input, SLAVE_TYPE_SPU, psz_mrl, false, false );
free( psz_mrl );
}
vlc_object_release( p_input );
return 1;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment