Commit f5009d6f authored by Clément Stenac's avatar Clément Stenac

Recommit 9469->9479 + fix wxT/wxU

parent d8e40e92
......@@ -67,6 +67,10 @@ static void Close( vlc_object_t * );
#define RECONNECT_LONGTEXT N_("Will automatically attempt a re-connection " \
"in case it was untimely closed.")
#define CONTINUOUS_TEXT N_("Continuous stream")
#define CONTINUOUS_LONGTEXT N_("Enable this option to read a file that is " \
"being constantly updated (for example, a JPG file on a server)")
vlc_module_begin();
set_description( _("HTTP input") );
set_capability( "access2", 0 );
......@@ -81,10 +85,13 @@ vlc_module_begin();
AGENT_LONGTEXT, VLC_FALSE );
add_bool( "http-reconnect", 0, NULL, RECONNECT_TEXT,
RECONNECT_LONGTEXT, VLC_TRUE );
add_bool( "http-continuous", 0, NULL, CONTINUOUS_TEXT,
CONTINUOUS_LONGTEXT, VLC_TRUE );
add_shortcut( "http" );
add_shortcut( "http4" );
add_shortcut( "http6" );
add_shortcut( "unsv" );
set_callbacks( Open, Close );
vlc_module_end();
......@@ -124,8 +131,11 @@ struct access_sys_t
char *psz_icy_genre;
char *psz_icy_title;
int i_remaining;
vlc_bool_t b_seekable;
vlc_bool_t b_reconnect;
vlc_bool_t b_continuous;
vlc_bool_t b_pace_control;
};
......@@ -137,6 +147,7 @@ static int Control( access_t *, int, va_list );
/* */
static void ParseURL( access_sys_t *, char *psz_url );
static int Connect( access_t *, int64_t );
static int Request( access_t *p_access, int64_t i_tell );
/*****************************************************************************
* Open:
......@@ -201,6 +212,7 @@ static int Open( vlc_object_t *p_this )
p_sys->psz_icy_name = NULL;
p_sys->psz_icy_genre = NULL;
p_sys->psz_icy_title = NULL;
p_sys->i_remaining = 0;
/* Parse URI */
ParseURL( p_sys, p_access->psz_path );
......@@ -269,6 +281,7 @@ static int Open( vlc_object_t *p_this )
}
p_sys->b_reconnect = var_CreateGetBool( p_access, "http-reconnect" );
p_sys->b_continuous = var_CreateGetBool( p_access, "http-continuous" );
/* Connect */
if( Connect( p_access, 0 ) )
......@@ -420,6 +433,7 @@ static int Read( access_t *p_access, uint8_t *p_buffer, int i_len )
return 0;
}
}
if( p_sys->b_chunked )
{
if( p_sys->i_chunk < 0 )
......@@ -454,11 +468,24 @@ static int Read( access_t *p_access, uint8_t *p_buffer, int i_len )
}
}
if( p_sys->b_continuous && i_len > p_sys->i_remaining )
{
/* Only ask for the remaining length */
int i_new_len = p_sys->i_remaining;
if( i_new_len == 0 )
{
Request( p_access, 0 );
i_read = Read( p_access, p_buffer, i_len );
return i_read;
}
i_len = i_new_len;
}
if( p_sys->i_icy_meta > 0 && p_access->info.i_pos > 0 )
{
int64_t i_next = p_sys->i_icy_meta -
int64_t i_next = p_sys->i_icy_meta -
p_access->info.i_pos % p_sys->i_icy_meta;
if( i_next == p_sys->i_icy_meta )
{
if( ReadICYMeta( p_access ) )
......@@ -472,6 +499,7 @@ static int Read( access_t *p_access, uint8_t *p_buffer, int i_len )
}
i_read = net_Read( p_access, p_sys->fd, NULL, p_buffer, i_len, VLC_FALSE );
if( i_read > 0 )
{
p_access->info.i_pos += i_read;
......@@ -489,6 +517,13 @@ static int Read( access_t *p_access, uint8_t *p_buffer, int i_len )
}
else if( i_read == 0 )
{
if( p_sys->b_continuous )
{
Request( p_access, 0 );
p_sys->b_continuous = VLC_FALSE;
i_read = Read( p_access, p_buffer, i_len );
p_sys->b_continuous = VLC_TRUE;
}
if( p_sys->b_reconnect )
{
msg_Dbg( p_access, "got disconnected, trying to reconnect" );
......@@ -508,6 +543,11 @@ static int Read( access_t *p_access, uint8_t *p_buffer, int i_len )
if( i_read == 0 ) p_access->info.b_eof = VLC_TRUE;
}
if( p_sys->b_continuous )
{
p_sys->i_remaining -= i_read;
}
return i_read;
}
......@@ -760,6 +800,14 @@ static int Connect( access_t *p_access, int64_t i_tell )
return VLC_EGENERIC;
}
return Request( p_access,i_tell );
}
static int Request( access_t *p_access, int64_t i_tell )
{
access_sys_t *p_sys = p_access->p_sys;
char *psz;
if( p_sys->b_proxy )
{
if( p_sys->url.psz_path )
......@@ -792,7 +840,7 @@ static int Connect( access_t *p_access, int64_t i_tell )
p_sys->url.i_port );
}
else
{
{
net_Printf( VLC_OBJECT(p_access), p_sys->fd, NULL,
"GET %s HTTP/1.%d\r\nHost: %s\r\n",
psz_path, p_sys->i_version, p_sys->url.psz_host );
......@@ -807,6 +855,7 @@ static int Connect( access_t *p_access, int64_t i_tell )
net_Printf( VLC_OBJECT(p_access), p_sys->fd, NULL,
"Range: bytes="I64Fd"-\r\n", i_tell );
}
/* Authentification */
if( p_sys->psz_user && *p_sys->psz_user )
{
......@@ -827,7 +876,17 @@ static int Connect( access_t *p_access, int64_t i_tell )
net_Printf( VLC_OBJECT(p_access), p_sys->fd, NULL, "Icy-MetaData: 1\r\n" );
net_Printf( VLC_OBJECT(p_access), p_sys->fd, NULL, "Connection: Close\r\n");
if( p_sys->b_continuous && p_sys->i_version == 1 )
{
net_Printf( VLC_OBJECT( p_access ), p_sys->fd, NULL,
"Connection: keep-alive\r\n" );
}
else
{
net_Printf( VLC_OBJECT(p_access), p_sys->fd, NULL,
"Connection: Close\r\n");
p_sys->b_continuous = VLC_FALSE;
}
if( net_Printf( VLC_OBJECT(p_access), p_sys->fd, NULL, "\r\n" ) < 0 )
{
......@@ -907,8 +966,17 @@ static int Connect( access_t *p_access, int64_t i_tell )
if( !strcasecmp( psz, "Content-Length" ) )
{
p_access->info.i_size = i_tell + atoll( p );
msg_Dbg( p_access, "stream size="I64Fd, p_access->info.i_size );
if( p_sys->b_continuous )
{
p_access->info.i_size = -1;
msg_Dbg( p_access, "this frame size="I64Fd, atoll(p ) );
p_sys->i_remaining = atoll( p );
}
else
{
p_access->info.i_size = i_tell + atoll( p );
msg_Dbg( p_access, "stream size="I64Fd, p_access->info.i_size );
}
}
else if( !strcasecmp( psz, "Location" ) )
{
......@@ -924,7 +992,7 @@ static int Connect( access_t *p_access, int64_t i_tell )
else if( !strcasecmp( psz, "Pragma" ) )
{
if( !strcasecmp( psz, "Pragma: features" ) )
p_sys->b_mms = VLC_TRUE;
p_sys->b_mms = VLC_TRUE;
if( p_sys->psz_pragma ) free( p_sys->psz_pragma );
p_sys->psz_pragma = strdup( p );
msg_Dbg( p_access, "Pragma: %s", p_sys->psz_pragma );
......@@ -935,11 +1003,12 @@ static int Connect( access_t *p_access, int64_t i_tell )
if( !strncasecmp( p, "Icecast", 7 ) ||
!strncasecmp( p, "Nanocaster", 10 ) )
{
/* Remember if this is Icecast
* we need to force mp3 in some cases without breaking autodetection */
/* Remember if this is Icecast
* we need to force mp3 in some cases without breaking
* autodetection */
/* Let live365 streams (nanocaster) piggyback on the icecast routine.
* They look very similar */
/* Let live 65 streams (nanocaster) piggyback on the icecast
* routine. They look very similar */
p_sys->b_reconnect = VLC_TRUE;
p_sys->b_pace_control = VLC_FALSE;
......
......@@ -37,7 +37,7 @@
#include "xtag.h"
#undef CMML_DEBUG
#undef CMML_DEBUG
/*****************************************************************************
* decoder_sys_t : decoder descriptor
......@@ -50,12 +50,12 @@ struct decoder_sys_t
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static int OpenDecoder ( vlc_object_t * );
static void CloseDecoder ( vlc_object_t * );
static int OpenDecoder ( vlc_object_t * );
static void CloseDecoder ( vlc_object_t * );
static void DecodeBlock ( decoder_t *, block_t ** );
static subpicture_t *DecodeBlock ( decoder_t *, block_t ** );
static void ParseText ( decoder_t *, block_t * );
static void ParseText ( decoder_t *, block_t * );
/*****************************************************************************
* Exported prototypes
......@@ -140,17 +140,32 @@ static int OpenDecoder( vlc_object_t *p_this )
****************************************************************************
* This function must be fed with complete subtitles units.
****************************************************************************/
static void DecodeBlock( decoder_t *p_dec, block_t **pp_block )
static subpicture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
{
subpicture_t *p_spu;
if( !pp_block || *pp_block == NULL )
{
return;
return NULL;
}
ParseText( p_dec, *pp_block );
block_Release( *pp_block );
*pp_block = NULL;
/* allocate an empty subpicture to return. the actual subpicture
* displaying is done in the DisplayAnchor function in intf.c (called from
* DisplayPendingAnchor, which in turn is called from the main RunIntf
* loop). */
p_spu = p_dec->pf_spu_buffer_new( p_dec );
if( !p_spu )
{
msg_Dbg( p_dec, "couldn't allocate new subpicture" );
return NULL;
}
return p_spu;
}
/*****************************************************************************
......
......@@ -53,7 +53,6 @@
#undef CMML_INTF_USE_TIMED_URIS
#undef CMML_INTF_DEBUG
#undef CMML_INTF_SUBPICTURE_DEBUG
#undef CMML_INTF_HISTORY_DEBUG
/*****************************************************************************
......@@ -149,10 +148,11 @@ void E_(CloseIntf) ( vlc_object_t *p_this )
msg_Dbg( p_intf, "freeing CMML interface" );
#endif
/* Erase the anchor text description from the video output if it exists */
/* erase the anchor text description from the video output if it exists */
p_vout = vlc_object_find( p_intf, VLC_OBJECT_VOUT, FIND_ANYWHERE );
if( p_vout )
{
/* enable CMML as a subtitle track */
spu_Control( p_vout->p_spu, SPU_CHANNEL_CLEAR, DEFAULT_CHAN );
vlc_object_release( p_vout );
}
......@@ -160,7 +160,7 @@ void E_(CloseIntf) ( vlc_object_t *p_this )
var_DelCallback( p_intf->p_vlc, "key-pressed", KeyEvent, p_intf );
vlc_object_release( p_intf->p_sys->p_cmml_decoder );
free( p_intf->p_sys );
}
......@@ -484,7 +484,7 @@ static void FollowAnchor ( intf_thread_t *p_intf )
history_t *p_history = NULL;
history_item_t *p_history_item = NULL;
char *psz_timed_url;
p_history = GetHistory( p_playlist );
/* create history item */
......@@ -821,9 +821,8 @@ static int DisplayAnchor( intf_thread_t *p_intf,
if( psz_anchor_url )
{
/* Should display subtitle underlined and in blue,
* but it looks like VLC doesn't implement any
* text styles yet. D'oh! */
/* Should display subtitle underlined and in blue, but it looks
* like VLC doesn't implement any text styles yet. D'oh! */
p_style = &blue_with_underline;
}
......@@ -836,11 +835,6 @@ static int DisplayAnchor( intf_thread_t *p_intf,
i_margin_h, i_margin_v, i_now, 0 ) == VLC_SUCCESS )
{
/* Displayed successfully */
#ifdef CMML_INTF_SUBPICTURE_DEBUG
msg_Dbg( p_intf, "subpicture created at (%d, %d) (%d, %d)",
p_subpicture->i_x, p_subpicture->i_y,
p_subpicture->i_width, p_subpicture->i_height );
#endif
}
else
{
......
......@@ -463,8 +463,8 @@ static aout_buffer_t *DecodePacket( decoder_t *p_dec, ogg_packet *p_oggpacket )
return NULL;
}
i_ret = speex_decode( p_sys->p_state, &p_sys->bits,
(int16_t *)p_aout_buffer->p_buffer );
i_ret = speex_decode_int( p_sys->p_state, &p_sys->bits,
(int16_t *)p_aout_buffer->p_buffer );
if( i_ret == -1 )
{
/* End of stream */
......@@ -483,8 +483,9 @@ static aout_buffer_t *DecodePacket( decoder_t *p_dec, ogg_packet *p_oggpacket )
}
if( p_sys->p_header->nb_channels == 2 )
speex_decode_stereo( (int16_t *)p_aout_buffer->p_buffer,
p_sys->p_header->frame_size, &p_sys->stereo );
speex_decode_stereo_int( (int16_t *)p_aout_buffer->p_buffer,
p_sys->p_header->frame_size,
&p_sys->stereo );
/* Date management */
p_aout_buffer->start_date = aout_DateGet( &p_sys->end_date );
......@@ -744,15 +745,15 @@ static block_t *Encode( encoder_t *p_enc, aout_buffer_t *p_aout_buf )
/* Encode current frame */
if( p_enc->fmt_in.audio.i_channels == 2 )
speex_encode_stereo( p_samples, p_sys->i_frame_length,
&p_sys->bits );
speex_encode_stereo_int( p_samples, p_sys->i_frame_length,
&p_sys->bits );
#if 0
if( p_sys->preprocess )
speex_preprocess( p_sys->preprocess, p_samples, NULL );
#endif
speex_encode( p_sys->p_state, p_samples, &p_sys->bits );
speex_encode_int( p_sys->p_state, p_samples, &p_sys->bits );
p_buffer += p_sys->i_frame_size;
p_sys->i_samples_delay -= p_sys->i_frame_length;
......
......@@ -65,6 +65,7 @@ struct demux_sys_t
vlc_bool_t b_still;
mtime_t i_still_end;
mtime_t i_still_length;
mtime_t i_time;
mtime_t i_frame_length;
......@@ -75,7 +76,7 @@ struct demux_sys_t
};
/*****************************************************************************
* Peek: Helper function to peek data with incremental size.
* Peek: Helper function to peek data with incremental size.
* \return VLC_FALSE if peek no more data, VLC_TRUE otherwise.
*****************************************************************************/
static vlc_bool_t Peek( demux_t *p_demux, vlc_bool_t b_first )
......@@ -277,7 +278,7 @@ static int SendBlock( demux_t *p_demux, int i )
if( p_sys->b_still )
{
p_sys->i_still_end = mdate() + I64C(5000000);
p_sys->i_still_end = mdate() + p_sys->i_still_length;
}
return 1;
......@@ -327,6 +328,11 @@ static int Open( vlc_object_t * p_this )
goto error;
}
var_Create( p_demux, "mjpeg-fps", VLC_VAR_FLOAT | VLC_VAR_DOINHERIT );
var_Get( p_demux, "mjpeg-fps", &val );
p_sys->i_frame_length = 0;
/* Check for jpeg file extension */
p_sys->b_still = VLC_FALSE;
p_sys->i_still_end = 0;
......@@ -335,12 +341,17 @@ static int Open( vlc_object_t * p_this )
!strcasecmp( psz_ext, ".jpg" ) ) )
{
p_sys->b_still = VLC_TRUE;
if( val.f_float)
{
p_sys->i_still_length =1000000.0 / val.f_float;
}
else
{
/* Defaults to 1fps */
p_sys->i_still_length = 1000000;
}
}
var_Create( p_demux, "mjpeg-fps", VLC_VAR_FLOAT | VLC_VAR_DOINHERIT );
var_Get( p_demux, "mjpeg-fps", &val );
p_sys->i_frame_length = 0;
if( val.f_float )
else if ( val.f_float )
{
p_sys->i_frame_length = 1000000.0 / val.f_float;
}
......@@ -373,7 +384,7 @@ static int MjpgDemux( demux_t *p_demux )
}
else if( p_sys->b_still && p_sys->i_still_end )
{
msleep( 40000 );
msleep( 400 );
return 1;
}
......
......@@ -1338,6 +1338,13 @@ static void Ogg_ReadAnnodexHeader( vlc_object_t *p_this,
p_stream->b_force_backup = 1;
}
else if( !strncmp(content_type_string, "audio/x-speex", 14) )
{
p_stream->fmt.i_cat = AUDIO_ES;
p_stream->fmt.i_codec = VLC_FOURCC( 's','p','x',' ' );
p_stream->b_force_backup = 1;
}
else if( !strncmp(content_type_string, "video/x-theora", 14) )
{
p_stream->fmt.i_cat = VIDEO_ES;
......
......@@ -30,24 +30,18 @@ class OSGraphics;
/// Class to handle a video output window
class VoutWindow: public GenericWindow
class VoutWindow: private GenericWindow
{
public:
VoutWindow( intf_thread_t *pIntf, int xPos, int yPos,
bool dragDrop, bool playOnDrop, GenericWindow &rParent );
virtual ~VoutWindow();
/// These methods are redefined here to make them public
/// Make some functions public
//@{
/// Show the window
virtual void show() { GenericWindow::show(); }
/// Hide the window
virtual void hide() { GenericWindow::hide(); }
/// Move the window
virtual void move( int left, int top )
{ GenericWindow::move( left, top ); }
using GenericWindow::show;
using GenericWindow::hide;
using GenericWindow::move;
//@}
/// Resize the window
......
......@@ -223,22 +223,6 @@ void ItemInfoDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
p_item->input.psz_uri = strdup( uri_text->GetLineText(0).mb_str() );
playlist_ItemAddInfo( p_item,"General","Author",
author_text->GetLineText(0).mb_str() );
vlc_bool_t b_old_enabled = p_item->b_enabled;
playlist_t * p_playlist =
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_playlist != NULL )
{
if( b_old_enabled == VLC_FALSE && enabled_checkbox->IsChecked() )
p_playlist->i_enabled ++;
else if( b_old_enabled == VLC_TRUE && !enabled_checkbox->IsChecked() )
p_playlist->i_enabled --;
vlc_object_release( p_playlist );
}
p_item->b_enabled = enabled_checkbox->IsChecked() ? VLC_TRUE : VLC_FALSE ;
vlc_mutex_unlock( &p_item->input.lock );
EndModal( wxID_OK );
}
......
......@@ -76,8 +76,6 @@ enum
SortTitle_Event,
RSortTitle_Event,
SortAuthor_Event,
RSortAuthor_Event,
Randomize_Event,
EnableSelection_Event,
......@@ -90,10 +88,6 @@ enum
Repeat_Event,
SelectAll_Event,
Up_Event,
Down_Event,
Infos_Event,
PopupPlay_Event,
PopupPlayThis_Event,
PopupSort_Event,
......@@ -137,8 +131,6 @@ BEGIN_EVENT_TABLE(Playlist, wxFrame)
EVT_MENU(SortTitle_Event, Playlist::OnSort)
EVT_MENU(RSortTitle_Event, Playlist::OnSort)
EVT_MENU(SortAuthor_Event, Playlist::OnSort)
EVT_MENU(RSortAuthor_Event, Playlist::OnSort)
EVT_MENU(Randomize_Event, Playlist::OnSort)
......@@ -147,7 +139,6 @@ BEGIN_EVENT_TABLE(Playlist, wxFrame)
EVT_MENU(InvertSelection_Event, Playlist::OnInvertSelection)
EVT_MENU(DeleteSelection_Event, Playlist::OnDeleteSelection)
EVT_MENU(SelectAll_Event, Playlist::OnSelectAll)
EVT_MENU(Infos_Event, Playlist::OnInfos)
EVT_MENU_OPEN( Playlist::OnMenuOpen )
EVT_MENU( -1, Playlist::OnMenuEvent )
......@@ -172,10 +163,6 @@ BEGIN_EVENT_TABLE(Playlist, wxFrame)
/* Button events */
EVT_BUTTON( Search_Event, Playlist::OnSearch)
EVT_BUTTON( Save_Event, Playlist::OnSave)
EVT_BUTTON( Infos_Event, Playlist::OnInfos)
EVT_BUTTON( Up_Event, Playlist::OnUp)
EVT_BUTTON( Down_Event, Playlist::OnDown)
EVT_TEXT(SearchText_Event, Playlist::OnSearchTextChange)
......@@ -222,9 +209,9 @@ Playlist::Playlist( intf_thread_t *_p_intf, wxWindow *p_parent ):
p_sd_menu = SDMenu();
i_current_view = VIEW_SIMPLE;
b_changed_view = VLC_FALSE;
i_title_sorted = 0;
i_author_sorted = 0;
i_group_sorted = 0;
i_duration_sorted = 0;
......@@ -251,9 +238,6 @@ Playlist::Playlist( intf_thread_t *_p_intf, wxWindow *p_parent ):
sort_menu->Append( SortTitle_Event, wxU(_("Sort by &title")) );
sort_menu->Append( RSortTitle_Event, wxU(_("&Reverse sort by title")) );
sort_menu->AppendSeparator();
sort_menu->Append( SortAuthor_Event, wxU(_("Sort by &author")) );
sort_menu->Append( RSortAuthor_Event, wxU(_("Reverse sort by author")) );
sort_menu->AppendSeparator();
sort_menu->Append( Randomize_Event, wxU(_("&Shuffle Playlist")) );
/* Create our "Selection" menu */
......@@ -404,11 +388,6 @@ Playlist::Playlist( intf_thread_t *_p_intf, wxWindow *p_parent ):
Rebuild();
}
void Playlist::OnSize( wxSizeEvent& event)
{
event.Skip();
}
Playlist::~Playlist()
{
playlist_t *p_playlist =
......@@ -426,8 +405,10 @@ Playlist::~Playlist()
}
/**********************************************************************
* Update one playlist item
* Update functions
**********************************************************************/
/* Update a node */
void Playlist::UpdateNode( playlist_t *p_playlist, playlist_item_t *p_node,
wxTreeItemId node )
{
......@@ -457,6 +438,7 @@ void Playlist::UpdateNode( playlist_t *p_playlist, playlist_item_t *p_node,
}
}
/* Creates the node p_node as last child of parent */
void Playlist::CreateNode( playlist_t *p_playlist, playlist_item_t *p_node,
wxTreeItemId parent )
......@@ -470,6 +452,7 @@ void Playlist::CreateNode( playlist_t *p_playlist, playlist_item_t *p_node,
UpdateNodeChildren( p_playlist, p_node, node );
}
/* Update all children (recursively) of this node */
void Playlist::UpdateNodeChildren( playlist_t *p_playlist,
playlist_item_t *p_node,
wxTreeItemId node )
......@@ -498,97 +481,62 @@ void Playlist::UpdateNodeChildren( playlist_t *p_playlist,
}
}
wxTreeItemId Playlist::FindItem( wxTreeItemId root, playlist_item_t *p_item )
/* Set current item */
void Playlist::SetCurrentItem( wxTreeItemId item )
{
long cookie;
PlaylistItem *p_wxcurrent;
wxTreeItemId search;
wxTreeItemId item = treectrl->GetFirstChild( root, cookie );
wxTreeItemId child;
p_wxcurrent = (PlaylistItem *)treectrl->GetItemData( root );
if( p_wxcurrent->p_item == p_item )
if( item.IsOk() )
{
return root;
treectrl->SetItemBold( item, true );
treectrl->EnsureVisible( item );
}
}
/* Update an item in the tree */
void Playlist::UpdateTreeItem( playlist_t *p_playlist, wxTreeItemId item )
{
playlist_item_t *p_item =
((PlaylistItem *)treectrl->GetItemData( item ))->p_item;
if( !p_item )
{
wxTreeItemId dummy;
return dummy;
return;
}
while( item.IsOk() )
{
p_wxcurrent = (PlaylistItem *)treectrl->GetItemData( item );
if( p_wxcurrent->p_item == p_item )
{
return item;
}
if( treectrl->ItemHasChildren( item ) )
{
wxTreeItemId search = FindItem( item, p_item );
if( search.IsOk() )
{
return search;
}
}
item = treectrl->GetNextChild( root, cookie);
}
/* Not found */
wxTreeItemId dummy;
return dummy;
}
wxString msg;
char *psz_author = playlist_ItemGetInfo( p_item, _("Meta-information"),
_("Artist"));
char psz_duration[MSTRTIME_MAX_SIZE];
mtime_t dur = p_item->input.i_duration;
wxTreeItemId Playlist::FindItemByName( wxTreeItemId root, wxString search_string, wxTreeItemId current, vlc_bool_t *pb_current_found )
{
long cookie;
PlaylistItem *p_wxcurrent;
wxTreeItemId search;
wxTreeItemId item = treectrl->GetFirstChild( root, cookie );
wxTreeItemId child;
if( dur != -1 )
secstotimestr( psz_duration, dur/1000000 );
else
memcpy( psz_duration, "-:--:--", sizeof("-:--:--") );
while( item.IsOk() )
if( !strcmp( psz_author, "" ) || p_item->input.b_fixed_name == VLC_TRUE )
{
if( treectrl->GetItemText( item).Lower().Contains(
search_string.Lower() ) )
{
if( !current.IsOk() || *pb_current_found == VLC_TRUE )
{
return item;
}
else if( current.IsOk() && item == current )
{
*pb_current_found = VLC_TRUE;
}
}
if( treectrl->ItemHasChildren( item ) )
{
wxTreeItemId search = FindItemByName( item, search_string, current,
pb_current_found );
if( search.IsOk() )
{
return search;
}
}
item = treectrl->GetNextChild( root, cookie);
msg.Printf( wxString( wxL2U( p_item->input.psz_name ) ) + wxU( " ( ") +
wxString(wxL2U(psz_duration ) ) + wxU( ")") );
}
/* Not found */
wxTreeItemId dummy;
return dummy;
}
else