[FFmpeg-devel] [PATCH] lavu: add av_get_media_type_string() convenience function
Stefano Sabatini
stefano.sabatini-lala at poste.it
Sat Aug 20 15:09:43 CEST 2011
On date Saturday 2011-08-20 12:46:25 +0200, Stefano Sabatini encoded:
> On date Saturday 2011-08-20 10:53:39 +0200, Nicolas George encoded:
> > Le primidi 1er fructidor, an CCXIX, Stefano Sabatini a écrit :
> > > + case AVMEDIA_TYPE_ATTACHMENT: return "attachment";
> > > + default: return NULL;
> >
> > Wouldn't "unknown" be more practical than NULL?
>
> But less flexible, for example in the case you want to return the
> localized equivalent of "unknown".
This was also more consistent with the behavior of other similar
function (av_get_pix_fmt_name(), sample_fmt_name(), etc.).
But I see that this is sometimes clumsy, what about a macro like this:
AV_X_IF_NULL(exp, x) ((exp) ? : (exp) : (x))
printf("type:%s\n", AV_X_IF_NULL(av_get_media_type_string(type), "unknown"));
possibly better than:
printf("type:%s\n", av_get_media_type_string(type) ? av_get_media_type_string(type) : "unknown");
--
FFmpeg = Faithless and Fanciful Mere Powered Evanescent Gospel
More information about the ffmpeg-devel
mailing list