[vlc-commits] [Git][videolan/vlc][3.0.x] 2 commits: demux: adaptive: return string reference for ContentType
Felix Paul Kühne (@fkuehne)
gitlab at videolan.org
Sun Jun 29 13:25:33 UTC 2025
Felix Paul Kühne pushed to branch 3.0.x at VideoLAN / VLC
Commits:
cc09ef58 by François Cartegnie at 2025-06-29T12:56:09+00:00
demux: adaptive: return string reference for ContentType
(adapted from commit 05e6bc4a080b16266362276b43ad6c23f722c258)
- - - - -
08dae4ad by François Cartegnie at 2025-06-29T12:56:09+00:00
xml: Node: remove unneeded includes
(adapted from commit ac37bcc89d6a0b7293168350f7c2c022b37bcd9d)
- - - - -
4 changed files:
- modules/demux/adaptive/http/Chunk.cpp
- modules/demux/adaptive/http/Chunk.h
- modules/demux/adaptive/test/SegmentTracker.cpp
- modules/demux/adaptive/xml/Node.cpp
Changes:
=====================================
modules/demux/adaptive/http/Chunk.cpp
=====================================
@@ -37,6 +37,8 @@
using namespace adaptive::http;
+static std::string EmptyStr = "";
+
AbstractChunkSource::AbstractChunkSource(ChunkType t, const BytesRange &range)
{
type = t;
@@ -57,9 +59,9 @@ const BytesRange & AbstractChunkSource::getBytesRange() const
return bytesRange;
}
-std::string AbstractChunkSource::getContentType() const
+const std::string & AbstractChunkSource::getContentType() const
{
- return std::string();
+ return EmptyStr;
}
RequestStatus AbstractChunkSource::getRequestStatus() const
@@ -88,7 +90,7 @@ AbstractChunk::~AbstractChunk()
source->recycle();
}
-std::string AbstractChunk::getContentType() const
+const std::string & AbstractChunk::getContentType() const
{
return source->getContentType();
}
@@ -264,13 +266,13 @@ StorageID HTTPChunkSource::makeStorageID(const std::string &s, const BytesRange
return std::to_string(r.getStartByte())+ std::to_string(r.getEndByte()) + '@' + s;
}
-std::string HTTPChunkSource::getContentType() const
+const std::string & HTTPChunkSource::getContentType() const
{
vlc_mutex_locker locker(&lock);
if(connection)
return connection->getContentType();
else
- return std::string();
+ return EmptyStr;
}
void HTTPChunkSource::setIdentifier(const std::string &s, const BytesRange &r)
@@ -570,7 +572,7 @@ ProbeableChunk::~ProbeableChunk()
delete source;
}
-std::string ProbeableChunk::getContentType() const
+const std::string & ProbeableChunk::getContentType() const
{
return source->getContentType();
}
=====================================
modules/demux/adaptive/http/Chunk.h
=====================================
@@ -55,7 +55,7 @@ namespace adaptive
{
public:
virtual ~ChunkInterface() = default;
- virtual std::string getContentType () const = 0;
+ virtual const std::string & getContentType () const = 0;
virtual RequestStatus getRequestStatus() const = 0;
virtual block_t * readBlock () = 0;
@@ -74,7 +74,7 @@ namespace adaptive
const BytesRange & getBytesRange () const;
ChunkType getChunkType () const;
const StorageID & getStorageID () const;
- virtual std::string getContentType () const override;
+ virtual const std::string & getContentType () const override;
virtual RequestStatus getRequestStatus() const override;
virtual void recycle() = 0;
@@ -93,7 +93,7 @@ namespace adaptive
public:
virtual ~AbstractChunk();
- virtual std::string getContentType () const override;
+ virtual const std::string & getContentType () const override;
virtual RequestStatus getRequestStatus () const override;
virtual size_t getBytesRead () const override;
virtual bool hasMoreData () const override;
@@ -124,7 +124,7 @@ namespace adaptive
virtual block_t * read (size_t) override;
virtual bool hasMoreData () const override;
virtual size_t getBytesRead () const override;
- virtual std::string getContentType () const override;
+ virtual const std::string & getContentType() const override;
virtual void recycle() override;
static const size_t CHUNK_SIZE = 32768;
@@ -203,7 +203,7 @@ namespace adaptive
ProbeableChunk(ChunkInterface *);
virtual ~ProbeableChunk();
- virtual std::string getContentType () const override;
+ virtual const std::string & getContentType () const override;
virtual RequestStatus getRequestStatus() const override;
virtual block_t * readBlock () override;
=====================================
modules/demux/adaptive/test/SegmentTracker.cpp
=====================================
@@ -73,7 +73,7 @@ class DummyChunkSource : public AbstractChunkSource
: AbstractChunkSource(t, range), data(v), offset(0), contentType(content) {}
virtual ~DummyChunkSource() = default;
virtual void recycle() override { delete this; }
- virtual std::string getContentType () const override
+ virtual const std::string & getContentType () const override
{
return contentType;
}
=====================================
modules/demux/adaptive/xml/Node.cpp
=====================================
@@ -28,8 +28,7 @@
#include "Node.h"
#include <cassert>
-#include <vlc_common.h>
-#include <vlc_xml.h>
+#include <algorithm>
using namespace adaptive::xml;
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/7008fb63145739b30b0a616cf1f524a6fb44a7f7...08dae4ad1d6c16df5d25245d6436324456b6130b
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/7008fb63145739b30b0a616cf1f524a6fb44a7f7...08dae4ad1d6c16df5d25245d6436324456b6130b
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list