mirror of
https://github.com/nyanmisaka/ffmpeg-rockchip.git
synced 2025-11-02 21:34:01 +08:00
lavu: add av_fourcc_make_string() and av_fourcc2str()
This commit is contained in:
@@ -121,6 +121,29 @@ unsigned av_int_list_length_for_size(unsigned elsize,
|
||||
return i;
|
||||
}
|
||||
|
||||
char *av_fourcc_make_string(char *buf, uint32_t fourcc)
|
||||
{
|
||||
int i;
|
||||
char *orig_buf = buf;
|
||||
size_t buf_size = AV_FOURCC_MAX_STRING_SIZE;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
const int c = fourcc & 0xff;
|
||||
const int print_chr = (c >= '0' && c <= '9') ||
|
||||
(c >= 'a' && c <= 'z') ||
|
||||
(c >= 'A' && c <= 'Z') ||
|
||||
(c && strchr(". -_", c));
|
||||
const int len = snprintf(buf, buf_size, print_chr ? "%c" : "[%d]", c);
|
||||
if (len < 0)
|
||||
break;
|
||||
buf += len;
|
||||
buf_size = buf_size > len ? buf_size - len : 0;
|
||||
fourcc >>= 8;
|
||||
}
|
||||
|
||||
return orig_buf;
|
||||
}
|
||||
|
||||
AVRational av_get_time_base_q(void)
|
||||
{
|
||||
return (AVRational){1, AV_TIME_BASE};
|
||||
|
||||
Reference in New Issue
Block a user