]> git.sesse.net Git - vlc/blobdiff - modules/stream_out/rtsp.c
transcode: set pts on module open
[vlc] / modules / stream_out / rtsp.c
index 783bda46808eae31d449a05f7d87ae9aa46f8d0f..5977f5303f90cb2708340c71c387b50486dcec38 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * rtsp.c: RTSP support for RTP stream output module
  *****************************************************************************
- * Copyright (C) 2003-2004, 2010 the VideoLAN team
+ * Copyright (C) 2003-2004, 2010 VLC authors and VideoLAN
  * Copyright © 2007 Rémi Denis-Courmont
  *
  * $Id$
@@ -9,19 +9,19 @@
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *          Pierre Ynard
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 /*****************************************************************************
@@ -45,7 +45,7 @@
 #include <stdlib.h>
 #include <time.h>
 
-#ifndef WIN32
+#ifndef _WIN32
 # include <locale.h>
 #endif
 #ifdef HAVE_XLOCALE_H
@@ -122,11 +122,10 @@ rtsp_stream_t *RtspSetup( vlc_object_t *owner, vod_media_t *media,
     if( rtsp->host == NULL )
         goto error;
 
-    char *user = var_InheritString(owner, "rtsp-user");
-    char *pwd = var_InheritString(owner, "rtsp-pwd");
+    char *user = var_InheritString(owner, "sout-rtsp-user");
+    char *pwd = var_InheritString(owner, "sout-rtsp-pwd");
 
-    rtsp->url = httpd_UrlNewUnique( rtsp->host, rtsp->psz_path,
-                                    user, pwd, NULL );
+    rtsp->url = httpd_UrlNew( rtsp->host, rtsp->psz_path, user, pwd );
     free(user);
     free(pwd);
     if( rtsp->url == NULL )
@@ -255,10 +254,10 @@ rtsp_stream_id_t *RtspAddId( rtsp_stream_t *rtsp, sout_stream_id_t *sid,
 
     msg_Dbg( rtsp->owner, "RTSP: adding %s", urlbuf );
 
-    char *user = var_InheritString(rtsp->owner, "rtsp-user");
-    char *pwd = var_InheritString(rtsp->owner, "rtsp-pwd");
+    char *user = var_InheritString(rtsp->owner, "sout-rtsp-user");
+    char *pwd = var_InheritString(rtsp->owner, "sout-rtsp-pwd");
 
-    url = id->url = httpd_UrlNewUnique( rtsp->host, urlbuf, user, pwd, NULL );
+    url = id->url = httpd_UrlNew( rtsp->host, urlbuf, user, pwd );
     free( user );
     free( pwd );
     free( urlbuf );
@@ -423,7 +422,7 @@ static void RtspClientAlive( rtsp_session_t *session )
 static int dup_socket(int oldfd)
 {
     int newfd;
-#if !defined(WIN32) || defined(UNDER_CE)
+#ifndef _WIN32
     newfd = vlc_dup(oldfd);
 #else
     WSAPROTOCOL_INFO info;
@@ -1052,16 +1051,17 @@ static int RtspHandler( rtsp_stream_t *rtsp, rtsp_stream_id_t *id,
                     info[infolen - 2] = '\0'; /* remove trailing ", " */
                     httpd_MsgAdd( answer, "RTP-Info", "%s", info );
                 }
+            }
+            vlc_mutex_unlock( &rtsp->lock );
+
+            if (ses != NULL)
+            {
                 if (vod)
                 {
                     vod_play(rtsp->vod_media, psz_session, &start, end);
                     npt = start;
                 }
-            }
-            vlc_mutex_unlock( &rtsp->lock );
 
-            if (ses != NULL)
-            {
                 double f_npt = (double) npt / CLOCK_FREQ;
                 httpd_MsgAdd( answer, "Range", "npt=%f-", f_npt );
             }
@@ -1089,15 +1089,7 @@ static int RtspHandler( rtsp_stream_t *rtsp, rtsp_stream_id_t *id,
             ses = RtspClientGet( rtsp, psz_session );
             if (ses != NULL)
             {
-                if (id == NULL)
-                {
-                    assert(vod);
-                    int64_t npt;
-                    vod_pause(rtsp->vod_media, psz_session, &npt);
-                    double f_npt = (double) npt / CLOCK_FREQ;
-                    httpd_MsgAdd( answer, "Range", "npt=%f-", f_npt );
-                }
-                else /* "Mute" the selected track */
+                if (id != NULL) /* "Mute" the selected track */
                 {
                     bool found = false;
                     for (int i = 0; i < ses->trackc; i++)
@@ -1123,6 +1115,15 @@ static int RtspHandler( rtsp_stream_t *rtsp, rtsp_stream_id_t *id,
                 RtspClientAlive(ses);
             }
             vlc_mutex_unlock( &rtsp->lock );
+
+            if (ses != NULL && id == NULL)
+            {
+                assert(vod);
+                int64_t npt = 0;
+                vod_pause(rtsp->vod_media, psz_session, &npt);
+                double f_npt = (double) npt / CLOCK_FREQ;
+                httpd_MsgAdd( answer, "Range", "npt=%f-", f_npt );
+            }
             break;
         }