@@ -50,7 +50,7 @@ namespace media {
5050 AVFrame *tmpFrame = nullptr ;
5151 AVPacket *packet = nullptr ;
5252
53- VideoRecorderImpl (int width, int height, const std::string & filename,
53+ VideoRecorderImpl (int width, int height, std::string_view filename,
5454 VideoRecorder::Settings settings);
5555
5656 VideoRecorderImpl (const VideoRecorderImpl &) = delete ;
@@ -96,7 +96,7 @@ namespace media {
9696 }
9797
9898 VideoRecorderImpl::VideoRecorderImpl (int width, int height,
99- const std::string & filename,
99+ std::string_view filename,
100100 VideoRecorder::Settings settings)
101101 : m_width(width), m_height(height) {
102102
@@ -111,7 +111,7 @@ namespace media {
111111 }
112112
113113 int ret = avformat_alloc_output_context2 (&formatContext, nullptr , nullptr ,
114- filename.c_str ());
114+ filename.data ());
115115 char errbuf[AV_ERROR_MAX_STRING_SIZE]{0 };
116116 if (ret < 0 ) {
117117 av_strerror (ret, errbuf, AV_ERROR_MAX_STRING_SIZE);
@@ -150,7 +150,7 @@ namespace media {
150150 terminate_with_message (" Couldn't open codec: %s" , errbuf);
151151 }
152152
153- ret = avio_open (&formatContext->pb , filename.c_str (), AVIO_FLAG_WRITE);
153+ ret = avio_open (&formatContext->pb , filename.data (), AVIO_FLAG_WRITE);
154154 if (ret < 0 ) {
155155 av_strerror (ret, errbuf, AV_ERROR_MAX_STRING_SIZE);
156156 terminate_with_message (" Couldn't open output stream: %s" , errbuf);
@@ -229,18 +229,18 @@ namespace media {
229229 VideoRecorder &VideoRecorder::operator =(VideoRecorder &&) noexcept = default ;
230230
231231 VideoRecorder::VideoRecorder (Uint32 width, Uint32 height,
232- const std::string & filename, Settings settings)
232+ std::string_view filename, Settings settings)
233233 : _width(width), _height(height) {
234234 this ->settings = settings;
235235 this ->open (width, height, filename);
236236 }
237237
238238 VideoRecorder::VideoRecorder (Uint32 width, Uint32 height,
239- const std::string & filename)
239+ std::string_view filename)
240240 : VideoRecorder(width, height, filename, Settings{}) {}
241241
242242 void VideoRecorder::open (Uint32 width, Uint32 height,
243- const std::string & filename) {
243+ std::string_view filename) {
244244 if (_impl)
245245 terminate_with_message (" Recording stream already open." );
246246
0 commit comments