Unified · Split
| @@ -0,0 +1 @@ | |||
| 1 | add `track-list/N/decoder` | ||
| @@ -3077,6 +3077,9 @@ Property list · 3076 unmodified lines | |||
| 3077 | match even if the default (builtin) demuxer is used, but there is | 3077 | match even if the default (builtin) demuxer is used, but there is |
| 3078 | no hard guarantee. | 3078 | no hard guarantee. |
| 3079 | 3079 | ||
| 3080 | ``track-list/N/decoder`` | ||
| 3081 | If this track is being decoded, the short decoder name, | ||
| 3082 | |||
| 3080 | ``track-list/N/decoder-desc`` | 3083 | ``track-list/N/decoder-desc`` |
| 3081 | If this track is being decoded, the human-readable decoder name, | 3084 | If this track is being decoded, the human-readable decoder name, |
| 3082 | 3085 | ||
| @@ -410,4 +410,6 @@ void mp_codec_info_from_av(const AVCodecContext *avctx, struct mp_codec_params * · 409 unmodified lines | |||
| 410 | c->codec_profile = avcodec_profile_name(avctx->codec_id, avctx->profile); | 410 | c->codec_profile = avcodec_profile_name(avctx->codec_id, avctx->profile); |
| 411 | c->codec = avctx->codec_descriptor->name; | 411 | c->codec = avctx->codec_descriptor->name; |
| 412 | c->codec_desc = avctx->codec_descriptor->long_name; | 412 | c->codec_desc = avctx->codec_descriptor->long_name; |
| 413 | c->decoder = avctx->codec->name; | ||
| 414 | c->decoder_desc = avctx->codec->long_name; | ||
| 413 | } | 415 | } |
| @@ -78,6 +78,12 @@ struct mp_codec_params { · 77 unmodified lines | |||
| 78 | // Corresponding codec profile | 78 | // Corresponding codec profile |
| 79 | const char *codec_profile; | 79 | const char *codec_profile; |
| 80 | 80 | ||
| 81 | // E.g. "h264" (usually corresponds to AVCodec.name) | ||
| 82 | const char *decoder; | ||
| 83 | |||
| 84 | // Usually corresponds to AVCodec.long_name | ||
| 85 | const char *decoder_desc; | ||
| 86 | |||
| 81 | // Usually a FourCC, exact meaning depends on codec. | 87 | // Usually a FourCC, exact meaning depends on codec. |
| 82 | unsigned int codec_tag; | 88 | unsigned int codec_tag; |
| 83 | 89 | ||
| @@ -224,7 +224,6 @@ struct priv { · 223 unmodified lines | |||
| 224 | 224 | ||
| 225 | // --- Protected by cache_lock. | 225 | // --- Protected by cache_lock. |
| 226 | char *cur_hwdec; | 226 | char *cur_hwdec; |
| 227 | char *decoder_desc; | ||
| 228 | bool try_spdif; | 227 | bool try_spdif; |
| 229 | bool attached_picture; | 228 | bool attached_picture; |
| 230 | bool pts_reset; | 229 | bool pts_reset; |
| @@ -397,9 +396,6 @@ static bool reinit_decoder(struct priv *p) · 166 unmodified lines | |||
| 397 | reset_decoder(p); | 396 | reset_decoder(p); |
| 398 | p->has_broken_packet_pts = -10; // needs 10 packets to reach decision | 397 | p->has_broken_packet_pts = -10; // needs 10 packets to reach decision |
| 399 | 398 | ||
| 400 | talloc_free(p->decoder_desc); | ||
| 401 | p->decoder_desc = NULL; | ||
| 402 | |||
| 403 | const struct mp_decoder_fns *driver = NULL; | 399 | const struct mp_decoder_fns *driver = NULL; |
| 404 | struct mp_decoder_list *list = NULL; | 400 | struct mp_decoder_list *list = NULL; |
| 405 | char *user_list = NULL; | 401 | char *user_list = NULL; |
| @@ -451,11 +447,12 @@ static bool reinit_decoder(struct priv *p) · 45 unmodified lines | |||
| 451 | 447 | ||
| 452 | p->decoder = driver->create(p->decf, p->codec, sel->decoder); | 448 | p->decoder = driver->create(p->decf, p->codec, sel->decoder); |
| 453 | if (p->decoder) { | 449 | if (p->decoder) { |
| 454 | mp_mutex_lock(&p->cache_lock); | 450 | p->codec->decoder = talloc_strdup(p, sel->decoder); |
| 455 | const char *d = sel->desc && sel->desc[0] ? sel->desc : sel->decoder; | 451 | p->codec->decoder_desc = talloc_strdup(p, sel->desc && sel->desc[0] ? sel->desc : NULL); |
| 456 | p->decoder_desc = talloc_strdup(p, d); | 452 | MP_VERBOSE(p, "Selected decoder: %s", sel->decoder); |
| 457 | MP_VERBOSE(p, "Selected codec: %s\n", p->decoder_desc); | 453 | if (p->codec->decoder_desc) |
| 458 | mp_mutex_unlock(&p->cache_lock); | 454 | MP_VERBOSE(p, " - %s", p->codec->decoder_desc); |
| 455 | MP_VERBOSE(p, "\n"); | ||
| 459 | break; | 456 | break; |
| 460 | } | 457 | } |
| 461 | 458 | ||
| @@ -482,15 +479,6 @@ bool mp_decoder_wrapper_reinit(struct mp_decoder_wrapper *d) · 20 unmodified lines | |||
| 482 | return res; | 479 | return res; |
| 483 | } | 480 | } |
| 484 | 481 | ||
| 485 | void mp_decoder_wrapper_get_desc(struct mp_decoder_wrapper *d, | ||
| 486 | char *buf, size_t buf_size) | ||
| 487 | { | ||
| 488 | struct priv *p = d->f->priv; | ||
| 489 | mp_mutex_lock(&p->cache_lock); | ||
| 490 | snprintf(buf, buf_size, "%s", p->decoder_desc ? p->decoder_desc : ""); | ||
| 491 | mp_mutex_unlock(&p->cache_lock); | ||
| 492 | } | ||
| 493 | |||
| 494 | void mp_decoder_wrapper_set_frame_drops(struct mp_decoder_wrapper *d, int num) | 482 | void mp_decoder_wrapper_set_frame_drops(struct mp_decoder_wrapper *d, int num) |
| 495 | { | 483 | { |
| 496 | struct priv *p = d->f->priv; | 484 | struct priv *p = d->f->priv; |
| @@ -43,10 +43,6 @@ struct mp_decoder_wrapper { · 42 unmodified lines | |||
| 43 | struct mp_decoder_wrapper *mp_decoder_wrapper_create(struct mp_filter *parent, | 43 | struct mp_decoder_wrapper *mp_decoder_wrapper_create(struct mp_filter *parent, |
| 44 | struct sh_stream *src); | 44 | struct sh_stream *src); |
| 45 | 45 | ||
| 46 | // For informational purposes. | ||
| 47 | void mp_decoder_wrapper_get_desc(struct mp_decoder_wrapper *d, | ||
| 48 | char *buf, size_t buf_size); | ||
| 49 | |||
| 50 | // Legacy decoder framedrop control. | 46 | // Legacy decoder framedrop control. |
| 51 | void mp_decoder_wrapper_set_frame_drops(struct mp_decoder_wrapper *d, int num); | 47 | void mp_decoder_wrapper_set_frame_drops(struct mp_decoder_wrapper *d, int num); |
| 52 | int mp_decoder_wrapper_get_frames_dropped(struct mp_decoder_wrapper *d); | 48 | int mp_decoder_wrapper_get_frames_dropped(struct mp_decoder_wrapper *d); |
| @@ -1977,10 +1977,6 @@ static int get_track_entry(int item, int action, void *arg, void *ctx) · 1976 unmodified lines | |||
| 1977 | struct mp_codec_params p = | 1977 | struct mp_codec_params p = |
| 1978 | track->stream ? *track->stream->codec : (struct mp_codec_params){0}; | 1978 | track->stream ? *track->stream->codec : (struct mp_codec_params){0}; |
| 1979 | 1979 | ||
| 1980 | char decoder_desc[256] = {0}; | ||
| 1981 | if (track->dec) | ||
| 1982 | mp_decoder_wrapper_get_desc(track->dec, decoder_desc, sizeof(decoder_desc)); | ||
| 1983 | |||
| 1984 | bool has_rg = track->stream && track->stream->codec->replaygain_data; | 1980 | bool has_rg = track->stream && track->stream->codec->replaygain_data; |
| 1985 | struct replaygain_data rg = has_rg ? *track->stream->codec->replaygain_data | 1981 | struct replaygain_data rg = has_rg ? *track->stream->codec->replaygain_data |
| 1986 | : (struct replaygain_data){0}; | 1982 | : (struct replaygain_data){0}; |
| @@ -2029,8 +2025,10 @@ static int get_track_entry(int item, int action, void *arg, void *ctx) · 42 unmodified lines | |||
| 2029 | .unavailable = !track->hls_bitrate}, | 2025 | .unavailable = !track->hls_bitrate}, |
| 2030 | {"program-id", SUB_PROP_INT(track->program_id), | 2026 | {"program-id", SUB_PROP_INT(track->program_id), |
| 2031 | .unavailable = track->program_id < 0}, | 2027 | .unavailable = track->program_id < 0}, |
| 2032 | {"decoder-desc", SUB_PROP_STR(decoder_desc), | 2028 | {"decoder", SUB_PROP_STR(p.decoder), |
| 2033 | .unavailable = !decoder_desc[0]}, | 2029 | .unavailable = !p.decoder}, |
| 2030 | {"decoder-desc", SUB_PROP_STR(p.decoder_desc), | ||
| 2031 | .unavailable = !p.decoder_desc}, | ||
| 2034 | {"codec", SUB_PROP_STR(p.codec), | 2032 | {"codec", SUB_PROP_STR(p.codec), |
| 2035 | .unavailable = !p.codec}, | 2033 | .unavailable = !p.codec}, |
| 2036 | {"codec-desc", SUB_PROP_STR(p.codec_desc), | 2034 | {"codec-desc", SUB_PROP_STR(p.codec_desc), |