On Fri, 25 Aug 2023, Steven Liu wrote:
> + list_len = (fourcc_str_len + 1) / 5;
> + // write the fourCcList field name
> + ff_amf_write_field_name(&p, "fourCcList");
> +
> + // write the fourcc array length
> + ff_amf_write_array_start(&p, list_len);
> +
> + while(fourcc_data - rt->enhanced_codecs < fourcc_str_len) {
> + unsigned char fourcc[5];
> + switch (AV_RN32(fourcc_data)) {
> + case MKTAG('h', 'v', 'c', '1'):
This feels a bit convoluted to use AV_RN32 + MKTAG on data that is already
just a string - just using strncmp(fourcc_data, "hvc1", 4) would work just
I want use strncmp at first, but i think strncmp will slower than
switch uint32_t value, so i chose use uint32_t. or should i use
strncmp?
Yes, strncmp will be slower than switching on an uint32_t - but this isn't
really performance sensitive code. We do this once only, on startup, on a
handful of fourccs. So I believe code clarity is more important than
absolute performance here.
// Martin
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".