[FFmpeg-devel] [PATCH 01/10] lavu: add av_fourcc_make_string() and av_4cc2str()

Clément Bœsch u at pkh.me
Mon Mar 27 17:56:13 EEST 2017


On Mon, Mar 27, 2017 at 11:16:24AM -0300, James Almer wrote:
> On 3/27/2017 4:51 AM, Clément Bœsch wrote:
> > ---
> >  doc/APIchanges      |  4 ++++
> >  libavutil/avutil.h  | 14 ++++++++++++++
> >  libavutil/utils.c   | 21 +++++++++++++++++++++
> >  libavutil/version.h |  2 +-
> >  4 files changed, 40 insertions(+), 1 deletion(-)
> > 
> > diff --git a/doc/APIchanges b/doc/APIchanges
> > index 6aaa9adceb..4736e3e6fc 100644
> > --- a/doc/APIchanges
> > +++ b/doc/APIchanges
> > @@ -15,6 +15,10 @@ libavutil:     2015-08-28
> >  
> >  API changes, most recent first:
> >  
> > +2017-03-xx - xxxxxxx - lavu 55.52.100 - avutil.h
> > +  add av_fourcc_make_string() function and av_4cc2str() macro to replace
> > +  av_get_codec_tag_string() from lavc.
> > +
> >  2017-03-xx - xxxxxxx - lavc 57.85.101 - avcodec.h
> >    vdpau hardware accelerated decoding now supports the new hwaccel API, which
> >    can create the decoder context and allocate hardware frame automatically.
> > diff --git a/libavutil/avutil.h b/libavutil/avutil.h
> > index e9aaa03722..98100fdcc5 100644
> > --- a/libavutil/avutil.h
> > +++ b/libavutil/avutil.h
> > @@ -343,6 +343,20 @@ FILE *av_fopen_utf8(const char *path, const char *mode);
> >   */
> >  AVRational av_get_time_base_q(void);
> >  
> > +#define AV_FOURCC_MAX_STRING_SIZE 32
> > +
> > +#define av_4cc2str(fourcc) av_fourcc_make_string((char[AV_FOURCC_MAX_STRING_SIZE]){0}, fourcc)
> > +
> > +/**
> > + * Fill the provided buffer with a string containing a FourCC (four-character
> > + * code) representation.
> > + *
> > + * @param buf    a buffer with size in bytes of at least AV_FOURCC_MAX_STRING_SIZE
> > + * @param fourcc the fourcc to represent
> > + * @return the buffer in input
> > + */
> > +char *av_fourcc_make_string(char *buf, uint32_t fourcc);
> 
> Maybe this could go in avstring.h instead.
> 

FourCC in strings? I feel like FourCC are more overall A/V specific than
string related. avstring is more about actually parsing string or craft
them from other strings.

Similarly, we didn't put timestamp string crafting in avstring,
av_ts2str() and its friends have their own header.

If more people feel like FourCC code should be there I'll move it,
otherwise I prefer if it stays here.

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20170327/3b2c6aa7/attachment.sig>


More information about the ffmpeg-devel mailing list