Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
98f58ea0
Commit
98f58ea0
authored
Sep 11, 2003
by
Clément Stenac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* modules/misc/sap.c: HTTP announcing support
parent
3cb2e73e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
118 additions
and
28 deletions
+118
-28
modules/misc/sap.c
modules/misc/sap.c
+118
-28
No files found.
modules/misc/sap.c
View file @
98f58ea0
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* sap.c : SAP interface module
* sap.c : SAP interface module
*****************************************************************************
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* Copyright (C) 2001 VideoLAN
* $Id: sap.c,v 1.2
1 2003/07/31 23:44:49 fenrir
Exp $
* $Id: sap.c,v 1.2
2 2003/09/11 15:34:16 zorglub
Exp $
*
*
* Authors: Arnaud Schauly <gitan@via.ecp.fr>
* Authors: Arnaud Schauly <gitan@via.ecp.fr>
* Clment Stenac <zorglub@via.ecp.fr>
* Clment Stenac <zorglub@via.ecp.fr>
...
@@ -88,6 +88,7 @@
...
@@ -88,6 +88,7 @@
typedef
struct
media_descr_t
media_descr_t
;
typedef
struct
media_descr_t
media_descr_t
;
typedef
struct
sess_descr_t
sess_descr_t
;
typedef
struct
sess_descr_t
sess_descr_t
;
typedef
struct
attr_descr_t
attr_descr_t
;
static
int
Activate
(
vlc_object_t
*
);
static
int
Activate
(
vlc_object_t
*
);
static
void
Run
(
intf_thread_t
*
p_intf
);
static
void
Run
(
intf_thread_t
*
p_intf
);
...
@@ -115,7 +116,8 @@ static void free_sd( sess_descr_t * );
...
@@ -115,7 +116,8 @@ static void free_sd( sess_descr_t * );
static
int
ismult
(
char
*
);
static
int
ismult
(
char
*
);
/* The struct that contains sdp informations */
/* The struct that contains sdp informations */
struct
sess_descr_t
{
struct
sess_descr_t
{
char
*
psz_version
;
char
*
psz_version
;
char
*
psz_origin
;
char
*
psz_origin
;
char
*
psz_sessionname
;
char
*
psz_sessionname
;
...
@@ -128,15 +130,24 @@ struct sess_descr_t {
...
@@ -128,15 +130,24 @@ struct sess_descr_t {
char
*
psz_attribute
;
char
*
psz_attribute
;
char
*
psz_connection
;
char
*
psz_connection
;
int
i_media
;
int
i_media
;
int
i_attributes
;
media_descr_t
**
pp_media
;
media_descr_t
**
pp_media
;
attr_descr_t
**
pp_attributes
;
};
};
/* All this informations are not useful yet. */
/* All this informations are not useful yet. */
struct
media_descr_t
{
struct
media_descr_t
{
char
*
psz_medianame
;
char
*
psz_medianame
;
char
*
psz_mediaconnection
;
char
*
psz_mediaconnection
;
};
};
struct
attr_descr_t
{
char
*
psz_field
;
char
*
psz_value
;
};
/*****************************************************************************
/*****************************************************************************
* Module descriptor
* Module descriptor
*****************************************************************************/
*****************************************************************************/
...
@@ -331,7 +342,9 @@ static int sess_toitem( intf_thread_t * p_intf, sess_descr_t * p_sd )
...
@@ -331,7 +342,9 @@ static int sess_toitem( intf_thread_t * p_intf, sess_descr_t * p_sd )
char
*
psz_port
;
char
*
psz_port
;
char
*
psz_uri_default
;
char
*
psz_uri_default
;
int
i_multicast
;
int
i_multicast
;
int
i_count
;
int
i_count
,
i
;
vlc_bool_t
b_http
=
VLC_FALSE
;
char
*
psz_http_path
=
NULL
;
playlist_t
*
p_playlist
;
playlist_t
*
p_playlist
;
psz_uri_default
=
NULL
;
psz_uri_default
=
NULL
;
...
@@ -386,12 +399,29 @@ static int sess_toitem( intf_thread_t * p_intf, sess_descr_t * p_sd )
...
@@ -386,12 +399,29 @@ static int sess_toitem( intf_thread_t * p_intf, sess_descr_t * p_sd )
return
0
;
return
0
;
}
}
for
(
i
=
0
;
i
<
p_sd
->
i_attributes
;
i
++
)
{
if
(
!
strcasecmp
(
p_sd
->
pp_attributes
[
i
]
->
psz_field
,
"type"
)
&&
strstr
(
p_sd
->
pp_attributes
[
i
]
->
psz_value
,
"http"
)
)
{
b_http
=
VLC_TRUE
;
}
if
(
!
strcasecmp
(
p_sd
->
pp_attributes
[
i
]
->
psz_field
,
"http-path"
))
{
psz_http_path
=
strdup
(
p_sd
->
pp_attributes
[
i
]
->
psz_value
);
}
}
/* Filling p_item->psz_uri */
/* Filling p_item->psz_uri */
if
(
b_http
==
VLC_FALSE
)
{
i_multicast
=
ismult
(
psz_uri
);
i_multicast
=
ismult
(
psz_uri
);
p_item
->
psz_uri
=
malloc
(
strlen
(
psz_proto
)
+
strlen
(
psz_uri
)
+
p_item
->
psz_uri
=
malloc
(
strlen
(
psz_proto
)
+
strlen
(
psz_uri
)
+
strlen
(
psz_port
)
+
5
+
i_multicast
);
strlen
(
psz_port
)
+
5
+
i_multicast
);
if
(
p_item
->
psz_uri
==
NULL
)
if
(
p_item
->
psz_uri
==
NULL
)
{
{
msg_Err
(
p_intf
,
"Not enough memory"
);
msg_Err
(
p_intf
,
"Not enough memory"
);
...
@@ -409,7 +439,26 @@ static int sess_toitem( intf_thread_t * p_intf, sess_descr_t * p_sd )
...
@@ -409,7 +439,26 @@ static int sess_toitem( intf_thread_t * p_intf, sess_descr_t * p_sd )
sprintf
(
p_item
->
psz_uri
,
"%s://%s:%s"
,
psz_proto
,
sprintf
(
p_item
->
psz_uri
,
"%s://%s:%s"
,
psz_proto
,
psz_uri
,
psz_port
);
psz_uri
,
psz_port
);
}
}
}
else
{
if
(
psz_http_path
==
NULL
)
psz_http_path
=
strdup
(
"/"
);
p_item
->
psz_uri
=
malloc
(
strlen
(
psz_proto
)
+
strlen
(
psz_uri
)
+
strlen
(
psz_port
)
+
3
+
strlen
(
psz_http_path
)
);
if
(
p_item
->
psz_uri
==
NULL
)
{
msg_Err
(
p_intf
,
"Not enough memory"
);
free
(
p_item
);
return
0
;
}
sprintf
(
p_item
->
psz_uri
,
"%s://%s:%s%s"
,
psz_proto
,
psz_uri
,
psz_port
,
psz_http_path
);
}
/* Enqueueing p_item in the playlist */
/* Enqueueing p_item in the playlist */
if
(
p_item
)
if
(
p_item
)
...
@@ -422,10 +471,10 @@ static int sess_toitem( intf_thread_t * p_intf, sess_descr_t * p_sd )
...
@@ -422,10 +471,10 @@ static int sess_toitem( intf_thread_t * p_intf, sess_descr_t * p_sd )
vlc_object_release
(
p_playlist
);
vlc_object_release
(
p_playlist
);
}
}
if
(
psz_http_path
)
free
(
psz_http_path
);
}
}
return
1
;
return
1
;
}
}
...
@@ -582,7 +631,9 @@ static int packet_handle( intf_thread_t * p_intf, char *p_packet, int i_len )
...
@@ -582,7 +631,9 @@ static int packet_handle( intf_thread_t * p_intf, char *p_packet, int i_len )
static
sess_descr_t
*
parse_sdp
(
intf_thread_t
*
p_intf
,
char
*
p_packet
)
static
sess_descr_t
*
parse_sdp
(
intf_thread_t
*
p_intf
,
char
*
p_packet
)
{
{
sess_descr_t
*
sd
;
sess_descr_t
*
sd
;
char
*
psz_eof
;
unsigned
int
i
;
// According to RFC 2327, the first bytes should be exactly "v="
// According to RFC 2327, the first bytes should be exactly "v="
if
((
p_packet
[
0
]
!=
'v'
)
||
(
p_packet
[
1
]
!=
'='
))
if
((
p_packet
[
0
]
!=
'v'
)
||
(
p_packet
[
1
]
!=
'='
))
{
{
...
@@ -597,6 +648,7 @@ static sess_descr_t * parse_sdp( intf_thread_t * p_intf, char *p_packet )
...
@@ -597,6 +648,7 @@ static sess_descr_t * parse_sdp( intf_thread_t * p_intf, char *p_packet )
}
}
sd
->
pp_media
=
NULL
;
sd
->
pp_media
=
NULL
;
sd
->
pp_attributes
=
NULL
;
sd
->
psz_origin
=
NULL
;
sd
->
psz_origin
=
NULL
;
sd
->
psz_sessionname
=
NULL
;
sd
->
psz_sessionname
=
NULL
;
sd
->
psz_information
=
NULL
;
sd
->
psz_information
=
NULL
;
...
@@ -608,7 +660,9 @@ static sess_descr_t * parse_sdp( intf_thread_t * p_intf, char *p_packet )
...
@@ -608,7 +660,9 @@ static sess_descr_t * parse_sdp( intf_thread_t * p_intf, char *p_packet )
sd
->
psz_attribute
=
NULL
;
sd
->
psz_attribute
=
NULL
;
sd
->
psz_connection
=
NULL
;
sd
->
psz_connection
=
NULL
;
sd
->
i_media
=
0
;
sd
->
i_media
=
0
;
sd
->
i_attributes
=
0
;
while
(
*
p_packet
!=
'\0'
)
while
(
*
p_packet
!=
'\0'
)
{
{
...
@@ -665,7 +719,36 @@ static sess_descr_t * parse_sdp( intf_thread_t * p_intf, char *p_packet )
...
@@ -665,7 +719,36 @@ static sess_descr_t * parse_sdp( intf_thread_t * p_intf, char *p_packet )
FIELD_COPY
(
sd
->
psz_repeat
);
FIELD_COPY
(
sd
->
psz_repeat
);
break
;
break
;
case
(
'a'
):
case
(
'a'
):
FIELD_COPY
(
sd
->
psz_attribute
);
if
(
sd
->
pp_attributes
)
{
sd
->
pp_attributes
=
realloc
(
sd
->
pp_attributes
,
sizeof
(
attr_descr_t
)
*
(
sd
->
i_attributes
+
1
)
);
}
else
{
sd
->
pp_attributes
=
malloc
(
sizeof
(
void
*
)
);
}
sd
->
pp_attributes
[
sd
->
i_attributes
]
=
malloc
(
sizeof
(
attr_descr_t
)
);
p_packet
+=
2
;
psz_eof
=
strchr
(
p_packet
,
':'
);
if
(
psz_eof
)
*
psz_eof
=
'\0'
;
sd
->
pp_attributes
[
sd
->
i_attributes
]
->
psz_field
=
strdup
(
p_packet
);
sd
->
pp_attributes
[
sd
->
i_attributes
]
->
psz_value
=
strdup
(
++
psz_eof
);
for
(
i
=
0
;
i
<
strlen
(
sd
->
pp_attributes
[
sd
->
i_attributes
]
->
psz_value
)
;
i
++
)
{
if
(
sd
->
pp_attributes
[
sd
->
i_attributes
]
->
psz_value
[
i
]
==
'\n'
)
sd
->
pp_attributes
[
sd
->
i_attributes
]
->
psz_value
[
i
]
=
0
;
}
sd
->
i_attributes
++
;
break
;
break
;
case
(
'm'
):
case
(
'm'
):
...
@@ -680,6 +763,7 @@ static sess_descr_t * parse_sdp( intf_thread_t * p_intf, char *p_packet )
...
@@ -680,6 +763,7 @@ static sess_descr_t * parse_sdp( intf_thread_t * p_intf, char *p_packet )
sd
->
pp_media
=
malloc
(
sizeof
(
void
*
)
);
sd
->
pp_media
=
malloc
(
sizeof
(
void
*
)
);
}
}
sd
->
pp_media
[
sd
->
i_media
]
=
sd
->
pp_media
[
sd
->
i_media
]
=
malloc
(
sizeof
(
media_descr_t
)
);
malloc
(
sizeof
(
media_descr_t
)
);
sd
->
pp_media
[
sd
->
i_media
]
->
psz_medianame
=
NULL
;
sd
->
pp_media
[
sd
->
i_media
]
->
psz_medianame
=
NULL
;
...
@@ -733,6 +817,12 @@ static void free_sd( sess_descr_t * p_sd )
...
@@ -733,6 +817,12 @@ static void free_sd( sess_descr_t * p_sd )
FREE
(
p_sd
->
pp_media
[
i
]
->
psz_medianame
);
FREE
(
p_sd
->
pp_media
[
i
]
->
psz_medianame
);
FREE
(
p_sd
->
pp_media
[
i
]
->
psz_mediaconnection
);
FREE
(
p_sd
->
pp_media
[
i
]
->
psz_mediaconnection
);
}
}
for
(
i
=
0
;
i
<
p_sd
->
i_attributes
;
i
++
)
{
FREE
(
p_sd
->
pp_attributes
[
i
]
->
psz_field
);
FREE
(
p_sd
->
pp_attributes
[
i
]
->
psz_value
);
}
FREE
(
p_sd
->
pp_attributes
);
FREE
(
p_sd
->
pp_media
);
FREE
(
p_sd
->
pp_media
);
free
(
p_sd
);
free
(
p_sd
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment