Workaround to make RealAudio plugin work

This commit is contained in:
av%netscape.com 1999-09-21 00:07:20 +00:00
Родитель 9adfdc2ef9
Коммит a39abecf84
2 изменённых файлов: 94 добавлений и 64 удалений

Просмотреть файл

@ -174,41 +174,56 @@ ns4xPluginStreamListener::OnDataAvailable(nsIPluginStreamInfo* pluginInfo,
// Write until the buffer is empty // Write until the buffer is empty
while (amountRead > 0) while (amountRead > 0)
{ {
if (callbacks->writeready != NULL) if (callbacks->writeready != NULL)
{ {
#if !TARGET_CARBON #if !TARGET_CARBON
// pinkerton // pinkerton
// relies on routine descriptors, not present in carbon. We need to fix this. // relies on routine descriptors, not present in carbon. We need to fix this.
numtowrite = CallNPP_WriteReadyProc(callbacks->writeready, numtowrite = CallNPP_WriteReadyProc(callbacks->writeready,
npp, npp,
&mNPStream); &mNPStream);
#endif #endif
if (numtowrite > amountRead) if (numtowrite > amountRead)
numtowrite = amountRead; numtowrite = amountRead;
} }
else // if WriteReady is not supported by the plugin, just write the whole buffer else // if WriteReady is not supported by the plugin, just write the whole buffer
numtowrite = length; numtowrite = length;
// if WriteReady returned 0, the plugin is not ready to handle the data, // if WriteReady returned 0, the plugin is not ready to handle the data,
// so just skip the Write until WriteReady returns a >0 value // so just skip the Write until WriteReady returns a >0 value
if(numtowrite > 0) if(numtowrite > 0)
{ {
#if !TARGET_CARBON
// pinkerton
// relies on routine descriptors, not present in carbon. We need to fix this.
writeCount = CallNPP_WriteProc(callbacks->write,
npp,
&mNPStream,
mPosition,
numtowrite,
(void *)buffer);
if(writeCount < 0)
return NS_ERROR_FAILURE;
#endif
amountRead -= numtowrite;
mPosition += numtowrite;
/**/
if(amountRead == 0)//~~~this is a temporary workaround to make RealAudio work
{
NPError error = CallNPP_DestroyStreamProc(callbacks->destroystream, npp, &mNPStream, NPRES_DONE);
if(error != NPERR_NO_ERROR)
return NS_ERROR_FAILURE;
if(callbacks->urlnotify != NULL && mNotifyData != nsnull)
{
#if !TARGET_CARBON #if !TARGET_CARBON
// pinkerton CallNPP_URLNotifyProc(callbacks->urlnotify,npp,mNPStream.url,nsPluginReason_Done,mNotifyData);
// relies on routine descriptors, not present in carbon. We need to fix this.
writeCount = CallNPP_WriteProc(callbacks->write,
npp,
&mNPStream,
mPosition,
numtowrite,
(void *)buffer);
if(writeCount < 0)
return NS_ERROR_FAILURE;
#endif #endif
amountRead -= numtowrite; }
mPosition += numtowrite; }
}
}
} }
return NS_OK; return NS_OK;

Просмотреть файл

@ -174,41 +174,56 @@ ns4xPluginStreamListener::OnDataAvailable(nsIPluginStreamInfo* pluginInfo,
// Write until the buffer is empty // Write until the buffer is empty
while (amountRead > 0) while (amountRead > 0)
{ {
if (callbacks->writeready != NULL) if (callbacks->writeready != NULL)
{ {
#if !TARGET_CARBON #if !TARGET_CARBON
// pinkerton // pinkerton
// relies on routine descriptors, not present in carbon. We need to fix this. // relies on routine descriptors, not present in carbon. We need to fix this.
numtowrite = CallNPP_WriteReadyProc(callbacks->writeready, numtowrite = CallNPP_WriteReadyProc(callbacks->writeready,
npp, npp,
&mNPStream); &mNPStream);
#endif #endif
if (numtowrite > amountRead) if (numtowrite > amountRead)
numtowrite = amountRead; numtowrite = amountRead;
} }
else // if WriteReady is not supported by the plugin, just write the whole buffer else // if WriteReady is not supported by the plugin, just write the whole buffer
numtowrite = length; numtowrite = length;
// if WriteReady returned 0, the plugin is not ready to handle the data, // if WriteReady returned 0, the plugin is not ready to handle the data,
// so just skip the Write until WriteReady returns a >0 value // so just skip the Write until WriteReady returns a >0 value
if(numtowrite > 0) if(numtowrite > 0)
{ {
#if !TARGET_CARBON
// pinkerton
// relies on routine descriptors, not present in carbon. We need to fix this.
writeCount = CallNPP_WriteProc(callbacks->write,
npp,
&mNPStream,
mPosition,
numtowrite,
(void *)buffer);
if(writeCount < 0)
return NS_ERROR_FAILURE;
#endif
amountRead -= numtowrite;
mPosition += numtowrite;
/**/
if(amountRead == 0)//~~~this is a temporary workaround to make RealAudio work
{
NPError error = CallNPP_DestroyStreamProc(callbacks->destroystream, npp, &mNPStream, NPRES_DONE);
if(error != NPERR_NO_ERROR)
return NS_ERROR_FAILURE;
if(callbacks->urlnotify != NULL && mNotifyData != nsnull)
{
#if !TARGET_CARBON #if !TARGET_CARBON
// pinkerton CallNPP_URLNotifyProc(callbacks->urlnotify,npp,mNPStream.url,nsPluginReason_Done,mNotifyData);
// relies on routine descriptors, not present in carbon. We need to fix this.
writeCount = CallNPP_WriteProc(callbacks->write,
npp,
&mNPStream,
mPosition,
numtowrite,
(void *)buffer);
if(writeCount < 0)
return NS_ERROR_FAILURE;
#endif #endif
amountRead -= numtowrite; }
mPosition += numtowrite; }
}
}
} }
return NS_OK; return NS_OK;