avcpp 3.1.0
Wrapper for the FFmpeg that simplify usage from C++ projects.
Loading...
Searching...
No Matches
avutils.h
Go to the documentation of this file.
1#pragma once
2
9
10#include "avcpp/avconfig.h"
11
12#include <ranges>
13#include <string>
14#include <string_view>
15#include <vector>
16#include <deque>
17#include <memory>
18#include <mutex>
19#include <sstream>
20#include <algorithm>
21#include <functional>
22#include <type_traits>
23#include <limits>
24
25#if AVCPP_CXX_STANDARD >= 20
26# include <span>
27#endif
28
29#include "ffmpeg.h"
30#include "avtime.h"
31
32extern "C" {
33#include <libavutil/avstring.h>
34#include <libavutil/mem.h>
35}
36
37#if AVCPP_HAS_AVFORMAT
38extern "C" {
39#include <libavformat/avformat.h>
40}
41#endif
42
43//
44// Functions
45//
46namespace av {
47
48// Basic FFmpeg constants
55constexpr auto NoPts = static_cast<int64_t>(AV_NOPTS_VALUE);
59constexpr auto TimeBase = static_cast<int>(AV_TIME_BASE);
63constexpr auto TimeBaseQ = AVRational{1, AV_TIME_BASE};
64
65
77template<typename R, typename T>
78R lexical_cast(const T& v)
79{
80 R result;
81 std::stringstream ss;
82 ss << v;
83 ss >> result;
84 return result;
85}
86
93class noncopyable
94{
95protected:
96 noncopyable() = default;
97 noncopyable( const noncopyable& ) = delete;
98 void operator=( const noncopyable& ) = delete;
99};
100
108void set_logging_level(int32_t level);
109
110
120void set_logging_level(const std::string& level);
121
122// Compat code
128#define setFFmpegLoggingLevel set_logging_level
129
137[[deprecated("Use av::hex_dump()")]]
138void dumpBinaryBuffer(uint8_t *buffer, int buffer_size, int width = 16);
139
140
146std::string error2string(int error);
147
153inline std::string_view wrap2sview(const char *value) noexcept
154{
155 return value ? std::string_view(value) : std::string_view();
156}
157
158}
159
160
161
162
163//
164// Classes
165//
166namespace av {
167
175{
179 void operator()(void *) {}
180};
181
187namespace v1 {
196{
204 bool operator() (struct SwsContext* &swsContext);
212 bool operator() (struct AVCodecContext* &codecContext);
213#if AVCPP_HAS_AVFORMAT
221 bool operator() (struct AVOutputFormat* &format);
229 bool operator() (struct AVFormatContext* &formatContext);
230#endif // if AVCPP_HAS_AVFORMAT
238 bool operator() (struct AVFrame* &frame);
246 bool operator() (struct AVPacket* &packet);
254 bool operator() (struct AVDictionary* &dictionary);
255#if AVCPP_HAS_AVFILTER
263 bool operator ()(struct AVFilterInOut* &filterInOut);
264#endif // if AVCPP_HAS_AVFILTER
272 bool operator() (struct AVBufferRef* &bufferRef);
273};
274} // ::v1
275
276inline namespace v2 {
284{
294 template<typename T>
295 bool operator() (T *ptr) {
296 return v1::AvDeleter()(ptr);
297 }
298};
299}
300
310template<typename T>
311std::unique_ptr<T, void(*)(void*)> malloc(size_t size)
312{
313 return {static_cast<T*>(av_malloc(size)), av_free};
314}
315
325template<typename T>
326std::unique_ptr<T, void(*)(void*)> mallocz(size_t size)
327{
328 return {static_cast<T*>(av_mallocz(size)), av_free};
329}
330
341template<typename T>
342std::unique_ptr<T, void(*)(void*)> memdup(const void *p, size_t size)
343{
344 return {static_cast<T*>(av_memdup(p, size)), av_free};
345}
346
353inline std::unique_ptr<char, void(*)(void*)> strdup(std::string_view value)
354{
355 if (value.empty())
356 return {nullptr, av_free};
357
358 return {av_strndup(value.data(), value.size()), av_free};
359}
360
366template<typename T>
367void freep(T *&ptr) noexcept
368{
369 ::av_freep(&ptr);
370}
371
375#if 0
376struct AvNextElement
377{
378 AVFilterInOut * operator()(AVFilterInOut * x) const
379 {
380 if (x)
381 return x->next;
382 else
383 return 0;
384 }
385};
386#endif
387
388
389
402template<typename T, typename V = T>
404{
405public:
411 ScopedValue(T &var, const V& outValue)
412 : var(var),
413 outValue(outValue)
414 {
415 }
416
423 ScopedValue(T &var, const V &inValue, const V &outValue)
424 : var(var),
425 outValue(outValue)
426 {
427 this->var = inValue;
428 }
429
431 {
432 var = outValue;
433 }
434
435private:
436 T& var;
437 V outValue;
438};
439
440
469{
470public:
478 template<typename Proc>
479 ScopeOutAction(const Proc& proc)
480 : m_proc(proc)
481 {}
482
490 template<typename Proc>
491 ScopeOutAction(Proc&& proc)
492 : m_proc(std::forward<Proc>(proc))
493 {}
494
496 {
497 if (m_proc)
498 m_proc();
499 }
500
501private:
502 std::function<void()> m_proc;
503};
504
505
507
508#if AVCPP_CXX_STANDARD >= 20
509
513template<class T>
515{
517 using value_type = std::remove_reference_t<T>;
527 constexpr bool isEnd(T* it) const noexcept {
528 return it == end;
529 }
530};
531
535template<class T>
537{
539 using value_type = std::remove_cvref_t<T>;
549 constexpr bool isEnd(T* it) const noexcept {
550 return it == nullptr || *it == value;
551 }
552};
553
554
558template<class T, class Policy>
560{
562 Policy policy;
571 friend constexpr bool operator==(T* it, const ArraySentinel& s) noexcept {
572 return s.policy.isEnd(it);
573 }
574};
575
576template<class T, class U, bool UseProxy>
578
585template<class T, class U>
586struct ReferenceSelector<T, U, true>
587{
589 using Type = T&;
590};
591
598template<class T, class U>
599struct ReferenceSelector<T, U, false>
600{
602 using Type = U;
603};
604
611template<typename T, typename U>
612struct ArrayIterator
613{
615 static constexpr bool UseProxy = !std::is_same_v<std::remove_cvref_t<T>, std::remove_cvref_t<U>>;
616
618 using difference_type = std::ptrdiff_t;
620 using value_type = std::remove_reference_t<U>;
622 using pointer = std::remove_reference_t<T>*; // or also value_type*
623
628 std::conditional_t<
629 UseProxy,
630 std::random_access_iterator_tag,
631 std::contiguous_iterator_tag>;
632
633 ArrayIterator() noexcept = default; // semiregular
639 ArrayIterator(pointer ptr) noexcept : m_ptr(ptr) {}
640
646 reference operator*() const noexcept {
647 if constexpr (UseProxy)
648 return reference{*m_ptr};
649 else
650 return *m_ptr;
651 }
652
658 ArrayIterator& operator++() noexcept { m_ptr++; return *this; }
664 ArrayIterator operator++(int) noexcept { ArrayIterator tmp = *this; ++(*this); return tmp; }
665
671 ArrayIterator& operator--() noexcept { m_ptr--; return *this; }
677 ArrayIterator operator--(int) noexcept { ArrayIterator tmp = *this; --(*this); return tmp; }
678
686 ArrayIterator& operator+=(int n) noexcept { m_ptr+=n; return *this; }
694 ArrayIterator& operator-=(int n) noexcept { m_ptr-=n; return *this; }
695
696 // i[n]
704 reference operator[](int n) noexcept {
705 if constexpr (UseProxy)
706 return reference{m_ptr[n]};
707 else
708 return m_ptr[n];
709 }
710
717 const reference operator[](int n) const noexcept {
718 if constexpr (UseProxy)
719 return reference{m_ptr[n]};
720 else
721 return m_ptr[n];
722 }
723 //reference operator&() noexcept { return }
724 // a + n
725 // n + a
734 friend ArrayIterator operator+(const ArrayIterator& a, int n) noexcept { return {a.m_ptr + n}; }
743 friend ArrayIterator operator+(int n, const ArrayIterator& a) noexcept { return {a.m_ptr + n}; }
744 // i - n
753 friend ArrayIterator operator-(const ArrayIterator& a, int n) noexcept { return {a.m_ptr - n}; }
754 // b - a
763 friend difference_type operator-(const ArrayIterator& b, const ArrayIterator& a) noexcept { return b.m_ptr - a.m_ptr; }
764
765 // a<=>b
774 friend std::strong_ordering operator<=>(const ArrayIterator& a, const ArrayIterator& b) noexcept {
775 return a.m_ptr == b.m_ptr ? std::strong_ordering::equal
776 : a.m_ptr < b.m_ptr ? std::strong_ordering::less
777 : std::strong_ordering::greater;
778 }
779
787 friend bool operator== (const ArrayIterator& a, const ArrayIterator& b) { return a.m_ptr == b.m_ptr; };
796 friend bool operator!= (const ArrayIterator& a, const ArrayIterator& b) { return !(a == b); };
797
798 //
799 // Sentinels
800 //
801 friend bool operator==(ArrayIterator it, std::default_sentinel_t) = delete;
802
811 template<class Policy>
812 friend constexpr bool operator==(ArrayIterator it, const ArraySentinel<T, Policy>& sentinel)
813 { return sentinel.policy.isEnd(it.m_ptr); }
814
823 template<class Policy>
824 friend constexpr bool operator!=(ArrayIterator it, const ArraySentinel<T, Policy>& sentinel)
825 { return !sentinel.policy.isEnd(it.m_ptr); }
826
835 template<class Policy>
836 friend constexpr bool operator==(const ArraySentinel<T, Policy>& sentinel, ArrayIterator it)
837 { return sentinel.policy.isEnd(it.m_ptr); }
838
847 template<class Policy>
848 friend constexpr bool operator!=(const ArraySentinel<T, Policy>& sentinel, ArrayIterator it)
849 { return !sentinel.policy.isEnd(it.m_ptr); }
850
851private:
852 pointer m_ptr{};
853};
854
860template<typename T, typename U, class Policy>
861class ArrayView : public std::ranges::view_interface<ArrayView<T, U, Policy>>
862{
863public:
864 constexpr ArrayView() = default;
873 constexpr ArrayView(T *ptr, Policy policy)
874 : m_ptr(ptr), m_policy(std::move(policy))
875 {}
876
882 auto constexpr begin() const noexcept
883 {
884 return ArrayIterator<T, U>{m_ptr};
885 }
886
892 auto constexpr end() const noexcept
893 {
894 // special case to allow back()/size()/etc method for well-defined sizes
895 if constexpr (std::is_same_v<Policy, std::size_t>) {
896 return ArrayIterator<T, U>{m_ptr + m_policy};
897 } else {
898 return ArraySentinel<T, Policy>{m_policy};
899 }
900 }
901
902private:
903 T *m_ptr{};
904 Policy m_policy{};
905};
906
913template<class U>
914auto make_array_view_size(auto* ptr, std::size_t size)
915{
916 using T = std::remove_reference_t<decltype(*ptr)>;
917 return ArrayView<T, U, std::size_t>(ptr, size);
918}
919
926template<class U>
927auto make_array_view_until(auto* ptr, auto value)
928{
929 using T = std::remove_reference_t<decltype(*ptr)>;
931}
932
946template<typename T, typename L>
947 requires std::ranges::range<L> &&
948 requires(L& r) {
949 std::ranges::empty(r);
950 }
951T guessValue(const T& value, L list)
952{
953 if (list.empty())
954 return value;
955
956 T best = value;
957 T bestDistance = (std::numeric_limits<T>::max)();
958
959 for (auto&& cur : list) {
960 auto const distance = (std::max)(cur, value) - (std::min)(cur, value);
961 if (distance < bestDistance) {
962 bestDistance = distance;
963 best = cur;
964 }
965 }
966
967 return best;
968}
969
970#endif // AVCPP_CXX_STANDARD
971
977template<typename T>
979{
986 : value(value)
987 {}
988
996 bool operator() (const T& value) const
997 {
998 if (this->value == value)
999 return true;
1000
1001 return false;
1002 }
1003
1005 const T& value;
1006};
1007
1023template<typename T, typename L, typename C>
1024T guessValue(const T& value, const L * list, C endListComparator)
1025{
1026 if (!list)
1027 return value;
1028
1029 T best = value;
1030 T bestDistance = (std::numeric_limits<T>::max)();
1031
1032 for (const L * ptr = list; !endListComparator(*ptr); ++ptr) {
1033 auto const cur = *ptr;
1034 auto const distance = (std::max)(cur, value) - (std::min)(cur, value);
1035 if (distance < bestDistance) {
1036 bestDistance = distance;
1037 best = cur;
1038 }
1039 }
1040
1041 return best;
1042}
1043
1044
1052template<typename T, typename Container>
1053void array_to_container(const T* array, std::size_t nelements, Container &container)
1054{
1055 if (!array || nelements == 0)
1056 return;
1057 std::copy_n(array, array + nelements, std::back_inserter(container));
1058}
1059
1068template<typename T, typename Container, typename Callable>
1069void array_to_container(const T* array, std::size_t nelements, Container &container, Callable convert)
1070{
1071 if (!array || nelements == 0)
1072 return;
1073 // TBD: implement in more clean way
1074 //std::copy_n(array, array + nelemnts, std::back_inserter(container));
1075 for (auto i = 0u; i < nelements; ++i) {
1076 container.push_back(convert(array[i]));
1077 }
1078}
1079
1088template<typename T, typename Container, typename Compare>
1089void array_to_container(const T* array, Container &container, Compare isEnd)
1090{
1091 if (!array)
1092 return;
1093 T value;
1094 while (!isEnd(value = *array++))
1095 container.push_back(value);
1096}
1097
1106template<typename T, typename Container, typename Compare, typename Callable>
1107void array_to_container(const T* array, Container &container, Compare isEnd, Callable convert)
1108{
1109 if (!array)
1110 return;
1111 T value;
1112 while (!isEnd(value = *array++))
1113 container.push_back(convert(value));
1114}
1115
1117
1118//
1119// Allow to use without AVFORMAT library
1120//
1128void hex_dump(FILE *f, const uint8_t *buf, std::size_t size);
1137void hex_dump_log(void *avcl, int level, const uint8_t *buf, std::size_t size);
1138
1139#if AVCPP_CXX_STANDARD >= 20
1146void hex_dump(FILE *f, std::span<const uint8_t> buf);
1154void hex_dump_log(void *avcl, int level, std::span<const uint8_t> buf);
1155#endif // if AVCPP_CXX_STANDARD >= 20
1156
1157} // ::av
1158
1160
1161#ifdef __cpp_lib_format
1162# include <format>
1163
1164namespace av {
1165template <typename B>
1166concept has_name_method_with_ec = requires(const B& type, std::error_code ec) {
1167 { type.name(ec) } -> std::convertible_to<std::string_view>;
1168};
1169
1170template <typename B>
1171concept has_name_method_without_ec = requires(const B& type) {
1172 { type.name() } -> std::convertible_to<std::string_view>;
1173};
1174
1175template <typename B>
1176concept has_long_name_method_with_ec = requires(const B& type, std::error_code ec) {
1177 { type.longName(ec) } -> std::convertible_to<std::string_view>;
1178};
1179
1180template <typename B>
1181concept has_long_name_method_without_ec = requires(const B& type) {
1182 { type.longName() } -> std::convertible_to<std::string_view>;
1183};
1184} // ::av
1185
1186template <class T, class CharT>
1187 requires av::has_name_method_with_ec<T> || av::has_name_method_without_ec<T>
1188struct std::formatter<T, CharT>
1189{
1190 bool longName = false;
1191
1192 template<typename ParseContext>
1193 constexpr ParseContext::iterator parse(ParseContext& ctx)
1194 {
1195 auto it = ctx.begin();
1196 if constexpr (requires { requires av::has_long_name_method_with_ec<T> || av::has_long_name_method_without_ec<T>; }) {
1197 if (it == ctx.end())
1198 return it;
1199 if (*it == 'l') {
1200 longName = true;
1201 ++it;
1202 }
1203 if (it != ctx.end() && *it != '}')
1204 throw std::format_error("Invalid format args");
1205 }
1206 return it;
1207 }
1208
1209 template<typename ParseContext>
1210 auto format(const T& value, ParseContext& ctx) const
1211 {
1212 if (longName) {
1213 if constexpr (requires { requires av::has_long_name_method_with_ec<T>; }) {
1214 std::error_code dummy;
1215 return std::format_to(ctx.out(), "{}", value.longName(dummy));
1216 } else if constexpr (requires { requires av::has_long_name_method_without_ec<T>; }) {
1217 return std::format_to(ctx.out(), "{}", value.longName());
1218 }
1219 } else {
1220 if constexpr (requires { requires av::has_name_method_with_ec<T>; }) {
1221 std::error_code dummy;
1222 return std::format_to(ctx.out(), "{}", value.name(dummy));
1223 } else {
1224 return std::format_to(ctx.out(), "{}", value.name());
1225 }
1226 }
1227 return ctx.out();
1228 }
1229};
1230#endif
Conversions between time units and FFmpeg time bases.
C-array (FFmpeg) wrapper witch can iterate over collection and represents any element via light-weigh...
Definition avutils.h:862
auto constexpr begin() const noexcept
First element.
Definition avutils.h:882
constexpr ArrayView(T *ptr, Policy policy)
Wrap an array with a policy that defines where it ends.
Definition avutils.h:873
auto constexpr end() const noexcept
End of the range.
Definition avutils.h:892
The ScopeOutAction class - guard-type class that allows points callback that will be called at the sc...
Definition avutils.h:469
ScopeOutAction(Proc &&proc)
Run a callback when the guard leaves scope, moving it in.
Definition avutils.h:491
ScopeOutAction(const Proc &proc)
Run a callback when the guard leaves scope.
Definition avutils.h:479
Functor to take next element in list/array.
Definition avutils.h:404
ScopedValue(T &var, const V &outValue)
Ctor.
Definition avutils.h:411
ScopedValue(T &var, const V &inValue, const V &outValue)
Ctor.
Definition avutils.h:423
FFmpeg types re-exported for the public API and small value wrappers.
The AvDeleter struct Unified delete functor for variois FFMPEG/libavformat/libavcodec and so on resou...
Definition avutils.h:187
Root namespace of the library.
Definition audioresampler.h:19
std::unique_ptr< char, void(*)(void *)> strdup(std::string_view value)
Duplicates a string using the FFmpeg allocator.
Definition avutils.h:353
std::unique_ptr< T, void(*)(void *)> malloc(size_t size)
Allocate memory with the FFmpeg allocator.
Definition avutils.h:311
R lexical_cast(const T &v)
Convert a value through its stream representation.
Definition avutils.h:78
std::string_view wrap2sview(const char *value) noexcept
Wraps a nullable C string into a string_view without copying.
Definition avutils.h:153
std::string error2string(int error)
C++ verstion of the av_err2str().
std::unique_ptr< T, void(*)(void *)> mallocz(size_t size)
Allocate zeroed memory with the FFmpeg allocator.
Definition avutils.h:326
void freep(T *&ptr) noexcept
Frees a buffer allocated by the FFmpeg allocator and resets the pointer.
Definition avutils.h:367
auto make_array_view_size(auto *ptr, std::size_t size)
Helper to create array view with well-known size.
Definition avutils.h:914
void hex_dump_log(void *avcl, int level, const uint8_t *buf, std::size_t size)
Write a hexadecimal dump of a buffer through the FFmpeg log system.
void dumpBinaryBuffer(uint8_t *buffer, int buffer_size, int width=16)
dump_binary_buffer Dump binary buffer to std out in HEX view
bool operator==(const Timestamp &left, const Timestamp &right) noexcept
Compare two timestamps, taking their time bases into account.
Definition timestamp.h:286
auto make_array_view_until(auto *ptr, auto value)
Helper to create array view with end marker.
Definition avutils.h:927
constexpr auto TimeBaseQ
The global time base as a rational value.
Definition avutils.h:63
void hex_dump(FILE *f, const uint8_t *buf, std::size_t size)
Write a hexadecimal dump of a buffer to a C stream.
std::unique_ptr< T, void(*)(void *)> memdup(const void *p, size_t size)
Copy a memory block using the FFmpeg allocator.
Definition avutils.h:342
constexpr auto TimeBase
Denominator of the global time base used for container-level timestamps.
Definition avutils.h:59
T guessValue(const T &value, L list)
Select more approptiate value from given value list.
Definition avutils.h:951
void array_to_container(const T *array, std::size_t nelements, Container &container)
Append a fixed number of array elements to a container.
Definition avutils.h:1053
void set_logging_level(int32_t level)
This method can be used to turn up or down FFmpeg's logging level.
constexpr auto NoPts
Timestamp value meaning "no timestamp".
Definition avutils.h:55
STL namespace.
Wrapped array iterator.
Definition avutils.h:613
std::ptrdiff_t difference_type
Distance type required by the iterator traits.
Definition avutils.h:618
friend std::strong_ordering operator<=>(const ArrayIterator &a, const ArrayIterator &b) noexcept
Order two iterators.
Definition avutils.h:774
ArrayIterator operator--(int) noexcept
Step back, returning the previous position.
Definition avutils.h:677
friend bool operator==(const ArrayIterator &a, const ArrayIterator &b)
Compare two iterators.
Definition avutils.h:787
friend constexpr bool operator!=(const ArraySentinel< T, Policy > &sentinel, ArrayIterator it)
Compare a sentinel with an iterator.
Definition avutils.h:848
friend difference_type operator-(const ArrayIterator &b, const ArrayIterator &a) noexcept
Distance between two iterators.
Definition avutils.h:763
typename ReferenceSelector< T, U, !UseProxy >::Type reference
Dereference result: a proxy wrapper or a plain reference.
Definition avutils.h:625
ArrayIterator & operator--() noexcept
Step back to the previous element.
Definition avutils.h:671
ArrayIterator & operator+=(int n) noexcept
Advance by several elements.
Definition avutils.h:686
std::remove_reference_t< U > value_type
Type produced by dereferencing.
Definition avutils.h:620
std::remove_reference_t< T > * pointer
Pointer type of the underlying array.
Definition avutils.h:622
friend ArrayIterator operator+(int n, const ArrayIterator &a) noexcept
Advance an iterator.
Definition avutils.h:743
static constexpr bool UseProxy
Whether dereferencing must produce a proxy view instead of a reference.
Definition avutils.h:615
reference operator[](int n) noexcept
Element at an offset from the current position.
Definition avutils.h:704
ArrayIterator & operator++() noexcept
Advance to the next element.
Definition avutils.h:658
friend constexpr bool operator!=(ArrayIterator it, const ArraySentinel< T, Policy > &sentinel)
Compare an iterator with a sentinel.
Definition avutils.h:824
const reference operator[](int n) const noexcept
Element at an offset, read-only.
Definition avutils.h:717
friend constexpr bool operator==(ArrayIterator it, const ArraySentinel< T, Policy > &sentinel)
Compare an iterator with a sentinel.
Definition avutils.h:812
friend bool operator!=(const ArrayIterator &a, const ArrayIterator &b)
Compare two iterators.
Definition avutils.h:796
friend ArrayIterator operator+(const ArrayIterator &a, int n) noexcept
Advance an iterator.
Definition avutils.h:734
std::conditional_t< UseProxy, std::random_access_iterator_tag, std::contiguous_iterator_tag > iterator_category
Iterator category: random access for proxies, contiguous otherwise.
Definition avutils.h:627
ArrayIterator operator++(int) noexcept
Advance, returning the previous position.
Definition avutils.h:664
friend ArrayIterator operator-(const ArrayIterator &a, int n) noexcept
Step an iterator back.
Definition avutils.h:753
friend constexpr bool operator==(const ArraySentinel< T, Policy > &sentinel, ArrayIterator it)
Compare a sentinel with an iterator.
Definition avutils.h:836
reference operator*() const noexcept
Element at the current position.
Definition avutils.h:646
ArrayIterator & operator-=(int n) noexcept
Step back by several elements.
Definition avutils.h:694
Policy based sentinel marker.
Definition avutils.h:560
Policy policy
Policy that decides where the range ends.
Definition avutils.h:562
friend constexpr bool operator==(T *it, const ArraySentinel &s) noexcept
Compare an iterator with the sentinel.
Definition avutils.h:571
Deleter that does nothing.
Definition avutils.h:175
void operator()(void *)
Accept the pointer and do nothing with it.
Definition avutils.h:179
bool operator()(const T &value) const
Compare an element with the stored value.
Definition avutils.h:996
EqualComparator(const T &value)
Remember the value to compare against.
Definition avutils.h:985
const T & value
The value that terminates the list.
Definition avutils.h:1005
U Type
Dereference result when a proxy view is produced.
Definition avutils.h:602
T & Type
Dereference result when no proxy is needed.
Definition avutils.h:589
Definition avutils.h:577
Sentinel policy that defines well-known range end pointer.
Definition avutils.h:515
std::remove_reference_t< T > value_type
Type of the range elements.
Definition avutils.h:517
value_type * end
Pointer that marks the end of the range.
Definition avutils.h:519
constexpr bool isEnd(T *it) const noexcept
Whether the iterator reached the end pointer.
Definition avutils.h:527
Sentinel policy that defines well-known sequence end marker, like '\0' at the C-string end or special...
Definition avutils.h:537
constexpr bool isEnd(T *it) const noexcept
Whether the iterator reached the terminating value.
Definition avutils.h:549
std::remove_cvref_t< T > value_type
Type of the range elements.
Definition avutils.h:539
value_type value
Value that terminates the sequence, for example '\0' or a null pointer.
Definition avutils.h:541
Free functors for the FFmpeg resource types.
Definition avutils.h:196
bool operator()(struct SwsContext *&swsContext)
Free a swscale context.
Template facade over the per-type deleters of namespace v1.
Definition avutils.h:284
bool operator()(T *ptr)
Free an FFmpeg object of type T.
Definition avutils.h:295