FFmpegfs Fuse Multi Media Filesystem 2.19
Loading...
Searching...
No Matches
ffmpeg_dictionary.cc
Go to the documentation of this file.
1/*
2 * Copyright (C) 2017-2026 by Norbert Schlia (nschlia@oblivion-software.de)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or
7 * (at your option) any later version.
8 */
9
17#ifdef __cplusplus
18extern "C" {
19#endif
20// Disable annoying warnings outside our code
21#pragma GCC diagnostic push
22#pragma GCC diagnostic ignored "-Wconversion"
23#pragma GCC diagnostic ignored "-Wsign-conversion"
24#include <libavutil/dict.h>
25#pragma GCC diagnostic pop
26#ifdef __cplusplus
27}
28#endif
29
30#include "ffmpeg_dictionary.h"
31
33 : m_dict(nullptr)
34{
35}
36
41
43 : m_dict(dict.m_dict)
44{
45 dict.m_dict = nullptr;
46}
47
48FFmpeg_Dictionary& FFmpeg_Dictionary::operator=(FFmpeg_Dictionary&& dict) noexcept
49{
50 if (this != &dict)
51 {
52 reset();
53 m_dict = dict.m_dict;
54 dict.m_dict = nullptr;
55 }
56
57 return *this;
58}
59
61{
62 if (m_dict != nullptr)
63 {
64 av_dict_free(&m_dict);
65 }
66}
67
69{
70 return m_dict == nullptr;
71}
72
74{
75 return m_dict;
76}
77
78const AVDictionary* FFmpeg_Dictionary::get() const
79{
80 return m_dict;
81}
82
84{
85 return &m_dict;
86}
87
89{
90 AVDictionary* dict = m_dict;
91 m_dict = nullptr;
92 return dict;
93}
94
95FFmpeg_Dictionary::operator AVDictionary*()
96{
97 return m_dict;
98}
99
100FFmpeg_Dictionary::operator const AVDictionary*() const
101{
102 return m_dict;
103}
RAII wrapper for AVDictionary.
AVDictionary * m_dict
Pointer to underlying AVDictionary.
AVDictionary * get()
Get the owned FFmpeg dictionary pointer.
AVDictionary ** address()
Get a writable pointer-to-pointer for FFmpeg APIs.
void reset()
Free the owned dictionary and reset the wrapper to empty.
AVDictionary * release()
Release ownership without freeing the dictionary.
bool empty() const
Check whether the wrapper currently owns a dictionary.
~FFmpeg_Dictionary()
Release the owned dictionary, if any.
FFmpeg_Dictionary()
Construct an empty dictionary wrapper.
FFmpeg AVDictionary RAII wrapper.