gst_plugins_base/gst-libs/gst/rtsp/gstrtspurl.c
author Pat Downey <patd@symbian.org>
Wed, 01 Sep 2010 12:16:41 +0100
branchRCL_3
changeset 30 7e817e7e631c
parent 29 567bb019e3e3
permissions -rw-r--r--
Revert incorrect RCL_3 drop: Revision: 201010 Kit: 201035
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     1
/* GStreamer
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     2
 * Copyright (C) <2005,2006> Wim Taymans <wim@fluendo.com>
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     3
 *
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     4
 * This library is free software; you can redistribute it and/or
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     5
 * modify it under the terms of the GNU Library General Public
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     6
 * License as published by the Free Software Foundation; either
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     7
 * version 2 of the License, or (at your option) any later version.
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     8
 *
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     9
 * This library is distributed in the hope that it will be useful,
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    12
 * Library General Public License for more details.
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    13
 *
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    14
 * You should have received a copy of the GNU Library General Public
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    15
 * License along with this library; if not, write to the
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    16
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    17
 * Boston, MA 02111-1307, USA.
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    18
 */
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    19
/*
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    20
 * Unless otherwise indicated, Source Code is licensed under MIT license.
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    21
 * See further explanation attached in License Statement (distributed in the file
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    22
 * LICENSE).
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    23
 *
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    24
 * Permission is hereby granted, free of charge, to any person obtaining a copy of
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    25
 * this software and associated documentation files (the "Software"), to deal in
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    26
 * the Software without restriction, including without limitation the rights to
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    27
 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    28
 * of the Software, and to permit persons to whom the Software is furnished to do
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    29
 * so, subject to the following conditions:
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    30
 *
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    31
 * The above copyright notice and this permission notice shall be included in all
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    32
 * copies or substantial portions of the Software.
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    33
 *
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    34
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    35
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    36
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    37
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    38
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    39
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    40
 * SOFTWARE.
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    41
 */
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    42
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    43
/**
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    44
 * SECTION:gstrtspurl
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    45
 * @short_description: handling RTSP urls
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    46
 *  
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    47
 * <refsect2>
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    48
 * <para>
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    49
 * Provides helper functions to handle RTSP urls.
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    50
 * </para>
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    51
 * </refsect2>
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    52
 *  
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    53
 * Last reviewed on 2007-07-25 (0.10.14)
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    54
 */
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    55
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    56
#include <stdlib.h>
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    57
#include <string.h>
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    58
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    59
#include "gstrtspurl.h"
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    60
30
7e817e7e631c Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 29
diff changeset
    61
#define RTSP_PROTO      "rtsp://"
7e817e7e631c Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 29
diff changeset
    62
#define RTSP_PROTO_LEN  7
7e817e7e631c Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 29
diff changeset
    63
#define RTSPU_PROTO     "rtspu://"
7e817e7e631c Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 29
diff changeset
    64
#define RTSPU_PROTO_LEN 8
7e817e7e631c Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 29
diff changeset
    65
#define RTSPT_PROTO     "rtspt://"
7e817e7e631c Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 29
diff changeset
    66
#define RTSPT_PROTO_LEN 8
0
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    67
30
7e817e7e631c Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 29
diff changeset
    68
