diff --git a/limelight-common/Limelight.h b/limelight-common/Limelight.h index c96ba85..6693e3f 100644 --- a/limelight-common/Limelight.h +++ b/limelight-common/Limelight.h @@ -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 diff --git a/limelight-common/Misc.c b/limelight-common/Misc.c index c85b52f..cb196b1 100644 --- a/limelight-common/Misc.c +++ b/limelight-common/Misc.c @@ -15,4 +15,20 @@ int isBeforeSignedInt(int numA, int numB, int ambiguousCase) { // The sign switch is ambiguous return ambiguousCase; } -} \ No newline at end of file +} + +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)); +}