Opened 14 months ago

Closed 4 months ago

#7220 closed defect (fixed)

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

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:

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

Change History (3)

comment:1 Changed 14 months ago by heleppkes

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

comment:2 Changed 14 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.

comment:3 Changed 4 months ago by cehoyos

  • Resolution set to fixed
  • Status changed from new to closed

I hope this will be fixed after the next version bump through 3aa6208db9666c0f1351855262d8c839002d9de1

Note: See TracTickets for help on using tickets.