Skip to main content

Closed captioning controls and stream events?

9 replies [Last post]
david_crandall
Offline
Joined: 2010-01-05

If I understand correctly, to turn closed captioning on, we basically need:

ServiceContext->ServiceContentHandler->Player->getControl("org.ocap.media.ClosedCaptioning")

I just want to make sure I'm on the right page, and that there is the correct procedure. I didn't know if there was an option to turn it on via a Host-ish interface the way, say, powerOn and PowerOff is done.

Which raises the next related question without going into lurid details... if I want to hear about a new (preferably JMF Player compatible for the aforementioned closed captioning) service opening up outside of my application, how do I hear about it? ---assuming of course such a thing is permitted.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
david_crandall
Offline
Joined: 2010-01-05

I see options to set this to "On" and "Off" in AbstractServicePlayer.java. That makes sense.

However, when I first make a call to get "Closed Caption On", it really doesn't have an 'favourites' set as available options. Is there something that's supposed to initialize this? I'm perfectly fine with doing so, but I don't know that me initializing the options to either "On" or "Off" is quite proper.

scottdeboy
Offline
Joined: 2009-02-02

The default closed captioning state is retrieved in the constructor via a call to mpe_ccGetClosedCaptioning (through MediaAPI.getCCState()) and the state is updated if a preference is set. If a preference is not set for closed captioning, the default state is returned in the call to getClosedCaptioningState.

david_crandall
Offline
Joined: 2010-01-05

Just to double check that I'm not out in the weeds on this:

If I call the UserPreferenceManager, and I see that there's really no preference set, (nor even any available preferences as my case stands) for "Closed Caption On", the next (and proper) option to find out is to query 'getClosedCaptioningState' from ClosedCaptioningControl.

ClosedCaptioningControl is the class chosen, because it exposes getCCState in MediaAPI appropriately (as far as I can see).

...subsequently, I'm allowed to write a preference in UserPreferenceManager for future use with the AbstractServicePlayer to read accordingly as it sees fit.

(follow-up about the abstract service player)

Message was edited by: david_crandall

scottdeboy
Offline
Joined: 2009-02-02

Yes, you can use ClosedCaptioningControl to get the Closed Captioning state, regardless if a Closed Captioning preference is set.

A UserPreferenceChangeListener is registered on the UserPreferenceManager in the REALIZE step in AbstractServicePlayer, and if the "Closed Caption On" preference is updated, the closed captioning state (and value returned by getClosedCaptioningState) are updated.

david_crandall
Offline
Joined: 2010-01-05

Thank you! This works almost a little too well.

scottdeboy
Offline
Joined: 2009-02-02

Closed Captioning can be turned on and off via a JMF Player's ClosedCaptioningControl as well as via the "Closed Caption On" User Preference, assuming you have the appropriate permissions needed to read and change preferences and change the state of the ClosedCaptioningControl.

You can create a Player and get a ClosedCaptioningControl if you created the player yourself by calling Manager.createPlayer, or you can get the player from your ServiceContext as you described.

The Player registers a UserPreferenceChangeListener on the UserPreferenceManager when it transitions into the Realized state. Once registered, changes to the "Closed Caption On" preference will turn on and off closed captioning when it is changed.

You can register a listener on the UserPreferenceManager to discover when the preference has changed, however, you can't add a ControllerListener to a Player you didn't create, so you won't be able to discover changes made by other apps via ClosedCaptionControl.

Scott

david_crandall
Offline
Joined: 2010-01-05

Thanks for getting back to me!

There wouldn't happen to be a catalog of user preferences made available somewhere, would there?

scottdeboy
Offline
Joined: 2009-02-02

You can find a table of OCAP-specific user preferences in Section 21.2.1.23 of the OCAP spec, and the set of MHP-supported preferences is available in Annex L of the MHP spec.

I believe those two sections together define the supported preferences (which are enumerated in arrays in the source code for org.dvb.user.GeneralPreference.

david_crandall
Offline
Joined: 2010-01-05

Thank you!

Just on a grep through the stack, I see a bunch of options, so that works too, in a pinch.

--David