<para>When specifying the <link linkend="texttext">text</link> attribute of the <link linkend="Text">Text</link> control or any tooltip attribute, you can insert escape sequences which will be expanded dynamically. An escape sequence always starts with the '$' character, followed by one or more predefined letters. Here is the list of accepted escape sequences:</para>
<itemizedlist>
+ <listitem><para>
+ <emphasis>$B</emphasis>: Get the stream bitrate (in kb/s).
+ </para></listitem>
<listitem><para>
<emphasis>$V</emphasis>: Value of the volume (from 0 to 100 --> useful for a percentage).
</para></listitem>
fmt_out.i_chroma = VLC_FOURCC('R','V','3','2');
+fprintf(stderr,"FILE %s\n", fileName.c_str());
+
pPic = image_ReadUrl( pImageHandler, fileName.c_str(), &fmt_in, &fmt_out );
if( !pPic ) return;
#include <vlc/vout.h>
#include <aout_internal.h>
+#include <math.h>
#include "vlcproc.hpp"
#include "os_factory.hpp"
#include "os_timer.hpp"
pVarManager->registerVar( m_cVarStreamName, "streamName" );
m_cVarStreamURI = VariablePtr( new VarText( getIntf(), false ) );
pVarManager->registerVar( m_cVarStreamURI, "streamURI" );
+ m_cVarStreamBitRate = VariablePtr( new VarText( getIntf(), false ) );
+ pVarManager->registerVar( m_cVarStreamBitRate, "bitrate" );
// Register the equalizer bands
for( int i = 0; i < EqualizerBands::kNbBands; i++)
VarBoolImpl *pVarDvdActive = (VarBoolImpl*)m_cVarDvdActive.get();
VarBoolImpl *pVarFullscreen = (VarBoolImpl*)m_cVarFullscreen.get();
VarBoolImpl *pVarHasVout = (VarBoolImpl*)m_cVarHasVout.get();
+ VarText *pBitrate = (VarText*)m_cVarStreamBitRate.get();
// Refresh audio variables
refreshAudio();
pVarFullscreen->set( pVout->b_fullscreen );
vlc_object_release( pVout );
}
+
+ // Get information on the current playlist item
+ input_item_t *pItem = pInput->input.p_item;
+ // Get the input bitrate
+ int bitrate = (int)(roundf(pItem->p_stats->f_demux_bitrate*8000));
+ pBitrate->set( UString::fromInt( getIntf(), bitrate ) );
}
else
{
void VlcProc::updateStreamName( playlist_t *p_playlist )
{
- if( p_playlist->p_input )
+ if( p_playlist && p_playlist->p_input )
{
+ // Get playlist item information
+ input_item_t *pItem = p_playlist->p_input->input.p_item;
+
VarText &rStreamName = getStreamNameVar();
VarText &rStreamURI = getStreamURIVar();
// XXX: we should not need to access p_input->psz_source directly, a
// getter should be provided by VLC core
- string name = p_playlist->p_input->input.p_item->psz_name;
+ string name = pItem->psz_name;
// XXX: This should be done in VLC core, not here...
// Remove path information if any
OSFactory *pFactory = OSFactory::instance( getIntf() );
name = name.substr( pos + 1, name.size() - pos + 1 );
}
UString srcName( getIntf(), name.c_str() );
- UString srcURI( getIntf(),
- p_playlist->p_input->input.p_item->psz_uri );
+ UString srcURI( getIntf(), pItem->psz_uri );
- // Create commands to update the stream variables
+ // Create commands to update the stream variables
CmdSetText *pCmd1 = new CmdSetText( getIntf(), rStreamName, srcName );
CmdSetText *pCmd2 = new CmdSetText( getIntf(), rStreamURI, srcURI );
// Push the commands in the asynchronous command queue
VarText &getStreamURIVar()
{ return *((VarText*)(m_cVarStreamURI.get())); }
+ /// Getter for the stream bitrate variable
+ VarText &getStreamBitRateVar()
+ { return *((VarText*)(m_cVarStreamBitRate.get())); }
+
/// Getter for the vout size variable
VarBox &getVoutSizeVar() { return m_varVoutSize; }
/// Variable for current stream properties
VariablePtr m_cVarStreamName;
VariablePtr m_cVarStreamURI;
+ VariablePtr m_cVarStreamBitRate;
/// Variable for the "mute" state
VariablePtr m_cVarMute;
/// Variables related to the input
*****************************************************************************/
#include <string.h>
+#include <sstream>
#include "ustring.hpp"
return tmp;
}
+
+
+UString UString::fromInt( intf_thread_t *pIntf, int number)
+{
+ stringstream ss;
+ ss << number;
+ return UString( pIntf, ss.str().c_str() );
+}
+
/// characters in this string starting at index position
UString substr( uint32_t position = 0, uint32_t n = npos) const;
+ /// Build a string from an integer
+ static UString fromInt(intf_thread_t *pIntf, int number);
+
/// XXX: temporary
void debug() const;
pVlcProc->getVolumeVar().delObserver( this );
pVlcProc->getStreamURIVar().delObserver( this );
pVlcProc->getStreamNameVar().delObserver( this );
+ pVlcProc->getStreamBitRateVar().delObserver( this );
VarManager *pVarManager = VarManager::instance( getIntf() );
pVarManager->getHelpText().delObserver( this );
}
{
temp.replace( pos, 2, pVlcProc->getStreamURIVar().get() );
}
+ while( (pos = temp.find( "$B" )) != UString::npos )
+ {
+ temp.replace( pos, 2, pVlcProc->getStreamBitRateVar().get() );
+ }
return temp;
}
pVlcProc->getVolumeVar().delObserver( this );
pVlcProc->getStreamNameVar().delObserver( this );
pVlcProc->getStreamURIVar().delObserver( this );
+ pVlcProc->getStreamBitRateVar().delObserver( this );
VarManager *pVarManager = VarManager::instance( getIntf() );
pVarManager->getHelpText().delObserver( this );
{
pVlcProc->getStreamURIVar().addObserver( this );
}
+ if( m_text.find( "$B" ) != UString::npos )
+ {
+ pVlcProc->getStreamBitRateVar().addObserver( this );
+ }
}
notify();
<Image x="0" y="0" image="title_focus" action="move" action2="main_window.setLayout(small_layout)" />
<Text font="digits_font;digits_font_2" x="30" y="26" width="72" text="$t" visible="not vlc.isStopped" scrolling="none" alignment="right" />
<Text font="text_font" x="111" y="27" width="155" text="$N" />
+ <Text font="text_font" x="111" y="43" width="15" text="$B" scrolling="none" alignment="right" />
<Slider value="volume" x="107" y="57" up="volume_up" down="volume_down" points="(7,6),(58,6)" tooltiptext="Volume: $V%">
<SliderBackground image="volume_bg;volume_bg_2" nbvert="28" padvert="2" />
</Slider>