virtual safe_ptr<basic_frame> receive(int hints) override\r
{\r
if(current_ == frame_producer::empty() && !producers_.empty())\r
- {\r
- current_ = producers_.front();\r
- producers_.pop_front();\r
- if(loop_)\r
- producers_.push_back(current_);\r
- }\r
+ next();\r
\r
auto frame = current_->receive(hints);\r
if(frame == basic_frame::eof())\r
\r
virtual std::wstring print() const override\r
{\r
- return L"playlist[]";\r
+ return L"playlist[" + current_->print() + L"]";\r
} \r
\r
virtual int64_t nb_frames() const override\r
static const boost::wregex push_front_exp (L"PUSH_FRONT (?<PARAM>.+)"); \r
static const boost::wregex push_back_exp (L"(PUSH_BACK|PUSH) (?<PARAM>.+)");\r
static const boost::wregex pop_front_exp (L"POP_FRONT"); \r
- static const boost::wregex pop_back_exp (L"(POP_BACK|POP)"); \r
+ static const boost::wregex pop_back_exp (L"(POP_BACK|POP)");\r
+ static const boost::wregex clear_exp (L"CLEAR");\r
+ static const boost::wregex next_exp (L"NEXT");\r
static const boost::wregex insert_exp (L"INSERT (?<POS>\\d+) (?<PARAM>.+)"); \r
static const boost::wregex remove_exp (L"REMOVE (?<POS>\\d+) (?<PARAM>.+)"); \r
static const boost::wregex list_exp (L"LIST"); \r
return pop_front(); \r
else if(boost::regex_match(param, what, pop_back_exp))\r
return pop_back(); \r
+ else if(boost::regex_match(param, what, clear_exp))\r
+ return clear();\r
+ else if(boost::regex_match(param, what, next_exp))\r
+ return next(); \r
else if(boost::regex_match(param, what, insert_exp))\r
return insert(boost::lexical_cast<size_t>(what["POS"].str()), what["PARAM"].str());\r
else if(boost::regex_match(param, what, remove_exp))\r
return L"";\r
}\r
\r
+ std::wstring clear()\r
+ {\r
+ producers_.clear();\r
+ return L"";\r
+ }\r
+\r
+ std::wstring next()\r
+ {\r
+ if(!producers_.empty())\r
+ {\r
+ current_ = producers_.front();\r
+ producers_.pop_front();\r
+ if(loop_)\r
+ producers_.push_back(current_);\r
+ }\r
+ return L"";\r
+ }\r
+ \r
std::wstring insert(size_t pos, const std::wstring& str)\r
{\r
if(pos >= producers_.size())\r
\r
std::wstring list() const\r
{\r
- std::wstring result = L"<playlist>";\r
+ std::wstring result = L"<playlist>\n";\r
BOOST_FOREACH(auto& producer, producers_) \r
result += L"\t<producer>" + producer->print() + L"</producer>\n";\r
return result + L"</playlist>";\r