Skip to content

Commit

Permalink
handle direct mms:// streams
Browse files Browse the repository at this point in the history
  • Loading branch information
thekvs committed Nov 24, 2016
1 parent b246880 commit 9b779f2
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ endif()

set(TARGET_VERSION_MAJOR 0)
set(TARGET_VERSION_MINOR 2)
set(TARGET_VERSION_PATCH 7)
set(TARGET_VERSION_PATCH 8)
set(APP_VERSION "${TARGET_VERSION_MAJOR}.${TARGET_VERSION_MINOR}.${TARGET_VERSION_PATCH}")

add_subdirectory(src)
Expand Down
22 changes: 21 additions & 1 deletion src/playlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,15 @@ Playlist::~Playlist()
std::tuple<bool, MediaStreams>
Playlist::get_streams(std::string url)
{
bool status = false;
MediaStreams streams;

if (has_prefix("mms://", url)) {
streams.push_back(url);
return std::make_tuple(true, streams);
}

bool status = false;

prepare_playlist_request(url, kOnlyHeaders);
auto rc = curl_easy_perform(handle);
auto http_status_code = get_http_status();
Expand Down Expand Up @@ -153,6 +159,20 @@ Playlist::run_playlist_decoders(std::string url)
return streams;
}

bool
Playlist::has_prefix(const std::string& prefix, const std::string& str)
{
if (prefix.size() > str.size()) {
return false;
}

if (strncasecmp(str.c_str(), prefix.c_str(), prefix.size()) == 0) {
return true;
}

return false;
}

size_t
Playlist::write_memory_cb(void* ptr, size_t size, size_t nmemb, void* data)
{
Expand Down
1 change: 1 addition & 0 deletions src/playlist.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class Playlist
long get_http_status();
std::string get_content_type();
MediaStreams run_playlist_decoders(std::string url);
bool has_prefix(const std::string& prefix, const std::string& str);

static size_t write_memory_cb(void* ptr, size_t size, size_t nmemb, void* data);
};
Expand Down

0 comments on commit 9b779f2

Please sign in to comment.