Merge pull request #4776 from akallabeth/fixes_cleanups_etc
Mac audin Fixes and cleanups
This commit is contained in:
commit
1c75854a3a
@ -47,7 +47,6 @@
|
||||
#include "audin_main.h"
|
||||
|
||||
#define MAC_AUDIO_QUEUE_NUM_BUFFERS 100
|
||||
#define MAC_AUDIO_QUEUE_BUFFER_SIZE 32768
|
||||
|
||||
/* Fix for #4462: Provide type alias if not declared (Mac OS < 10.10)
|
||||
* https://developer.apple.com/documentation/coreaudio/audioformatid
|
||||
@ -85,30 +84,16 @@ static AudioFormatID audin_mac_get_format(const AUDIO_FORMAT* format)
|
||||
{
|
||||
case WAVE_FORMAT_PCM:
|
||||
return kAudioFormatLinearPCM;
|
||||
/*
|
||||
case WAVE_FORMAT_GSM610:
|
||||
return kAudioFormatMicrosoftGSM;
|
||||
case WAVE_FORMAT_ALAW:
|
||||
return kAudioFormatALaw;
|
||||
case WAVE_FORMAT_MULAW:
|
||||
return kAudioFormatULaw;
|
||||
case WAVE_FORMAT_AAC_MS:
|
||||
return kAudioFormatMPEG4AAC;
|
||||
case WAVE_FORMAT_ADPCM:
|
||||
case WAVE_FORMAT_DVI_ADPCM:
|
||||
return kAudioFormatLinearPCM;
|
||||
*/
|
||||
}
|
||||
|
||||
return 0;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static AudioFormatFlags audin_mac_get_flags_for_format(const AUDIO_FORMAT* format)
|
||||
{
|
||||
switch (format->wFormatTag)
|
||||
{
|
||||
case WAVE_FORMAT_DVI_ADPCM:
|
||||
case WAVE_FORMAT_ADPCM:
|
||||
case WAVE_FORMAT_PCM:
|
||||
return kAudioFormatFlagIsSignedInteger;
|
||||
|
||||
@ -150,26 +135,19 @@ static UINT audin_mac_set_format(IAudinDevice* device, const AUDIO_FORMAT* forma
|
||||
WLog_INFO(TAG, "Audio Format %s [channels=%d, samples=%d, bits=%d]",
|
||||
rdpsnd_get_audio_tag_string(format->wFormatTag),
|
||||
format->nChannels, format->nSamplesPerSec, format->wBitsPerSample);
|
||||
mac->audioFormat.mBitsPerChannel = format->wBitsPerSample;
|
||||
|
||||
switch (format->wFormatTag)
|
||||
{
|
||||
case WAVE_FORMAT_ADPCM:
|
||||
case WAVE_FORMAT_DVI_ADPCM:
|
||||
mac->FramesPerPacket *= 4; /* Compression ratio. */
|
||||
mac->format.wBitsPerSample *= 4;
|
||||
break;
|
||||
}
|
||||
if (format->wBitsPerSample == 0)
|
||||
mac->audioFormat.mBitsPerChannel = 16;
|
||||
|
||||
mac->audioFormat.mBitsPerChannel = mac->format.wBitsPerSample;
|
||||
mac->audioFormat.mBytesPerFrame = 0;
|
||||
mac->audioFormat.mBytesPerPacket = 0;
|
||||
mac->audioFormat.mChannelsPerFrame = mac->format.nChannels;
|
||||
mac->audioFormat.mFormatFlags = audin_mac_get_flags_for_format(format);
|
||||
mac->audioFormat.mFormatID = audin_mac_get_format(format);
|
||||
mac->audioFormat.mFramesPerPacket = 1;
|
||||
mac->audioFormat.mReserved = 0;
|
||||
mac->audioFormat.mSampleRate = mac->format.nSamplesPerSec;
|
||||
mac->audioFormat.mBytesPerFrame =
|
||||
mac->audioFormat.mChannelsPerFrame * mac->audioFormat.mBitsPerChannel / 8;
|
||||
mac->audioFormat.mBytesPerPacket =
|
||||
mac->audioFormat.mBytesPerFrame * mac->audioFormat.mFramesPerPacket;
|
||||
return CHANNEL_RC_OK;
|
||||
}
|
||||
|
||||
@ -181,7 +159,7 @@ static void mac_audio_queue_input_cb(void* aqData,
|
||||
const AudioStreamPacketDescription* inPacketDesc)
|
||||
{
|
||||
AudinMacDevice* mac = (AudinMacDevice*)aqData;
|
||||
UINT error;
|
||||
UINT error = CHANNEL_RC_OK;
|
||||
const BYTE* buffer = inBuffer->mAudioData;
|
||||
int buffer_size = inBuffer->mAudioDataByteSize;
|
||||
(void)inAQ;
|
||||
@ -189,11 +167,14 @@ static void mac_audio_queue_input_cb(void* aqData,
|
||||
(void)inNumPackets;
|
||||
(void)inPacketDesc;
|
||||
|
||||
if ((error = mac->receive(&mac->format, buffer, buffer_size, mac->user_data)))
|
||||
if (buffer_size > 0)
|
||||
error = mac->receive(&mac->format, buffer, buffer_size, mac->user_data);
|
||||
AudioQueueEnqueueBuffer(inAQ, inBuffer, 0, NULL);
|
||||
|
||||
if (error)
|
||||
{
|
||||
WLog_ERR(TAG, "mac->receive failed with error %"PRIu32"", error);
|
||||
SetLastError(ERROR_INTERNAL_ERROR);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -262,7 +243,8 @@ static UINT audin_mac_open(IAudinDevice* device, AudinReceive receive, void* use
|
||||
|
||||
for (index = 0; index < MAC_AUDIO_QUEUE_NUM_BUFFERS; index++)
|
||||
{
|
||||
devStat = AudioQueueAllocateBuffer(mac->audioQueue, MAC_AUDIO_QUEUE_BUFFER_SIZE,
|
||||
devStat = AudioQueueAllocateBuffer(mac->audioQueue,
|
||||
mac->FramesPerPacket * 2 * mac->format.nChannels,
|
||||
&mac->audioBuffers[index]);
|
||||
|
||||
if (devStat != 0)
|
||||
|
@ -411,7 +411,6 @@ static UINT rdpsnd_server_send_wave_pdu(RdpsndServerContext* context,
|
||||
size_t length;
|
||||
size_t start, end = 0;
|
||||
const BYTE* src;
|
||||
BOOL status;
|
||||
AUDIO_FORMAT* format;
|
||||
ULONG written;
|
||||
wStream* s = context->priv->rdpsnd_pdu;
|
||||
@ -431,7 +430,7 @@ static UINT rdpsnd_server_send_wave_pdu(RdpsndServerContext* context,
|
||||
length = context->priv->out_pending_frames * context->priv->src_bytes_per_frame;
|
||||
|
||||
if (!freerdp_dsp_encode(context->priv->dsp_context, format, src, length, s))
|
||||
status = ERROR_INTERNAL_ERROR;
|
||||
error = ERROR_INTERNAL_ERROR;
|
||||
else
|
||||
{
|
||||
/* Set stream size */
|
||||
@ -440,11 +439,16 @@ static UINT rdpsnd_server_send_wave_pdu(RdpsndServerContext* context,
|
||||
Stream_Write_UINT16(s, end - start + 8);
|
||||
Stream_SetPosition(s, end);
|
||||
context->block_no = (context->block_no + 1) % 256;
|
||||
status = WTSVirtualChannelWrite(context->priv->ChannelHandle,
|
||||
(PCHAR) Stream_Buffer(s), start + 4, &written);
|
||||
|
||||
if (!WTSVirtualChannelWrite(context->priv->ChannelHandle,
|
||||
(PCHAR) Stream_Buffer(s), start + 4, &written))
|
||||
{
|
||||
WLog_ERR(TAG, "WTSVirtualChannelWrite failed!");
|
||||
error = ERROR_INTERNAL_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
if (status != CHANNEL_RC_OK)
|
||||
if (error != CHANNEL_RC_OK)
|
||||
{
|
||||
WLog_ERR(TAG, "WTSVirtualChannelWrite failed!");
|
||||
error = ERROR_INTERNAL_ERROR;
|
||||
@ -454,10 +458,9 @@ static UINT rdpsnd_server_send_wave_pdu(RdpsndServerContext* context,
|
||||
Stream_SetPosition(s, start);
|
||||
Stream_Write_UINT32(s, 0); /* bPad */
|
||||
Stream_SetPosition(s, start);
|
||||
status = WTSVirtualChannelWrite(context->priv->ChannelHandle,
|
||||
(PCHAR) Stream_Pointer(s), end - start, &written);
|
||||
|
||||
if (!status)
|
||||
if (!WTSVirtualChannelWrite(context->priv->ChannelHandle,
|
||||
(PCHAR) Stream_Pointer(s), end - start, &written))
|
||||
{
|
||||
WLog_ERR(TAG, "WTSVirtualChannelWrite failed!");
|
||||
error = ERROR_INTERNAL_ERROR;
|
||||
@ -481,7 +484,6 @@ static UINT rdpsnd_server_send_wave2_pdu(RdpsndServerContext* context,
|
||||
size_t length;
|
||||
size_t end = 0;
|
||||
const BYTE* src;
|
||||
BOOL status;
|
||||
AUDIO_FORMAT* format;
|
||||
ULONG written;
|
||||
wStream* s = context->priv->rdpsnd_pdu;
|
||||
@ -501,7 +503,7 @@ static UINT rdpsnd_server_send_wave2_pdu(RdpsndServerContext* context,
|
||||
length = context->priv->out_pending_frames * context->priv->src_bytes_per_frame;
|
||||
|
||||
if (!freerdp_dsp_encode(context->priv->dsp_context, format, src, length, s))
|
||||
status = ERROR_INTERNAL_ERROR;
|
||||
error = ERROR_INTERNAL_ERROR;
|
||||
else
|
||||
{
|
||||
/* Set stream size */
|
||||
@ -511,14 +513,13 @@ static UINT rdpsnd_server_send_wave2_pdu(RdpsndServerContext* context,
|
||||
Stream_SetPosition(s, end);
|
||||
Stream_SealLength(s);
|
||||
context->block_no = (context->block_no + 1) % 256;
|
||||
status = WTSVirtualChannelWrite(context->priv->ChannelHandle,
|
||||
(PCHAR) Stream_Buffer(s), Stream_Length(s), &written);
|
||||
}
|
||||
|
||||
if (!status)
|
||||
{
|
||||
WLog_ERR(TAG, "WTSVirtualChannelWrite failed!");
|
||||
error = ERROR_INTERNAL_ERROR;
|
||||
if (!WTSVirtualChannelWrite(context->priv->ChannelHandle,
|
||||
(PCHAR) Stream_Buffer(s), Stream_Length(s), &written))
|
||||
{
|
||||
WLog_ERR(TAG, "WTSVirtualChannelWrite failed!");
|
||||
error = ERROR_INTERNAL_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
|
@ -172,7 +172,7 @@ BOOL freerdp_client_print_command_line_help_ex(int argc, char** argv,
|
||||
}
|
||||
|
||||
static int freerdp_client_command_line_pre_filter(void* context, int index,
|
||||
int argc, LPCSTR* argv)
|
||||
int argc, LPSTR* argv)
|
||||
{
|
||||
if (index == 1)
|
||||
{
|
||||
@ -592,9 +592,7 @@ static char** freerdp_command_line_parse_comma_separated_values_ex(const char* n
|
||||
{
|
||||
char* dst = (char*)&p[1];
|
||||
p[0] = dst;
|
||||
|
||||
strncpy(dst, name, len);
|
||||
|
||||
*count = 1;
|
||||
return p;
|
||||
}
|
||||
|
@ -52,8 +52,10 @@ typedef BOOL (*psPeerLogon)(freerdp_peer* peer, SEC_WINNT_AUTH_IDENTITY* identit
|
||||
typedef BOOL (*psPeerAdjustMonitorsLayout)(freerdp_peer* peer);
|
||||
typedef BOOL (*psPeerClientCapabilities)(freerdp_peer* peer);
|
||||
|
||||
typedef int (*psPeerSendChannelData)(freerdp_peer* peer, UINT16 channelId, BYTE* data, int size);
|
||||
typedef int (*psPeerReceiveChannelData)(freerdp_peer* peer, UINT16 channelId, BYTE* data, int size,
|
||||
typedef int (*psPeerSendChannelData)(freerdp_peer* peer, UINT16 channelId, const BYTE* data,
|
||||
int size);
|
||||
typedef int (*psPeerReceiveChannelData)(freerdp_peer* peer, UINT16 channelId, const BYTE* data,
|
||||
int size,
|
||||
int flags, int totalSize);
|
||||
|
||||
typedef HANDLE(*psPeerVirtualChannelOpen)(freerdp_peer* peer, const char* name, UINT32 flags);
|
||||
|
@ -843,7 +843,7 @@ static BOOL freerdp_dsp_encode_ms_adpcm(FREERDP_DSP_CONTEXT* context, const BYTE
|
||||
BYTE* start;
|
||||
INT32 sample;
|
||||
UINT32 out_size;
|
||||
const size_t step = 8 + (context->format.nChannels > 1) ? 4 : 0;
|
||||
const size_t step = 8 + ((context->format.nChannels > 1) ? 4 : 0);
|
||||
out_size = size / 2;
|
||||
|
||||
if (!Stream_EnsureRemainingCapacity(out, size))
|
||||
|
@ -352,7 +352,7 @@ int rts_extract_pdu_signature(rdpRpc* rpc, RtsPduSignature* signature, rpcconn_r
|
||||
}
|
||||
|
||||
UINT32 rts_identify_pdu_signature(rdpRpc* rpc, RtsPduSignature* signature,
|
||||
RTS_PDU_SIGNATURE_ENTRY** entry)
|
||||
const RTS_PDU_SIGNATURE_ENTRY** entry)
|
||||
{
|
||||
int i, j;
|
||||
RtsPduSignature* pSignature;
|
||||
@ -388,7 +388,7 @@ UINT32 rts_identify_pdu_signature(rdpRpc* rpc, RtsPduSignature* signature,
|
||||
int rts_print_pdu_signature(rdpRpc* rpc, RtsPduSignature* signature)
|
||||
{
|
||||
UINT32 SignatureId;
|
||||
RTS_PDU_SIGNATURE_ENTRY* entry;
|
||||
const RTS_PDU_SIGNATURE_ENTRY* entry;
|
||||
WLog_INFO(TAG, "RTS PDU Signature: Flags: 0x%04"PRIX16" NumberOfCommands: %"PRIu16"",
|
||||
signature->Flags, signature->NumberOfCommands);
|
||||
SignatureId = rts_identify_pdu_signature(rpc, signature, &entry);
|
||||
|
@ -184,7 +184,7 @@ FREERDP_LOCAL BOOL rts_match_pdu_signature(rdpRpc* rpc,
|
||||
FREERDP_LOCAL int rts_extract_pdu_signature(rdpRpc* rpc,
|
||||
RtsPduSignature* signature, rpcconn_rts_hdr_t* rts);
|
||||
FREERDP_LOCAL UINT32 rts_identify_pdu_signature(rdpRpc* rpc,
|
||||
RtsPduSignature* signature, RTS_PDU_SIGNATURE_ENTRY** entry);
|
||||
RtsPduSignature* signature, const RTS_PDU_SIGNATURE_ENTRY** entry);
|
||||
FREERDP_LOCAL int rts_print_pdu_signature(rdpRpc* rpc,
|
||||
RtsPduSignature* signature);
|
||||
|
||||
|
@ -363,7 +363,7 @@ static BOOL wts_write_drdynvc_create_request(wStream* s, UINT32 ChannelId,
|
||||
}
|
||||
|
||||
static BOOL WTSProcessChannelData(rdpPeerChannel* channel, UINT16 channelId,
|
||||
BYTE* data, int size, int flags, int totalSize)
|
||||
const BYTE* data, int size, int flags, int totalSize)
|
||||
{
|
||||
BOOL ret = TRUE;
|
||||
|
||||
@ -401,7 +401,7 @@ static BOOL WTSProcessChannelData(rdpPeerChannel* channel, UINT16 channelId,
|
||||
}
|
||||
|
||||
static int WTSReceiveChannelData(freerdp_peer* client, UINT16 channelId,
|
||||
BYTE* data, int size, int flags, int totalSize)
|
||||
const BYTE* data, int size, int flags, int totalSize)
|
||||
{
|
||||
UINT32 i;
|
||||
BOOL status = FALSE;
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include <freerdp/utils/pcap.h>
|
||||
#include <freerdp/log.h>
|
||||
|
||||
#include "../cache/cache.h"
|
||||
#include "surface.h"
|
||||
|
||||
#define TAG FREERDP_TAG("core.surface")
|
||||
@ -46,6 +47,7 @@ static BOOL update_recv_surfcmd_bitmap_header_ex(wStream* s, TS_COMPRESSED_BITMA
|
||||
static BOOL update_recv_surfcmd_bitmap_ex(wStream* s, TS_BITMAP_DATA_EX* bmp)
|
||||
{
|
||||
size_t pos;
|
||||
|
||||
if (!s || !bmp)
|
||||
return FALSE;
|
||||
|
||||
@ -67,6 +69,7 @@ static BOOL update_recv_surfcmd_bitmap_ex(wStream* s, TS_BITMAP_DATA_EX* bmp)
|
||||
}
|
||||
|
||||
memset(&bmp->exBitmapDataHeader, 0, sizeof(TS_COMPRESSED_BITMAP_HEADER_EX));
|
||||
|
||||
if (bmp->flags & EX_COMPRESSED_BITMAP_HEADER_PRESENT)
|
||||
{
|
||||
if (!update_recv_surfcmd_bitmap_header_ex(s, &bmp->exBitmapDataHeader))
|
||||
@ -79,7 +82,6 @@ static BOOL update_recv_surfcmd_bitmap_ex(wStream* s, TS_BITMAP_DATA_EX* bmp)
|
||||
pos = Stream_GetPosition(s) + bmp->bitmapDataLength;
|
||||
bmp->bitmapData = Stream_Pointer(s);
|
||||
Stream_SetPosition(s, pos);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -97,6 +99,7 @@ static BOOL update_recv_surfcmd_surface_bits(rdpUpdate* update, wStream* s)
|
||||
Stream_Read_UINT16(s, cmd->destTop);
|
||||
Stream_Read_UINT16(s, cmd->destRight);
|
||||
Stream_Read_UINT16(s, cmd->destBottom);
|
||||
|
||||
if (!update_recv_surfcmd_bitmap_ex(s, &cmd->bmp))
|
||||
goto fail;
|
||||
|
||||
@ -107,7 +110,7 @@ static BOOL update_recv_surfcmd_surface_bits(rdpUpdate* update, wStream* s)
|
||||
}
|
||||
|
||||
return update->SurfaceBits(update->context, cmd);
|
||||
fail:
|
||||
fail:
|
||||
free_surface_bits_command(update->context, cmd);
|
||||
return FALSE;
|
||||
}
|
||||
@ -122,8 +125,8 @@ static BOOL update_recv_surfcmd_frame_marker(rdpUpdate* update, wStream* s)
|
||||
Stream_Read_UINT16(s, marker.frameAction);
|
||||
Stream_Read_UINT32(s, marker.frameId);
|
||||
WLog_Print(update->log, WLOG_DEBUG, "SurfaceFrameMarker: action: %s (%"PRIu32") id: %"PRIu32"",
|
||||
(!marker.frameAction) ? "Begin" : "End",
|
||||
marker.frameAction, marker.frameId);
|
||||
(!marker.frameAction) ? "Begin" : "End",
|
||||
marker.frameAction, marker.frameId);
|
||||
|
||||
if (!update->SurfaceFrameMarker)
|
||||
{
|
||||
@ -177,7 +180,8 @@ int update_recv_surfcmds(rdpUpdate* update, wStream* s)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static BOOL update_write_surfcmd_bitmap_header_ex(wStream* s, const TS_COMPRESSED_BITMAP_HEADER_EX* header)
|
||||
static BOOL update_write_surfcmd_bitmap_header_ex(wStream* s,
|
||||
const TS_COMPRESSED_BITMAP_HEADER_EX* header)
|
||||
{
|
||||
if (!s || !header)
|
||||
return FALSE;
|
||||
@ -189,7 +193,6 @@ static BOOL update_write_surfcmd_bitmap_header_ex(wStream* s, const TS_COMPRESSE
|
||||
Stream_Write_UINT32(s, header->lowUniqueId);
|
||||
Stream_Write_UINT64(s, header->tmMilliseconds);
|
||||
Stream_Write_UINT64(s, header->tmSeconds);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -232,7 +235,6 @@ BOOL update_write_surfcmd_surface_bits(wStream* s, const SURFACE_BITS_COMMAND* c
|
||||
Stream_Write_UINT16(s, cmd->destTop);
|
||||
Stream_Write_UINT16(s, cmd->destRight);
|
||||
Stream_Write_UINT16(s, cmd->destBottom);
|
||||
|
||||
return update_write_surfcmd_bitmap_ex(s, &cmd->bmp);
|
||||
}
|
||||
|
||||
|
@ -32,8 +32,8 @@
|
||||
|
||||
static const AUDIO_FORMAT supported_audio_formats[] =
|
||||
{
|
||||
{ WAVE_FORMAT_PCM, 2, 44100, 176400, 4, 16, NULL },
|
||||
{ WAVE_FORMAT_ALAW, 2, 22050, 44100, 2, 8, NULL }
|
||||
{ WAVE_FORMAT_PCM, 2, 44100, 176400, 4, 16, 0, NULL },
|
||||
{ WAVE_FORMAT_ALAW, 2, 22050, 44100, 2, 8, 0, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
@ -62,7 +62,8 @@ static UINT mf_peer_audin_open_result(audin_server_context* context, UINT32 resu
|
||||
*
|
||||
* @return 0 on success, otherwise a Win32 error code
|
||||
*/
|
||||
static UINT mf_peer_audin_receive_samples(audin_server_context* context, const void* buf, int nframes)
|
||||
static UINT mf_peer_audin_receive_samples(audin_server_context* context, const void* buf,
|
||||
int nframes)
|
||||
{
|
||||
return CHANNEL_RC_OK;
|
||||
}
|
||||
@ -72,15 +73,13 @@ void mf_peer_audin_init(mfPeerContext* context)
|
||||
context->audin = audin_server_context_new(context->vcm);
|
||||
context->audin->rdpcontext = &context->_p;
|
||||
context->audin->data = context;
|
||||
|
||||
context->audin->server_formats = supported_audio_formats;
|
||||
context->audin->num_server_formats = sizeof(supported_audio_formats) / sizeof(supported_audio_formats[0]);
|
||||
|
||||
context->audin->num_server_formats = sizeof(supported_audio_formats) / sizeof(
|
||||
supported_audio_formats[0]);
|
||||
context->audin->dst_format.wFormatTag = 1;
|
||||
context->audin->dst_format.nChannels = 2;
|
||||
context->audin->dst_format.nSamplesPerSec = 44100;
|
||||
context->audin->dst_format.wBitsPerSample = 16;
|
||||
|
||||
context->audin->Opening = mf_peer_audin_opening;
|
||||
context->audin->OpenResult = mf_peer_audin_open_result;
|
||||
context->audin->ReceiveSamples = mf_peer_audin_receive_samples;
|
||||
|
@ -91,10 +91,9 @@ static void mf_peer_rfx_update(freerdp_peer* client)
|
||||
RFX_RECT rect;
|
||||
rdpUpdate* update;
|
||||
mfPeerContext* mfp;
|
||||
SURFACE_BITS_COMMAND* cmd;
|
||||
SURFACE_BITS_COMMAND cmd = { 0 };
|
||||
update = client->update;
|
||||
mfp = (mfPeerContext*) client->context;
|
||||
cmd = &update->surface_bits_command;
|
||||
s = mfp->s;
|
||||
Stream_Clear(s);
|
||||
Stream_SetPosition(s, 0);
|
||||
@ -113,19 +112,18 @@ static void mf_peer_rfx_update(freerdp_peer* client)
|
||||
return;
|
||||
}
|
||||
|
||||
memset(cmd, 0, sizeof(SURFACE_BITS_COMMAND));
|
||||
cmd->destLeft = x;
|
||||
cmd->destTop = y;
|
||||
cmd->destRight = x + rect.width;
|
||||
cmd->destBottom = y + rect.height;
|
||||
cmd->bmp.bpp = 32;
|
||||
cmd->bmp.codecID = 3;
|
||||
cmd->bmp.width = rect.width;
|
||||
cmd->bmp.height = rect.height;
|
||||
cmd->bmp.bitmapDataLength = Stream_GetPosition(s);
|
||||
cmd->bmp.bitmapData = Stream_Buffer(s);
|
||||
cmd.destLeft = x;
|
||||
cmd.destTop = y;
|
||||
cmd.destRight = x + rect.width;
|
||||
cmd.destBottom = y + rect.height;
|
||||
cmd.bmp.bpp = 32;
|
||||
cmd.bmp.codecID = 3;
|
||||
cmd.bmp.width = rect.width;
|
||||
cmd.bmp.height = rect.height;
|
||||
cmd.bmp.bitmapDataLength = Stream_GetPosition(s);
|
||||
cmd.bmp.bitmapData = Stream_Buffer(s);
|
||||
//send
|
||||
update->SurfaceBits(update->context, cmd);
|
||||
update->SurfaceBits(update->context, &cmd);
|
||||
//clean up... maybe?
|
||||
}
|
||||
|
||||
|
@ -40,13 +40,13 @@ static void* read_image(const char* src, size_t* size)
|
||||
|
||||
if (!a)
|
||||
{
|
||||
fprintf(stderr, "Failed malloc %ld bytes\n", src_size);
|
||||
fprintf(stderr, "Failed malloc %"PRId64" bytes\n", src_size);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (fread(a, sizeof(char), src_size, fsrc) != src_size)
|
||||
{
|
||||
fprintf(stderr, "Failed read %ld bytes\n", src_size);
|
||||
fprintf(stderr, "Failed read %"PRId64" bytes\n", src_size);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user