`Page 1/20
`Saved: 10/26/01, 11:16:04 AM
`Printed for: Implicit
`
`/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`1
`+++++¬
`…
`¬2
`$Id: mp3decoder.c,v 1.20 2001/10/26 16:16:04 guyc Exp $¬
`3
`¬4
`Copyright (c) 2001 BeComm Corporation¬
`5
`¬6
`Filename:¬
`7
`¬8
` mp3decoder.c¬
`9
`¬10
`Abstract:¬
`11
`¬12
` Wrapper for the mpegaudiodecoder class.¬
`13
`¬14
` This could/should become a general-purpose codec filter¬
`15
` for filters implemented via the SOS_IAUDIODECODE interface.¬
`16
`¬17
`Owner:¬
`18
`¬19
` Guy Carpenter (guyc)¬
`20
`¬21
`--------------------------------------------------------------------------
`22
`---*/¬
`…
`¬23
`#define SOS_DEBUG_ZONE "/beads/mp3decoder"¬
`24
`#include <sosstrings.h>¬
`25
`#include <sosmultimedia.h>¬
`26
`¬27
`SOS_SOURCE_VERSION("$Id: mp3decoder.c,v 1.20 2001/10/26 16:16:04 guyc Exp
`28
`$");¬
`…
`¬29
`/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`30
`+++++¬
`…
`Named Constants¬
`31
`--------------------------------------------------------------------------
`32
`---*/¬
`…
`¬33
`/*¬
`34
`* Name of bead¬
`35
`*/¬
`36
`static const char BEAD_NAME[] = "mp3decoder";¬
`37
`¬38
`/*¬
`39
`* Name of library bead uses¬
`40
`
`Page 1 of 20
`
`Implicit Exhibit 2076
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.01/b…/…/main/mp3decoder.c
`Page 2/20
`Saved: 10/26/01, 11:16:04 AM
`Printed for: Implicit
`
` */¬
`41
`#define DECODER_CLASS_NAME "mpegaudiodecoder"¬
`42
`¬43
`/*¬
`44
` * Name of audio context class¬
`45
` */¬
`46
`#define AUDIOCONTEXT_CLASS_NAME "pcmcontext"¬
`47
`¬48
`/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`49
`+++++¬
`…
`Structs¬
`50
`--------------------------------------------------------------------------
`51
`---*/¬
`…
`¬52
`typedef struct _MP3_CONTEXT {¬
`53
` SOS_IAUDIODECODE* IAudioDecode; /* Interface to an audio decoder */¬
`54
` SOS_BOOLEAN FormatIsSet; /* A flag used to determine if the¬
`55
` AudioFormat path attribute has¬
`56
` been set yet*/¬
`57
` SOS_IAUDIOCONTEXT *IInAudioContext;¬
`58
` SOS_IAUDIOCONTEXT* IOutAudioContext;/* Propagates the format of the
`59
`PCM¬
`…
` audio stream down the path. */¬
`60
` SOS_UINT32 BytesPerSample;¬
`61
` SOS_UINT32 SampleCount;¬
`62
`} MP3_CONTEXT;¬
`63
`¬64
`/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`65
`+++++¬
`…
`Helper Functions¬
`66
`++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`67
`+++*/¬
`…
`¬68
`static¬
`69
`void*¬
`70
`Mp3Decoder_PathContextInterfaceGet(¬
`71
` SOS_PATH* Path,¬
`72
` const char * Name,¬
`73
` SOS_INTERFACE_ID InterfaceId¬
`74
`)¬
`75
`{¬
`76
` SOS_STATUS status;¬
`77
` SOS_REGOBJECT *object;¬
`78
` void *interface = NULL;¬
`79
` ¬
`80
`
`Page 2 of 20
`
`Implicit Exhibit 2076
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.01/b…/…/main/mp3decoder.c
`Page 3/20
`Saved: 10/26/01, 11:16:04 AM
`Printed for: Implicit
`
` status = SOS_Path_AttributeGet(¬
`81
` Path,¬
`82
` Name,¬
`83
` &object¬
`84
` );¬
`85
` ¬
`86
` if (SOS_SUCCEEDED(status)) {¬
`87
` status = SOS_RegObject_InterfaceGet(¬
`88
` object,¬
`89
` InterfaceId,¬
`90
` &interface¬
`91
` );¬
`92
` SOS_RegObject_Release(object);¬
`93
` }¬
`94
`¬95
` return interface;¬
`96
`}¬
`97
`¬98
`static¬
`99
`SOS_STATUS¬
`100
`Mp3Decoder_AudioContextCreate(¬
`101
` MP3_CONTEXT* Context,¬
`102
` SOS_PATH* Path¬
`103
`)¬
`104
`{¬
`105
` SOS_STATUS status = SOS_Error;¬
`106
` SOS_IAUDIOCONTEXT *iAudioContext = NULL;¬
`107
`¬
`108
` /*¬
`109
` * If an audio context already exists we will use it to ¬
`110
` * extract the timestamp and pass it along.¬
`111
` */¬
`112
` Context->IInAudioContext = Mp3Decoder_PathContextInterfaceGet(¬
`113
` Path,¬
`114
` SOS_AUDIOCONTEXT_NAME,¬
`115
` SOS_IAUDIOCONTEXT_ID¬
`116
` );¬
`117
`¬
`118
` iAudioContext = SOS_Interface_CreateFromClassName(¬
`119
` AUDIOCONTEXT_CLASS_NAME,¬
`120
` SOS_IAUDIOCONTEXT_ID¬
`121
` );¬
`122
`¬
`123
` SOS_ASSERT_ASSUMPTION(¬
`124
` iAudioContext!=NULL,¬
`125
`
`Page 3 of 20
`
`Implicit Exhibit 2076
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.01/b…/…/main/mp3decoder.c
`Page 4/20
`Saved: 10/26/01, 11:16:04 AM
`Printed for: Implicit
`
`126
`127
`128
`129
`130
`131
`132
`133
`134
`135
`136
`137
`138
`139
`140
`141
`142
`143
`144
`145
`146
`147
`148
`149
`150
`151
`152
`153
`154
`155
`156
`157
`158
`159
`160
`161
`162
`163
`164
`165
`166
`167
`168
`169
`170
`
` "Couldn't create audio context"¬
` );¬
`¬
` if (iAudioContext) {¬
` status = SOS_Path_AttributeSet(¬
` Path,¬
` SOS_AUDIOCONTEXT_NAME,¬
` SOS_Interface_ObjectPeek(iAudioContext)¬
` );¬
` }¬
`¬
` Context->IOutAudioContext = iAudioContext;¬
`¬
` return status;¬
`}¬
`/*++¬
`Routine Name:¬
`¬
` Mp3Decoder_FormatSet¬
`¬
`Routine Description:¬
`¬
` Attempts to set the AudioFormat path attribute for the Path that¬
` is passed in. The AudioFormat path attribute is used by¬
` subsequent beads to determine the format the audio data they are¬
` receiving is in.¬
`¬
`Parameters:¬
`¬
` MP3_CONTEXT* Context - [in]¬
` The session context.¬
`¬
` SOS_PATH* Path - [in]¬
` The path to set the attribute for.¬
`¬
`Return Value:¬
`¬
` SOS_STATUS - ¬
` SOS_Success if everything succeeded.¬
`¬
` SOS_True if more data is required to determine the audio format.¬
`¬
` other error codes are returned if an error occuerd¬
`¬
`--*/¬
`
`Page 4 of 20
`
`Implicit Exhibit 2076
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.01/b…/…/main/mp3decoder.c
`Page 5/20
`Saved: 10/26/01, 11:16:04 AM
`Printed for: Implicit
`
`171
`172
`173
`174
`175
`176
`177
`178
`179
`180
`181
`182
`183
`184
`185
`186
`187
`188
`189
`190
`191
`192
`193
`194
`195
`196
`197
`198
`199
`200
`201
`202
`203
`204
`205
`206
`207
`208
`209
`210
`211
`212
`…
`213
`214
`
`static¬
`SOS_STATUS¬
`Mp3Decoder_FormatSet(¬
` MP3_CONTEXT* Context,¬
` SOS_PATH* Path¬
`)¬
`{¬
` SOS_AUDIO_FORMAT format;¬
` SOS_STATUS status = SOS_Success;¬
`¬
` SOS_DEBUGOUT_FUNC_TRACE("Mp3Decoder_FormatSet called\n");¬
`¬
` status = Context->IAudioDecode->FormatGet(¬
` Context->IAudioDecode,¬
` &format¬
` );¬
`¬
` SOS_DEBUGOUT_MAJOR_EVENT(¬
` "MP3 format is %u/%u/%u\n",¬
` format.Frequency,¬
` format.SampleBits,¬
` format.Channels¬
` );¬
` ¬
` /* check for SOS_Success instead of SOS_SUCCCEEDED¬
` because SOS_True is returned if the¬
` decoder needs more data */¬
` if (SOS_Success == status) {¬
`¬
` status = Context->IOutAudioContext->FormatSet(¬
` Context->IOutAudioContext,¬
` &format¬
` );¬
`¬
` SOS_ASSERT_ASSUMPTION(¬
` SOS_SUCCEEDED(status),¬
` "Could not set format in audio context"¬
` );¬
`¬
` if (SOS_SUCCEEDED(status)) {¬
` Context->FormatIsSet = SOS_True;¬
` Context->BytesPerSample =
`(format.SampleBits+SOS_BITSPERBYTE-1)/¬
` SOS_BITSPERBYTE*format.Channels;¬
` }¬
`
`Page 5 of 20
`
`Implicit Exhibit 2076
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.01/b…/…/main/mp3decoder.c
`Page 6/20
`Saved: 10/26/01, 11:16:04 AM
`Printed for: Implicit
`
`215
`216
`217
`218
`219
`220
`221
`…
`222
`223
`…
`224
`225
`226
`227
`228
`229
`230
`231
`232
`…
`233
`234
`235
`236
`237
`238
`239
`240
`241
`242
`243
`244
`245
`246
`247
`248
`249
`250
`251
`252
`253
`254
`255
`256
`
`¬
` }¬
` ¬
` return status;¬
`}¬
`¬
`/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`+++++¬
`Context create and destory¬
`--------------------------------------------------------------------------
`---*/¬
`¬
`/*++¬
`Routine Name:¬
`¬
` Mp3Decoder_ContextCreate¬
`¬
`Routine Description:¬
`¬
` Attempt to allocate a Mp3Decoder session and all the resources it
`requires.¬
`¬
`Parameters:¬
`¬
` None.¬
`¬
`Return Value:¬
`¬
` MP3_CONTEXT * - ¬
` A valid pointer to a session context on success.¬
`¬
` A NULL pointer if an error occured.¬
`¬
`--*/¬
`static¬
`MP3_CONTEXT *¬
`Mp3Decoder_ContextCreate(¬
` void¬
`)¬
`{¬
` MP3_CONTEXT *context;¬
` SOS_REGOBJECT *decoder;¬
`¬
` SOS_DEBUGOUT_FUNC_TRACE("Mp3Decoder_ContextCreate called\n");¬
`¬
`
`Page 6 of 20
`
`Implicit Exhibit 2076
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.01/b…/…/main/mp3decoder.c
`Page 7/20
`Saved: 10/26/01, 11:16:04 AM
`Printed for: Implicit
`
`257
`258
`259
`260
`261
`262
`263
`264
`265
`266
`267
`268
`269
`270
`271
`272
`273
`274
`275
`276
`277
`278
`279
`280
`281
`282
`283
`284
`285
`286
`287
`288
`289
`290
`291
`292
`293
`294
`295
`296
`297
`298
`299
`300
`301
`
` /* allocate memory for Mp3Decoder session context */¬
` context = SOS_Mem_Alloc(sizeof(*context));¬
`¬
` if (context) {¬
`¬
` SOS_REGOBJECTCLASS* mp3Class;¬
` SOS_memset(context, 0, sizeof(*context));¬
`¬
` /* ask Strings to find the mpegaudiodecoder class */¬
` mp3Class = SOS_RegObjectClass_GetByName(¬
` DECODER_CLASS_NAME¬
` );¬
`¬
` SOS_ASSERT_ASSUMPTION(¬
` mp3Class != NULL,¬
` "Cannot find required decoder object class"¬
` );¬
`¬
` if (NULL != mp3Class) {¬
` /* create a mpegaudiodecoder object */¬
` decoder = SOS_RegObject_Create(mp3Class);¬
` SOS_RegObjectClass_Release(mp3Class);¬
`¬
` /*¬
` * if we were successful in creating an object attempt to¬
` * create a decoder interface¬
` */¬
` if (decoder) {¬
` ¬
` SOS_RegObject_InterfaceGet(¬
` decoder,¬
` SOS_IAUDIODECODE_ID,¬
` (void**)(&context->IAudioDecode)¬
` );¬
` /*¬
` * We now release the decoder object, since¬
` * we no longer need it.¬
` */¬
` SOS_RegObject_Release(decoder);¬
` }¬
` }¬
` /*¬
` * If we failed to find the correct interface,¬
` * we should clean up. This will catch the case¬
` * where the object was not created too.¬
`
`Page 7 of 20
`
`Implicit Exhibit 2076
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.01/b…/…/main/mp3decoder.c
`Page 8/20
`Saved: 10/26/01, 11:16:04 AM
`Printed for: Implicit
`
`302
`303
`304
`305
`306
`307
`308
`309
`310
`311
`312
`313
`314
`315
`316
`317
`318
`319
`320
`321
`322
`323
`324
`325
`326
`327
`328
`329
`330
`331
`332
`333
`334
`335
`336
`337
`338
`339
`340
`341
`342
`343
`344
`345
`346
`
` */¬
` if (!context->IAudioDecode) {¬
` SOS_Mem_Free(context);¬
` context = NULL;¬
` }¬
` }¬
` return context;¬
`}¬
`¬
`/*++¬
`Routine Name:¬
`¬
` Mp3Decoder_ContextDestroy¬
`¬
`Routine Description:¬
`¬
` A helper function use to release all Mp3Decoder context resources.¬
`¬
`Parameters:¬
`¬
` MP3_CONTEXT * Context - [consumed]¬
` An Mp3Decoder context who's resources and memory are to be freed¬
`¬
`Return Value:¬
`¬
` None.¬
`¬
`--*/¬
`static¬
`void¬
`Mp3Decoder_ContextDestroy(¬
` MP3_CONTEXT * Context¬
`)¬
`{¬
` SOS_DEBUGOUT_FUNC_TRACE("Mp3Decoder_ContextDestroy called\n");¬
` ¬
` if (Context) {¬
` SOS_Interface_Release(Context->IAudioDecode);¬
` SOS_Interface_Release(Context->IOutAudioContext);¬
` SOS_Interface_Release(Context->IInAudioContext);¬
` SOS_Mem_Free(Context);¬
` }¬
`}¬
`¬
`/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`
`Page 8 of 20
`
`Implicit Exhibit 2076
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.01/b…/…/main/mp3decoder.c
`Page 9/20
`Saved: 10/26/01, 11:16:04 AM
`Printed for: Implicit
`
`346…
`347
`348
`…
`349
`350
`351
`352
`353
`354
`355
`356
`357
`358
`359
`360
`361
`362
`363
`364
`365
`366
`367
`368
`369
`370
`371
`372
`373
`374
`375
`376
`377
`378
`379
`380
`381
`382
`383
`384
`385
`386
`387
`388
`389
`
`+++++¬
`Edge Handlers¬
`--------------------------------------------------------------------------
`---*/¬
`¬
`/*++¬
`Routine Name:¬
`¬
` Mp3Decoder_KeyCreate¬
`¬
`Routine Description:¬
`¬
` Creates a unique Key and assocates it with the given path every¬
` time it is called. ¬
` A value of SOS_PathBuild_Stop is returned because¬
` whoever comes after Mp3Decoder wants the AudioFormat variable to¬
` be set and it currently is not set until Mp3Decoder_MessageHandler.¬
`¬
`Parameters:¬
`¬
` SOS_PATH *Path - [in]¬
` The new Path to create a Key for¬
`¬
` SOS_MESSAGE *Message - [in]¬
` The first message sent along this path. We could check its¬
` data to make sure it is a valid mp3 but for now it is not used.¬
`¬
`Return Value:¬
`¬
` SOS_STATUS - ¬
` SOS_PathBuild_Stop on success.¬
`¬
` SOS_Error if something goes wrong.¬
`--*/¬
`static¬
`SOS_STATUS¬
`Mp3Decoder_KeyCreate(¬
` SOS_PATH *Path,¬
` SOS_MESSAGE *Message¬
`)¬
`{¬
` static int s_UniqueId;¬
`¬
` SOS_REGOBJECT* uniqueSessionKey = SOS_Int32_Create(s_UniqueId++);¬
` SOS_STATUS status = SOS_Success;¬
`
`Page 9 of 20
`
`Implicit Exhibit 2076
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.…/…/…/main/mp3decoder.c
`Page 10/20
`Saved: 10/26/01, 11:16:04 AM
`Printed for: Implicit
`
`390
`391
`392
`393
`394
`395
`396
`397
`398
`399
`400
`401
`402
`403
`404
`405
`406
`407
`408
`409
`410
`411
`412
`413
`414
`415
`416
`417
`418
`419
`420
`421
`422
`423
`424
`425
`426
`427
`428
`429
`430
`431
`432
`433
`434
`
`¬
` SOS_DEBUGOUT_FUNC_TRACE("Mp3Decoder_KeyCreate called\n");¬
`¬
` if (!uniqueSessionKey) {¬
` status = SOS_Error;¬
` }¬
`¬
` /* set a unique key on the Path */¬
` if (SOS_SUCCEEDED(status)){¬
` status = SOS_Path_SessionKeySet(Path, uniqueSessionKey);¬
` SOS_RegObject_Release(uniqueSessionKey);¬
` }¬
`¬
` return SOS_SUCCEEDED(status) ? SOS_PathBuild_Stop : SOS_Error;¬
`}¬
`¬
`¬
`/*++¬
`Routine Name:¬
`¬
` Mp3Decoder_MessageHandler¬
`¬
`Routine Description:¬
`¬
` Insert Description Here¬
`¬
`Parameters:¬
`¬
` SOS_PATH *Path - [in]¬
` The Path that this message is arriving on. It is used to get¬
` the Mp3Decoder session context.¬
`¬
` SOS_MESSAGE *Message - [consumed]¬
` Message containing mp3 data to be decoded.¬
`¬
`Return Value:¬
`¬
` SOS_STATUS - ¬
` SOS_Success if decode and message send onward were successful.¬
`¬
` SOS_Error otherwise.¬
`¬
`--*/¬
`static¬
`SOS_STATUS¬
`
`Page 10 of 20
`
`Implicit Exhibit 2076
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.…/…/…/main/mp3decoder.c
`Page 11/20
`Saved: 10/26/01, 11:16:04 AM
`Printed for: Implicit
`
`435
`436
`437
`438
`439
`440
`441
`442
`443
`444
`445
`446
`447
`448
`449
`450
`451
`452
`453
`454
`455
`456
`457
`458
`459
`460
`461
`462
`463
`464
`465
`466
`467
`468
`469
`470
`471
`472
`473
`474
`475
`476
`477
`478
`479
`
`Mp3Decoder_MessageHandler(¬
` SOS_PATH *Path,¬
` SOS_MESSAGE *Message¬
`)¬
`{¬
` MP3_CONTEXT * context;¬
` size_t available;¬
` SOS_MESSAGE * outMessage = NULL;¬
` SOS_STATUS status = SOS_Success;¬
` SOS_UINT32 messageBytes = 0;¬
`¬
`¬
` SOS_DEBUGOUT_FUNC_TRACE("Mp3Decoder_MessageHandler\n");¬
`¬
` status = SOS_Path_SessionContextPeek(Path, (void**)&context);¬
`¬
` if (SOS_SUCCEEDED(status)) {¬
`¬
` if (context->IInAudioContext) {¬
` status = context->IInAudioContext->Unpack(¬
` context->IInAudioContext,¬
` Message);¬
` if (SOS_SUCCEEDED(status)) {¬
` SOS_AUDIO_TIMESTAMP timestamp;¬
` status = context->IInAudioContext->TimeStampGet(¬
` context->IInAudioContext,¬
` NULL,¬
` ×tamp);¬
` if (SOS_SUCCEEDED(status)) {¬
` context->SampleCount = timestamp;¬
` }¬
` }¬
` }¬
`¬
` /* hand the mp3 data off to the encoder class */¬
` status = context->IAudioDecode->DataMessagePut(¬
` context->IAudioDecode,¬
` Message¬
` );¬
`¬
` /* set the format for the decoded audio that is sent out */¬
` if (SOS_SUCCEEDED(status) &&¬
` !context->FormatIsSet) {¬
` status = Mp3Decoder_FormatSet(context, Path);¬
` }¬
`
`Page 11 of 20
`
`Implicit Exhibit 2076
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.…/…/…/main/mp3decoder.c
`Page 12/20
`Saved: 10/26/01, 11:16:04 AM
`Printed for: Implicit
`
`480
`481
`482
`483
`484
`485
`486
`487
`488
`489
`490
`491
`492
`493
`494
`495
`496
`497
`498
`499
`500
`501
`502
`503
`504
`505
`506
`507
`508
`509
`510
`511
`512
`513
`514
`515
`516
`517
`518
`519
`520
`521
`522
`523
`524
`
` ¬
` /* Accumulate all available data from the decoder¬
`¬
` Be careful because FormatSet returns SOS_True if it needs¬
` more data¬
` */¬
` while (SOS_Success == status &&¬
` SOS_True == context->IAudioDecode->DataAvailable(¬
` context->IAudioDecode,¬
` &available¬
` )) {¬
` ¬
` size_t returned;¬
` void * data = SOS_Mem_Alloc(available);¬
`¬
` /* if we failed to allocate the memory return error */¬
` if (!data) {¬
` status = SOS_Error;¬
` }¬
`¬
` /* decode a chunk of mp3 data */¬
` if (SOS_SUCCEEDED(status)){¬
` status = context->IAudioDecode->PcmDataGet(¬
` context->IAudioDecode,¬
` data,¬
` available,¬
` &returned¬
` );¬
` }¬
`¬
`#if 0¬
` /* Realloc so we don't waste any extra memory */¬
` if (SOS_SUCCEEDED(status)){¬
` SOS_Mem_Realloc(¬
` data,¬
` returned¬
` );¬
` }¬
`#endif¬
` /* create a message to send decoded audio out in */¬
` if (!outMessage && SOS_SUCCEEDED(status)) {¬
` outMessage = SOS_Message_Create();¬
`¬
` /* failed to allocate message */¬
` if (!outMessage) {¬
`
`Page 12 of 20
`
`Implicit Exhibit 2076
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.…/…/…/main/mp3decoder.c
`Page 13/20
`Saved: 10/26/01, 11:16:04 AM
`Printed for: Implicit
`
`525
`526
`527
`528
`529
`530
`531
`532
`533
`534
`535
`536
`537
`538
`539
`540
`541
`542
`543
`544
`545
`546
`547
`548
`549
`550
`551
`552
`…
`553
`554
`555
`556
`557
`558
`559
`560
`561
`562
`563
`564
`565
`566
`567
`568
`
` status = SOS_Error;¬
` }¬
` }¬
`¬
` /* put the decoded audio into a message */¬
` if (SOS_SUCCEEDED(status)) {¬
` status = SOS_Message_TailDataPush(¬
` outMessage,¬
` data,¬
` returned,¬
` SOS_Mem_Free¬
` );¬
` data = NULL;¬
` messageBytes += returned;¬
` }¬
`¬
` /* if we failed to put data into a message destroy it */¬
` if (data) {¬
` SOS_Mem_Free(data);¬
` }¬
` }¬
`¬
` /* If a message was created, send it */¬
` if (SOS_SUCCEEDED(status) && outMessage) {¬
`¬
` /* add any encapsulation required by audio context */¬
` if (SOS_SUCCEEDED(status)) {¬
` SOS_UINT32 messageSamples = messageBytes /
`context->BytesPerSample;¬
`¬
` status = context->IOutAudioContext->TimeStampSet(¬
` context->IOutAudioContext,¬
` context->SampleCount¬
` );¬
`¬
` context->SampleCount += messageSamples;¬
` }¬
` ¬
` if (SOS_SUCCEEDED(status)) { ¬
` status = context->IOutAudioContext->Pack(¬
` context->IOutAudioContext,¬
` outMessage);¬
` }¬
`¬
` if (SOS_SUCCEEDED(status)) {¬
`
`Page 13 of 20
`
`Implicit Exhibit 2076
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.…/…/…/main/mp3decoder.c
`Page 14/20
`Saved: 10/26/01, 11:16:04 AM
`Printed for: Implicit
`
`569
`570
`571
`572
`573
`574
`575
`576
`577
`578
`579
`580
`581
`582
`583
`584
`585
`586
`587
`…
`588
`589
`…
`590
`591
`592
`593
`594
`595
`596
`597
`598
`599
`600
`601
`602
`603
`604
`605
`606
`607
`608
`609
`610
`611
`
` status = SOS_Path_MessageSend(¬
` Path,¬
` outMessage¬
` );¬
` outMessage = NULL;¬
` }¬
` ¬
` }¬
` /* if error occured do not send message on */¬
` }¬
`¬
` if (outMessage){¬
` SOS_Message_Destroy( outMessage);¬
` }¬
`¬
` return SOS_SUCCEEDED(status) ? SOS_Success : SOS_Error;¬
`}¬
`¬
`/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`+++++¬
`Session init and uninit¬
`++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`+++*/¬
`¬
`/*++¬
`Routine Name:¬
`¬
` Mp3Decoder_SessionInit¬
`¬
`Routine Description:¬
`¬
` Called by Strings when Mp3Decoder_KeyCreate returns that a new¬
` Mp3Decoder session should be created. It allocates a session¬
` context and assocates it with the Path that is passed in.¬
`¬
`Parameters:¬
`¬
` SOS_PATH *Path - [in]¬
` The path assocated with the mp3decoder to be created.¬
`¬
`Return Value:¬
`¬
` SOS_STATUS - ¬
` SOS_Success if a context was created and succesfully assocated¬
` with a path.¬
`
`Page 14 of 20
`
`Implicit Exhibit 2076
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.…/…/…/main/mp3decoder.c
`Page 15/20
`Saved: 10/26/01, 11:16:04 AM
`Printed for: Implicit
`
`612
`613
`614
`615
`616
`617
`618
`619
`620
`621
`622
`623
`624
`625
`626
`627
`628
`629
`630
`631
`632
`633
`634
`635
`636
`637
`638
`639
`640
`641
`642
`643
`644
`645
`646
`647
`648
`649
`650
`651
`652
`653
`654
`655
`656
`
`¬
` SOS_Error otherwise.¬
`¬
`--*/¬
`static¬
`SOS_STATUS¬
`Mp3Decoder_SessionInit(¬
` SOS_PATH *Path¬
`)¬
`{¬
` SOS_STATUS status = SOS_Success;¬
` MP3_CONTEXT *context = Mp3Decoder_ContextCreate();¬
`¬
` SOS_DEBUGOUT_FUNC_TRACE("Mp3Decoder_SessionInit called\n");¬
`¬
` if (context) {¬
` /* add an audio context to the path context */¬
` status = Mp3Decoder_AudioContextCreate(context, Path);¬
` if (SOS_SUCCEEDED(status)) {¬
` /* assocate the new context with a path */¬
` status = SOS_Path_SessionContextPut(Path, context);¬
` }¬
` } else {¬
` /* could not create context */¬
` status = SOS_Error;¬
` }¬
` ¬
` return status;¬
`}¬
`¬
`/*++¬
`Routine Name:¬
`¬
` Mp3Decoder_SessionUninit¬
`¬
`Routine Description:¬
`¬
` Called by Strings to free all memory assocated with this session¬
` of mp3decoder.¬
`¬
`Parameters:¬
`¬
` SOS_PATH *Path - [in]¬
` The path assocated with the mp3decoder to be destroyed.¬
`¬
`
`Page 15 of 20
`
`Implicit Exhibit 2076
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.…/…/…/main/mp3decoder.c
`Page 16/20
`Saved: 10/26/01, 11:16:04 AM
`Printed for: Implicit
`
`657
`658
`659
`660
`661
`662
`663
`664
`665
`666
`667
`668
`669
`670
`671
`672
`673
`674
`675
`676
`677
`678
`679
`680
`681
`682
`683
`684
`685
`…
`686
`687
`…
`688
`689
`690
`691
`692
`693
`694
`695
`696
`697
`698
`699
`
`Return Value:¬
`¬
` SOS_STATUS - ¬
` SOS_Success always.¬
`¬
`--*/¬
`static¬
`SOS_STATUS¬
`Mp3Decoder_SessionUninit(¬
` SOS_PATH *Path¬
`)¬
`{¬
` SOS_STATUS status;¬
` MP3_CONTEXT *context;¬
`¬
` SOS_DEBUGOUT_FUNC_TRACE("Mp3Decoder_SessionUninit called\n");¬
`¬
` /* find the session context assocated with this path */¬
` status = SOS_Path_SessionContextPeek(Path, (void**)&context);¬
`¬
` /* make sure we found a valid context */¬
` if (SOS_SUCCEEDED(status) && context) {¬
` Mp3Decoder_ContextDestroy(context);¬
` }¬
`¬
` return SOS_Success;¬
`}¬
`¬
`/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`+++++¬
`Bead init and uninit¬
`++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`+++*/¬
`¬
`/*++¬
`Routine Name:¬
`¬
` Mp3Decoder_BeadInit¬
`¬
`Routine Description:¬
`¬
` This function is called by Strings when the mp3decoder bead is¬
` registerd. We use it to register one edge assocated with the¬
` mp3decoder bead.¬
` ¬
`
`Page 16 of 20
`
`Implicit Exhibit 2076
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.…/…/…/main/mp3decoder.c
`Page 17/20
`Saved: 10/26/01, 11:16:04 AM
`Printed for: Implicit
`
`700
`701
`702
`703
`704
`705
`706
`707
`708
`709
`710
`711
`712
`713
`714
`715
`716
`717
`718
`719
`720
`721
`722
`723
`724
`725
`726
`727
`728
`729
`730
`731
`732
`733
`734
`735
`736
`737
`738
`739
`740
`741
`742
`743
`744
`
`Parameters:¬
`¬
` SOS_BEAD *Bead - [in]¬
` A reference to the mp3decoder bead. We use this parameter to¬
` register edges assocated with the mp3decoder bead.¬
`¬
` SOS_REGOBJECT *InitContext - [in]¬
` Set to NULL because thats the value we passed into the bead¬
` register function.¬
`¬
`Return Value:¬
`¬
` SOS_STATUS - ¬
` The return value of our call to SOS_Edge_Register.¬
`¬
`--*/¬
`static¬
`SOS_STATUS¬
`Mp3Decoder_BeadInit(¬
` SOS_BEAD *Bead,¬
` SOS_REGOBJECT *InitContext¬
`)¬
`{¬
` SOS_STATUS status;¬
` ¬
` SOS_DEBUGOUT_FUNC_TRACE("BeadInit called\n");¬
` /* register Encode Edge */¬
` status = SOS_Edge_Register(¬
` Bead,¬
` "Decode",¬
` NULL,¬
` NULL,¬
` NULL,¬
` Mp3Decoder_KeyCreate,¬
` Mp3Decoder_MessageHandler,¬
` NULL,¬
` NULL,¬
` NULL,¬
` NULL);¬
`¬
` if (SOS_FAILED(status)) {¬
` SOS_DEBUGOUT_MAJOR_EVENT( "Could not register Decode edge");¬
` }¬
` return status;¬
`}¬
`
`Page 17 of 20
`
`Implicit Exhibit 2076
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.…/…/…/main/mp3decoder.c
`Page 18/20
`Saved: 10/26/01, 11:16:04 AM
`Printed for: Implicit
`
`745
`746
`747
`748
`749
`750
`751
`752
`753
`754
`755
`756
`757
`758
`759
`760
`761
`762
`763
`764
`765
`766
`767
`768
`769
`770
`771
`772
`773
`774
`775
`776
`…
`777
`778
`…
`779
`780
`781
`782
`783
`784
`785
`786
`787
`
`¬
`/*++¬
`Routine Name:¬
`¬
` Mp3Decoder_BeadUninit¬
`¬
`Routine Description:¬
`¬
` Called when Strings attempts to unload the Bead.¬
`¬
`Parameters:¬
`¬
` void *BeadContext - [in]¬
` NULL because SOS_Bead_ContextPut is never called by mp3decoder¬
`¬
`Return Value:¬
`¬
` SOS_STATUS - ¬
` Always SOS_Success¬
`¬
`--*/¬
`static¬
`SOS_STATUS¬
`Mp3Decoder_BeadUninit(¬
` void *BeadContext¬
`)¬
`{¬
` SOS_DEBUGOUT_FUNC_TRACE("BeadUninit called\n");¬
` return SOS_Success;¬
`}¬
`¬
`/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`+++++¬
`Module init and uninit¬
`++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`+++*/¬
`¬
`/*+¬
`Routine Name:¬
`¬
` SOS_ModuleInit¬
`¬
`Routine Description:¬
`¬
` Called by Strings when this object file is loaded. It registers¬
`
`Page 18 of 20
`
`Implicit Exhibit 2076
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.…/…/…/main/mp3decoder.c
`Page 19/20
`Saved: 10/26/01, 11:16:04 AM
`Printed for: Implicit
`
`788
`789
`790
`791
`792
`793
`794
`795
`796
`797
`798
`799
`800
`801
`802
`803
`804
`805
`806
`807
`808
`809
`810
`811
`812
`813
`814
`815
`816
`817
`818
`819
`820
`821
`822
`823
`824
`825
`826
`827
`828
`829
`830
`831
`832
`
` the mp3decoder bead with Strings.¬
`¬
`Parameters:¬
`¬
` SOS_OBJECTFILE* ObjectFile - [in]¬
` The object file that is being loaded. ¬
`¬
` SOS_REGOBJECT* RegistryHandle - [in]¬
` A pointer to a configuration file for this objectfile¬
` (currently NULL)¬
`¬
`Return Value:¬
`¬
` SOS_STATUS - ¬
` SOS_Success, is returned is SOS_Bead_Register succeeded¬
` otherwise an error code is returned.¬
`¬
`--*/¬
`SOS_STATUS¬
`SOS_ModuleInit (¬
` SOS_OBJECTFILE *ObjectFile,¬
` SOS_REGOBJECT *InitContext¬
`)¬
`{¬
` SOS_STATUS status;¬
` ¬
` SOS_DEBUGOUT_FUNC_TRACE("SOS_ModuleInit called\n");¬
`¬
` /* register the Bead */¬
` status = SOS_Bead_Register(¬
` ObjectFile,¬
` BEAD_NAME,¬
` NULL, /* Bead context */¬
` Mp3Decoder_BeadInit,¬
` Mp3Decoder_BeadUninit,¬
` Mp3Decoder_SessionInit,¬
` Mp3Decoder_SessionUninit¬
` );¬
`¬
` return status;¬
`}¬
`¬
`/*+¬
`Routine Name:¬
`¬
`
`Page 19 of 20
`
`Implicit Exhibit 2076
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.…/…/…/main/mp3decoder.c
`Page 20/20
`Saved: 10/26/01, 11:16:04 AM
`Printed for: Implicit
`
` SOS_ModuleUninit¬
`¬
`Routine Description:¬
`¬
` Called by Strings when this object file is unloaded. It does¬
` nothing because the mp3decoder bead is unloaded before the¬
` module uninit is ever called.¬
`¬
`Parameters:¬
`¬
` SOS_OBJECTFILE* ObjectFile - [in]¬
` The object file that is being unloaded.¬
`¬
`Return Value:¬
`¬
` None.¬
`¬
`--*/¬
`void¬
`SOS_ModuleUninit (¬
` SOS_OBJECTFILE *ObjectFile¬
`)¬
`{¬
` SOS_DEBUGOUT_FUNC_TRACE("SOS_ModuleUninit called\n");¬
`}¬
`
`833
`834
`835
`836
`837
`838
`839
`840
`841
`842
`843
`844
`845
`846
`847
`848
`849
`850
`851
`852
`853
`854
`855
`856
`857
`858
`
`Page 20 of 20
`
`Implicit Exhibit 2076
`Sonos v. Implicit, IPR2018-0766, -0767
`
`