blob: df677d4b83e2348152a1eaabff94ca2f61829e5f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
/*!
* \file mg_playlist.c
* \brief defines functions to be executed on playlists for the vdr muggle plugindatabase
*
* \version $Revision: 1.6 $
* \date $Date: 2004/07/26 22:20:55 $
* \author Ralf Klueber, Lars von Wedel, Andreas Kellner
* \author Responsible author: $Author: lvw $
*
* This file implements the class mgPlaylist which maintains a playlist
* and supports editing (e.g. adding or moving tracks), navigating it
* (e.g. obtaining arbitrary items or accessing them sequentially) or
* making it persistent in some database.
*/
#ifndef __MG_PLAYLIST
#define __MG_PLAYLIST
#include <string>
#include "mg_content_interface.h"
/*!
* \class mgPlaylist
*
* \brief Represents a generic playlist, i.e. an ordered collection of tracks
* Derived classes take care of specifics of certain media types
*/
class mgPlaylist : public mgTracklist
{
private:
//! \brief current index in the playlist
// TODO: should be a property of the player?
int m_current_idx;
protected:
// TODO: Why not make these private? Subclasses should use access functions. LVW
//! \brief the name of the playlist
std::string m_listname;
public:
/* ==== constructors and initialization ==== */
//! \brief the default constructor (random listname)
mgPlaylist();
/*! \brief constructor with a specified listname
*
* \param listname - initial name of the list
*/
mgPlaylist( std::string listname );
void initialize();
/* ==== destructor ==== */
//! \brief the destructor
virtual ~mgPlaylist();
/* === control behavior */
//! \brief toggle the loop mode. TODO.
void toggleLoop();
//! \brief toggle the shuffle mode. TODO.
void toggleShuffle();
/* ==== add/ remove tracks ==== */
/*! \brief adds a song at the end of the playlist
*
* \param item - the item to be appended
*/
virtual void append(mgContentItem* item);
/*! \brief add a vector of songs at the end of the playlist
*
* \param tracks - the vector of tracks to be added
*/
virtual void appendList(std::vector<mgContentItem*> *tracks);
/*! \brief add a song after a specified position
*
* Might be merged with append by using a default argument for the position
*
* \param item - the item to be added
* \param position - the position where the item should be added
*/
virtual void insert(mgContentItem* item, unsigned int position);
//! \brief clear all tracks
virtual void clear();
/*! \brief move tracks within playlist
*
* \param from - the item of the index to be moved
* \param to - the target index of the item
*/
void move( int from, int to );
/*! \brief remove a track from the playlist
*
* \param pos - the index of the track to be removed
*/
// bool remove( int pos );
/* ==== access tracks ==== */
//! \brief obtain the listname
std::string getListname() ;
//! \brief returns the current item of the list
virtual mgContentItem* getCurrent();
/*! \brief set the listname
*
* \param name - the new name of this list
*/
virtual void setListname(std::string name);
//! \brief returns the count of items in the list
int count();
/*! \brief returns the nth track from the playlist
*
* \param position - the position to skip to
*/
virtual void gotoPosition(unsigned int position);
//! \brief proceeds to the next item
virtual void skipFwd();
//! \brief goes back to the previous item
virtual void skipBack();
//! \brief obtain the next item without skipping the current position
virtual mgContentItem* sneakNext();
virtual bool storePlaylist() = 0;
//! \brief export the playlist in m3u format
virtual bool exportM3U( std::string m3u_file );
};
#endif
|