]> git.sesse.net Git - vlc/blobdiff - modules/misc/rtsp.c
Replaces xml special chars in image url
[vlc] / modules / misc / rtsp.c
index 99cd4e5b32d8936e43ea283da64f0d6effc953a7..884d18304c727b3afe7a3d4227a618beeee78ad3 100644 (file)
@@ -25,8 +25,6 @@
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
-#define _GNU_SOURCE
-#include <stdlib.h>
 
 #include <errno.h>
 
@@ -40,6 +38,7 @@
 #include "vlc_url.h"
 #include <vlc_network.h>
 #include <vlc_charset.h>
+#include <vlc_strings.h>
 
 /*****************************************************************************
  * Module descriptor
@@ -48,11 +47,10 @@ static int  Open ( vlc_object_t * );
 static void Close( vlc_object_t * );
 
 #define HOST_TEXT N_( "RTSP host address" )
-/// \bug [String] extra space
 #define HOST_LONGTEXT N_( \
     "This defines the address, port and path the RTSP VOD server will listen " \
     "on.\nSyntax is address:port/path. The default is to listen on all "\
-    "interfaces (address 0.0.0.0), on port 554, with no path.\n To listen " \
+    "interfaces (address 0.0.0.0), on port 554, with no path.\nTo listen " \
     "only on the local interface, use \"localhost\" as address." )
 
 #define THROTLE_TEXT N_( "Maximum number of connections" )
@@ -324,7 +322,7 @@ static void Close( vlc_object_t * p_this )
     vod_sys_t *p_sys = p_vod->p_sys;
 
     /* Stop command thread */
-    p_vod->b_die = VLC_TRUE;
+    vlc_object_kill( p_vod );
     CommandPush( p_vod, RTSP_CMD_TYPE_NONE, NULL, NULL, 0.0, NULL );
     vlc_thread_join( p_vod );
 
