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
return contentLength;
}
const std::string & AbstractConnection::getContentType() const
{
return contentType;
}
HTTPConnection::HTTPConnection(vlc_object_t *p_object_, AuthStorage *auth,
Socket *socket_, const ConnectionParams &proxy, bool persistent)
: AbstractConnection( p_object_ )
......@@ -123,6 +128,7 @@ void HTTPConnection::disconnect()
chunked = false;
chunkLength = 0;
bytesRange = BytesRange();
contentType = std::string();
socket->disconnect();
}
......@@ -380,6 +386,10 @@ void HTTPConnection::onHeader(const std::string &key,
{
chunked = true;
}
else if(key == "Content-Type")
{
contentType = value;
}
else if(key == "Location")
{
locationparams = ConnectionParams();
......@@ -464,6 +474,7 @@ void StreamUrlConnection::reset()
p_streamurl = NULL;
bytesRead = 0;
contentLength = 0;
contentType = std::string();
bytesRange = BytesRange();
}
......@@ -486,6 +497,13 @@ int StreamUrlConnection::request(const std::string &path, const BytesRange &rang
if(!p_streamurl)
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" );
if( p_chain )
p_streamurl = p_chain;
......
......@@ -50,6 +50,7 @@ namespace adaptive
virtual ssize_t read (void *p_buffer, size_t len) = 0;
virtual size_t getContentLength() const;
virtual const std::string & getContentType() const;
virtual void setUsed( bool ) = 0;
protected:
......@@ -57,6 +58,7 @@ namespace adaptive
ConnectionParams params;
bool available;
size_t contentLength;
std::string contentType;
BytesRange bytesRange;
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