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.
    `String` | `mediaEncoding` | The RTP media encoding.
    `static String` | `RTP_MEDIA_AC3` |
    `static String` | `RTP_MEDIA_AMR` |
    `static String` | `RTP_MEDIA_AMR_WB` |
    `static String` | `RTP_MEDIA_H263_1998` |
    `static String` | `RTP_MEDIA_H263_2000` |
    `static String` | `RTP_MEDIA_H264` |
    `static String` | `RTP_MEDIA_H265` |
    `static String` | `RTP_MEDIA_MPEG4_GENERIC` |
    `static String` | `RTP_MEDIA_MPEG4_LATM_AUDIO` |
    `static String` | `RTP_MEDIA_MPEG4_VIDEO` |
    `static String` | `RTP_MEDIA_OPUS` |
    `static String` | `RTP_MEDIA_PCM_L16` |
    `static String` | `RTP_MEDIA_PCM_L8` |
    `static String` | `RTP_MEDIA_PCMA` |
    `static String` | `RTP_MEDIA_PCMU` |
    `static String` | `RTP_MEDIA_VP8` |
    `static String` | `RTP_MEDIA_VP9` |
    `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, String mediaEncoding)` | 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.
    `static @com.google.android.exoplayer2.C.PcmEncoding int` | `getRawPcmEncodingType​(String mediaEncoding)` | Returns the PCM encoding type for `mediaEncoding`.
    `int` | `hashCode()` |

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

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

- - ### Field Detail

    - #### RTP_MEDIA_AC3

          public static final String RTP_MEDIA_AC3

      See Also:
        Constant Field Values

    - #### RTP_MEDIA_AMR

          public static final String RTP_MEDIA_AMR

      See Also:
        Constant Field Values

    - #### RTP_MEDIA_AMR_WB

          public static final String RTP_MEDIA_AMR_WB

      See Also:
        Constant Field Values

    - #### RTP_MEDIA_MPEG4_GENERIC

          public static final String RTP_MEDIA_MPEG4_GENERIC

      See Also:
        Constant Field Values

    - #### RTP_MEDIA_MPEG4_LATM_AUDIO

          public static final String RTP_MEDIA_MPEG4_LATM_AUDIO

      See Also:
        Constant Field Values

    - #### RTP_MEDIA_MPEG4_VIDEO

          public static final String RTP_MEDIA_MPEG4_VIDEO

      See Also:
        Constant Field Values

    - #### RTP_MEDIA_H263_1998

          public static final String RTP_MEDIA_H263_1998

      See Also:
        Constant Field Values

    - #### RTP_MEDIA_H263_2000

          public static final String RTP_MEDIA_H263_2000

      See Also:
        Constant Field Values

    - #### RTP_MEDIA_H264

          public static final String RTP_MEDIA_H264

      See Also:
        Constant Field Values

    - #### RTP_MEDIA_H265

          public static final String RTP_MEDIA_H265

      See Also:
        Constant Field Values

    - #### RTP_MEDIA_OPUS

          public static final String RTP_MEDIA_OPUS

      See Also:
        Constant Field Values

    - #### RTP_MEDIA_PCM_L8

          public static final String RTP_MEDIA_PCM_L8

      See Also:
        Constant Field Values

    - #### RTP_MEDIA_PCM_L16

          public static final String RTP_MEDIA_PCM_L16

      See Also:
        Constant Field Values

    - #### RTP_MEDIA_PCMA

          public static final String RTP_MEDIA_PCMA

      See Also:
        Constant Field Values

    - #### RTP_MEDIA_PCMU

          public static final String RTP_MEDIA_PCMU

      See Also:
        Constant Field Values

    - #### RTP_MEDIA_VP8

          public static final String RTP_MEDIA_VP8

      See Also:
        Constant Field Values

    - #### RTP_MEDIA_VP9

          public static final String RTP_MEDIA_VP9

      See Also:
        Constant Field Values

    - #### 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).

    - #### mediaEncoding

          public final String mediaEncoding

      The RTP media encoding.

  - ### Constructor Detail

    - #### RtpPayloadFormat

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

      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.
        `mediaEncoding` - The RTP media encoding.

  - ### Method Detail

    - #### 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.

    - #### getRawPcmEncodingType

          public static @com.google.android.exoplayer2.C.PcmEncoding int getRawPcmEncodingType​(String mediaEncoding)

      Returns the PCM encoding type for `mediaEncoding`.

    - #### equals

          public boolean equals​(@Nullable
                                Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`