/*
 * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
 *
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */
package org.jitsi.service.neomedia;

/**
 * The <tt>MediaType</tt> enumeration contains a list of media types
 * currently known to and handled by the <tt>MediaService</tt>.
 *
 * @author Emil Ivov
 */
public enum MediaType
{
    /**
     * Represents an AUDIO media type.
     */
    AUDIO("audio"),

    /**
     * Represents a VIDEO media type.
     */
    VIDEO("video");

    /**
     * The name of this <tt>MediaType</tt>.
     */
    private final String mediaTypeName;

    /**
     * Creates a <tt>MediaType</tt> instance with the specified name.
     *
     * @param mediaTypeName the name of the <tt>MediaType</tt> we'd like to
     * create.
     */
    private MediaType(String mediaTypeName)
    {
        this.mediaTypeName = mediaTypeName;
    }

    /**
     * Returns the name of this MediaType (e.g. "audio" or "video"). The name
     * returned by this method is meant for use by session description
     * mechanisms such as SIP/SDP or XMPP/Jingle.
     *
     * @return the name of this MediaType (e.g. "audio" or "video").
     */
    @Override
    public String toString()
    {
        return mediaTypeName;
    }

    /**
     * Returns a <tt>MediaType</tt> value corresponding to the specified
     * <tt>mediaTypeName</tt> or in other words <tt>MediaType.AUDIO</tt> for
     * "audio" and <tt>MediaType.VIDEO</tt> for "video".
     *
     * @param mediaTypeName the name that we'd like to parse.
     * @return a <tt>MediaType</tt> value corresponding to the specified
     * <tt>mediaTypeName</tt>.
     *
     * @throws IllegalArgumentException in case <tt>mediaTypeName</tt> is not a
     * valid or currently supported media type.
     */
    public static MediaType parseString(String mediaTypeName)
        throws IllegalArgumentException
    {
        if(AUDIO.toString().equals(mediaTypeName))
            return AUDIO;

        if(VIDEO.toString().equals(mediaTypeName))
            return VIDEO;

        throw new IllegalArgumentException(
            mediaTypeName + " is not a currently supported MediaType");
    }
}

@@ -443,16 +443,105 @@
 dio%22),%0A%0A
+    /**%0A     * Represents a (chat-) MESSAGE media type.%0A     */%0A    MESSAGE(%22message%22),%0A%0A
     /**%0A
@@ -570,32 +570,32 @@
 DEO media type.%0A
-
      */%0A    VIDE
@@ -1048,32 +1048,43 @@
 pe (e.g. %22audio%22
+, %22message%22
  or %22video%22). Th
@@ -1080,16 +1080,23 @@
 video%22).
+%0A     *
  The nam
@@ -1096,23 +1096,16 @@
 The name
-%0A     *
  returne
@@ -1518,88 +1518,61 @@
 %3Ctt%3E
-MediaType.AUDIO%3C/tt%3E for%0A     * %22audio%22 and %3Ctt%3EMediaType.VIDEO%3C/tt%3E for %22video%22
+AUDIO%3C/tt%3E, %3Ctt%3EMESSAGE%3C/tt%3E%0A     * or %3Ctt%3EVIDEO%3C/tt%3E
 .%0A  
@@ -2036,32 +2036,32 @@
 mediaTypeName))%0A
-
             retu
@@ -2067,24 +2067,106 @@
 urn AUDIO;%0A%0A
+        if(MESSAGE.toString().equals(mediaTypeName))%0A            return MESSAGE;%0A%0A
         if(V

Support "message" media type.