Add string_view overload for Wrap method
FileWrapper API is WebRTC private, so exposing absl::string_view overload for thrid-party users. Bug: b/301228802 Change-Id: Id81775c8078e61eafe9bee53a4cba6ac476b11d6 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/321460 Commit-Queue: Artem Titov <titovartem@webrtc.org> Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> Cr-Commit-Position: refs/heads/main@{#40798}
This commit is contained in:
parent
b4d4bbcebd
commit
ba97eec127
@ -10,13 +10,20 @@
|
||||
|
||||
#include "modules/video_coding/utility/ivf_file_writer.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "api/video/encoded_image.h"
|
||||
#include "api/video/video_codec_type.h"
|
||||
#include "api/video_codecs/video_codec.h"
|
||||
#include "modules/rtp_rtcp/source/byte_io.h"
|
||||
#include "modules/video_coding/utility/ivf_defines.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/system/file_wrapper.h"
|
||||
|
||||
// TODO(palmkvist): make logging more informative in the absence of a file name
|
||||
// (or get one)
|
||||
@ -53,6 +60,12 @@ std::unique_ptr<IvfFileWriter> IvfFileWriter::Wrap(FileWrapper file,
|
||||
new IvfFileWriter(std::move(file), byte_limit));
|
||||
}
|
||||
|
||||
std::unique_ptr<IvfFileWriter> IvfFileWriter::Wrap(absl::string_view filename,
|
||||
size_t byte_limit) {
|
||||
return std::unique_ptr<IvfFileWriter>(
|
||||
new IvfFileWriter(FileWrapper::OpenWriteOnly(filename), byte_limit));
|
||||
}
|
||||
|
||||
bool IvfFileWriter::WriteHeader() {
|
||||
if (!file_.Rewind()) {
|
||||
RTC_LOG(LS_WARNING) << "Unable to rewind ivf output file.";
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "api/video/encoded_image.h"
|
||||
#include "api/video/video_codec_type.h"
|
||||
#include "rtc_base/numerics/sequence_number_unwrapper.h"
|
||||
@ -31,6 +32,8 @@ class IvfFileWriter {
|
||||
// will fail. A `byte_limit` of 0 is equivalent to no limit.
|
||||
static std::unique_ptr<IvfFileWriter> Wrap(FileWrapper file,
|
||||
size_t byte_limit);
|
||||
static std::unique_ptr<IvfFileWriter> Wrap(absl::string_view filename,
|
||||
size_t byte_limit);
|
||||
~IvfFileWriter();
|
||||
|
||||
IvfFileWriter(const IvfFileWriter&) = delete;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user