36#pragma GCC diagnostic push
37#pragma GCC diagnostic ignored "-Wconversion"
38#pragma GCC diagnostic ignored "-Wsign-conversion"
39#include <libavcodec/avcodec.h>
40#pragma GCC diagnostic pop
48 std::shared_ptr<AVSubtitle>(alloc_subtitle(), &
FFmpeg_Subtitle::delete_subtitle),
50 m_stream_idx(stream_index)
52 m_res = (get() !=
nullptr) ? 0 : AVERROR(ENOMEM);
65FFmpeg_Subtitle::operator AVSubtitle*()
70FFmpeg_Subtitle::operator
const AVSubtitle*()
const
82 return reinterpret_cast<AVSubtitle *
>(av_mallocz(
sizeof(AVSubtitle)));
87 if (subtitle !=
nullptr)
89 avsubtitle_free(subtitle);
The FFmpeg_Subtitle class.
FFmpeg_Subtitle(int stream_index=INVALID_STREAM)
Construct FFmpeg_Subtitle object.
void unref() noexcept
Unreference underlying frame. Synonym for shared_ptr::reset().
int m_res
0 if last operation was successful, or negative AVERROR value
static void delete_subtitle(AVSubtitle *subtitle)
Delete a subtitle.
AVSubtitle * operator->()
operator ->: Do as if we were a pointer to AVSubtitle
int res() const
Get result of last operation.
AVSubtitle * alloc_subtitle()
Allocate a subtitle.
FFmpeg AVSubtitle extension.