[FFmpeg-devel] [PATCH] lavf/utils: extend has_codec_parameters() to make it show what info is missing

Stefano Sabatini stefasab at gmail.com
Wed Jul 18 18:17:12 CEST 2012


On date Wednesday 2012-07-18 03:14:25 +0200, Michael Niedermayer encoded:
> On Tue, Jul 17, 2012 at 10:30:56PM +0200, Stefano Sabatini wrote:
[...]
> > Nitfest.
> > 
> > Currently:
> > static int has_codec_parameters(AVStream *st)
> > =>
> > [flv @ 0x3303160] max_analyze_duration 5000000 reached at 5018000
> > [flv @ 0x3303160] Could not find codec parameters (Video: h264, 204 kb/s)
> > 
> > Alternative 1:
> > static int has_codec_parameters(AVStream *st, void *logctx)
> > =>
> > [flv @ 0x3303160] max_analyze_duration 5000000 reached at 5018000
> > [flv @ 0x3303160] Unspecified frame size for stream (Video: h264, 204 kb/s)
> > [flv @ 0x3303160] Could not find codec parameters for stream 0 (Video: h264, 204 kb/s)
> > 
> > Alternative 2:
> > static int has_codec_parameters(AVStream *st, char *msg, size_t msg_size)
> > =>
> > [flv @ 0x3303160] max_analyze_duration 5000000 reached at 5018000
> > [flv @ 0x3303160] Could not find codec parameters for stream 0 (Video: h264, 204 kb/s): unspecified frame size
> > 
> > With alternative 1 there is no way to show the stream index, since
> > has_codec_parameters() takes in input the stream, and the index may
> > not be available when the function is called (may be an issue if you
> > have several streams of the same type in input).
> > 
> > Alternative 2 provides the most useful and complete feedback IMHO, but
> > I'm fine with 1 if you dislike it very much.
> 
> what about just returning a pointer to the error message through a
> const char **err_message argument ?
> it would avoid the strlcpy()
> 
> either way feel free to commit what you like best.

Applied the **err_message argument variant, thanks.
-- 
FFmpeg = Frenzy Fabulous Multimedia Pitiless Entertaining Generator


More information about the ffmpeg-devel mailing list