@@ -424,7 +422,7 @@ static vod_media_t *MediaNew( vod_t *p_vod, const char *psz_name,
 
     p_media->i_sdp_id = mdate();
     p_media->i_sdp_version = 1;
-    p_media->i_length = p_item->i_duration;
+    p_media->i_length = input_item_GetDuration( p_item );
 
     vlc_mutex_lock( &p_item->lock );
     msg_Dbg( p_vod, "media has %i declared ES", p_item->i_es );
@@ -948,7 +946,6 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
                 if( httpd_ClientIP( cl, ip ) == NULL )
                 {
                     answer->i_status = 500;
-                    answer->psz_status = strdup( "Internal server error" );
                     answer->i_body = 0;
                     answer->p_body = NULL;
                     break;
@@ -965,7 +962,6 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
                         ( p_vod->p_sys->i_connections >= p_vod->p_sys->i_throttle_users ) )
                     {
                         answer->i_status = 503;
-                        answer->psz_status = strdup( "Too many connections" );
                         answer->i_body = 0;
                         answer->p_body = NULL;
                         break;
@@ -977,7 +973,6 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
                     if( !p_rtsp )
                     {
                         answer->i_status = 454;
-                        answer->psz_status = strdup( "Unknown session id" );
                         answer->i_body = 0;
                         answer->p_body = NULL;
                         break;
@@ -989,7 +984,6 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
                     if( !p_rtsp )
                     {
                         answer->i_status = 454;
-                        answer->psz_status = strdup( "Unknown session id" );
                         answer->i_body = 0;
                         answer->p_body = NULL;
                         break;
@@ -997,7 +991,6 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
                 }
 
                 answer->i_status = 200;
-                answer->psz_status = strdup( "OK" );
                 answer->i_body = 0;
                 answer->p_body = NULL;
 
@@ -1021,7 +1014,6 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
             else /* TODO  strstr( psz_transport, "interleaved" ) ) */
             {
                 answer->i_status = 461;
-                answer->psz_status = strdup( "Unsupported Transport" );
                 answer->i_body = 0;
                 answer->p_body = NULL;
             }
@@ -1040,7 +1032,6 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
             if( !psz_playnow )
             {
                 answer->i_status = 200;
-                answer->psz_status = strdup( "OK" );
                 answer->i_body = 0;
                 answer->p_body = NULL;
             }
@@ -1053,7 +1044,6 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
             if( !p_rtsp )
             {
                 answer->i_status = 500;
-                answer->psz_status = strdup( "Internal server error" );
                 answer->i_body = 0;
                 answer->p_body = NULL;
                 break;
@@ -1163,7 +1153,6 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
             if( psz_sdp != NULL )
             {
                 answer->i_status = 200;
-                answer->psz_status = strdup( "OK" );
                 httpd_MsgAdd( answer, "Content-type",  "%s", "application/sdp" );
 
                 answer->p_body = (uint8_t *)psz_sdp;
@@ -1172,7 +1161,6 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
             else
             {
                 answer->i_status = 500;
-                answer->psz_status = strdup( "Internal server error" );
                 answer->p_body = NULL;
                 answer->i_body = 0;
             }
@@ -1190,7 +1178,6 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
             p_rtsp->b_paused = VLC_TRUE;
 
             answer->i_status = 200;
-            answer->psz_status = strdup( "OK" );
             answer->i_body = 0;
             answer->p_body = NULL;
             break;
@@ -1198,7 +1185,6 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
         case HTTPD_MSG_TEARDOWN:
             /* for now only multicast so easy again */
             answer->i_status = 200;
-            answer->psz_status = strdup( "OK" );
             answer->i_body = 0;
             answer->p_body = NULL;
 
@@ -1214,7 +1200,6 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
 
         case HTTPD_MSG_GETPARAMETER:
             answer->i_status = 200;
-            answer->psz_status = strdup( "OK" );
             answer->i_body = 0;
             answer->p_body = NULL;
             break;
@@ -1287,7 +1272,6 @@ static int RtspCallbackES( httpd_callback_sys_t *p_args, httpd_client_t *cl,
                 if( httpd_ClientIP( cl, ip ) == NULL )
                 {
                     answer->i_status = 500;
-                    answer->psz_status = strdup( "Internal server error" );
                     answer->i_body = 0;
                     answer->p_body = NULL;
                     break;
@@ -1304,7 +1288,6 @@ static int RtspCallbackES( httpd_callback_sys_t *p_args, httpd_client_t *cl,
                         ( p_vod->p_sys->i_connections >= p_vod->p_sys->i_throttle_users ) )
                     {
                         answer->i_status = 503;
-                        answer->psz_status = strdup( "Too many connections" );
                         answer->i_body = 0;
                         answer->p_body = NULL;
                         break;
@@ -1320,7 +1303,6 @@ static int RtspCallbackES( httpd_callback_sys_t *p_args, httpd_client_t *cl,
                     if( !p_rtsp )
                     {
                         answer->i_status = 454;
-                        answer->psz_status = strdup( "Unknown session id" );
                         answer->i_body = 0;
                         answer->p_body = NULL;
                         break;
@@ -1331,7 +1313,6 @@ static int RtspCallbackES( httpd_callback_sys_t *p_args, httpd_client_t *cl,
                 if( !p_rtsp_es )
                 {
                     answer->i_status = 500;
-                    answer->psz_status = strdup( "Internal server error" );
                     answer->i_body = 0;
                     answer->p_body = NULL;
                     break;
@@ -1342,7 +1323,6 @@ static int RtspCallbackES( httpd_callback_sys_t *p_args, httpd_client_t *cl,
                 TAB_APPEND( p_rtsp->i_es, p_rtsp->es, p_rtsp_es );
 
                 answer->i_status = 200;
-                answer->psz_status = strdup( "OK" );
                 answer->i_body = 0;
                 answer->p_body = NULL;
 
@@ -1368,7 +1348,6 @@ static int RtspCallbackES( httpd_callback_sys_t *p_args, httpd_client_t *cl,
             else /* TODO  strstr( psz_transport, "interleaved" ) ) */
             {
                 answer->i_status = 461;
-                answer->psz_status = strdup( "Unsupported Transport" );
                 answer->i_body = 0;
                 answer->p_body = NULL;
             }
@@ -1407,7 +1386,6 @@ static int RtspCallbackES( httpd_callback_sys_t *p_args, httpd_client_t *cl,
             if( !psz_playnow )
             {
                 answer->i_status = 200;
-                answer->psz_status = strdup( "OK" );
                 answer->i_body = 0;
                 answer->p_body = NULL;
             }
@@ -1415,7 +1393,6 @@ static int RtspCallbackES( httpd_callback_sys_t *p_args, httpd_client_t *cl,
 
         case HTTPD_MSG_TEARDOWN:
             answer->i_status = 200;
-            answer->psz_status = strdup( "OK" );
             answer->i_body = 0;
             answer->p_body = NULL;
 
@@ -1455,7 +1432,6 @@ static int RtspCallbackES( httpd_callback_sys_t *p_args, httpd_client_t *cl,
             p_rtsp->b_paused = VLC_TRUE;
 
             answer->i_status = 200;
-            answer->psz_status = strdup( "OK" );
             answer->i_body = 0;
             answer->p_body = NULL;
             break;