[FFmpeg-devel] [PATCH 04/10] lavf: fix usages of av_get_codec_tag_string()

Clément Bœsch u at pkh.me
Mon Mar 27 18:02:40 EEST 2017


On Mon, Mar 27, 2017 at 11:59:05AM -0300, James Almer wrote:
> On 3/27/2017 11:50 AM, Clément Bœsch wrote:
> > On Mon, Mar 27, 2017 at 11:35:41AM -0300, James Almer wrote:
> > [...]
> >>> -        char tag_buf[32];
> >>> -
> >>> -        av_get_codec_tag_string(tag_buf, sizeof(tag_buf), par->codec_tag);
> >>
> >> char *tag_buf = av_4cc2str(par->codec_tag); and keep the two line below
> >> unchanged.
> >>
> > 
> > No, I can't do that, av_4cc2str() creates a temporary anonymous buffer
> > with a reduced lifetime. It can only live within the function call.
> 
> Then do
> 
> char buf[AV_FOURCC_MAX_STRING_SIZE], *tag_buf = av_fourcc_make_string(buf, par->codec_tag);
> 
> av_4cc2str() seems mainly useful as a simplification when you're using
> it once to me.
> But it's a nit, so lgtm either way.
> 

as you wish, but note that in any case the call is made only once: it's in
an error path.

-- 
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/4328d50a/attachment.sig>


More information about the ffmpeg-devel mailing list