Update of /cvsroot/mplayerplug-in/mplayerplug-in/Source
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv625/Source
Modified Files:
plugin-list.cpp plugin-setup.h plugin-support.cpp
plugin-threads.cpp plugin.cpp
Log Message:
Fixed javascript filename method
Index: plugin-list.cpp
===================================================================
RCS file: /cvsroot/mplayerplug-in/mplayerplug-in/Source/plugin-list.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** plugin-list.cpp 12 Mar 2004 15:44:10 -0000 1.24
--- plugin-list.cpp 12 Mar 2004 17:12:46 -0000 1.25
***************
*** 221,259 ****
Node *node = NULL;
Node *n;
- char tmpdir[1024];
- char *tmp;
char *filename;
char localitem[1024];
! if (!isMms(item)) {
! if (strncasecmp(item, "http", 4) != 0) {
!
! if (item[0] != '/') {
! strlcpy(tmpdir, item, sizeof(tmpdir)); // reuse the buffer
! if (instance->baseurl != NULL) {
! strlcpy(localitem, instance->baseurl, 1024);
! }
! strlcat(localitem, tmpdir, 1024);
! } else {
! if (instance->hostname != NULL) {
! snprintf(tmpdir, sizeof(tmpdir), "http://%s/%s",
! instance->hostname, item);
! strlcpy(localitem, tmpdir, 1024);
! }
! }
!
! } else {
! // if :80 is in the URL, cut it out
! strlcpy(localitem, item, sizeof(localitem));
! tmp = strstr(localitem, ":80");
! if (tmp != NULL) {
! *tmp = '\0';
! strlcat(localitem, tmp + 3, 1024);
! }
! }
! } else {
! strlcpy(localitem, item, 1024);
! }
!
n = instance->td->list;
--- 221,228 ----
Node *node = NULL;
Node *n;
char *filename;
char localitem[1024];
! fullyQualifyURL(instance, item, localitem);
n = instance->td->list;
Index: plugin-setup.h
===================================================================
RCS file: /cvsroot/mplayerplug-in/mplayerplug-in/Source/plugin-setup.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** plugin-setup.h 12 Mar 2004 01:57:16 -0000 1.19
--- plugin-setup.h 12 Mar 2004 17:12:47 -0000 1.20
***************
*** 130,133 ****
--- 130,134 ----
extern void remove_quotes(char *url);
void killmplayer(nsPluginInstance * instance);
+ void fullyQualifyURL(nsPluginInstance * instance, char *item, char *localitem);
//plugin-list.cpp
Index: plugin-support.cpp
===================================================================
RCS file: /cvsroot/mplayerplug-in/mplayerplug-in/Source/plugin-support.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** plugin-support.cpp 12 Mar 2004 15:44:10 -0000 1.13
--- plugin-support.cpp 12 Mar 2004 17:12:47 -0000 1.14
***************
*** 361,365 ****
}
}
!
if (instance->control > 0) {
close(instance->control);
--- 361,365 ----
}
}
! /*
if (instance->control > 0) {
close(instance->control);
***************
*** 371,374 ****
--- 371,411 ----
}
+ */
}
}
+
+ void fullyQualifyURL(nsPluginInstance * instance, char *item, char *localitem)
+ {
+ char tmpdir[1024];
+ char *tmp;
+
+ if (!isMms(item)) {
+ if (strncasecmp(item, "http", 4) != 0) {
+
+ if (item[0] != '/') {
+ strlcpy(tmpdir, item, sizeof(tmpdir)); // reuse the buffer
+ if (instance->baseurl != NULL) {
+ strlcpy(localitem, instance->baseurl, 1024);
+ }
+ strlcat(localitem, tmpdir, 1024);
+ } else {
+ if (instance->hostname != NULL) {
+ snprintf(tmpdir, sizeof(tmpdir), "http://%s/%s",
+ instance->hostname, item);
+ strlcpy(localitem, tmpdir, 1024);
+ }
+ }
+
+ } else {
+ // if :80 is in the URL, cut it out
+ strlcpy(localitem, item, sizeof(localitem));
+ tmp = strstr(localitem, ":80");
+ if (tmp != NULL) {
+ *tmp = '\0';
+ strlcat(localitem, tmp + 3, 1024);
+ }
+ }
+ } else {
+ strlcpy(localitem, item, 1024);
+ }
+ }
Index: plugin-threads.cpp
===================================================================
RCS file: /cvsroot/mplayerplug-in/mplayerplug-in/Source/plugin-threads.cpp,v
retrieving revision 1.51
retrieving revision 1.52
diff -C2 -d -r1.51 -r1.52
*** plugin-threads.cpp 12 Mar 2004 01:57:16 -0000 1.51
--- plugin-threads.cpp 12 Mar 2004 17:12:47 -0000 1.52
***************
*** 682,687 ****
printf
("----player thread: breaking read loop - cancelled\n");
! pthread_mutex_unlock(&(local_td->instance->playlist_mutex));
! break;
}
pthread_mutex_unlock(&(local_td->instance->playlist_mutex));
--- 682,687 ----
printf
("----player thread: breaking read loop - cancelled\n");
! //pthread_mutex_unlock(&(local_td->instance->playlist_mutex));
! //break;
}
pthread_mutex_unlock(&(local_td->instance->playlist_mutex));
***************
*** 819,825 ****
while (local_list != NULL) {
printf
! ("----player thread: PL URL: %s\nplay = %i, cancelled= %i\n",
local_list->url, local_list->play,
! local_list->cancelled);
local_list = local_list->next;
}
--- 819,827 ----
while (local_list != NULL) {
printf
! ("----player thread: local_list = %p\nPL URL: %s\nplay = %i, cancelled= %i\nnext= %p\n",
! local_list,
local_list->url, local_list->play,
! local_list->cancelled,
! local_list->next);
local_list = local_list->next;
}
***************
*** 968,974 ****
//also revents us from playing it again
pthread_mutex_lock(&(local_td->instance->playlist_mutex));
! if (!tryagain) {
! local_list->cancelled = 1;
! }
pthread_mutex_unlock(&
(local_td->instance->playlist_mutex));
--- 970,976 ----
//also revents us from playing it again
pthread_mutex_lock(&(local_td->instance->playlist_mutex));
! // if (!tryagain) {
! // local_list->cancelled = 1;
! // }
pthread_mutex_unlock(&
(local_td->instance->playlist_mutex));
***************
*** 1046,1050 ****
if (DEBUG) {
! printf("----player thread: normal exit");
}
--- 1048,1052 ----
if (DEBUG) {
! printf("----player thread: normal exit\n");
}
Index: plugin.cpp
===================================================================
RCS file: /cvsroot/mplayerplug-in/mplayerplug-in/Source/plugin.cpp,v
retrieving revision 1.49
retrieving revision 1.50
diff -C2 -d -r1.49 -r1.50
*** plugin.cpp 12 Mar 2004 15:44:10 -0000 1.49
--- plugin.cpp 12 Mar 2004 17:12:47 -0000 1.50
***************
*** 258,262 ****
void nsPluginInstance::shut()
{
! int count, status, i;
if (DEBUG)
--- 258,262 ----
void nsPluginInstance::shut()
{
! int i;
if (DEBUG)
***************
*** 302,308 ****
}
! if (url != NULL) {
! free(url);
! url = NULL;
}
--- 302,308 ----
}
! if (href != NULL) {
! free(href);
! href = NULL;
}
***************
*** 1274,1277 ****
--- 1274,1278 ----
void nsPluginInstance::SetFilename(const char *filename)
{
+ char localurl[1024];
pthread_mutex_lock(&control_mutex);
killmplayer(this);
***************
*** 1285,1298 ****
deleteList(list);
list = newNode();
- td->list = list;
// need to convert to Fully Qualified URL here
! snprintf(list->url, 1024, "%s", (char *)filename);
! pthread_mutex_unlock(&playlist_mutex);
!
! if (isMms(list->url)) {
! list->mmsstream = 1;
! } else {
! NPN_GetURL(mInstance, list->url, NULL);
}
}
--- 1286,1313 ----
deleteList(list);
list = newNode();
// need to convert to Fully Qualified URL here
! fullyQualifyURL(this, (char*)filename, localurl);
!
! if (href != NULL) {
! free(href);
! href = NULL;
! }
!
! if (fname != NULL) {
! free(fname);
! fname = NULL;
}
+
+ if (url != NULL) {
+ free(url);
+ url = NULL;
+ }
+
+ url = strdup(localurl);
+ cancelled = 0;
+ if (!isMms(localurl))
+ NPN_GetURL(mInstance, localurl, NULL);
+
+ pthread_mutex_unlock(&playlist_mutex);
}
|