Skip to content

Commit

Permalink
Added UDL for fmt_stringview to simplify raw string format passing
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikołaj Małecki committed Jul 22, 2024
1 parent d0f472f commit 061ec3b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion apps/transmitmedia.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ SrtCommon::~SrtCommon()
SrtSource::SrtSource(string host, int port, const map<string,string>& par)
{
Init(host, port, par, false);
hostport_copy = srt::ocat(host, OFMT_RAWSTR(":"), port);
hostport_copy = srt::ocat(host, ":"_V, port);
}

int SrtSource::Read(size_t chunk, MediaPacket& pkt, ostream &out_stats)
Expand Down
5 changes: 5 additions & 0 deletions srtcore/ofmt.h
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,11 @@ class ofmtstream
#if (defined(__cplusplus) && __cplusplus > 199711L) \
|| (defined(_MSVC_LANG) && _MSVC_LANG > 199711L) // Some earlier versions get this wrong

inline internal::fmt_stringview operator""_V(const char* ptr, size_t s)
{
return internal::fmt_stringview(ptr, s);
}

template<typename Stream> inline
Stream& oprint(Stream& out)
{
Expand Down
2 changes: 1 addition & 1 deletion testing/testmedia.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1606,7 +1606,7 @@ void SrtCommon::UpdateGroupStatus(const SRT_SOCKGROUPDATA* grpdata, size_t grpda
SrtSource::SrtSource(string host, int port, std::string path, const map<string,string>& par)
{
Init(host, port, path, par, SRT_EPOLL_IN);
hostport_copy = srt::ocat(host, OFMT_RAWSTR(":"), port);
hostport_copy = srt::ocat(host, ":"_V, port);
}

static void PrintSrtStats(SRTSOCKET sock, bool clr, bool bw, bool stats)
Expand Down

0 comments on commit 061ec3b

Please sign in to comment.