Opened 10 months ago

Last modified 10 months ago

#7220 new defect

Pointer returned from av_demuxer_iterate() should not be const

Reported by: jlindgren Owned by:
Priority: normal Component: avformat
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no


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:

  1. Attempt to use av_demuxer_iterate() in conjunction with the rest of the FFmpeg API.

Change History (2)

comment:1 Changed 10 months ago by heleppkes

AVInputFormat should be constant, so instead the other spots should be updated to take a const pointer.

comment:2 Changed 10 months ago by jlindgren

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.

Note: See TracTickets for help on using tickets.