Add helper functions to zero callback and configuration structures for better source compatibility with future versions

This commit is contained in:
Cameron Gutman 2015-08-15 10:06:00 -07:00
parent 7500382c26
commit ad7d0ef218
2 changed files with 29 additions and 1 deletions

View File

@ -32,6 +32,9 @@ typedef struct _STREAM_CONFIGURATION {
char remoteInputAesIv[16];
} STREAM_CONFIGURATION, *PSTREAM_CONFIGURATION;
// Use this function to zero the stream configuration when allocated on the stack or heap
void LiInitializeStreamConfiguration(PSTREAM_CONFIGURATION streamConfig);
typedef struct _LENTRY {
// Pointer to the next entry or NULL if this is the last entry
struct _LENTRY *next;
@ -82,6 +85,9 @@ typedef struct _DECODER_RENDERER_CALLBACKS {
int capabilities;
} DECODER_RENDERER_CALLBACKS, *PDECODER_RENDERER_CALLBACKS;
// Use this function to zero the video callbacks when allocated on the stack or heap
void LiInitializeVideoCallbacks(PDECODER_RENDERER_CALLBACKS drCallbacks);
// This callback initializes the audio renderer
typedef void(*AudioRendererInit)(void);
@ -98,6 +104,9 @@ typedef struct _AUDIO_RENDERER_CALLBACKS {
int capabilities;
} AUDIO_RENDERER_CALLBACKS, *PAUDIO_RENDERER_CALLBACKS;
// Use this function to zero the audio callbacks when allocated on the stack or heap
void LiInitializeAudioCallbacks(PAUDIO_RENDERER_CALLBACKS arCallbacks);
// Subject to change in future releases
// Use LiGetStageName() for stable stage names
#define STAGE_NONE 0
@ -147,6 +156,9 @@ typedef struct _CONNECTION_LISTENER_CALLBACKS {
ConnListenerDisplayTransientMessage displayTransientMessage;
} CONNECTION_LISTENER_CALLBACKS, *PCONNECTION_LISTENER_CALLBACKS;
// Use this function to zero the connection callbacks when allocated on the stack or heap
void LiInitializeConnectionCallbacks(PCONNECTION_LISTENER_CALLBACKS clCallbacks);
// This function begins streaming.
//
// Callbacks are all optional. Pass NULL for individual callbacks within each struct or pass NULL for the entire struct

View File

@ -16,3 +16,19 @@ int isBeforeSignedInt(int numA, int numB, int ambiguousCase) {
return ambiguousCase;
}
}
void LiInitializeStreamConfiguration(PSTREAM_CONFIGURATION streamConfig) {
memset(streamConfig, 0, sizeof(*streamConfig));
}
void LiInitializeVideoCallbacks(PDECODER_RENDERER_CALLBACKS drCallbacks) {
memset(drCallbacks, 0, sizeof(*drCallbacks));
}
void LiInitializeAudioCallbacks(PAUDIO_RENDERER_CALLBACKS arCallbacks) {
memset(arCallbacks, 0, sizeof(*arCallbacks));
}
void LiInitializeConnectionCallbacks(PCONNECTION_LISTENER_CALLBACKS clCallbacks) {
memset(clCallbacks, 0, sizeof(*clCallbacks));
}