Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Right-click on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: Kevin DeKorte <kdekorte@us...> - 2005-10-20 01:23:07
|
Update of /cvsroot/mplayerplug-in/mplayerplug-in/Source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22345/Source Modified Files: plugin-setup.cpp plugin-setup.h plugin-threads.cpp plugin-ui.cpp plugin.cpp plugin.h Log Message: Added onMediaCompleteWithError callback Index: plugin.h =================================================================== RCS file: /cvsroot/mplayerplug-in/mplayerplug-in/Source/plugin.h,v retrieving revision 1.86 retrieving revision 1.87 diff -C2 -d -r1.86 -r1.87 *** plugin.h 19 Oct 2005 15:31:11 -0000 1.86 --- plugin.h 20 Oct 2005 01:22:55 -0000 1.87 *************** *** 174,177 **** --- 174,178 ---- float percent; char *mediaCompleteCallback; + char *mediaCompleteWithErrorCallback; char *mouseClickCallback; char *mouseDownCallback; Index: plugin-threads.cpp =================================================================== RCS file: /cvsroot/mplayerplug-in/mplayerplug-in/Source/plugin-threads.cpp,v retrieving revision 1.178 retrieving revision 1.179 diff -C2 -d -r1.178 -r1.179 *** plugin-threads.cpp 19 Oct 2005 00:05:02 -0000 1.178 --- plugin-threads.cpp 20 Oct 2005 01:22:55 -0000 1.179 *************** *** 66,69 **** --- 66,72 ---- NPN_GetURL(instance->mInstance, instance->mediaCompleteCallback, "_self"); + if (instance->mediaCompleteWithErrorCallback != NULL) + NPN_GetURL(instance->mInstance, + instance->mediaCompleteWithErrorCallback, "_self"); return FALSE; } *************** *** 683,691 **** //return true if we should try to play this again immediately, false if not ! int playNode(ThreadData * local_td, Node * local_list, char *local_url, int local_mmsstream, int *usefps, int *nomouseinput, int *maybeplaylist) { char buffer[1024]; char message[1024]; --- 686,695 ---- //return true if we should try to play this again immediately, false if not ! PlayResult *playNode(ThreadData * local_td, Node * local_list, char *local_url, int local_mmsstream, int *usefps, int *nomouseinput, int *maybeplaylist) { + PlayResult *result = (PlayResult *)NPN_MemAlloc(sizeof(PlayResult)); char buffer[1024]; char message[1024]; *************** *** 695,699 **** char *cf; double cfpercent; - int retval = FALSE; char *eos; char *msg; --- 699,702 ---- *************** *** 707,716 **** int fsupdated = 0; #endif - #define TRYAGAIN_FALSE 0 - #define TRYAGAIN_TRUE 1 - #define TRYAGAIN_FALLBACK 2 - - int tryagain = TRYAGAIN_FALLBACK; /* --- 710,717 ---- int fsupdated = 0; #endif + result->errorcode = ERROR_NO_ERROR; + result->tryagain = TRYAGAIN_FALLBACK; + result->retval = FALSE; /* *************** *** 839,843 **** printf("Exiting. Will try again with mmst://\n";); } ! tryagain = TRYAGAIN_FALLBACK; break; } --- 840,844 ---- printf("Exiting. Will try again with mmst://\n";); } ! result->tryagain = TRYAGAIN_FALLBACK; break; } *************** *** 1024,1028 **** #endif } ! tryagain = TRYAGAIN_FALSE; } --- 1025,1029 ---- #endif } ! result->tryagain = TRYAGAIN_FALSE; } *************** *** 1064,1067 **** --- 1065,1071 ---- g_idle_add(gtkgui_message, local_td->instance); #endif + result->tryagain = TRYAGAIN_FALSE; + result->errorcode = ERROR_NO_STREAM; + break; } *************** *** 1070,1077 **** if (strstr(buffer, "Example: mplayer -playlist ") != NULL) { if (*maybeplaylist == 0) { ! tryagain = TRYAGAIN_TRUE; *maybeplaylist = 1; } else ! tryagain = TRYAGAIN_FALSE; break; } --- 1074,1082 ---- if (strstr(buffer, "Example: mplayer -playlist ") != NULL) { if (*maybeplaylist == 0) { ! result->tryagain = TRYAGAIN_TRUE; *maybeplaylist = 1; } else ! result->tryagain = TRYAGAIN_FALSE; ! result->errorcode = ERROR_NOT_PLAYLIST; break; } *************** *** 1111,1115 **** printf("----player thread: breaking read loop - Quit\n"); local_td->instance->js_state = JS_STATE_UNDEFINED; ! tryagain = TRYAGAIN_FALSE; break; } --- 1116,1120 ---- printf("----player thread: breaking read loop - Quit\n"); local_td->instance->js_state = JS_STATE_UNDEFINED; ! result->tryagain = TRYAGAIN_FALSE; break; } *************** *** 1126,1132 **** if (local_td->instance->rtsp_use_tcp == 1) { local_td->instance->rtsp_use_tcp = 0; ! tryagain = TRYAGAIN_TRUE; } else { ! tryagain = TRYAGAIN_FALSE; } break; --- 1131,1138 ---- if (local_td->instance->rtsp_use_tcp == 1) { local_td->instance->rtsp_use_tcp = 0; ! result->tryagain = TRYAGAIN_TRUE; } else { ! result->tryagain = TRYAGAIN_FALSE; ! result->errorcode = ERROR_PLAYER_INTERRUPTED; } break; *************** *** 1142,1146 **** ("----player thread: waiting to download entire movie\n"); } ! tryagain = TRYAGAIN_TRUE; while (1) { pthread_testcancel(); --- 1148,1152 ---- ("----player thread: waiting to download entire movie\n"); } ! result->tryagain = TRYAGAIN_TRUE; while (1) { pthread_testcancel(); *************** *** 1165,1169 **** pthread_testcancel(); if (strstr(buffer, "FPS not specified") != NULL) { ! tryagain = TRYAGAIN_TRUE; *usefps = 1; break; --- 1171,1175 ---- pthread_testcancel(); if (strstr(buffer, "FPS not specified") != NULL) { ! result->tryagain = TRYAGAIN_TRUE; *usefps = 1; break; *************** *** 1173,1186 **** if (strstr(buffer, "nomouseinput") != NULL) { *nomouseinput = 0; ! tryagain = TRYAGAIN_TRUE; break; } - // Possible work around for cinema now site - // if (strstr(buffer, "ASF file format detected") != NULL) { - // tryagain = TRYAGAIN_TRUE; - // local_list->playlist = 1; - // break; - // } - pthread_testcancel(); --- 1179,1185 ---- if (strstr(buffer, "nomouseinput") != NULL) { *nomouseinput = 0; ! result->tryagain = TRYAGAIN_TRUE; break; } pthread_testcancel(); *************** *** 1195,1199 **** #endif } ! tryagain = TRYAGAIN_FALSE; break; } --- 1194,1199 ---- #endif } ! result->tryagain = TRYAGAIN_FALSE; ! result->errorcode = ERROR_NO_ERROR; break; } *************** *** 1209,1213 **** if (local_td->instance->rtsp_use_tcp == 1) { local_td->instance->rtsp_use_tcp = 0; ! tryagain = TRYAGAIN_TRUE; } else { #ifdef GTK_ENABLED --- 1209,1213 ---- if (local_td->instance->rtsp_use_tcp == 1) { local_td->instance->rtsp_use_tcp = 0; ! result->tryagain = TRYAGAIN_TRUE; } else { #ifdef GTK_ENABLED *************** *** 1216,1220 **** g_idle_add(gtkgui_message, local_td->instance); #endif ! tryagain = TRYAGAIN_FALSE; } } --- 1216,1221 ---- g_idle_add(gtkgui_message, local_td->instance); #endif ! result->tryagain = TRYAGAIN_FALSE; ! result->errorcode = ERROR_PLAYER_INTERRUPTED; } } *************** *** 1232,1236 **** g_idle_add(gtkgui_message, local_td->instance); #endif ! tryagain = TRYAGAIN_FALSE; break; } --- 1233,1238 ---- g_idle_add(gtkgui_message, local_td->instance); #endif ! result->tryagain = TRYAGAIN_FALSE; ! result->errorcode = ERROR_EXECV; break; } *************** *** 1240,1243 **** --- 1242,1247 ---- if (DEBUG) printf("----player thread: breaking read loop - killed\n"); + result->tryagain = TRYAGAIN_FALSE; + result->errorcode = ERROR_EXPLICIT_KILL; break; } *************** *** 1248,1251 **** --- 1252,1257 ---- printf ("----player thread: breaking read loop - codec issue\n"); + result->tryagain = TRYAGAIN_FALSE; + result->errorcode = ERROR_CODEC_FAILURE; break; } *************** *** 1259,1274 **** if (DEBUG) { ! printf("----player thread: tryagain = %d\n", tryagain); } //we always return either true or false ! if (tryagain == TRYAGAIN_TRUE) { ! retval = TRUE; } ! if (tryagain == TRYAGAIN_FALSE) { ! retval = FALSE; } ! if (tryagain == TRYAGAIN_FALLBACK) { //fallback to msst if we can strlcpy(url_copy, local_url, 1023); --- 1265,1280 ---- if (DEBUG) { ! printf("----player thread: tryagain = %d\n", result->tryagain); } //we always return either true or false ! if (result->tryagain == TRYAGAIN_TRUE) { ! result->retval = TRUE; } ! if (result->tryagain == TRYAGAIN_FALSE) { ! result->retval = FALSE; } ! if (result->tryagain == TRYAGAIN_FALLBACK) { //fallback to msst if we can strlcpy(url_copy, local_url, 1023); *************** *** 1277,1288 **** if (strncmp(local_url, "mms://";, 6) == 0) { snprintf(local_url, 1023, "mmst://%s";, url_copy + 6); ! retval = TRUE; } else if (local_mmsstream && strncmp(local_url, "http://";, 7) == 0) { snprintf(local_url, 1023, "mmst://%s";, url_copy + 7); ! retval = TRUE; } else { ! retval = FALSE; } } --- 1283,1294 ---- if (strncmp(local_url, "mms://";, 6) == 0) { snprintf(local_url, 1023, "mmst://%s";, url_copy + 6); ! result->retval = TRUE; } else if (local_mmsstream && strncmp(local_url, "http://";, 7) == 0) { snprintf(local_url, 1023, "mmst://%s";, url_copy + 7); ! result->retval = TRUE; } else { ! result->retval = FALSE; } } *************** *** 1293,1297 **** } #endif ! return retval; } --- 1299,1303 ---- } #endif ! return result; } *************** *** 1299,1302 **** --- 1305,1309 ---- { + PlayResult * result = NULL; FILE *playlist; char cmd[2048]; *************** *** 1304,1307 **** --- 1311,1315 ---- char mmsplaylist[1024]; char buffer[1024]; // scratch pad + char *p; // pointer to find the ( in the callback int argc = 0, base_argc = 0; *************** *** 1550,1554 **** do { ! pthread_testcancel(); --- 1558,1566 ---- do { ! if (result != NULL) { ! NPN_MemFree(result); ! result = NULL; ! } ! pthread_testcancel(); *************** *** 1682,1686 **** local_td->instance->mediaPercent = 0; ! tryagain = playNode(local_td, local_list, local_url, local_mmsstream, &usefps, &nomouseinput, --- 1694,1698 ---- local_td->instance->mediaPercent = 0; ! result = playNode(local_td, local_list, local_url, local_mmsstream, &usefps, &nomouseinput, *************** *** 1690,1694 **** printf ("----player thread: playNode returned = %d\n", ! tryagain); pthread_testcancel(); --- 1702,1706 ---- printf ("----player thread: playNode returned = %d\n", ! result->retval); pthread_testcancel(); *************** *** 1704,1708 **** // also revents us from playing it again pthread_mutex_lock(&(local_td->instance->playlist_mutex)); ! if (!tryagain) { local_list->played = 1; } --- 1716,1720 ---- // also revents us from playing it again pthread_mutex_lock(&(local_td->instance->playlist_mutex)); ! if (!(result->retval)) { local_list->played = 1; } *************** *** 1732,1736 **** } ! } while (tryagain); local_td->instance->currentnode = NULL; --- 1744,1768 ---- } ! // update MediaCompleteWithError Callback ! if (local_td->instance->mediaCompleteWithErrorCallback != NULL) { ! if (DEBUG) ! printf("mediaCompleteWithError = %s\n",local_td->instance->mediaCompleteWithErrorCallback); ! strncpy(message,local_td->instance->mediaCompleteWithErrorCallback,1024); ! p = index(message,'('); ! if (p == NULL) { ! p = message + strlen(message); ! } ! *p = '\0'; ! snprintf(buffer,1024,"%s('%i');",message,result->errorcode); ! if (DEBUG) ! printf("mediaCompleteWithError = %s\np = %p\nmessage = %p\n",buffer,p,message); ! NPN_MemFree(local_td->instance->mediaCompleteWithErrorCallback); ! local_td->instance->mediaCompleteWithErrorCallback = (char *) NPN_MemAlloc(strlen(buffer)); ! strncpy(local_td->instance->mediaCompleteWithErrorCallback,buffer,strlen(buffer)); ! if (DEBUG) ! printf("mediaCompleteWithError = %s\n",local_td->instance->mediaCompleteWithErrorCallback); ! } ! ! } while (result->retval); local_td->instance->currentnode = NULL; *************** *** 1776,1779 **** --- 1808,1814 ---- NPN_GetURL(local_td->instance->mInstance, local_td->instance->mediaCompleteCallback, "_self"); + if (local_td->instance->mediaCompleteWithErrorCallback != NULL) + NPN_GetURL(local_td->instance->mInstance, + local_td->instance->mediaCompleteWithErrorCallback, "_self"); #endif #ifdef GTK2_ENABLED Index: plugin-setup.h =================================================================== RCS file: /cvsroot/mplayerplug-in/mplayerplug-in/Source/plugin-setup.h,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** plugin-setup.h 17 Oct 2005 21:38:53 -0000 1.48 --- plugin-setup.h 20 Oct 2005 01:22:55 -0000 1.49 *************** *** 80,83 **** --- 80,97 ---- #define JS_STATE_INITIALIZING 12 + // PlayNode Error Codes + #define ERROR_NO_ERROR 0 + #define ERROR_NO_STREAM 1 + #define ERROR_CODEC_FAILURE ERROR_NO_STREAM << 1 + #define ERROR_EXPLICIT_KILL ERROR_NO_STREAM << 2 + #define ERROR_PLAYER_INTERRUPTED ERROR_NO_STREAM << 3 + #define ERROR_EXECV ERROR_NO_STREAM << 4 + #define ERROR_NOT_PLAYLIST ERROR_NO_STREAM << 5 + + #define TRYAGAIN_FALSE 0 + #define TRYAGAIN_TRUE 1 + #define TRYAGAIN_FALLBACK 2 + + #ifndef STRUCTURES #define STRUCTURES *************** *** 120,123 **** --- 134,143 ---- } ThreadData; + typedef struct _PlayResult { + int errorcode; + int tryagain; + int retval; + } PlayResult; + #endif Index: plugin.cpp =================================================================== RCS file: /cvsroot/mplayerplug-in/mplayerplug-in/Source/plugin.cpp,v retrieving revision 1.246 retrieving revision 1.247 diff -C2 -d -r1.246 -r1.247 *** plugin.cpp 19 Oct 2005 15:31:11 -0000 1.246 --- plugin.cpp 20 Oct 2005 01:22:55 -0000 1.247 *************** *** 196,199 **** --- 196,200 ---- panel_drawn = 0; mediaCompleteCallback = NULL; + mediaCompleteWithErrorCallback = NULL; mouseClickCallback = NULL; mouseDownCallback = NULL; *************** *** 897,901 **** if (showlogo) gtk_widget_show(image); ! gtk_widget_show(GTK_WIDGET(progress_bar)); gtk_fixed_put(GTK_FIXED(fixed_container), GTK_WIDGET(status), 10, 60); --- 898,903 ---- if (showlogo) gtk_widget_show(image); ! if (!hidestatus) ! gtk_widget_show(GTK_WIDGET(progress_bar)); gtk_fixed_put(GTK_FIXED(fixed_container), GTK_WIDGET(status), 10, 60); *************** *** 916,920 **** GTK_WIDGET(progress_bar), 10, window_height - 20); ! gtk_widget_show(GTK_WIDGET(progress_bar)); #ifdef GTK2_ENABLED gtk_widget_set_size_request(GTK_WIDGET(progress_bar), --- 918,923 ---- GTK_WIDGET(progress_bar), 10, window_height - 20); ! if (!hidestatus) ! gtk_widget_show(GTK_WIDGET(progress_bar)); #ifdef GTK2_ENABLED gtk_widget_set_size_request(GTK_WIDGET(progress_bar), *************** *** 1272,1276 **** } else { if (movie_width == 0 && movie_height == 0) ! gtk_widget_show(GTK_WIDGET(progress_bar)); } } --- 1275,1280 ---- } else { if (movie_width == 0 && movie_height == 0) ! if (!hidestatus) ! gtk_widget_show(GTK_WIDGET(progress_bar)); } } *************** *** 1732,1736 **** (maxdownload * 1.0))); ! gtk_widget_show(GTK_WIDGET(progress_bar)); gtk_widget_queue_draw(GTK_WIDGET (progress_bar)); --- 1736,1741 ---- (maxdownload * 1.0))); ! if (!hidestatus) ! gtk_widget_show(GTK_WIDGET(progress_bar)); gtk_widget_queue_draw(GTK_WIDGET (progress_bar)); *************** *** 1762,1766 **** (maxdownload * 1.0))); ! gtk_widget_show(GTK_WIDGET(progress_bar)); gtk_widget_queue_draw(GTK_WIDGET (progress_bar)); --- 1767,1772 ---- (maxdownload * 1.0))); ! if (!hidestatus) ! gtk_widget_show(GTK_WIDGET(progress_bar)); gtk_widget_queue_draw(GTK_WIDGET (progress_bar)); Index: plugin-ui.cpp =================================================================== RCS file: /cvsroot/mplayerplug-in/mplayerplug-in/Source/plugin-ui.cpp,v retrieving revision 1.160 retrieving revision 1.161 diff -C2 -d -r1.160 -r1.161 *** plugin-ui.cpp 18 Oct 2005 00:25:37 -0000 1.160 --- plugin-ui.cpp 20 Oct 2005 01:22:55 -0000 1.161 *************** *** 1218,1222 **** if (instance->movie_height == 0 && instance->movie_width == 0) ! gtk_widget_show(GTK_WIDGET(instance->progress_bar)); gtk_progress_bar_update(instance->progress_bar, instance->percent); --- 1218,1223 ---- if (instance->movie_height == 0 && instance->movie_width == 0) ! if (!(instance->hidestatus)) ! gtk_widget_show(GTK_WIDGET(instance->progress_bar)); gtk_progress_bar_update(instance->progress_bar, instance->percent); Index: plugin-setup.cpp =================================================================== RCS file: /cvsroot/mplayerplug-in/mplayerplug-in/Source/plugin-setup.cpp,v retrieving revision 1.95 retrieving revision 1.96 diff -C2 -d -r1.95 -r1.96 *** plugin-setup.cpp 19 Oct 2005 15:31:11 -0000 1.95 --- plugin-setup.cpp 20 Oct 2005 01:22:55 -0000 1.96 *************** *** 774,777 **** --- 774,796 ---- } + if (strncasecmp(parameters->argn[i], "onmediacompletewitherror", 24) == 0) { + instance->mediaCompleteWithErrorCallback = + (char *) NPN_MemAlloc(strlen(parameters->argv[i]) + + 12); + if (strncasecmp(parameters->argv[i], "javascript:", 11) + == 0) { + snprintf(instance->mediaCompleteWithErrorCallback, + strlen(parameters->argv[i]), "%s", + parameters->argv[i]); + } else { + snprintf(instance->mediaCompleteWithErrorCallback, + strlen(parameters->argv[i]) + 12, + "javascript:%s", parameters->argv[i]); + } + if (DEBUG) + printf("mediaCompleteWithErrorCallback=%s\n", + instance->mediaCompleteWithErrorCallback); + } + if (strncasecmp(parameters->argn[i], "onclick", 7) == 0) { instance->mouseClickCallback = |