Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[streamdetails] Add SubtitleCodec and SubtitleType #25023

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

enen92
Copy link
Member

@enen92 enen92 commented Apr 19, 2024

Description

This is yet another alternative to #25000 and adds the codec type (if available) for subtitles as well as their type (muxed/external). This allows skins to rely on properties that should always be defined (i.e. the type) instead of the language as the single source of truth.

Motivation and context

Currently to check if a file has subtitles skins check for the subtitle language property. However:
If no subtitle:
String.IsEmpty(ListItem.Property(SubtitleLanguage.1) = true

If there is a subtitle but language that isn't defined:
String.IsEmpty(ListItem.Property(SubtitleLanguage.1) = true

With this change we have the information more consistent with audio and have also properties that should always be defined indirectly solving the issue above.

How has this been tested?

Runtime tested

What is the effect on users?

Skins can use the subtitle type property to check if a given subtitle exists.

Screenshots (if appropriate):

Types of change

  • Bug fix (non-breaking change which fixes an issue)
  • Clean up (non-breaking change which removes non-working, unmaintained functionality)
  • Improvement (non-breaking change which improves existing functionality)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that will cause existing functionality to change)
  • Cosmetic change (non-breaking change that doesn't touch code)
  • Student submission (PR was done for educational purposes and will be treated as such)
  • None of the above (please explain below)

@@ -86,6 +86,8 @@ class CStreamDetailSubtitle final : public CStreamDetail
void Serialize(CVariant& value) const override;
bool IsWorseThan(const CStreamDetail &that) const override;

std::string m_codec;
std::string m_type;
Copy link
Contributor

@CrystalP CrystalP Apr 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Name: "type" is a generic word, maybe "location" or "storage" or "storage type" is better?
audio tracks could use that field as well.

type; non-localized strings "muxed" or "external" can work for storage but are not great for display to the user and I don't think translation should be up to the skin.

I don't know if there could ever be more values than internal/external > a bool could be enough. Or a number for an enum.

Copy link

@dcfou dcfou Apr 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Subtitle Type cannot be a boolean because this property will be used to know if there is or not a subtitle - and if you set it to false, what would that mean ? no subtitle or external one?. Codec cannot be used for this, because it is only retrieved if the subtitle is internal.
To my point of view, Type property is fine (why not an enum), better than location (which sounds more like network or local values).

@CrystalP
Copy link
Contributor

I like the idea and have been wanting to see the subs codec in the skin (same way the screen opened by o shows video and audio codec and info).

const CStreamDetailSubtitle* item =
dynamic_cast<const CStreamDetailSubtitle*>(GetNthStream(CStreamDetail::SUBTITLE, idx));
if (item)
return item->m_type;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return item->m_type;
return item->m_codec;

And the reverse in the function below?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Content Component: Database Type: Feature non-breaking change which adds functionality Type: Improvement non-breaking change which improves existing functionality v22 "P" Wiki: Needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants