Opened 7 years ago
Closed 6 years ago
#7220 closed defect (fixed)
Pointer returned from av_demuxer_iterate() should not be const
Reported by: | John Lindgren | 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:
av_demuxer_iterate() was added in commit 0694d8702421 as a replacement for av_iformat_next(). However, it's not a very good replacement since it returns <const AVInputFormat *> instead of <AVInputFormat *>.
In order to do anything useful with the returned pointer, such as pass it to avformat_open_input(), it's now necessary to add an ugly cast to get rid of the <const>. This seems like an oversight.
How to reproduce:
- Attempt to use av_demuxer_iterate() in conjunction with the rest of the FFmpeg API.
Change History (3)
comment:1 by , 7 years ago
comment:2 by , 7 years ago
Well, if the goal is to annotate all uses of <AVInputFormat *> with <const>, then IMHO it would have been better to start with the functions taking such a parameter, and only afterwards move on the the functions returning <AVInputFormat *>.
That way, clients using the FFmpeg libraries could update cleanly to use <const AVInputFormat *> everywhere, without adding ugly casts.
comment:3 by , 6 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
I hope this will be fixed after the next version bump through 3aa6208db9666c0f1351855262d8c839002d9de1
AVInputFormat should be constant, so instead the other spots should be updated to take a const pointer.