/* format is rtsp[u]://[user:passwd@]host[:port]/abspath[?query] */
0
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    69
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    70
/**
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    71
 * gst_rtsp_url_parse:
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    72
 * @urlstr: the url string to parse
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    73
 * @url: location to hold the result.
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    74
 *
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    75
 * Parse the RTSP @urlstr into a newly allocated #GstRTSPUrl. Free after usage
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    76
 * with gst_rtsp_url_free().
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    77
 *
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    78
 * Returns: a #GstRTSPResult.
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    79
 */
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    80
GstRTSPResult
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    81
gst_rtsp_url_parse (const gchar * urlstr, GstRTSPUrl ** url)
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    82
{
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    83
  GstRTSPUrl *res;
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    84
  gchar *p, *delim, *at, *col;
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    85
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    86
  g_return_val_if_fail (urlstr != NULL, GST_RTSP_EINVAL);
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    87
  g_return_val_if_fail (url != NULL, GST_RTSP_EINVAL);
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    88
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    89
  res = g_new0 (GstRTSPUrl, 1);
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    90
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    91
  p = (gchar *) urlstr;
30
7e817e7e631c Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 29
diff changeset
    92
  if (g_str_has_prefix (p, RTSP_PROTO)) {
7e817e7e631c Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 29
diff changeset
    93
    res->transports =
7e817e7e631c Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 29
diff changeset
    94
        GST_RTSP_LOWER_TRANS_TCP | GST_RTSP_LOWER_TRANS_UDP |
7e817e7e631c Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 29
diff changeset
    95
        GST_RTSP_LOWER_TRANS_UDP_MCAST;
7e817e7e631c Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 29
diff changeset
    96
    p += RTSP_PROTO_LEN;
7e817e7e631c Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 29
diff changeset
    97
  } else if (g_str_has_prefix (p, RTSPU_PROTO)) {
7e817e7e631c Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 29
diff changeset
    98
    res->transports = GST_RTSP_LOWER_TRANS_UDP | GST_RTSP_LOWER_TRANS_UDP_MCAST;
7e817e7e631c Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 29
diff changeset
    99
    p += RTSPU_PROTO_LEN;
7e817e7e631c Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 29
diff changeset
   100
  } else if (g_str_has_prefix (p, RTSPT_PROTO)) {
7e817e7e631c Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 29
diff changeset
   101
    res->transports = GST_RTSP_LOWER_TRANS_TCP;
7e817e7e631c Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 29
diff changeset
   102
    p += RTSPT_PROTO_LEN;
7e817e7e631c Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 29
diff changeset
   103
  } else
0
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   104
    goto invalid;
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   105
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   106
  delim = strpbrk (p, "/?");
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   107
  at = strchr (p, '@');
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   108
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   109
  if (at && delim && at > delim)
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   110
    at = NULL;
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   111
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   112
  if (at) {
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   113
    col = strchr (p, ':');
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   114
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   115
    /* must have a ':' and it must be before the '@' */
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   116
    if (col == NULL || col > at)
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   117
      goto invalid;
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   118
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   119
    res->user = g_strndup (p, col - p);
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   120
    col++;
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   121
    res->passwd = g_strndup (col, at - col);
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   122
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   123
    /* move to host */
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   124
    p = at + 1;
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   125
  }
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   126
30
7e817e7e631c Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 29
diff changeset
   127
  col = strchr (p, ':');
7e817e7e631c Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 29
diff changeset
   128
  /* we have a ':' and a delimiter but the ':' is after the delimiter, it's
7e817e7e631c Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 29
diff changeset
   129
   * not really part of the hostname */
7e817e7e631c Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 29
diff changeset
   130
  if (col && delim && col >= delim)
7e817e7e631c Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 29
diff changeset
   131
    col = NULL;
0
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   132
30
7e817e7e631c Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 29
diff changeset
   133
  if (col) {
7e817e7e631c Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 29
diff changeset
   134
    res->host = g_strndup (p, col - p);
7e817e7e631c Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 29
diff changeset
   135
    p = col + 1;
7e817e7e631c Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 29
diff changeset
   136
    res->port = strtoul (p, (char **) &p, 10);
7e817e7e631c Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 29
diff changeset
   137
    if (delim)
7e817e7e631c Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 29
diff changeset
   138
      p = delim;
7e817e7e631c Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 29
diff changeset
   139
  } else {
7e817e7e631c Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 29
diff changeset
   140
    /* no port specified, set to 0. _get_port() will return the default port. */
7e817e7e631c Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 29
diff changeset
   141
    res->port = 0;
7e817e7e631c Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 29
diff changeset
   142
    if (!delim) {
7e817e7e631c Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 29
diff changeset
   143
      res->host = g_strdup (p);
7e817e7e631c Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 29
diff changeset
   144
      p = NULL;
0
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   145
    } else {
30
7e817e7e631c Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 29
diff changeset
   146
      res->host = g_strndup (p, delim - p);
7e817e7e631c Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 29
diff changeset
   147
      p = delim;
0
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   148
    }
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   149
  }
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   150
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   151
  if (p && *p == '/') {
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   152
    delim = strchr (p, '?');
30
7e817e7e631c Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 29
diff changeset
   153
    if (!delim) {
0
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   154
      res->abspath = g_strdup (p);
30
7e817e7e631c Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 29
diff changeset
   155
      p = NULL;
7e817e7e631c Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 29
diff changeset
   156
    } else {
0
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   157
      res->abspath = g_strndup (p, delim - p);
30
7e817e7e631c Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 29
diff changeset
   158
      p = delim;
7e817e7e631c Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 29
diff changeset
   159
    }
0
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   160
  } else {
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   161
    res->abspath = g_strdup ("/");
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   162
  }
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   163
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   164
  if (p && *p == '?')
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   165
    res->query = g_strdup (p + 1);
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   166
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   167
  *url = res;
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   168
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   169
  return GST_RTSP_OK;
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   170
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   171
  /* ERRORS */
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   172
invalid:
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   173
  {
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   174
    gst_rtsp_url_free (res);
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   175
    return GST_RTSP_EINVAL;
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   176
  }
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   177
}
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   178
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   179
/**
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   180
 * gst_rtsp_url_free:
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   181
 * @url: a #GstRTSPUrl
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   182
 *
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   183
 * Free the memory used by @url.
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   184
 */
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   185
void
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   186
gst_rtsp_url_free (GstRTSPUrl * url)
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   187
{
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   188
  if (url == NULL)
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   189
    return;
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   190
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   191
  g_free (url->user);
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   192
  g_free (url->passwd);
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   193
  g_free (url->host);
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   194
  g_free (url->abspath);
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   195
  g_free (url->query);
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   196
  g_free (url);
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   197
}
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   198
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   199
/**
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   200
 * gst_rtsp_url_set_port:
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   201
 * @url: a #GstRTSPUrl
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   202
 * @port: the port
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   203
 *
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   204
 * Set the port number in @url to @port.
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   205
 *
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   206
 * Returns: #GST_RTSP_OK.
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   207
 */
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   208
GstRTSPResult
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   209
gst_rtsp_url_set_port (GstRTSPUrl * url, guint16 port)
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   210
{
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   211
  g_return_val_if_fail (url != NULL, GST_RTSP_EINVAL);
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   212
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   213
  url->port = port;
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   214
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   215
  return GST_RTSP_OK;
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   216
}
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   217
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   218
/**
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   219
 * gst_rtsp_url_get_port:
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   220
 * @url: a #GstRTSPUrl
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   221
 * @port: location to hold the port
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   222
 *
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   223
 * Get the port number of @url.
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   224
 *
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   225
 * Returns: #GST_RTSP_OK.
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   226
 */
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   227
GstRTSPResult
30
7e817e7e631c Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 29
diff changeset
   228
