removed very situational video_man from raii namespace

This commit is contained in:
rexy712
2019-03-11 17:45:34 -07:00
parent 21500bf41e
commit f62f3ceca5
8 changed files with 312 additions and 289 deletions

View File

@@ -22,9 +22,18 @@ namespace libav::fmt{
reset();
}
}
input_context(const input_context&) = delete;
input_context(input_context&& i)noexcept:
m_context(std::exchange(i.m_context, nullptr)){}
~input_context(void){
reset();
}
input_context& operator=(const input_context&) = delete;
input_context& operator=(input_context&& i){
std::swap(m_context, i.m_context);
return *this;
}
void reset(AVFormatContext* context = nullptr){
if(m_context)
avformat_close_input(&m_context);
@@ -65,13 +74,22 @@ namespace libav::fmt{
return;
if(!(m_context->oformat->flags & AVFMT_NOFILE)){
if(avio_open(&m_context->pb, filename, AVIO_FLAG_WRITE) < 0){
reset();
avformat_free_context(m_context);
}
}
}
output_context(const output_context&) = delete;
output_context(output_context&& o)noexcept:
m_context(std::exchange(o.m_context, nullptr)){}
~output_context(void){
reset();
}
output_context& operator=(const output_context&) = delete;
output_context& operator=(output_context&& o)noexcept{
std::swap(m_context, o.m_context);
return *this;
}
void reset(AVFormatContext* context = nullptr){
if(m_context){
if(!(m_context->oformat->flags & AVFMT_NOFILE)){