Skip to content
Snippets Groups Projects
Commit 1fdf88d7 authored by François Cartegnie's avatar François Cartegnie :fingers_crossed:
Browse files

demux: adaptive: expose content-type

parent 7bbd00f2
No related branches found
No related tags found
No related merge requests found
...@@ -59,6 +59,11 @@ size_t AbstractConnection::getContentLength() const ...@@ -59,6 +59,11 @@ size_t AbstractConnection::getContentLength() const
return contentLength; return contentLength;
} }
const std::string & AbstractConnection::getContentType() const
{
return contentType;
}
HTTPConnection::HTTPConnection(vlc_object_t *p_object_, AuthStorage *auth, HTTPConnection::HTTPConnection(vlc_object_t *p_object_, AuthStorage *auth,
Socket *socket_, const ConnectionParams &proxy, bool persistent) Socket *socket_, const ConnectionParams &proxy, bool persistent)
: AbstractConnection( p_object_ ) : AbstractConnection( p_object_ )
...@@ -123,6 +128,7 @@ void HTTPConnection::disconnect() ...@@ -123,6 +128,7 @@ void HTTPConnection::disconnect()
chunked = false; chunked = false;
chunkLength = 0; chunkLength = 0;
bytesRange = BytesRange(); bytesRange = BytesRange();
contentType = std::string();
socket->disconnect(); socket->disconnect();
} }
...@@ -380,6 +386,10 @@ void HTTPConnection::onHeader(const std::string &key, ...@@ -380,6 +386,10 @@ void HTTPConnection::onHeader(const std::string &key,
{ {
chunked = true; chunked = true;
} }
else if(key == "Content-Type")
{
contentType = value;
}
else if(key == "Location") else if(key == "Location")
{ {
locationparams = ConnectionParams(); locationparams = ConnectionParams();
...@@ -464,6 +474,7 @@ void StreamUrlConnection::reset() ...@@ -464,6 +474,7 @@ void StreamUrlConnection::reset()
p_streamurl = NULL; p_streamurl = NULL;
bytesRead = 0; bytesRead = 0;
contentLength = 0; contentLength = 0;
contentType = std::string();
bytesRange = BytesRange(); bytesRange = BytesRange();
} }
...@@ -486,6 +497,13 @@ int StreamUrlConnection::request(const std::string &path, const BytesRange &rang ...@@ -486,6 +497,13 @@ int StreamUrlConnection::request(const std::string &path, const BytesRange &rang
if(!p_streamurl) if(!p_streamurl)
return VLC_EGENERIC; return VLC_EGENERIC;
char *psz_type = stream_ContentType(p_streamurl);
if(psz_type)
{
contentType = std::string(psz_type);
free(psz_type);
}
stream_t *p_chain = vlc_stream_FilterNew( p_streamurl, "inflate" ); stream_t *p_chain = vlc_stream_FilterNew( p_streamurl, "inflate" );
if( p_chain ) if( p_chain )
p_streamurl = p_chain; p_streamurl = p_chain;
......
...@@ -50,6 +50,7 @@ namespace adaptive ...@@ -50,6 +50,7 @@ namespace adaptive
virtual ssize_t read (void *p_buffer, size_t len) = 0; virtual ssize_t read (void *p_buffer, size_t len) = 0;
virtual size_t getContentLength() const; virtual size_t getContentLength() const;
virtual const std::string & getContentType() const;
virtual void setUsed( bool ) = 0; virtual void setUsed( bool ) = 0;
protected: protected:
...@@ -57,6 +58,7 @@ namespace adaptive ...@@ -57,6 +58,7 @@ namespace adaptive
ConnectionParams params; ConnectionParams params;
bool available; bool available;
size_t contentLength; size_t contentLength;
std::string contentType;
BytesRange bytesRange; BytesRange bytesRange;
size_t bytesRead; size_t bytesRead;
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment