diff options
author | lvw <lvw@e10066b5-e1e2-0310-b819-94efdf66514b> | 2004-10-04 20:47:58 +0000 |
---|---|---|
committer | lvw <lvw@e10066b5-e1e2-0310-b819-94efdf66514b> | 2004-10-04 20:47:58 +0000 |
commit | 44cd4c0319c75d4315fe0554d701effe77680776 (patch) | |
tree | af037733af84b3a217256e2269ee5df2bcff22d6 | |
parent | 50075887187e1801f3d3425f20a6b6127ffd7ff8 (diff) | |
download | vdr-plugin-muggle-44cd4c0319c75d4315fe0554d701effe77680776.tar.gz vdr-plugin-muggle-44cd4c0319c75d4315fe0554d701effe77680776.tar.bz2 |
Added a patch to correct minor errors. Further, remove using namespace directives in order to remain compatible with g++ 2.95.4
git-svn-id: https://vdr-muggle.svn.sourceforge.net/svnroot/vdr-muggle/trunk/muggle-plugin@200 e10066b5-e1e2-0310-b819-94efdf66514b
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | gd_content_interface.c | 95 | ||||
-rwxr-xr-x | mg_content_interface.c | 32 | ||||
-rw-r--r-- | mg_database.c | 9 | ||||
-rw-r--r-- | mg_filters.c | 32 | ||||
-rw-r--r-- | mg_media.c | 37 | ||||
-rw-r--r-- | mg_playlist.c | 22 | ||||
-rw-r--r-- | mg_tools.c | 8 | ||||
-rw-r--r-- | muggle.c | 9 | ||||
-rw-r--r-- | muggle.h | 2 | ||||
-rwxr-xr-x | mugglei.c | 71 | ||||
-rw-r--r-- | vdr_decoder.c | 10 | ||||
-rw-r--r-- | vdr_decoder_mp3.c | 1 | ||||
-rw-r--r-- | vdr_decoder_ogg.c | 7 | ||||
-rw-r--r-- | vdr_menu.c | 37 | ||||
-rw-r--r-- | vdr_menu.h | 6 | ||||
-rw-r--r-- | vdr_player.c | 7 | ||||
-rw-r--r-- | vdr_stream.c | 11 |
18 files changed, 194 insertions, 207 deletions
@@ -46,6 +46,7 @@ INCLUDES += -I$(VDRDIR) -I$(VDRDIR)/include -I$(DVBDIR)/include \ #DEFINES += -DPLUGIN_NAME_I18N='"$(PLUGIN)"' -DHAVE_VORBISFILE DEFINES += -DPLUGIN_NAME_I18N='"$(PLUGIN)"' +DEFINES += -D_GNU_SOURCE MIFLAGS += -I/usr/include/taglib -lmysqlclient ### The object files (add further files here): @@ -60,7 +61,7 @@ all: libvdr-$(PLUGIN).so mugglei # Dependencies: -MAKEDEP = g++ -MM -MG +MAKEDEP = $(CXX) -MM -MG DEPFILE = .dependencies $(DEPFILE): Makefile @$(MAKEDEP) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@ @@ -88,5 +89,5 @@ dist: clean @echo Distribution package created as $(PACKAGE).tgz clean: - @-rm -f $(OBJS) $(BINOBJS) $(DEPFILE) *.so *.tgz core* *~ + @-rm -f $(OBJS) $(BINOBJS) $(DEPFILE) *.so *.tgz core* *~ mugglei.o mugglei diff --git a/gd_content_interface.c b/gd_content_interface.c index 4537b21..6fda5e4 100644 --- a/gd_content_interface.c +++ b/gd_content_interface.c @@ -26,7 +26,6 @@ #include "i18n.h" -using namespace std; #define GD_PLAYLIST_TYPE 0 //< listtype for giant disc db @@ -83,9 +82,9 @@ int GdInitDatabase( MYSQL *db ) return 0; } -vector<string> *GdGetStoredPlaylists(MYSQL db) +std::vector<std::string> *GdGetStoredPlaylists(MYSQL db) { - vector<string>* list = new vector<string>(); + std::vector<std::string>* list = new std::vector<std::string>(); MYSQL_RES *result; MYSQL_ROW row; @@ -101,13 +100,13 @@ vector<string> *GdGetStoredPlaylists(MYSQL db) gdFilterSets::gdFilterSets() { mgFilter* filter; - vector<mgFilter*>* set; - vector<string>* rating; + std::vector<mgFilter*>* set; + std::vector<std::string>* rating; m_titles.push_back( tr("Track Search") ); // create an initial set of filters with empty values - set = new vector<mgFilter*>(); - rating = new vector<string>(); + set = new std::vector<mgFilter*>(); + rating = new std::vector<std::string>(); rating->push_back("-"); rating->push_back("O"); rating->push_back("+"); @@ -135,7 +134,7 @@ gdFilterSets::gdFilterSets() m_titles.push_back(tr("Album Search")); - set = new vector<mgFilter*>(); + set = new std::vector<mgFilter*>(); // year-from filter = new mgFilterInt(tr("year (from)"), 1901, 1900, 2100); set->push_back(filter); // year-to @@ -153,7 +152,7 @@ gdFilterSets::gdFilterSets() m_titles.push_back(tr("Playlist Search")); - set = new vector<mgFilter*>(); + set = new std::vector<mgFilter*>(); // year-from filter = new mgFilterInt(tr("year (from)"), 1901, 1900, 2100); set->push_back(filter); // year-to @@ -182,9 +181,9 @@ gdFilterSets::~gdFilterSets() // everything is done in the destructor of the base class } -string gdFilterSets::computeRestriction(int *viewPrt) +std::string gdFilterSets::computeRestriction(int *viewPrt) { - string sql_str = "1"; + std::string sql_str = "1"; switch( m_activeSetId ) { @@ -209,7 +208,7 @@ string gdFilterSets::computeRestriction(int *viewPrt) } break; } - for( vector<mgFilter*>::iterator iter = m_activeSet->begin(); + for( std::vector<mgFilter*>::iterator iter = m_activeSet->begin(); iter != m_activeSet->end(); iter++ ) { @@ -285,7 +284,7 @@ string gdFilterSets::computeRestriction(int *viewPrt) } } } - mgDebug(1, "Applying sql string %s (view=%d)", sql_str.c_str(), *viewPrt ); + mgDebug(1, "Applying sql std::string %s (view=%d)", sql_str.c_str(), *viewPrt ); return sql_str; } @@ -358,7 +357,7 @@ bool mgGdTrack::readData() m_artist = row[0]; m_album = row[1]; m_title = row[2]; - m_mp3file = string( the_setup.ToplevelDir ) + row[3]; + m_mp3file = std::string( the_setup.ToplevelDir ) + row[3]; m_genre = row[4]; if( sscanf( row[5], "%d", &m_year) != 1 ) @@ -393,7 +392,7 @@ bool mgGdTrack::readData() return true; } -string mgGdTrack::getSourceFile() +std::string mgGdTrack::getSourceFile() { if( !m_retrieved ) { @@ -402,7 +401,7 @@ string mgGdTrack::getSourceFile() return m_mp3file; } -string mgGdTrack::getTitle() +std::string mgGdTrack::getTitle() { if( !m_retrieved ) { @@ -411,7 +410,7 @@ string mgGdTrack::getTitle() return m_title; } -string mgGdTrack::getArtist() +std::string mgGdTrack::getArtist() { if(!m_retrieved) { @@ -430,7 +429,7 @@ int mgGdTrack::getLength() } -string mgGdTrack::getLabel(int col) +std::string mgGdTrack::getLabel(int col) { if( !m_retrieved ) { @@ -451,17 +450,17 @@ string mgGdTrack::getLabel(int col) } } -vector<mgFilter*> *mgGdTrack::getTrackInfo() +std::vector<mgFilter*> *mgGdTrack::getTrackInfo() { - return new vector<mgFilter*>(); + return new std::vector<mgFilter*>(); } -bool mgGdTrack::setTrackInfo(vector<mgFilter*> *info) +bool mgGdTrack::setTrackInfo(std::vector<mgFilter*> *info) { return false; } -string mgGdTrack::getAlbum() +std::string mgGdTrack::getAlbum() { if( !m_retrieved ) { @@ -470,7 +469,7 @@ string mgGdTrack::getAlbum() return m_album; } -string mgGdTrack::getGenre() +std::string mgGdTrack::getGenre() { if(!m_retrieved) { @@ -524,7 +523,7 @@ int mgGdTrack::getChannels() return m_channels; } -string mgGdTrack::getBitrate() +std::string mgGdTrack::getBitrate() { if(!m_retrieved) { @@ -533,27 +532,27 @@ string mgGdTrack::getBitrate() return m_bitrate; } -string mgGdTrack::getImageFile() +std::string mgGdTrack::getImageFile() { return "dummyImg.jpg"; } -void mgGdTrack::setTitle(string new_title) +void mgGdTrack::setTitle(std::string new_title) { m_title = new_title; } -void mgGdTrack::setArtist(string new_artist) +void mgGdTrack::setArtist(std::string new_artist) { m_artist = new_artist; } -void mgGdTrack::setAlbum(string new_album) +void mgGdTrack::setAlbum(std::string new_album) { m_album = new_album; } -void mgGdTrack::setGenre(string new_genre) +void mgGdTrack::setGenre(std::string new_genre) { m_genre = new_genre; } @@ -578,7 +577,7 @@ bool mgGdTrack::writeData() return true; } -GdTracklist::GdTracklist(MYSQL db_handle, string restrictions) +GdTracklist::GdTracklist(MYSQL db_handle, std::string restrictions) { MYSQL_RES *result; MYSQL_ROW row; @@ -603,7 +602,7 @@ GdTracklist::GdTracklist(MYSQL db_handle, string restrictions) } } -GdPlaylist::GdPlaylist(string listname, MYSQL db_handle) +GdPlaylist::GdPlaylist(std::string listname, MYSQL db_handle) { MYSQL_RES *result; MYSQL_ROW row; @@ -707,7 +706,7 @@ int GdPlaylist::insertDataFromSQL() bool GdPlaylist::storePlaylist() { - vector<mgContentItem*>::iterator iter; + std::vector<mgContentItem*>::iterator iter; int num; MYSQL_RES *result; MYSQL_ROW row; @@ -792,7 +791,7 @@ int GdPlaylist::getPlayTimeRemaining() /*! * \brief constructor */ -GdTreeNode::GdTreeNode(MYSQL db, int view, string filters) +GdTreeNode::GdTreeNode(MYSQL db, int view, std::string filters) : mgSelectionTreeNode(db, view) { // create a root node @@ -803,9 +802,9 @@ GdTreeNode::GdTreeNode(MYSQL db, int view, string filters) } GdTreeNode::GdTreeNode( mgSelectionTreeNode* parent, - string id, - string label, - string restriction ) + std::string id, + std::string label, + std::string restriction ) : mgSelectionTreeNode(parent, id, label) { m_restriction = restriction; @@ -908,14 +907,14 @@ bool GdTreeNode::expand() char idbuf[255]; int numchild; - string labelfield; // human readable db field for the column to be expanded - string idfield; // unique id field for the column to be expanded - string new_restriction_field; // field to be restricted by the new level - string new_restriction; // complete restriction str for the current child - string new_label; + std::string labelfield; // human readable db field for the column to be expanded + std::string idfield; // unique id field for the column to be expanded + std::string new_restriction_field; // field to be restricted by the new level + std::string new_restriction; // complete restriction str for the current child + std::string new_label; GdTreeNode* new_child; - string tables; // stores the db tables used + std::string tables; // stores the db tables used #define FROMJOIN " FROM tracks, genre as genre1, genre as genre2, album WHERE tracks.sourceid=album.cddbid AND genre1.id=tracks.genre1 AND genre2.id=tracks.genre2 AND %s " @@ -1215,8 +1214,8 @@ bool GdTreeNode::expand() // diese die den Filterkriterien entsprechen. // das betrifft nur die Search Views! - string row0 = mgDB::escape_string( &m_db, string( row[0] ) ); - string row1 = mgDB::escape_string( &m_db, string( row[1] ) ); + std::string row0 = mgDB::escape_string( &m_db, std::string( row[0] ) ); + std::string row1 = mgDB::escape_string( &m_db, std::string( row[1] ) ); if( m_view < 100 ) { @@ -1229,7 +1228,7 @@ bool GdTreeNode::expand() } new_child = new GdTreeNode(this, // parent - (string) idbuf, // id + (std::string) idbuf, // id // row[0], // label, row0, new_restriction); @@ -1282,16 +1281,16 @@ bool GdTreeNode::expand() /*! * \brief iterate all children recursively to find the tracks */ -vector<mgContentItem*>* GdTreeNode::getTracks() +std::vector<mgContentItem*>* GdTreeNode::getTracks() { MYSQL_ROW row; MYSQL_RES *result; int nrows; int nfields; - vector<mgContentItem*>* retlist; + std::vector<mgContentItem*>* retlist; int trackid; - retlist = new vector<mgContentItem*>(); + retlist = new std::vector<mgContentItem*>(); // get all tracks satisying the restrictions of this node mgDebug(5, "getTracks(): query '%s'", m_restriction.c_str()); diff --git a/mg_content_interface.c b/mg_content_interface.c index 3f502ab..af16389 100755 --- a/mg_content_interface.c +++ b/mg_content_interface.c @@ -15,10 +15,10 @@ */ #define DEBUG +#include <algorithm> #include "mg_content_interface.h" #include "mg_tools.h" -using namespace std; //! \brief a special item representing an undefined state mgContentItem mgContentItem::UNDEFINED = mgContentItem(); @@ -31,7 +31,7 @@ mgTracklist::mgTracklist() mgTracklist::~mgTracklist() { mgContentItem* ptr; - vector<mgContentItem*>::iterator iter; + std::vector<mgContentItem*>::iterator iter; for( iter = m_list.begin(); iter != m_list.end(); iter++ ) { @@ -41,7 +41,7 @@ mgTracklist::~mgTracklist() m_list.clear(); } -vector<mgContentItem*> *mgTracklist::getAll() +std::vector<mgContentItem*> *mgTracklist::getAll() { return &m_list; } @@ -60,7 +60,7 @@ void mgTracklist::sortBy(int col, bool direction) { } -void mgTracklist::setDisplayColumns(vector<int> cols) +void mgTracklist::setDisplayColumns(std::vector<int> cols) { m_columns = cols; } @@ -70,9 +70,9 @@ unsigned int mgTracklist::getNumColumns() return m_columns.size(); } -string mgTracklist::getLabel(unsigned int position, const string separator) +std::string mgTracklist::getLabel(unsigned int position, const std::string separator) { - string label = ""; + std::string label = ""; mgContentItem* item; if( position >= m_list.size() ) @@ -84,7 +84,7 @@ string mgTracklist::getLabel(unsigned int position, const string separator) item = *( m_list.begin() + position ); } - for( vector<int>::iterator iter = m_columns.begin(); + for( std::vector<int>::iterator iter = m_columns.begin(); iter != m_columns.end(); iter++ ) { if( iter != m_columns.begin() ) @@ -111,7 +111,7 @@ bool mgTracklist::remove(unsigned int position) if( position < m_list.size() ) { - vector<mgContentItem*>::iterator iter; + std::vector<mgContentItem*>::iterator iter; iter = m_list.begin() + position; m_list.erase(iter); @@ -125,7 +125,7 @@ bool mgTracklist::remove(unsigned int position) int mgTracklist::remove(mgContentItem* item) { int retval = 0; - vector<mgContentItem*>::iterator iter; + std::vector<mgContentItem*>::iterator iter; for( iter = m_list.begin(); iter != m_list.end (); iter++ ) { @@ -149,7 +149,7 @@ mgSelectionTreeNode::mgSelectionTreeNode(MYSQL db, int view) m_label = "ROOT"; m_expanded = false; } -mgSelectionTreeNode::mgSelectionTreeNode(mgSelectionTreeNode* parent, string id, string label) +mgSelectionTreeNode::mgSelectionTreeNode(mgSelectionTreeNode* parent, std::string id, std::string label) { m_parent = parent; m_level = m_parent->m_level+1; @@ -181,7 +181,7 @@ mgSelectionTreeNode* mgSelectionTreeNode::getParent() void mgSelectionTreeNode::collapse() // removes all children (recursively) { - vector <mgSelectionTreeNode*>::iterator iter; + std::vector <mgSelectionTreeNode*>::iterator iter; mgSelectionTreeNode* ptr; for(iter = m_children.begin(); iter != m_children.end();iter++) @@ -193,23 +193,23 @@ void mgSelectionTreeNode::collapse() // removes all children (recursively) m_children.clear(); } -vector<mgSelectionTreeNode*> &mgSelectionTreeNode::getChildren() +std::vector<mgSelectionTreeNode*> &mgSelectionTreeNode::getChildren() { // mgDebug(5," returning %d children", m_children.size()); return m_children; } -string mgSelectionTreeNode::getID() +std::string mgSelectionTreeNode::getID() { return m_id; } -string mgSelectionTreeNode::getLabel() +std::string mgSelectionTreeNode::getLabel() { return m_label; } -string mgSelectionTreeNode::getLabel(int n) +std::string mgSelectionTreeNode::getLabel(int n) { mgSelectionTreeNode* node = this; int d = m_level; @@ -223,7 +223,7 @@ string mgSelectionTreeNode::getLabel(int n) return node->m_label; } -string mgSelectionTreeNode::getRestrictions() +std::string mgSelectionTreeNode::getRestrictions() { return m_restriction; } diff --git a/mg_database.c b/mg_database.c index 3ad6fc9..fa38e17 100644 --- a/mg_database.c +++ b/mg_database.c @@ -9,14 +9,13 @@ #include "mg_database.h" -using namespace std; mgDB::mgDB() { } -mgDB::mgDB(string host, string name, - string user, string pass, +mgDB::mgDB(std::string host, std::string name, + std::string user, std::string pass, int port) { } @@ -31,13 +30,13 @@ MYSQL mgDB::getDBHandle() return m_dbase; } -string mgDB::escape_string( MYSQL *db, string s ) +std::string mgDB::escape_string( MYSQL *db, std::string s ) { char *escbuf = (char *) malloc( 2*s.size() + 1 ); int len = mysql_real_escape_string( db, escbuf, s.c_str(), s.size() ); - string r = string( escbuf ); + std::string r = std::string( escbuf ); free( escbuf ); return r; diff --git a/mg_filters.c b/mg_filters.c index f8c164d..e0457da 100644 --- a/mg_filters.c +++ b/mg_filters.c @@ -3,17 +3,17 @@ * \brief ******************************************************************** * \version $Revision: 1.3 $ - * \date $Date: 2004/05/28 15:29:18 $ + * \date $Date$ * \author Ralf Klueber, Lars von Wedel, Andreas Kellner - * \author file owner: $Author: lvw $ + * \author file owner: $Author$ */ /*******************************************************************/ /* makes sure we dont parse the same declarations twice */ +#include <stdio.h> #include "mg_filters.h" #include "mg_tools.h" -using namespace std; //------------------------------------------------------------------- // mgFilter @@ -54,12 +54,12 @@ mgFilterInt::~mgFilterInt() { } -string mgFilterInt::getStrVal() +std::string mgFilterInt::getStrVal() { char buffer[20]; sprintf(buffer, "%d", m_intval); - return (string)buffer; + return (std::string)buffer; } int mgFilterInt::getIntVal() @@ -109,7 +109,7 @@ bool mgFilterInt::isSet() // mgFilterString //------------------------------------------------------------------- mgFilterString::mgFilterString(const char *name, const char* value, - int maxlen, string allowedchar) + int maxlen, std::string allowedchar) : mgFilter(name) { m_type = STRING; @@ -132,14 +132,14 @@ int mgFilterString::getMaxLength() return m_maxlen; } -string mgFilterString::getAllowedChars() +std::string mgFilterString::getAllowedChars() { return m_allowedchar; } -string mgFilterString::getStrVal() +std::string mgFilterString::getStrVal() { - return (string) m_strval; + return (std::string) m_strval; } void mgFilterString::store() { @@ -172,7 +172,7 @@ bool mgFilterString::isSet() // mgFilterBool //------------------------------------------------------------------- mgFilterBool::mgFilterBool(const char *name, bool value, - string truestr, string falsestr) + std::string truestr, std::string falsestr) : mgFilter(name) { m_type = BOOL; @@ -188,7 +188,7 @@ mgFilterBool::~mgFilterBool() { } -string mgFilterBool::getStrVal() +std::string mgFilterBool::getStrVal() { if(m_bval) return "true"; @@ -201,12 +201,12 @@ int mgFilterBool::getIntVal() return (int) m_bval; } -string mgFilterBool::getTrueString() +std::string mgFilterBool::getTrueString() { return m_truestr; } -string mgFilterBool::getFalseString() +std::string mgFilterBool::getFalseString() { return m_falsestr; } @@ -243,7 +243,7 @@ bool mgFilterBool::isSet() //------------------------------------------------------------------- // mgFilterChoice //------------------------------------------------------------------- -mgFilterChoice::mgFilterChoice(const char *name, int value, vector<string> *choices) +mgFilterChoice::mgFilterChoice(const char *name, int value, std::vector<std::string> *choices) : mgFilter(name) { m_type = CHOICE; @@ -260,7 +260,7 @@ mgFilterChoice::~mgFilterChoice() m_choices.clear(); } -string mgFilterChoice::getStrVal() +std::string mgFilterChoice::getStrVal() { if( m_selval < 0 || m_selval >= (int) m_choices.size() ) { @@ -268,7 +268,7 @@ string mgFilterChoice::getStrVal() } return m_choices[m_selval]; } -vector<string> &mgFilterChoice::getChoices() +std::vector<std::string> &mgFilterChoice::getChoices() { return m_choices; } @@ -17,7 +17,6 @@ #include "vdr_setup.h" -using namespace std; //------------------------------------------------------------------- // mgFilterSets @@ -35,12 +34,12 @@ mgFilterSets::mgFilterSets() mgFilterSets::~mgFilterSets() { - vector<mgFilter*> *set; - for(vector<vector<mgFilter*>*>::iterator iter1 = m_sets.begin(); + std::vector<mgFilter*> *set; + for(std::vector<std::vector<mgFilter*>*>::iterator iter1 = m_sets.begin(); iter1 != m_sets.end(); iter1++) { set = *iter1; - for(vector<mgFilter*>::iterator iter2 = set->begin(); + for(std::vector<mgFilter*>::iterator iter2 = set->begin(); iter2 != set->end(); iter2++) { delete (*iter2); @@ -99,7 +98,7 @@ void mgFilterSets::select(int n) ********************************************************************/ void mgFilterSets::clear() { - for(vector<mgFilter*>::iterator iter = m_activeSet->begin(); + for(std::vector<mgFilter*>::iterator iter = m_activeSet->begin(); iter != m_activeSet->end(); iter++) { (*iter)->clear(); @@ -111,7 +110,7 @@ void mgFilterSets::select(int n) ********************************************************************/ void mgFilterSets::accept() { - for(vector<mgFilter*>::iterator iter = m_activeSet->begin(); + for(std::vector<mgFilter*>::iterator iter = m_activeSet->begin(); iter != m_activeSet->end(); iter++) { (*iter)->store(); @@ -125,9 +124,9 @@ void mgFilterSets::select(int n) * the application may temporarily modify the filter values * accept() needs to be called to memorize the changed values ********************************************************************/ - vector<mgFilter*> *mgFilterSets::getFilters() + std::vector<mgFilter*> *mgFilterSets::getFilters() { - for(vector<mgFilter*>::iterator iter = m_activeSet->begin(); + for(std::vector<mgFilter*>::iterator iter = m_activeSet->begin(); iter != m_activeSet->end(); iter++) { (*iter)->restore(); @@ -139,7 +138,7 @@ void mgFilterSets::select(int n) /*! * \brief return title of the active filter set */ -string mgFilterSets::getTitle() +std::string mgFilterSets::getTitle() { if(m_activeSetId < (int) m_titles.size()) { @@ -147,7 +146,7 @@ string mgFilterSets::getTitle() } else { - mgWarning("Implementation error: No title string for filter set %d", + mgWarning("Implementation error: No title std::string for filter set %d", m_activeSetId); return "NO-TITLE"; } @@ -200,7 +199,7 @@ mgMedia::~mgMedia() } } -string mgMedia::getMediaTypeName() +std::string mgMedia::getMediaTypeName() { switch(m_mediatype) { @@ -226,11 +225,11 @@ mgSelectionTreeNode* mgMedia::getSelectionRoot() mgPlaylist* mgMedia::createTemporaryPlaylist() { - string tmpname = "current"; + std::string tmpname = "current"; return loadPlaylist( tmpname ); } -mgPlaylist* mgMedia::loadPlaylist(string name) +mgPlaylist* mgMedia::loadPlaylist(std::string name) { mgPlaylist *list; switch( m_mediatype ) @@ -250,7 +249,7 @@ mgPlaylist* mgMedia::loadPlaylist(string name) /*! * \brief Obtain a list of stored playlists */ -vector<string> *mgMedia::getStoredPlaylists() +std::vector<std::string> *mgMedia::getStoredPlaylists() { switch(m_mediatype) { @@ -260,15 +259,15 @@ vector<string> *mgMedia::getStoredPlaylists() } break; } mgError("implementation Error"); // we should never get here - return new vector<string>(); + return new std::vector<std::string>(); } /*! * \brief obtain the indices of columns which are presented by default */ -vector<int> mgMedia::getDefaultCols() +std::vector<int> mgMedia::getDefaultCols() { - vector<int> cols; + std::vector<int> cols; switch(m_mediatype) { case GD_MP3: @@ -324,7 +323,7 @@ void mgMedia::initFilterSet(int num) * * Note: Modifications become only effective by calling applyActiveFilter() ********************************************************************/ -vector<mgFilter*> *mgMedia::getActiveFilters() +std::vector<mgFilter*> *mgMedia::getActiveFilters() { if(!m_filters) { @@ -336,7 +335,7 @@ vector<mgFilter*> *mgMedia::getActiveFilters() /*! * \brief returns title of the active filter set */ -string mgMedia::getActiveFilterTitle() +std::string mgMedia::getActiveFilterTitle() { switch(m_mediatype) diff --git a/mg_playlist.c b/mg_playlist.c index 3c7dae0..a63519e 100644 --- a/mg_playlist.c +++ b/mg_playlist.c @@ -13,13 +13,13 @@ * making it persistent in some database. */ +#include <stdio.h> #include "mg_playlist.h" #include "mg_tools.h" #include <vector> #include <iostream> -using namespace std; /* ==== constructors ==== */ @@ -33,7 +33,7 @@ mgPlaylist::mgPlaylist() m_listname = buffer; } -mgPlaylist::mgPlaylist(string listname) +mgPlaylist::mgPlaylist(std::string listname) { m_current_idx = -1; m_listname = listname; @@ -67,9 +67,9 @@ void mgPlaylist::append(mgContentItem* item) } /* append a list of tracks at the end of the playlist */ -void mgPlaylist::appendList( vector<mgContentItem*> *tracks ) +void mgPlaylist::appendList( std::vector<mgContentItem*> *tracks ) { - vector<mgContentItem*>::iterator iter; + std::vector<mgContentItem*>::iterator iter; mgDebug( 3, "Adding %d tracks to the playlist", tracks->size() ); @@ -116,7 +116,7 @@ void mgPlaylist::clear() { // TODO: who takes care of memory allocation/deallocation of mgItems? - vector<mgContentItem*>::iterator iter; + std::vector<mgContentItem*>::iterator iter; for( iter = m_list.begin(); iter != m_list.end(); iter++ ) { // delete each item in the list @@ -132,8 +132,8 @@ void mgPlaylist::clear() void mgPlaylist::move( int from, int to ) { - vector<mgContentItem*>::iterator from_iter = m_list.begin() + from; - vector<mgContentItem*>::iterator to_iter = m_list.begin() + to; + std::vector<mgContentItem*>::iterator from_iter = m_list.begin() + from; + std::vector<mgContentItem*>::iterator to_iter = m_list.begin() + to; m_list.insert( to_iter, *from_iter); m_list.erase( from_iter ); @@ -149,12 +149,12 @@ void mgPlaylist::move( int from, int to ) } /*==== access tracks ====*/ -string mgPlaylist::getListname() +std::string mgPlaylist::getListname() { return m_listname; } -void mgPlaylist::setListname(string name) +void mgPlaylist::setListname(std::string name) { m_listname = name; } @@ -239,9 +239,9 @@ mgContentItem* mgPlaylist::sneakNext() } } -bool mgPlaylist::exportM3U( string m3u_file ) +bool mgPlaylist::exportM3U( std::string m3u_file ) { - vector<mgContentItem*>::iterator iter; + std::vector<mgContentItem*>::iterator iter; bool result = true; // open a file for writing @@ -10,12 +10,12 @@ #include "mg_tools.h" -extern "C" -{ +/*extern "C" +{*/ #include <stdarg.h> #include <stdio.h> -} - +/*} +*/ #include <stdlib.h> #define MAX_BUFLEN 2048 @@ -10,10 +10,6 @@ * $Id$ */ -#include <getopt.h> - -#include <config.h> - #include "muggle.h" #include "vdr_menu.h" @@ -23,12 +19,13 @@ #include "mg_media.h" #include "i18n.h" +#include <getopt.h> +#include <config.h> static const char *VERSION = "0.0.4"; static const char *DESCRIPTION = "Media juggle plugin for VDR"; static const char *MAINMENUENTRY = "Muggle"; -using namespace std; const char* mgMuggle::Version(void) { @@ -128,7 +125,7 @@ bool mgMuggle::ProcessArgs(int argc, char *argv[]) { if (optarg[strlen(optarg) - 1] != '/') { - string res = string(optarg) + "/"; + std::string res = std::string(optarg) + "/"; the_setup.ToplevelDir = strdup( res.c_str() ); } else @@ -32,7 +32,7 @@ #ifndef _MUGGLE_H #define _MUGGLE_H - +#include <string> #include <plugin.h> class mgMedia; @@ -4,9 +4,8 @@ * * \author Lars von Wedel */ - +//#define VERBOSE #include <string> -using namespace std; #include <stdlib.h> #include <stdio.h> @@ -22,7 +21,7 @@ using namespace std; MYSQL *db; -string host, user, pass, dbname, socket; +std::string host, user, pass, dbname, socket; bool import_assorted; int init_database() @@ -31,7 +30,7 @@ int init_database() if( db == NULL ) { - cout << "mysql_init failed." << endl; + std::cout << "mysql_init failed." << std::endl; return -1; } @@ -42,7 +41,7 @@ int init_database() 0, socket.c_str(), 0 ) == NULL ) { - cout << "mysql_real_connect using sockets failed." << endl; + std::cout << "mysql_real_connect using sockets failed." << std::endl; return -2; } } @@ -51,7 +50,7 @@ int init_database() if( mysql_real_connect( db, host.c_str(), user.c_str(), pass.c_str(), dbname.c_str(), 0, NULL, 0 ) == NULL ) { - cout << "mysql_real_connect via TCP failed." << endl; + std::cout << "mysql_real_connect via TCP failed." << std::endl; return -2; } } @@ -59,7 +58,7 @@ int init_database() return 0; } -time_t get_fs_modification_time( string filename ) +time_t get_fs_modification_time( std::string filename ) { struct stat *buf = (struct stat*) malloc( sizeof( struct stat ) ); @@ -79,7 +78,7 @@ time_t get_db_modification_time( long uid ) MYSQL_RES *result = mgSqlReadQuery( db, "SELECT modification_time FROM tracks WHERE id=\"%d\"", uid ); MYSQL_ROW row = mysql_fetch_row( result ); - string mod_time = row[0]; + std::string mod_time = row[0]; mt = (time_t) atol( mod_time.c_str() ); return mt; @@ -95,7 +94,7 @@ TagLib::String escape_string( MYSQL *db, TagLib::String s ) return TagLib::String( escbuf ); } -long find_file_in_database( MYSQL *db, string filename ) +long find_file_in_database( MYSQL *db, std::string filename ) { TagLib::String file = TagLib::String( filename.c_str() ); file = escape_string( db, file ); @@ -108,7 +107,7 @@ long find_file_in_database( MYSQL *db, string filename ) } // read tags from the mp3 file and store them into the corresponding database entry -void update_db( long uid, string filename ) +void update_db( long uid, std::string filename ) { TagLib::String title, album, artist, genre, cddbid; uint trackno, year; @@ -118,7 +117,7 @@ void update_db( long uid, string filename ) if( !f.isNull() && f.tag() ) { - // cout << "Evaluating " << filename << endl; + // std::cout << "Evaluating " << filename << std::endl; TagLib::Tag *tag = f.tag(); // obtain tag information @@ -220,7 +219,7 @@ void update_db( long uid, string filename ) if( uid > 0 ) { // the entry is known to exist already, hence update it - mgSqlWriteQuery( db, "UPDATE tracks SET artist=\"%s\", title=\"%s\", year=\"%s\"," + mgSqlWriteQuery( db, "UPDATE tracks SET artist=\"%s\", title=\"%s\", year=\"%d\"," "sourceid=\"%s\", mp3file=\"%s\", length=%d, bitrate=\"%d\"," "samplerate=%d, channels=%d WHERE id=%d", artist.toCString(), title.toCString(), year, @@ -236,25 +235,25 @@ void update_db( long uid, string filename ) trackno, filename.c_str(), len, bitrate, sample, channels ); #ifdef VERBOSE - cout << "-- TAG --" << endl; - cout << "title - \"" << tag->title() << "\"" << endl; - cout << "artist - \"" << tag->artist() << "\"" << endl; - cout << "album - \"" << tag->album() << "\"" << endl; - cout << "year - \"" << tag->year() << "\"" << endl; - cout << "comment - \"" << tag->comment() << "\"" << endl; - cout << "track - \"" << tag->track() << "\"" << endl; - cout << "genre - \"" << tag->genre() << "\"" << endl; + std::cout << "-- TAG --" << std::endl; + std::cout << "title - \"" << tag->title() << "\"" << std::endl; + std::cout << "artist - \"" << tag->artist() << "\"" << std::endl; + std::cout << "album - \"" << tag->album() << "\"" << std::endl; + std::cout << "year - \"" << tag->year() << "\"" << std::endl; + std::cout << "comment - \"" << tag->comment() << "\"" << std::endl; + std::cout << "track - \"" << tag->track() << "\"" << std::endl; + std::cout << "genre - \"" << tag->genre() << "\"" << std::endl; #endif } } } -void update_tags( long uid, string filename ) +void update_tags( long uid, std::string filename ) { } -void evaluate_file( MYSQL *db, string filename ) +void evaluate_file( MYSQL *db, std::string filename ) { if( 0 == init_database() ) { @@ -293,22 +292,22 @@ void evaluate_file( MYSQL *db, string filename ) int main( int argc, char *argv[] ) { int option_index; - string filename; + std::string filename; if( argc < 2 ) { // we need at least a filename! - cout << "mugglei -- import helper for Muggle VDR plugin" << endl; - cout << "(C) Lars von Wedel" << endl; - cout << "This is free software; see the source for copying conditions." << endl; - cout << "" << endl; - cout << "Options:" << endl; - cout << " -h <hostname> - specify host of mySql database server (default is 'localhost')" << endl; - cout << " -s <socket> - specify a socket for mySQL communication (default is TCP)" << endl; - cout << " -n <database> - specify database name (default is 'GiantDisc')" << endl; - cout << " -u <username> - specify user of mySql database (default is empty)" << endl; - cout << " -p <password> - specify password of user (default is empty password)" << endl; - cout << " -f <filename> - name of music file to import" << endl; - cout << " -a - import track as if it was on an assorted album" << endl; + std::cout << "mugglei -- import helper for Muggle VDR plugin" << std::endl; + std::cout << "(C) Lars von Wedel" << std::endl; + std::cout << "This is free software; see the source for copying conditions." << std::endl; + std::cout << "" << std::endl; + std::cout << "Options:" << std::endl; + std::cout << " -h <hostname> - specify host of mySql database server (default is 'localhost')" << std::endl; + std::cout << " -s <socket> - specify a socket for mySQL communication (default is TCP)" << std::endl; + std::cout << " -n <database> - specify database name (default is 'GiantDisc')" << std::endl; + std::cout << " -u <username> - specify user of mySql database (default is empty)" << std::endl; + std::cout << " -p <password> - specify password of user (default is empty password)" << std::endl; + std::cout << " -f <filename> - name of music file to import" << std::endl; + std::cout << " -a - import track as if it was on an assorted album" << std::endl; exit( 1 ); } @@ -381,7 +380,7 @@ int main( int argc, char *argv[] ) } else { - cout << "Database initialization failed. Exiting.\n" << endl; + std::cout << "Database initialization failed. Exiting.\n" << std::endl; } return res; diff --git a/vdr_decoder.c b/vdr_decoder.c index 1c0b154..0384031 100644 --- a/vdr_decoder.c +++ b/vdr_decoder.c @@ -21,20 +21,18 @@ #include <sys/stat.h> #include <sys/vfs.h> -#include <videodir.h> -#include <interface.h> - #include "vdr_decoder.h" #include "vdr_decoder_mp3.h" #include "vdr_decoder_ogg.h" #include "mg_content_interface.h" -using namespace std; +#include <videodir.h> +#include <interface.h> // --- mgDecoders --------------------------------------------------------------- -mgMediaType mgDecoders::getMediaType( string s ) +mgMediaType mgDecoders::getMediaType( std::string s ) { mgMediaType mt = MT_UNKNOWN; @@ -62,7 +60,7 @@ mgDecoder *mgDecoders::findDecoder( mgContentItem *item ) { mgDecoder *decoder = 0; - string filename = item->getSourceFile(); + std::string filename = item->getSourceFile(); switch( getMediaType( filename ) ) { diff --git a/vdr_decoder_mp3.c b/vdr_decoder_mp3.c index 20fca5e..eb5cb42 100644 --- a/vdr_decoder_mp3.c +++ b/vdr_decoder_mp3.c @@ -32,7 +32,6 @@ #define d(x) x -using namespace std; // ---------------------------------------------------------------- diff --git a/vdr_decoder_ogg.c b/vdr_decoder_ogg.c index 9525979..94bd37d 100644 --- a/vdr_decoder_ogg.c +++ b/vdr_decoder_ogg.c @@ -22,7 +22,6 @@ #include "mg_content_interface.h" -using namespace std; // --- mgOggFile ---------------------------------------------------------------- @@ -36,11 +35,11 @@ class mgOggFile // : public mgFileInfo void error( const char *action, const int err ); - string m_filename; + std::string m_filename; public: - mgOggFile( string filename ); + mgOggFile( std::string filename ); ~mgOggFile(); bool open(bool log=true); @@ -56,7 +55,7 @@ class mgOggFile // : public mgFileInfo long long indexMs(void); }; -mgOggFile::mgOggFile( string filename ) : +mgOggFile::mgOggFile( std::string filename ) : m_filename( filename ) { m_canSeek = false; @@ -10,11 +10,11 @@ * $Id$ */ +#include <typeinfo> #include <string> #include <vector> #include <mysql/mysql.h> - #include <menuitems.h> #include <tools.h> #include <config.h> @@ -38,7 +38,6 @@ #include "gd_content_interface.h" -using namespace std; // ----------------------- mgMenuTreeItem ------------------ @@ -155,7 +154,7 @@ eOSState mgMainMenu::ProcessKey(eKeys key) { mgDebug( 1, "mgMainMenu: add selection %s to playlist", current->getLabel().c_str() ); // Add selection to Play - vector<mgContentItem*> *tracks = current->getTracks(); + std::vector<mgContentItem*> *tracks = current->getTracks(); if( tracks ) { @@ -335,7 +334,7 @@ eOSState mgMainMenu::ProcessKey(eKeys key) m_current_playlist -> clear(); delete m_current_playlist; - string selected = (*m_plists)[ Current() ]; + std::string selected = (*m_plists)[ Current() ]; m_current_playlist = m_media->loadPlaylist( selected.c_str() ); // clean the list of playlist @@ -499,9 +498,9 @@ void mgMainMenu::DisplayTree( mgSelectionTreeNode* node, int select ) SetButtons(); m_node = node; - vector<mgSelectionTreeNode*> children = node->getChildren(); + std::vector<mgSelectionTreeNode*> children = node->getChildren(); - for( vector<mgSelectionTreeNode*>::iterator iter = children.begin(); + for( std::vector<mgSelectionTreeNode*>::iterator iter = children.begin(); iter != children.end(); iter ++ ) { @@ -560,7 +559,7 @@ eOSState mgMainMenu::TreeSubmenuAction( int n ) m_current_playlist->clear(); // append current node - vector<mgContentItem*> *tracks = current->getTracks(); + std::vector<mgContentItem*> *tracks = current->getTracks(); if( tracks ) { @@ -594,7 +593,7 @@ void mgMainMenu::DisplayPlaylist( int index_current ) Clear(); SetButtons(); - vector<mgContentItem*>* list = m_current_playlist-> getAll(); + std::vector<mgContentItem*>* list = m_current_playlist-> getAll(); static char titlestr[80]; sprintf( titlestr, "Muggle - %s (%d %s)",tr("Playlist"), list->size() , @@ -603,7 +602,7 @@ void mgMainMenu::DisplayPlaylist( int index_current ) for( unsigned int i = 0; i < m_current_playlist->getNumItems(); i++) { - string label = m_current_playlist->getLabel( i, " " ); + std::string label = m_current_playlist->getLabel( i, " " ); Add( new cOsdItem( label.c_str() ) ); } @@ -632,7 +631,7 @@ void mgMainMenu::LoadPlaylist() // retrieve list of available playlists m_plists = m_media->getStoredPlaylists(); - for(vector<string>::iterator iter = m_plists->begin(); + for(std::vector<std::string>::iterator iter = m_plists->begin(); iter != m_plists->end() ; iter++) { Add( new cOsdItem( iter->c_str() ) ); @@ -730,7 +729,7 @@ eOSState mgMainMenu::ExecutePlaylistCommand( int current ) #endif free( buffer ); - string tmp_m3u_file = (char *) AddDirectory( cPlugin::ConfigDirectory("muggle"), "current.m3u" ); + std::string tmp_m3u_file = (char *) AddDirectory( cPlugin::ConfigDirectory("muggle"), "current.m3u" ); m_current_playlist->exportM3U( tmp_m3u_file ); char *result = (char *)command->Execute( tmp_m3u_file.c_str() ); @@ -752,7 +751,7 @@ eOSState mgMainMenu::ExecutePlaylistCommand( int current ) eOSState mgMainMenu::PlaylistSubmenuAction( int n ) { - cout << "mgMainMenu::PlaylistSubmenuAction: " << n << endl << flush; + std::cout << "mgMainMenu::PlaylistSubmenuAction: " << n << std::endl << std::flush; eOSState state = osContinue; switch( n ) @@ -797,7 +796,7 @@ eOSState mgMainMenu::PlaylistSubmenuAction( int n ) { // clear playlist cControl *control = cControl::Control(); - string buffer; + std::string buffer; if( control && typeid(*control) == typeid(mgPlayerControl) ) { @@ -832,7 +831,7 @@ eOSState mgMainMenu::PlaylistSubmenuAction( int n ) DisplayPlaylist( m_last_osd_index ); // confirmation - string confirm = res? "Entry deleted": "Cannot delete entry"; + std::string confirm = res? "Entry deleted": "Cannot delete entry"; #if VDRVERSNUM >= 10307 Skins.Message( mtInfo, confirm.c_str() ); @@ -844,7 +843,7 @@ eOSState mgMainMenu::PlaylistSubmenuAction( int n ) } break; case 5: { - string m3u_file = AddDirectory( cPlugin::ConfigDirectory("muggle"), + std::string m3u_file = AddDirectory( cPlugin::ConfigDirectory("muggle"), m_current_playlist->getListname().c_str() ); m_current_playlist->exportM3U( m3u_file ); } break; @@ -869,10 +868,10 @@ void mgMainMenu::DisplayFilter() SetButtons(); SetTitle( m_media->getActiveFilterTitle().c_str() ); - vector<mgFilter*> *filter_list = m_media->getActiveFilters(); + std::vector<mgFilter*> *filter_list = m_media->getActiveFilters(); int i=0; - for( vector<mgFilter*>::iterator iter = filter_list->begin(); + for( std::vector<mgFilter*>::iterator iter = filter_list->begin(); iter != filter_list->end(); iter ++ ) { @@ -912,12 +911,12 @@ void mgMainMenu::DisplayFilter() case mgFilter::CHOICE: { mgFilterChoice *fc = (mgFilterChoice *) (*iter); - vector<string> choices = fc->getChoices(); + std::vector<std::string> choices = fc->getChoices(); char **choices_str = new (char *)[ choices.size() ]; int j = 0; - for( vector<string>::iterator iter = choices.begin(); + for( std::vector<std::string>::iterator iter = choices.begin(); iter != choices.end(); iter ++, j ++ ) { @@ -13,11 +13,11 @@ #ifndef _VDR_MENU_H #define _VDR_MENU_H +#include <string> #include <list> #include <vector> #include <osd.h> - #include "i18n.h" class cCommands; @@ -107,10 +107,10 @@ class mgMainMenu : public cOsdMenu mgSelectionTreeNode *m_root; mgSelectionTreeNode *m_node; mgPlaylist *m_current_playlist; - std::vector<std::string> *m_plists; + std::vector< std::string > *m_plists; MuggleStatus m_state; - std::list<int> m_history; + std::list< int > m_history; cCommands *m_playlist_commands; diff --git a/vdr_player.c b/vdr_player.c index e70b8fa..2ed1416 100644 --- a/vdr_player.c +++ b/vdr_player.c @@ -45,7 +45,6 @@ #include "mg_playlist.h" #include "mg_content_interface.h" -using namespace std; // ---------------------------------------------------------------- @@ -350,7 +349,7 @@ void mgPCMPlayer::Action(void) #ifdef DEBUG if(time(0)>=beat+30) { - cout << "mgPCMPlayer::Action: heartbeat buffer=" << m_ringbuffer->Available() << endl << flush; + std::cout << "mgPCMPlayer::Action: heartbeat buffer=" << m_ringbuffer->Available() << std::endl << std::flush; scale.Stats(); if(haslevel) norm.Stats(); beat=time(0); } @@ -369,7 +368,7 @@ void mgPCMPlayer::Action(void) if( m_playing && m_playing != &(mgContentItem::UNDEFINED) ) { - string filename = m_playing->getSourceFile(); + std::string filename = m_playing->getSourceFile(); // mgDebug( 1, "mgPCMPlayer::Action: music file is %s", filename.c_str() ); if( ( m_decoder = mgDecoders::findDecoder( m_playing ) ) && m_decoder->start() ) @@ -436,7 +435,7 @@ void mgPCMPlayer::Action(void) static unsigned int oldrate=0; if(oldrate!=pcm->samplerate) { - cout << "mgPCMPlayer::Action: new input sample rate " << pcm->samplerate << endl << flush; + std::cout << "mgPCMPlayer::Action: new input sample rate " << pcm->samplerate << std::endl << std::flush; oldrate = pcm->samplerate; } } diff --git a/vdr_stream.c b/vdr_stream.c index d82877e..0c12075 100644 --- a/vdr_stream.c +++ b/vdr_stream.c @@ -3,11 +3,11 @@ * \brief Implementation of media stream classes * * \version $Revision: 1.2 $ - * \date $Date: 2004/05/28 15:29:19 $ + * \date $Date$ * \author Ralf Klueber, Lars von Wedel, Andreas Kellner - * \author Responsible author: $Author: lvw $ + * \author Responsible author: $Author$ * - * $Id: vdr_stream.c,v 1.2 2004/05/28 15:29:19 lvw Exp $ + * $Id$ * * Adapted from * MP3/MPlayer plugin to VDR (C++) @@ -31,7 +31,7 @@ // #include "i18n.h" // #include "version.h" -#define tr(x) x +//#define tr(x) x #ifdef USE_MMAP #include <sys/mman.h> @@ -39,11 +39,10 @@ #define DEFAULT_PORT 80 // default port for streaming (HTTP) -using namespace std; // --- mgStream ----------------------------------------------------------------- -mgStream::mgStream( string filename ) +mgStream::mgStream( std::string filename ) : m_filename( filename ) { m_fd = -1; |