summaryrefslogtreecommitdiff
path: root/src/demuxers/demux_real.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/demuxers/demux_real.c')
-rw-r--r--src/demuxers/demux_real.c48
1 files changed, 31 insertions, 17 deletions
diff --git a/src/demuxers/demux_real.c b/src/demuxers/demux_real.c
index 761296ac4..8f6ce0611 100644
--- a/src/demuxers/demux_real.c
+++ b/src/demuxers/demux_real.c
@@ -49,10 +49,10 @@
#define LOG
*/
-#include "xine_internal.h"
-#include "xineutils.h"
-#include "compat.h"
-#include "demux.h"
+#include <xine/xine_internal.h>
+#include <xine/xineutils.h>
+#include <xine/compat.h>
+#include <xine/demux.h>
#include "bswap.h"
#define FOURCC_TAG BE_FOURCC
@@ -232,7 +232,7 @@ static void real_parse_index(demux_real_t *this) {
if(index && entries) {
/* Allocate memory for index */
- *index = xine_xmalloc(entries * sizeof(real_index_entry_t));
+ *index = xine_xcalloc(entries, sizeof(real_index_entry_t));
/* Read index */
for(i = 0; i < entries; i++) {
@@ -275,19 +275,13 @@ static mdpr_t *real_parse_mdpr(const char *data) {
mdpr->duration=_X_BE_32(&data[28]);
mdpr->stream_name_size=data[32];
- mdpr->stream_name=malloc(sizeof(char)*(mdpr->stream_name_size+1));
- memcpy(mdpr->stream_name, &data[33], mdpr->stream_name_size);
- mdpr->stream_name[(int)mdpr->stream_name_size]=0;
+ mdpr->stream_name=xine_memdup0(&data[33], mdpr->stream_name_size);
mdpr->mime_type_size=data[33+mdpr->stream_name_size];
- mdpr->mime_type=malloc(sizeof(char)*(mdpr->mime_type_size+1));
- memcpy(mdpr->mime_type, &data[34+mdpr->stream_name_size], mdpr->mime_type_size);
- mdpr->mime_type[(int)mdpr->mime_type_size]=0;
+ mdpr->mime_type=xine_memdup0(&data[34+mdpr->stream_name_size], mdpr->mime_type_size);
mdpr->type_specific_len=_X_BE_32(&data[34+mdpr->stream_name_size+mdpr->mime_type_size]);
- mdpr->type_specific_data=malloc(sizeof(char)*(mdpr->type_specific_len));
- memcpy(mdpr->type_specific_data,
- &data[38+mdpr->stream_name_size+mdpr->mime_type_size], mdpr->type_specific_len);
+ mdpr->type_specific_data=xine_memdup(&data[38+mdpr->stream_name_size+mdpr->mime_type_size], mdpr->type_specific_len);
lprintf("MDPR: stream number: %i\n", mdpr->stream_number);
lprintf("MDPR: maximal bit rate: %i\n", mdpr->max_bit_rate);
@@ -804,8 +798,27 @@ static int demux_real_parse_references( demux_real_t *this) {
lprintf("received %d bytes [%s]\n", buf_used, buf);
- for(i=0;i<buf_used;i++) {
-
+ if (!strncmp(buf,"http://",7))
+ {
+ i = 0;
+ while (buf[i])
+ {
+ j = i;
+ while (buf[i] && !isspace(buf[i]))
+ ++i; /* skip non-space */
+ len = buf[i];
+ buf[i] = 0;
+ if (strncmp (buf + j, "http://", 7) || (i - j) < 8)
+ break; /* stop at the first non-http reference */
+ lprintf("reference [%s] found\n", buf + j);
+ _x_demux_send_mrl_reference (this->stream, 0, buf + j, NULL, 0, 0);
+ buf[i] = (char) len;
+ while (buf[i] && isspace(buf[i]))
+ ++i; /* skip spaces */
+ }
+ }
+ else for (i = 0; i < buf_used; ++i)
+ {
/* "--stop--" is used to have pnm alternative for old real clients
* new real clients will stop processing the file and thus use
* rtsp protocol.
@@ -1529,7 +1542,8 @@ static int real_check_stream_type(uint8_t *buf, int len)
return 1;
buf[len] = '\0';
- if( strstr(buf,"pnm://") || strstr(buf,"rtsp://") || strstr(buf,"<smil>") )
+ if( strstr(buf,"pnm://") || strstr(buf,"rtsp://") || strstr(buf,"<smil>") ||
+ !strncmp(buf,"http://",7) )
return 2;
return 0;