Unified · Split
| @@ -0,0 +1 @@ | ||
| 1 | +add `track-list/N/decoder` | |
| @@ -3077,6 +3077,9 @@ Property list · 3076 unmodified lines | ||
| 3077 | 3077 | match even if the default (builtin) demuxer is used, but there is |
| 3078 | 3078 | no hard guarantee. |
| 3079 | 3079 | |
| 3080 | + ``track-list/N/decoder`` | |
| 3081 | + If this track is being decoded, the short decoder name, | |
| 3082 | + | |
| 3080 | 3083 | ``track-list/N/decoder-desc`` |
| 3081 | 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 | 410 | c->codec_profile = avcodec_profile_name(avctx->codec_id, avctx->profile); |
| 411 | 411 | c->codec = avctx->codec_descriptor->name; |
| 412 | 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 | 78 | // Corresponding codec profile |
| 79 | 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 | 87 | // Usually a FourCC, exact meaning depends on codec. |
| 82 | 88 | unsigned int codec_tag; |
| 83 | 89 | |
| @@ -224,7 +224,6 @@ struct priv { · 223 unmodified lines | ||
| 224 | 224 | |
| 225 | 225 | // --- Protected by cache_lock. |
| 226 | 226 | char *cur_hwdec; |
| 227 | − char *decoder_desc; | |
| 228 | 227 | bool try_spdif; |
| 229 | 228 | bool attached_picture; |
| 230 | 229 | bool pts_reset; |
| @@ -397,9 +396,6 @@ static bool reinit_decoder(struct priv *p) · 166 unmodified lines | ||
| 397 | 396 | reset_decoder(p); |
| 398 | 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 | 399 | const struct mp_decoder_fns *driver = NULL; |
| 404 | 400 | struct mp_decoder_list *list = NULL; |
| 405 | 401 | char *user_list = NULL; |
| @@ -451,11 +447,12 @@ static bool reinit_decoder(struct priv *p) · 45 unmodified lines | ||
| 451 | 447 | |
| 452 | 448 | p->decoder = driver->create(p->decf, p->codec, sel->decoder); |
| 453 | 449 | if (p->decoder) { |
| 454 | − mp_mutex_lock(&p->cache_lock); | |
| 455 | − const char *d = sel->desc && sel->desc[0] ? sel->desc : sel->decoder; | |
| 456 | − p->decoder_desc = talloc_strdup(p, d); | |
| 457 | − MP_VERBOSE(p, "Selected codec: %s\n", p->decoder_desc); | |
| 458 | − mp_mutex_unlock(&p->cache_lock); | |
| 450 | + p->codec->decoder = talloc_strdup(p, sel->decoder); | |
| 451 | + p->codec->decoder_desc = talloc_strdup(p, sel->desc && sel->desc[0] ? sel->desc : NULL); | |
| 452 | + MP_VERBOSE(p, "Selected decoder: %s", sel->decoder); | |
| 453 | + if (p->codec->decoder_desc) | |
| 454 | + MP_VERBOSE(p, " - %s", p->codec->decoder_desc); | |
| 455 | + MP_VERBOSE(p, "\n"); | |
| 459 | 456 | break; |
| 460 | 457 | } |
| 461 | 458 | |
| @@ -482,15 +479,6 @@ bool mp_decoder_wrapper_reinit(struct mp_decoder_wrapper *d) · 20 unmodified lines | ||
| 482 | 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 | 482 | void mp_decoder_wrapper_set_frame_drops(struct mp_decoder_wrapper *d, int num) |
| 495 | 483 | { |
| 496 | 484 | struct priv *p = d->f->priv; |
| @@ -43,10 +43,6 @@ struct mp_decoder_wrapper { · 42 unmodified lines | ||
| 43 | 43 | struct mp_decoder_wrapper *mp_decoder_wrapper_create(struct mp_filter *parent, |
| 44 | 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 | 46 | // Legacy decoder framedrop control. |
| 51 | 47 | void mp_decoder_wrapper_set_frame_drops(struct mp_decoder_wrapper *d, int num); |
| 52 | 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 | 1977 | struct mp_codec_params p = |
| 1978 | 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 | 1980 | bool has_rg = track->stream && track->stream->codec->replaygain_data; |
| 1985 | 1981 | struct replaygain_data rg = has_rg ? *track->stream->codec->replaygain_data |
| 1986 | 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 | 2025 | .unavailable = !track->hls_bitrate}, |
| 2030 | 2026 | {"program-id", SUB_PROP_INT(track->program_id), |
| 2031 | 2027 | .unavailable = track->program_id < 0}, |
| 2032 | − {"decoder-desc", SUB_PROP_STR(decoder_desc), | |
| 2033 | − .unavailable = !decoder_desc[0]}, | |
| 2028 | + {"decoder", SUB_PROP_STR(p.decoder), | |
| 2029 | + .unavailable = !p.decoder}, | |
| 2030 | + {"decoder-desc", SUB_PROP_STR(p.decoder_desc), | |
| 2031 | + .unavailable = !p.decoder_desc}, | |
| 2034 | 2032 | {"codec", SUB_PROP_STR(p.codec), |
| 2035 | 2033 | .unavailable = !p.codec}, |
| 2036 | 2034 | {"codec-desc", SUB_PROP_STR(p.codec_desc), |