Package com.google.android.exoplayer2.source.rtsp

## Class RtpPayloadFormat

- java.lang.Object
- - com.google.android.exoplayer2.source.rtsp.RtpPayloadFormat

-     public final class RtpPayloadFormat
      extends Object

  Represents the payload format used in RTP.

  In RTSP playback, the format information is always present in the `SessionDescription` enclosed in the response of a DESCRIBE request. Within each track's `MediaDescription`, it is the attributes FMTP and RTPMAP that allows us to recreate the media format.

  This class wraps around the `Format` class, in addition to the instance fields that are specific to RTP.

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `int` | `clockRate` | The clock rate in Hertz, associated with the format.
    `ImmutableMap<String,​String>` | `fmtpParameters` | The format parameters, mapped from the SDP FMTP attribute (RFC2327 Page 22).
    `Format` | `format` | The `Format` of this RTP payload.
    `int` | `rtpPayloadType` | The payload type associated with this format.

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `RtpPayloadFormat​(Format format, int rtpPayloadType, int clockRate, Map<String,​String> fmtpParameters)` | Creates a new instance.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `equals​(Object o)` |
    `static String` | `getMimeTypeFromRtpMediaType​(String mediaType)` | Gets the MIME type that is associated with the RTP media type.
    `int` | `hashCode()` |
    `static boolean` | `isFormatSupported​(com.google.android.exoplayer2.source.rtsp.MediaDescription mediaDescription)` | Returns whether the format of a `MediaDescription` is supported.

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### rtpPayloadType

          public final int rtpPayloadType

      The payload type associated with this format.

    - #### clockRate

          public final int clockRate

      The clock rate in Hertz, associated with the format.

    - #### format

          public final Format format

      The `Format` of this RTP payload.

    - #### fmtpParameters

          public final ImmutableMap<String,​String> fmtpParameters

      The format parameters, mapped from the SDP FMTP attribute (RFC2327 Page 22).

  - ### Constructor Detail

    - #### RtpPayloadFormat

          public RtpPayloadFormat​(Format format,
                                  int rtpPayloadType,
                                  int clockRate,
                                  Map<String,​String> fmtpParameters)

      Creates a new instance.
      Parameters:
        `format` - The associated `media format`.
        `rtpPayloadType` - The assigned RTP payload type, from the RTPMAP attribute in `MediaDescription`.
        `clockRate` - The associated clock rate in hertz.
        `fmtpParameters` - The format parameters, from the SDP FMTP attribute (RFC2327 Page 22), empty if unset. The keys and values are specified in the RFCs for specific formats. For instance, RFC3640 Section 4.1 defines keys like profile-level-id and config.

  - ### Method Detail

    - #### isFormatSupported

          public static boolean isFormatSupported​(com.google.android.exoplayer2.source.rtsp.MediaDescription mediaDescription)

      Returns whether the format of a `MediaDescription` is supported.

    - #### getMimeTypeFromRtpMediaType

          public static String getMimeTypeFromRtpMediaType​(String mediaType)

      Gets the MIME type that is associated with the RTP media type.

      For instance, RTP media type "H264" maps to `MimeTypes.VIDEO_H264`.

      Throws:
        `IllegalArgumentException` - When the media type is not supported/recognized.

    - #### equals

          public boolean equals​(@Nullable
                                Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`