Copyright 2008 Motorola Inc. and Nokia Corporation. All Rights Reserved.
Specification License

javax.microedition.broadcast.control
Interface NTPTimeControl

All Superinterfaces:
javax.microedition.media.Control

public interface NTPTimeControl
extends javax.microedition.media.Control

NTPTimeControl provides the capabilities to map the Player's media time to the underlying NTP time of the broadcast media. This allows the application to use NTP time as a common time base to synchronize with other media streams or external events. Therefore, the JSR 272 implementation must compute the NTP time mapping based on the actual NTP timestamps from the media stream (generated by the head-end server); rather than the "wall clock" time generated by the device.

The Network Time Protocol (RFC 1305) defines a protocol for synchronizing the clocks for networked computers. IP-based broadcast protocols such as RTP uses NTP time for media synchronizations. Detail descriptions of how RTP uses NTP time for media synchronizations can be found at: RFC 1889.

NTP specifies time relative to "0h UTC on 1 January 1900" in an unsigned 64-bit timestamp value. The first 32 bits specify the integer value in seconds and the last 32 bits specify the fractional part. getCurrentNTPTime() and media2NTPTime(long) return the 64-bit NTP timestamp values. However, since long is a signed integer, the return value should only be interpreted as bit values, not as integer values.

NTP time mapping may not be immediately known. For example, for some RTP/RTCP implementations, the correct mapping between NTP and media time can only be computed after the first few RTCP packets are received. During the time when the NTP and media time mapping cannot be computed, UNKNOWN_TIME will be returned.

For recorded and time-shifted content the NTPTimeControl can report either the NTP time of the (non-real time) media time, that is, media2NTPTime(long), or UNKNOWN_TIME.


Field Summary
static long UNKNOWN_TIME
          UNKNOWN_TIME will be returned when the NTP to media time mapping cannot be derived.
 
Method Summary
 long getCurrentNTPTime()
          Get the current NTP time stamp.
 long media2NTPTime(long mediaTime)
          Convert media time to an NTP timestamp.
 long NTP2MediaTime(long ntpTime)
          Convert NTP time to the media time.
 

Field Detail

UNKNOWN_TIME

static final long UNKNOWN_TIME
UNKNOWN_TIME will be returned when the NTP to media time mapping cannot be derived.

See Also:
Constant Field Values
Method Detail

getCurrentNTPTime

long getCurrentNTPTime()
Get the current NTP time stamp.

Returns:
the current NTP time stamp, or UNKNOWN_TIME if the NTP to media time mapping cannot be derived.

media2NTPTime

long media2NTPTime(long mediaTime)
Convert media time to an NTP timestamp.

Returns:
the NTP timestamp corresponding to the given media time, or UNKNOWN_TIME if the NTP to media time mapping cannot be derived.

NTP2MediaTime

long NTP2MediaTime(long ntpTime)
Convert NTP time to the media time.

Returns:
the media time value corresponding to the given NTP time, or UNKNOWN_TIME if the NTP to media time mapping cannot be derived.


Copyright 2008 Motorola Inc. and Nokia Corporation. All Rights Reserved.
Specification License