gst_rtsp_url_get_port (GstRTSPUrl * url, guint16 * port)
0
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   229
{
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   230
  g_return_val_if_fail (url != NULL, GST_RTSP_EINVAL);
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   231
  g_return_val_if_fail (port != NULL, GST_RTSP_EINVAL);
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   232
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   233
  /* if a port was specified, use that else use the default port. */
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   234
  if (url->port != 0)
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   235
    *port = url->port;
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   236
  else
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   237
    *port = GST_RTSP_DEFAULT_PORT;
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   238
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   239
  return GST_RTSP_OK;
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   240
}
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   241
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   242
/**
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   243
 * gst_rtsp_url_get_request_uri:
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   244
 * @url: a #GstRTSPUrl
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   245
 *
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   246
 * Get a newly allocated string describing the request URI for @url. 
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   247
 *
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   248
 * Returns: a string with the request URI. g_free() after usage.
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   249
 */
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   250
gchar *
30
7e817e7e631c Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 29
diff changeset
   251
gst_rtsp_url_get_request_uri (GstRTSPUrl * url)
0
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   252
{
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   253
  gchar *uri;
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   254
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   255
  g_return_val_if_fail (url != NULL, NULL);
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   256
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   257
  if (url->port != 0) {
30
7e817e7e631c Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 29
diff changeset
   258
    uri = g_strdup_printf ("rtsp://%s:%u%s%s%s", url->host, url->port,
7e817e7e631c Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 29
diff changeset
   259
        url->abspath, url->query ? "?" : "", url->query ? url->query : "");
0
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   260
  } else {
30
7e817e7e631c Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 29
diff changeset
   261
    uri = g_strdup_printf ("rtsp://%s%s%s%s", url->host, url->abspath,
7e817e7e631c Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 29
diff changeset
   262
        url->query ? "?" : "", url->query ? url->query : "");
0
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   263
  }
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   264
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   265
  return uri;
0e761a78d257 Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   266
}