| 3 | | Seeking in mpg should require AVSEEK_FLAG_ANY to be set in order for success to be returned. |
| | 3 | '''Updated Edit:''' |
| | 4 | It seems that any `AVInputFormat` that doesn't have it's own `read_seek()` or `read_seek2()` functions defined will default to either `ff_seek_frame_binary()` or `ff_gen_search()` (with priority given to `ff_seek_frame_binary()`). `ff_seek_frame_binary()` doesn't respect seeking by keyframe, and will break the keyframe contract made by `av_seek_frame()` when `AVSEEK_FLAG_ANY` is not set. |
| | 5 | |
| | 6 | Proposed solutions: |
| | 7 | '''1)''' |
| | 8 | Seeking in mpg should require `AVSEEK_FLAG_ANY` to be set in order for success to be returned (return failure if it's not specified). This can be done by requiring `AVSEEK_FLAG_ANY` to be set before calling `ff_seek_frame_binary()`. |
| | 9 | |
| | 10 | '''2) (in response to Don's suggestions)''' |
| | 11 | Change `ff_seek_frame_binary()` so that it respects seeking by keyframe if `AVSEEK_FLAG_ANY` is not set. This can be done by sequentially reading (either forwards or backwards (I would prefer backwards)) up to a keyframe after the binary search is complete. |