| 504 | } |
| 505 | |
| 506 | void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode) |
| 507 | { |
| 508 | const char *codec_type; |
| 509 | const char *codec_name; |
| 510 | const char *profile = NULL; |
| 511 | AVBPrint bprint; |
| 512 | int64_t bitrate; |
| 513 | int new_line = 0; |
| 514 | AVRational display_aspect_ratio; |
| 515 | const char *separator = enc->dump_separator ? (const char *)enc->dump_separator : ", "; |
| 516 | const char *str; |
| 517 | |
| 518 | if (!buf || buf_size <= 0) |
| 519 | return; |
| 520 | av_bprint_init_for_buffer(&bprint, buf, buf_size); |
| 521 | codec_type = av_get_media_type_string(enc->codec_type); |
| 522 | codec_name = avcodec_get_name(enc->codec_id); |
| 523 | profile = avcodec_profile_name(enc->codec_id, enc->profile); |
| 524 | |
| 525 | av_bprintf(&bprint, "%s: %s", codec_type ? codec_type : "unknown", |
| 526 | codec_name); |
| 527 | buf[0] ^= 'a' ^ 'A'; /* first letter in uppercase */ |
| 528 | |
| 529 | if (enc->codec && strcmp(enc->codec->name, codec_name)) |
| 530 | av_bprintf(&bprint, " (%s)", enc->codec->name); |
| 531 | |
| 532 | if (profile) |
| 533 | av_bprintf(&bprint, " (%s)", profile); |
| 534 | if ( enc->codec_type == AVMEDIA_TYPE_VIDEO |
| 535 | && av_log_get_level() >= AV_LOG_VERBOSE |
| 536 | && enc->refs) |
| 537 | av_bprintf(&bprint, ", %d reference frame%s", |
| 538 | enc->refs, enc->refs > 1 ? "s" : ""); |
| 539 | |
| 540 | if (enc->codec_tag) |
| 541 | av_bprintf(&bprint, " (%s / 0x%04X)", |
| 542 | av_fourcc2str(enc->codec_tag), enc->codec_tag); |
| 543 | |
| 544 | switch (enc->codec_type) { |
| 545 | case AVMEDIA_TYPE_VIDEO: |
| 546 | { |
| 547 | unsigned len; |
| 548 | |
| 549 | av_bprintf(&bprint, "%s%s", separator, |
| 550 | enc->pix_fmt == AV_PIX_FMT_NONE ? "none" : |
| 551 | unknown_if_null(av_get_pix_fmt_name(enc->pix_fmt))); |
| 552 | |
| 553 | av_bprint_chars(&bprint, '(', 1); |
| 554 | len = bprint.len; |
| 555 | |
| 556 | /* The following check ensures that '(' has been written |
| 557 | * and therefore allows us to erase it if it turns out |
| 558 | * to be unnecessary. */ |
| 559 | if (!av_bprint_is_complete(&bprint)) |
| 560 | return; |
| 561 | |
| 562 | if (enc->bits_per_raw_sample && enc->pix_fmt != AV_PIX_FMT_NONE && |
| 563 | enc->bits_per_raw_sample < av_pix_fmt_desc_get(enc->pix_fmt)->comp[0].depth) |
no test coverage detected