@@ -53,7 +53,7 @@ FormatContext::~FormatContext()
53
53
54
54
void FormatContext::findStreamInfo (AVDictionary** options)
55
55
{
56
- int err = avformat_find_stream_info (_avFormatContext, options);
56
+ const int err = avformat_find_stream_info (_avFormatContext, options);
57
57
if (err < 0 )
58
58
{
59
59
throw std::ios_base::failure (" Unable to find stream informations: " + getDescriptionFromErrorCode (err));
@@ -65,7 +65,7 @@ void FormatContext::openRessource(const std::string& url, int flags)
65
65
if ((_avFormatContext->flags & AVFMT_NOFILE) == AVFMT_NOFILE)
66
66
return ;
67
67
68
- int err = avio_open2 (&_avFormatContext->pb , url.c_str (), flags, NULL , NULL );
68
+ const int err = avio_open2 (&_avFormatContext->pb , url.c_str (), flags, NULL , NULL );
69
69
if (err < 0 )
70
70
{
71
71
throw std::ios_base::failure (" Error when opening output format: " + getDescriptionFromErrorCode (err));
@@ -77,7 +77,7 @@ void FormatContext::closeRessource()
77
77
if ((_avFormatContext->flags & AVFMT_NOFILE) == AVFMT_NOFILE)
78
78
return ;
79
79
80
- int err = avio_close (_avFormatContext->pb );
80
+ const int err = avio_close (_avFormatContext->pb );
81
81
if (err < 0 )
82
82
{
83
83
throw std::ios_base::failure (" Error when close output format: " + getDescriptionFromErrorCode (err));
@@ -86,7 +86,7 @@ void FormatContext::closeRessource()
86
86
87
87
void FormatContext::writeHeader (AVDictionary** options)
88
88
{
89
- int ret = avformat_write_header (_avFormatContext, options);
89
+ const int ret = avformat_write_header (_avFormatContext, options);
90
90
if (ret != 0 )
91
91
{
92
92
throw std::runtime_error (" Could not write header: " + getDescriptionFromErrorCode (ret));
@@ -115,7 +115,7 @@ void FormatContext::writeFrame(AVPacket& packet, bool interleaved)
115
115
116
116
void FormatContext::writeTrailer ()
117
117
{
118
- int ret = av_write_trailer (_avFormatContext);
118
+ const int ret = av_write_trailer (_avFormatContext);
119
119
if (ret != 0 )
120
120
{
121
121
throw std::runtime_error (" Could not write trailer: " + getDescriptionFromErrorCode (ret));
@@ -124,7 +124,7 @@ void FormatContext::writeTrailer()
124
124
125
125
void FormatContext::addMetaData (const std::string& key, const std::string& value)
126
126
{
127
- int ret = av_dict_set (&_avFormatContext->metadata , key.c_str (), value.c_str (), 0 );
127
+ const int ret = av_dict_set (&_avFormatContext->metadata , key.c_str (), value.c_str (), 0 );
128
128
if (ret < 0 )
129
129
{
130
130
LOG_ERROR (getDescriptionFromErrorCode (ret))
@@ -144,8 +144,8 @@ AVStream& FormatContext::addAVStream(const AVCodec& avCodec)
144
144
145
145
bool FormatContext::seek (const uint64_t position, const int flag)
146
146
{
147
- LOG_INFO (" Seek in '" << _avFormatContext->filename << " ' at " << position << " (in AV_TIME_BASE units) " )
148
- int err = av_seek_frame (_avFormatContext, -1 , position, flag);
147
+ LOG_INFO (" Seek in '" << _avFormatContext->filename << " ' at " << position << " with flag ' " << flag << " ' " )
148
+ const int err = av_seek_frame (_avFormatContext, -1 , position, flag);
149
149
if (err < 0 )
150
150
{
151
151
LOG_ERROR (" Error when seek at " << position << " (in AV_TIME_BASE units) in file" )
0 commit comments