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

James Almer jamrial at gmail.com
Mon Mar 27 17:59:05 EEST 2017


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.



More information about the ffmpeg-devel mailing list