~ubuntu-branches/debian/wheezy/vlc/wheezy

« back to all changes in this revision

Viewing changes to modules/gui/skins2/vars/stream.cpp

Tags: upstream-0.7.2.final
Import upstream version 0.7.2.final

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*****************************************************************************
 
2
 * time.cpp
 
3
 *****************************************************************************
 
4
 * Copyright (C) 2003 VideoLAN
 
5
 * $Id: stream.cpp 7397 2004-04-20 17:27:30Z sam $
 
6
 *
 
7
 * Authors: Olivier Teuli�re <ipkiss@via.ecp.fr>
 
8
 *
 
9
 * This program is free software; you can redistribute it and/or modify
 
10
 * it under the terms of the GNU General Public License as published by
 
11
 * the Free Software Foundation; either version 2 of the License, or
 
12
 * (at your option) any later version.
 
13
 *
 
14
 * This program is distributed in the hope that it will be useful,
 
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
17
 * GNU General Public License for more details.
 
18
 *
 
19
 * You should have received a copy of the GNU General Public License
 
20
 * along with this program; if not, write to the Free Software
 
21
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
 
22
 *****************************************************************************/
 
23
 
 
24
#include <stdio.h>  // snprintf
 
25
 
 
26
#include "stream.hpp"
 
27
#include "../utils/ustring.hpp"
 
28
#include "../src/os_factory.hpp"
 
29
#include <vlc/input.h>
 
30
 
 
31
 
 
32
void Stream::set( const UString &name, bool updateVLC )
 
33
{
 
34
    VarText::set( name );
 
35
 
 
36
    // Avoid looping forever...
 
37
    if( updateVLC )
 
38
    {
 
39
        // We have nothing to do here, until we decide that the user
 
40
        // can change a stream name on the fly...
 
41
    }
 
42
}
 
43
 
 
44
 
 
45
const string Stream::getAsStringName() const
 
46
{
 
47
    string fullName = getAsStringFullName();
 
48
 
 
49
    // XXX: This should be done in VLC core, not here...
 
50
    // Remove path information if any
 
51
    OSFactory *pFactory = OSFactory::instance( getIntf() );
 
52
    string::size_type pos = fullName.rfind( pFactory->getDirSeparator() );
 
53
    if( pos != string::npos )
 
54
    {
 
55
        fullName = fullName.substr( pos + 1, fullName.size() - pos + 1 );
 
56
    }
 
57
 
 
58
    return fullName;
 
59
}
 
60
 
 
61
 
 
62
const string Stream::getAsStringFullName() const
 
63
{
 
64
    string ret;
 
65
 
 
66
    // XXX: we are not using geIntf()->p_sys->p_input direclty here, because it
 
67
    // is not updated by VlcProc yet. Anyway, we shouldn't need to do that,
 
68
    // because VLC core should provide getter functions for the stream name...
 
69
    if( getIntf()->p_sys->p_playlist->p_input == NULL )
 
70
    {
 
71
        ret = "";
 
72
    }
 
73
    else
 
74
    {
 
75
        ret = getIntf()->p_sys->p_playlist->p_input->psz_source;
 
76
    }
 
77
 
 
78
    return ret;
 
79
}
 
80