Opened 3 years ago
Closed 3 years ago
#9288 closed defect (invalid)
avformat constify commit
Reported by: | Mr-Dave | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | avformat |
Version: | git-master | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
Summary of the bug:
It seems the commits in the git master around 14fa0a4efbc989619860ed8ec0fd33dcdae558b0
now prevent the normal use of the api. The following is a sample that was previously functional for setting up a MP4 container with HEVC.
#include <libavformat/avformat.h>
int main (int argc, const char argv) {
AVFormatContext *format_context;
format_context = avformat_alloc_context();
format_context->oformat = av_guess_format("mp4", NULL, NULL);
format_context->oformat->video_codec = AV_CODEC_ID_HEVC;
avformat_close_input(&format_context);
return 0;
}
Compiler message:
error: assignment of member ‘video_codec’ in read-only object
format_context->oformat->video_codec = AV_CODEC_ID_HEVC;
That code was never valid. Maybe it worked by chance (but actually probably not), but it is not how you are supposed to use the API.