Opened 8 years ago
Closed 20 months ago
#5781 closed enhancement (fixed)
Improve documentation and examples for AVCodecParameters related functions
Reported by: | patacca | Owned by: | |
---|---|---|---|
Priority: | wish | Component: | documentation |
Version: | git-master | Keywords: | |
Cc: | Max Kellermann, James | Blocked By: | |
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
Summary of the bug:
Bug previously opened on mpd bug tracker: https://bugs.musicpd.org/view.php?id=4564 (see cirrus's comment https://bugs.musicpd.org/view.php?id=4564#c10084)
When decoding a m4a file avcodec_send_packet fails if the AVCodecContext instance is created via avcodec_alloc_context3.
How to reproduce:
See mpd code:
http://git.musicpd.org/cgit/master/mpd.git/commit/?id=8825393660b95664141ce818089359e1edd612a3
http://git.musicpd.org/cgit/master/mpd.git/tree/src/decoder/plugins/FfmpegDecoderPlugin.cxx?h=v0.19.x#n497
Change History (9)
comment:1 by , 8 years ago
comment:3 by , 8 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
Replying to pritambaral:
I can confirm that jamrial's suggestion works.
Could you report this to MPD's developers, then?
Thanks for testing.
follow-up: 5 comment:4 by , 8 years ago
jamrial, I can't find documentation on this requirement in the FFmpeg API documentation. Quite contrary, none of the code samples has this call.
I'm not quite happy with the situation. I closed the bug report on the MPD bug tracker as an apparent FFmpeg bug, because I couldn't find anything that's wrong with MPD.
This looks like a secret trick, but it shouldn't be secret. Did I miss something?
comment:5 by , 8 years ago
Component: | undetermined → documentation |
---|---|
Resolution: | invalid |
Status: | closed → reopened |
Type: | defect → enhancement |
Replying to cirrus:
jamrial, I can't find documentation on this requirement in the FFmpeg API documentation. Quite contrary, none of the code samples has this call.
If you check ffplay.c and ffprobe.c you'll see this in action (ffmpeg.c has yet to be updated to this API).
Similarly, i recently pushed a patch for the demuxing_decoding example as commit bba6a03b2816d805d44bce4f9701a71f7d3f8dad.
I'm not quite happy with the situation. I closed the bug report on the MPD bug tracker as an apparent FFmpeg bug, because I couldn't find anything that's wrong with MPD.
This looks like a secret trick, but it shouldn't be secret. Did I miss something?
No, you didn't. The doxygen documentation in avcodec.h for avcodec_open2() doesn't mention it because an input AVStream is not required unless you're demuxing with libavformat.
I agree it should be mentioned somewhere, though.
Basically, since AVStream.AVCodecContext (which has all the stream's parameters already filled) shouldn't be used anymore, the manually allocated AVCodecContext needs to be filled with said parameters in some way, and as its doxy states that's what the above function does.
comment:6 by , 8 years ago
Cc: | added |
---|---|
Summary: | avcodec_send_packet() fails with m4a files when AVCodecContext is created with avcodec_alloc_context3() → Improve documentation and examples for AVCodecParameters related functions |
comment:7 by , 8 years ago
Priority: | normal → wish |
---|
comment:9 by , 20 months ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Looks like they are not copying codec parameters from the AVStream.AVCodecParameters struct to the avcodec_alloc_context3 allocated context before calling avcodec_open2.
The function avcodec_parameters_to_context should be used for this purpose.
Can't really test but it could be the source of the problem.