Changeset 467472bcecd6bae797dea03543ca105a61a8f6c2
- Timestamp:
- 15/04/06 18:18:59
(3 years ago)
- Author:
- Cyril Deguet <asmax@videolan.org>
- git-committer:
- Cyril Deguet <asmax@videolan.org> 1145117939 +0000
- git-parent:
[3782ac32ca58235b122f82b568969a2073836d92]
- git-author:
- Cyril Deguet <asmax@videolan.org> 1145117939 +0000
- Message:
* all: added a new skin text variable "$S" to get the audio sample rate
(in KHz) + fixed the bitrate ("$B") variable to use only the audio bit rate.
* winamp2.xml: updated the winamp2 skin
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r858ff0c |
r467472b |
|
| 922 | 922 | <itemizedlist> |
|---|
| 923 | 923 | <listitem><para> |
|---|
| 924 | | <emphasis>$B</emphasis>: Get the stream bitrate (in kb/s). |
|---|
| | 924 | <emphasis>$B</emphasis>: Get the audio stream bitrate (in kb/s). |
|---|
| 925 | 925 | </para></listitem> |
|---|
| 926 | 926 | <listitem><para> |
|---|
| … | … | |
| 948 | 948 | <listitem><para> |
|---|
| 949 | 949 | <emphasis>$F</emphasis>: Full name (with path) of the stream that is being played. |
|---|
| | 950 | </para></listitem> |
|---|
| | 951 | <listitem><para> |
|---|
| | 952 | <emphasis>$S</emphasis>: Get the audio sample rate (in kHz). |
|---|
| 950 | 953 | </para></listitem> |
|---|
| 951 | 954 | </itemizedlist> |
|---|
| ref5c233 |
r467472b |
|
| 27 | 27 | #include <aout_internal.h> |
|---|
| 28 | 28 | |
|---|
| 29 | | #include <math.h> |
|---|
| 30 | 29 | #include "vlcproc.hpp" |
|---|
| 31 | 30 | #include "os_factory.hpp" |
|---|
| … | … | |
| 112 | 111 | m_cVarStreamBitRate = VariablePtr( new VarText( getIntf(), false ) ); |
|---|
| 113 | 112 | pVarManager->registerVar( m_cVarStreamBitRate, "bitrate" ); |
|---|
| | 113 | m_cVarStreamSampleRate = VariablePtr( new VarText( getIntf(), false ) ); |
|---|
| | 114 | pVarManager->registerVar( m_cVarStreamSampleRate, "samplerate" ); |
|---|
| 114 | 115 | |
|---|
| 115 | 116 | // Register the equalizer bands |
|---|
| … | … | |
| 244 | 245 | VarBoolImpl *pVarHasVout = (VarBoolImpl*)m_cVarHasVout.get(); |
|---|
| 245 | 246 | VarText *pBitrate = (VarText*)m_cVarStreamBitRate.get(); |
|---|
| | 247 | VarText *pSampleRate = (VarText*)m_cVarStreamSampleRate.get(); |
|---|
| 246 | 248 | |
|---|
| 247 | 249 | // Refresh audio variables |
|---|
| … | … | |
| 296 | 298 | } |
|---|
| 297 | 299 | |
|---|
| 298 | | // Get information on the current playlist item |
|---|
| 299 | | input_item_t *pItem = pInput->input.p_item; |
|---|
| 300 | 300 | // Get the input bitrate |
|---|
| 301 | | int bitrate = (int)(roundf(pItem->p_stats->f_demux_bitrate*8000)); |
|---|
| | 301 | int bitrate = var_GetInteger( pInput, "bit-rate" ) / 1000; |
|---|
| 302 | 302 | pBitrate->set( UString::fromInt( getIntf(), bitrate ) ); |
|---|
| | 303 | |
|---|
| | 304 | // Get the audio sample rate |
|---|
| | 305 | int sampleRate = var_GetInteger( pInput, "sample-rate" ) / 1000; |
|---|
| | 306 | pSampleRate->set( UString::fromInt( getIntf(), sampleRate ) ); |
|---|
| 303 | 307 | } |
|---|
| 304 | 308 | else |
|---|
| ref5c233 |
r467472b |
|
| 76 | 76 | VarText &getStreamBitRateVar() |
|---|
| 77 | 77 | { return *((VarText*)(m_cVarStreamBitRate.get())); } |
|---|
| | 78 | |
|---|
| | 79 | /// Getter for the stream sample rate variable |
|---|
| | 80 | VarText &getStreamSampleRateVar() |
|---|
| | 81 | { return *((VarText*)(m_cVarStreamSampleRate.get())); } |
|---|
| 78 | 82 | |
|---|
| 79 | 83 | /// Getter for the vout size variable |
|---|
| … | … | |
| 116 | 120 | VariablePtr m_cVarStreamURI; |
|---|
| 117 | 121 | VariablePtr m_cVarStreamBitRate; |
|---|
| | 122 | VariablePtr m_cVarStreamSampleRate; |
|---|
| 118 | 123 | /// Variable for the "mute" state |
|---|
| 119 | 124 | VariablePtr m_cVarMute; |
|---|
| ref5c233 |
r467472b |
|
| 50 | 50 | pVlcProc->getStreamNameVar().delObserver( this ); |
|---|
| 51 | 51 | pVlcProc->getStreamBitRateVar().delObserver( this ); |
|---|
| | 52 | pVlcProc->getStreamSampleRateVar().delObserver( this ); |
|---|
| 52 | 53 | VarManager *pVarManager = VarManager::instance( getIntf() ); |
|---|
| 53 | 54 | pVarManager->getHelpText().delObserver( this ); |
|---|
| … | … | |
| 126 | 127 | { |
|---|
| 127 | 128 | temp.replace( pos, 2, pVlcProc->getStreamBitRateVar().get() ); |
|---|
| | 129 | } |
|---|
| | 130 | while( (pos = temp.find( "$S" )) != UString::npos ) |
|---|
| | 131 | { |
|---|
| | 132 | temp.replace( pos, 2, pVlcProc->getStreamSampleRateVar().get() ); |
|---|
| 128 | 133 | } |
|---|
| 129 | 134 | |
|---|
| … | … | |
| 151 | 156 | pVlcProc->getStreamURIVar().delObserver( this ); |
|---|
| 152 | 157 | pVlcProc->getStreamBitRateVar().delObserver( this ); |
|---|
| | 158 | pVlcProc->getStreamSampleRateVar().delObserver( this ); |
|---|
| 153 | 159 | VarManager *pVarManager = VarManager::instance( getIntf() ); |
|---|
| 154 | 160 | pVarManager->getHelpText().delObserver( this ); |
|---|
| … | … | |
| 189 | 195 | { |
|---|
| 190 | 196 | pVlcProc->getStreamBitRateVar().addObserver( this ); |
|---|
| | 197 | } |
|---|
| | 198 | if( m_text.find( "$S" ) != UString::npos ) |
|---|
| | 199 | { |
|---|
| | 200 | pVlcProc->getStreamSampleRateVar().addObserver( this ); |
|---|
| 191 | 201 | } |
|---|
| 192 | 202 | } |
|---|
| … | … | |
| 218 | 228 | } |
|---|
| 219 | 229 | } |
|---|
| | 230 | |
|---|
| ref5c233 |
r467472b |
|
| 196 | 196 | <Text font="text_font" x="111" y="27" width="155" text="$N" /> |
|---|
| 197 | 197 | <Text font="text_font" x="111" y="43" width="15" text="$B" scrolling="none" alignment="right" /> |
|---|
| | 198 | <Text font="text_font" x="151" y="43" width="15" text="$S" scrolling="none" alignment="right" /> |
|---|
| 198 | 199 | <Slider value="volume" x="107" y="57" up="volume_up" down="volume_down" points="(7,6),(58,6)" tooltiptext="Volume: $V%"> |
|---|
| 199 | 200 | <SliderBackground image="volume_bg;volume_bg_2" nbvert="28" padvert="2" /> |
|---|
| r470b47f |
r467472b |
|
| 1597 | 1597 | |
|---|
| 1598 | 1598 | if( fmt->audio.i_rate > 0 ) |
|---|
| | 1599 | { |
|---|
| 1599 | 1600 | input_Control( p_input, INPUT_ADD_INFO, psz_cat, _("Sample rate"), |
|---|
| 1600 | 1601 | _("%d Hz"), fmt->audio.i_rate ); |
|---|
| | 1602 | var_SetInteger( p_input, "sample-rate", fmt->audio.i_rate ); |
|---|
| | 1603 | } |
|---|
| 1601 | 1604 | |
|---|
| 1602 | 1605 | if( fmt->audio.i_bitspersample > 0 ) |
|---|
| … | … | |
| 1606 | 1609 | |
|---|
| 1607 | 1610 | if( fmt->i_bitrate > 0 ) |
|---|
| | 1611 | { |
|---|
| 1608 | 1612 | input_Control( p_input, INPUT_ADD_INFO, psz_cat, _("Bitrate"), |
|---|
| 1609 | 1613 | _("%d kb/s"), fmt->i_bitrate / 1000 ); |
|---|
| | 1614 | var_SetInteger( p_input, "bit-rate", fmt->i_bitrate ); |
|---|
| | 1615 | } |
|---|
| 1610 | 1616 | break; |
|---|
| 1611 | 1617 | |
|---|
| rfc1cbba |
r467472b |
|
| 726 | 726 | es_out_Control( p_input->p_es_out, ES_OUT_SET_ACTIVE, VLC_FALSE ); |
|---|
| 727 | 727 | es_out_Control( p_input->p_es_out, ES_OUT_SET_MODE, ES_OUT_MODE_NONE ); |
|---|
| | 728 | |
|---|
| | 729 | var_Create( p_input, "bit-rate", VLC_VAR_INTEGER ); |
|---|
| | 730 | var_Create( p_input, "sample-rate", VLC_VAR_INTEGER ); |
|---|
| 728 | 731 | |
|---|
| 729 | 732 | if( InputSourceInit( p_input, &p_input->input, |
|---|