throbber
/Users/implicit/Desktop/Source Code/2001.11.01/bea…/…/main/avidemux.c
`Page 1/27
`Saved: 10/2/01, 4:07:24 PM
`Printed for: Implicit
`
`/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`1
`++++++¬
`…
`¬2
`Copyright (c) 2001 BeComm Corporation¬
`3
`¬4
`Filename:¬
`5
`¬6
` avidemux.c¬
`7
`¬8
`Group Overview:¬
`9
`¬10
` Extracts the incoming avi data stream into audio and¬
`11
` video. Video is sent along the main path, while audio¬
`12
` is forked onto a new child path.¬
`13
`¬14
`Owner:¬
`15
`¬16
` Guy Carpenter (guyc) 17-Jul-2001¬
`17
`¬18
`-------------------------------------------------------------------------
`19
`----*/¬
`…
`¬20
`#define SOS_DEBUG_ZONE "/beads/avidemux"¬
`21
`¬22
`#include <sosstrings.h>¬
`23
`#include <sosmultimedia.h>¬
`24
`#include "riffparser.h"¬
`25
`#include "aviformat.h"¬
`26
`#include "wavformat.h"¬
`27
`#include "bmpformat.h"¬
`28
`¬29
`SOS_SOURCE_VERSION (¬
`30
` "$Id: avidemux.c,v 1.36 2001/10/02 21:07:24 guyc Exp $"¬
`31
`);¬
`32
`¬33
`#define BEAD_NAME "avidemux"¬
`34
`¬35
`/*¬
`36
`* Name of audio context to use if we get a pcm audio stream¬
`37
`*/¬
`38
`#define AUDIOCONTEXT_CLASS "pcmcontext"¬
`39
`/*¬
`40
`* Name of video context to use if we get a bmp audio stream.¬
`41
`*/¬
`42
`#define VIDEOCONTEXT_CLASS "rgbcontext"¬
`43
`
`Page 1 of 27
`
`Implicit Exhibit 2043
`Sonos v. Implicit, IPR2018-0766, -0767
`
`

`

`/Users/implicit/Desktop/Source Code/2001.11.01/bea…/…/main/avidemux.c
`Page 2/27
`Saved: 10/2/01, 4:07:24 PM
`Printed for: Implicit
`
`/*¬
`44
` * Name of sample clock class¬
`45
` */¬
`46
`#define SAMPLECLOCK_CLASS "sampleclock"¬
`47
`¬48
`/*¬
`49
` * Specify level of detail in debug prints, from¬
`50
` * minimum to maximum the useful values are:¬
`51
` * 0 : no output¬
`52
` * SOS_DEBUG_LEVEL_FuncTrace : basic procedure entry logging¬
`53
` * SOS_DEBUG_LEVEL_DataTrace : data format logging¬
`54
` * SOS_DEBUG_LEVEL_Detail : per-chunk logging¬
`55
` */¬
`56
`#define DEBUG_LEVEL SOS_DEBUG_LEVEL_DataTrace¬
`57
`¬58
`/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`59
`++++++¬
`…
`Configuration¬
`60
`+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`61
`++++*/¬
`…
`¬62
`/*¬
`63
` * The following parameters should really be set through¬
`64
` * the InitContext.¬
`65
` */¬
`66
`¬67
`/*¬
`68
` * Maximum queue size (in messages) of the audio path¬
`69
` */¬
`70
`#define AUDIO_MAX_QUEUE_LENGTH "50"¬
`71
`/*¬
`72
` * play only 1 in N frame - useful on slow machines.¬
`73
` */¬
`74
`#define VIDEO_DECIMATE 1 /* 1 means play every frame */¬
`75
`¬76
`/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`77
`++++++¬
`…
`Structures¬
`78
`+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`79
`++++*/¬
`…
`¬80
`/*¬
`81
` * AVIDEMUX_CONTEXT is the session context for the bead. Each¬
`82
` * active session of this bead will get it's own copy of this¬
`83
` * structure.¬
`84
`
`Page 2 of 27
`
`Implicit Exhibit 2043
`Sonos v. Implicit, IPR2018-0766, -0767
`
`

`

`/Users/implicit/Desktop/Source Code/2001.11.01/bea…/…/main/avidemux.c
`Page 3/27
`Saved: 10/2/01, 4:07:24 PM
`Printed for: Implicit
`
` */¬
`85
`typedef struct _AVIDEMUX_CONTEXT {¬
`86
` RIFF_CONTEXT * Riff; /* riff parser */¬
`87
` RIFF_CHUNK * Chunk; /* current riff chunk */¬
`88
` SOS_UINT32 StreamIndex; /* counts streams in avi */¬
`89
` ¬
`90
` SOS_UINT32 VidStreamId; /* fourcc identifier */¬
`91
` SOS_UINT32 VidStreamIndex; /* index of video stream */¬
`92
` SOS_UINT32 VidFrameNumber; /* count of sent frames */¬
`93
` BMP_FORMAT VidStreamFormat;/* bmp format header */¬
`94
` SOS_UINT32 VidFrameRate; /* frame rate numerator */¬
`95
` SOS_UINT32 VidFrameRateDivisor; /* frame rate div */¬
`96
` SOS_IVIDEOCONTEXT * IVideoContext; /* progagates format */¬
`97
`¬98
` SOS_PATH * AudioPath; /* path for audio output */¬
`99
` SOS_UINT32 AudStreamId; /* fourcc identifier */¬
`100
` SOS_UINT32 AudStreamIndex; /* index of audio stream */¬
`101
` WAV_FORMAT AudStreamFormat;/* audio format from wav */¬
`102
` SOS_IAUDIOCONTEXT * IAudioContext; /* propagates format */¬
`103

`104
` SOS_ISAMPLECLOCK * IAudioClock; /* master sample clock */¬
`105
` SOS_ISAMPLECLOCK * IVideoClock; /* slave sample clock */¬
`106

`107
` SOS_UINT32 AudioSampleCount;/* total samples sent */¬
`108
` SOS_UINT32 AudioSampleBytes;/* bytes per sample */¬
`109
`} AVIDEMUX_CONTEXT;¬
`110

`111
`/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`112
`++++++¬
`…
`Debug Output Functions¬
`113
`+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`114
`++++*/¬
`…

`115
`/*¬
`116
` * Print out the avi header for debugging¬
`117
` */¬
`118
`static¬
`119
`void¬
`120
`DumpAviHeader(¬
`121
` AVI_HEADER * AviHeader¬
`122
`)¬
`123
`{¬
`124
` SOS_DEBUGOUT_DATA_TRACE(¬
`125
` "MicroSecPerFrame %u\n"¬
`126
` "MaxBytesPerSec %u\n"¬
`127
`
`Page 3 of 27
`
`Implicit Exhibit 2043
`Sonos v. Implicit, IPR2018-0766, -0767
`
`

`

`/Users/implicit/Desktop/Source Code/2001.11.01/bea…/…/main/avidemux.c
`Page 4/27
`Saved: 10/2/01, 4:07:24 PM
`Printed for: Implicit
`
`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
`171
`172
`
` "Reserved1 %u\n"¬
` "Flags %u\n"¬
` "TotalFrames %u\n"¬
` "InitialFrames %u\n"¬
` "Streams %u\n"¬
` "SuggestedBufferSize %u\n"¬
` "Width %u\n"¬
` "Height %u\n"¬
` "Scale %u\n"¬
` "Rate %u\n"¬
` "Start %u\n"¬
` "Length %u\n\n",¬
` AviHeader->MicroSecPerFrame,¬
` AviHeader->MaxBytesPerSec,¬
` AviHeader->Reserved1,¬
` AviHeader->Flags,¬
` AviHeader->TotalFrames,¬
` AviHeader->InitialFrames,¬
` AviHeader->Streams,¬
` AviHeader->SuggestedBufferSize,¬
` AviHeader->Width,¬
` AviHeader->Height,¬
` AviHeader->Scale,¬
` AviHeader->Rate,¬
` AviHeader->Start,¬
` AviHeader->Length¬
` );¬
`}¬

`/*¬
` * Print out the avi stream header for debugging¬
` */¬
`static¬
`void¬
`DumpAviStreamHeader(¬
` AVI_STREAMHEADER *AviStreamHeader¬
`)¬
`{¬
` SOS_DEBUGOUT_DATA_TRACE(¬
` "Type %.4s [%lx]\n"¬
` "Handler %.4s\n"¬
` "Flags %u\n"¬
` "Reserved1 %u\n"¬
` "InitialFrames %u\n"¬
` "Scale %u\n"¬
`
`Page 4 of 27
`
`Implicit Exhibit 2043
`Sonos v. Implicit, IPR2018-0766, -0767
`
`

`

`/Users/implicit/Desktop/Source Code/2001.11.01/bea…/…/main/avidemux.c
`Page 5/27
`Saved: 10/2/01, 4:07:24 PM
`Printed for: Implicit
`
`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
`215
`216
`217
`
` "Rate %u\n"¬
` "Length %u\n"¬
` "SuggestedBufferSize %u\n"¬
` "Quality %u\n"¬
` "SampleSize %u\n"¬
` "Reserved2 %u\n"¬
` "Reserved3 %u\n\n",¬
` &AviStreamHeader->Type,¬
` AviStreamHeader->Type,¬
` &AviStreamHeader->Handler,¬
` AviStreamHeader->Flags,¬
` AviStreamHeader->Reserved1,¬
` AviStreamHeader->InitialFrames,¬
` AviStreamHeader->Scale,¬
` AviStreamHeader->Rate,¬
` AviStreamHeader->Start,¬
` AviStreamHeader->Length,¬
` AviStreamHeader->SuggestedBufferSize,¬
` AviStreamHeader->Quality,¬
` AviStreamHeader->SampleSize,¬
` AviStreamHeader->Reserved2,¬
` AviStreamHeader->Reserved3¬
` );¬
`}¬

`/*¬
` * Print out the wav format header for debugging¬
` */¬
`static¬
`void¬
`DumpWavFormat(¬
` WAV_FORMAT * WavFormat¬
`)¬
`{¬
` ¬
` SOS_DEBUGOUT_DATA_TRACE(¬
` "WAV Header:\n"¬
` "FormatTag %u\n"¬
` "Channels %u\n"¬
` "SamplesPerSec %lu\n"¬
` "AvgBytesPerSec %lu\n"¬
` "BlockAlign %u\n"¬
` "BitsPerSample %u\n"¬
` "Size %u\n\n",¬
` WavFormat->FormatTag,¬
`
`Page 5 of 27
`
`Implicit Exhibit 2043
`Sonos v. Implicit, IPR2018-0766, -0767
`
`

`

`/Users/implicit/Desktop/Source Code/2001.11.01/bea…/…/main/avidemux.c
`Page 6/27
`Saved: 10/2/01, 4:07:24 PM
`Printed for: Implicit
`
`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
`257
`258
`259
`260
`261
`262
`
` WavFormat->Channels,¬
` WavFormat->SamplesPerSec,¬
` WavFormat->AvgBytesPerSec,¬
` WavFormat->BlockAlign,¬
` WavFormat->BitsPerSample,¬
` WavFormat->Size¬
` );¬
`}¬

`/*¬
` * Print out the wav format header for debugging¬
` */¬
`static¬
`void¬
`DumpBmpFormat(¬
` BMP_FORMAT * BmpFormat¬
`)¬
`{¬
` ¬
` SOS_DEBUGOUT_DATA_TRACE(¬
` "BMP Header:\n"¬
` "Size %lu\n"¬
` "Width %ld\n"¬
` "Height %ld\n"¬
` "Planes %u\n"¬
` "BitCount %u\n"¬
` "Compression %lu\n"¬
` "SizeImage %lu\n"¬
` "XPixelsPerMeter %d\n"¬
` "YPixelsPerMeter %d\n"¬
` "ClrUsed %lu\n"¬
` "ClrImportant %lu\n\n",¬
` BmpFormat->Size,¬
` BmpFormat->Width,¬
` BmpFormat->Height,¬
` BmpFormat->Planes,¬
` BmpFormat->BitCount,¬
` BmpFormat->Compression,¬
` BmpFormat->SizeImage,¬
` BmpFormat->XPixelsPerMeter,¬
` BmpFormat->YPixelsPerMeter,¬
` BmpFormat->ClrUsed,¬
` BmpFormat->ClrImportant¬
` );¬
`}¬
`
`Page 6 of 27
`
`Implicit Exhibit 2043
`Sonos v. Implicit, IPR2018-0766, -0767
`
`

`

`/Users/implicit/Desktop/Source Code/2001.11.01/bea…/…/main/avidemux.c
`Page 7/27
`Saved: 10/2/01, 4:07:24 PM
`Printed for: Implicit
`
`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
`302
`303
`304
`305
`

`/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`++++++¬

`+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`++++*/¬

`/*++¬
`Routine Name:¬

` AviDemux_AudioFormatSet¬

`Routine Description:¬

` Used only for raw pcm audio streams. Creates an audio context¬
` containing the audio format. This is stored in the path context¬
` for use by subsequent beads to determine the format of the audio¬
` data they are receiving.¬

`Parameters:¬

` AVIDEMUX_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¬

`--*/¬

`#define SOS_IAUDIOCONTEXT_CREATE(NAME) \¬


`static¬
`SOS_STATUS¬
`AviDemux_AudioFormatSet(¬
` AVIDEMUX_CONTEXT* Context,¬
`
`Page 7 of 27
`
`Implicit Exhibit 2043
`Sonos v. Implicit, IPR2018-0766, -0767
`
`

`

`/Users/implicit/Desktop/Source Code/2001.11.01/bea…/…/main/avidemux.c
`Page 8/27
`Saved: 10/2/01, 4:07:24 PM
`Printed for: Implicit
`
`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
`347
`348
`349
`350
`
` SOS_PATH* Path¬
`)¬
`{¬
` SOS_STATUS status = SOS_Success;¬

` /*¬
` * Create a new audio context.¬
` */¬

` Context->IAudioContext = SOS_Interface_CreateFromClassName(¬
` AUDIOCONTEXT_CLASS,¬
` SOS_IAUDIOCONTEXT_ID¬
` );¬

` SOS_ASSERT_ASSUMPTION(¬
` Context->IAudioContext!=NULL,¬
` "Could not create new audio context"¬
` );¬

` if (Context->IAudioContext) {¬
` SOS_AUDIO_FORMAT format;¬
` format.Frequency = Context->AudStreamFormat.SamplesPerSec;¬
` format.Channels = Context->AudStreamFormat.Channels;¬
` format.SampleBits= Context->AudStreamFormat.BitsPerSample;¬

` SOS_DEBUGOUT_MAJOR_EVENT(¬
` "AVI pcm format is %u/%u/%u\n",¬
` format.Frequency,¬
` format.SampleBits,¬
` format.Channels¬
` );¬

` Context->AudioSampleBytes =¬
` (format.SampleBits+SOS_BITSPERBYTE-1)/¬
` SOS_BITSPERBYTE*format.Channels;¬

` status = Context->IAudioContext->FormatSet(¬
` Context->IAudioContext,¬
` &format¬
` );¬

` /*¬
` * Store the audio context as a path attribute¬
` */¬

`
`Page 8 of 27
`
`Implicit Exhibit 2043
`Sonos v. Implicit, IPR2018-0766, -0767
`
`

`

`/Users/implicit/Desktop/Source Code/2001.11.01/bea…/…/main/avidemux.c
`Page 9/27
`Saved: 10/2/01, 4:07:24 PM
`Printed for: Implicit
`
`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
`390
`391
`392
`393
`394
`395
`
` if (SOS_SUCCEEDED(status)) {¬
` status = SOS_Path_AttributeSet(¬
` Path,¬
` SOS_AUDIOCONTEXT_NAME,¬
` SOS_Interface_ObjectPeek(Context->IAudioContext)¬
` );¬
` }¬

` /*¬
` * Initialize the audio clock and store it in the¬
` * audio path as the master clock.¬
` */¬

`// if (SOS_SUCCEEDED(status)) {¬
`// Context->IAudioClock->FrequencySet(¬
`// Context->IAudioClock,¬
`// format.Frequency,¬
`// SOS_MSPERSECOND¬
`// );¬
`// }¬

` } else {¬
` /* error - couldn't create audio context */¬
` status = SOS_Error;¬
` }¬
` /*¬
` * If everything succeeded we retain a reference to the¬
` * audio context in our context struct.¬
` */¬

` return status;¬
`}¬

`/*¬
` * Create the audio path, assign a content-type¬
` * base on the audio stream format header, and¬
` * set the maximum queue length.¬
` */¬
`static¬
`SOS_STATUS¬
`AudioPrepare(¬
` AVIDEMUX_CONTEXT * Context,¬
` SOS_PATH * ParentPath¬
`)¬
`{¬
`
`Page 9 of 27
`
`Implicit Exhibit 2043
`Sonos v. Implicit, IPR2018-0766, -0767
`
`

`

`/Users/implicit/Desktop/Source Code/2001.11.01/be…/…/main/avidemux.c
`Page 10/27
`Saved: 10/2/01, 4:07:24 PM
`Printed for: Implicit
`
`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
`435
`436
`437
`438
`439
`440
`
` SOS_STATUS status;¬
` SOS_REGOBJECT *contentType;¬
` const char *contentTypeString;¬

` /*¬
` * Create a new path on which to send audio¬
` */¬

` Context->AudioPath = SOS_Path_Create(ParentPath);¬

` /*¬
` * Determine the audio format of the audio stream¬
` */¬

` switch (Context->AudStreamFormat.FormatTag) {¬
` case WAVE_FORMAT_MPEGLAYER3:¬
` contentTypeString = "audio/mp3";¬
` break;¬
` case WAVE_FORMAT_PCM:¬
` contentTypeString = "audio/pcm";¬
` AviDemux_AudioFormatSet(Context, Context->AudioPath);¬
` break;¬
` default:¬
` contentTypeString = "audio/unknown";¬
` SOS_ASSERT_ASSUMPTION(0,"Unsupported audio format");¬
` break;¬
` }¬

` SOS_DEBUGOUT_FUNC_TRACE("Audio format is %s\n",contentTypeString);¬

` /*¬
` * Add the format to the path context for the audio path to¬
` * allow mapping to find the correct codecs enroute to the speaker¬
` */¬
` ¬
` contentType = SOS_String_CreateFromString(contentTypeString);¬

` if (contentType) {¬
` status = SOS_Path_AttributeSet(¬
` Context->AudioPath,¬
` "Content-Type",¬
` contentType);¬
` SOS_RegObject_Release(contentType);¬

` /*¬
`
`Page 10 of 27
`
`Implicit Exhibit 2043
`Sonos v. Implicit, IPR2018-0766, -0767
`
`

`

`/Users/implicit/Desktop/Source Code/2001.11.01/be…/…/main/avidemux.c
`Page 11/27
`Saved: 10/2/01, 4:07:24 PM
`Printed for: Implicit
`
`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
`480
`481
`482
`483
`484
`485
`
` * The audio path is seeded with the same clock for¬
` * both master and render clocks. The audio beads probably wont¬
` * even look at the master clock, but if they do¬
` * they will find that it is always right on time :-)¬
` */¬

` status = SOS_Path_AttributeSet(¬
` Context->AudioPath,¬
` SOS_MASTERCLOCK_NAME,¬
` SOS_Interface_ObjectPeek(Context->IAudioClock)¬
` );¬

` status = SOS_Path_AttributeSet(¬
` Context->AudioPath,¬
` SOS_RENDERCLOCK_NAME,¬
` SOS_Interface_ObjectPeek(Context->IAudioClock)¬
` );¬
` ¬

` /*¬
` * Set the maximum number of messages that can be enqueued on¬
` * a path before it will block pending delivery. Note that¬
` * there is only a queue at the beginning of each path.¬
` * Mid-path message sends are synchronously delivered.¬
` */¬

` status = SOS_Path_QosParameterSet(¬
` Context->AudioPath,¬
` SOS_PATH_QOS_MaxQueueLength,¬
` AUDIO_MAX_QUEUE_LENGTH¬
` );¬
` } else {¬
` status = SOS_ErrorResourceAllocation;¬
` }¬
` ¬
` return status;¬
`}¬

`/*¬
` * Create the video context and fill in values¬
` */¬
`static¬
`SOS_STATUS¬
`VideoPrepare(¬
` AVIDEMUX_CONTEXT * Context,¬
`
`Page 11 of 27
`
`Implicit Exhibit 2043
`Sonos v. Implicit, IPR2018-0766, -0767
`
`

`

`/Users/implicit/Desktop/Source Code/2001.11.01/be…/…/main/avidemux.c
`Page 12/27
`Saved: 10/2/01, 4:07:24 PM
`Printed for: Implicit
`
`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
`525
`526
`527
`528
`…
`
` SOS_PATH * VideoPath¬
`)¬
`{¬
` SOS_STATUS status;¬
` ¬
` Context->IVideoContext = SOS_Interface_CreateFromClassName(¬
` VIDEOCONTEXT_CLASS,¬
` SOS_IVIDEOCONTEXT_ID¬
` );¬

` SOS_ASSERT_ASSUMPTION(¬
` Context->IVideoContext!=NULL,¬
` "Could not create new video context"¬
` );¬

` if (Context->IVideoContext) {¬
` SOS_VIDEO_FORMAT format;¬
` format.Width = Context->VidStreamFormat.Width;¬
` format.Height = Context->VidStreamFormat.Height;¬
` format.Encoding = Context->VidStreamFormat.Compression;¬
` format.FrameRate = Context->VidFrameRate;¬
` format.FrameRateDivisor = Context->VidFrameRateDivisor *
`SOS_MSPERSECOND;¬

` status = Context->IVideoContext->FormatSet(¬
` Context->IVideoContext,¬
` &format¬
` );¬

` if (SOS_SUCCEEDED(status)) {¬
` status = SOS_Path_AttributeSet(¬
` VideoPath,¬
` SOS_VIDEOCONTEXT_NAME,¬
` SOS_Interface_ObjectPeek(Context->IVideoContext)¬
` );¬
` }¬
` } else {¬
` status = SOS_Error;¬
` }¬

` return status;¬
`}¬

`/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`++++++¬
`
`Page 12 of 27
`
`Implicit Exhibit 2043
`Sonos v. Implicit, IPR2018-0766, -0767
`
`

`

`/Users/implicit/Desktop/Source Code/2001.11.01/be…/…/main/avidemux.c
`Page 13/27
`Saved: 10/2/01, 4:07:24 PM
`Printed for: Implicit
`
`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
`569
`570
`571
`572
`

`+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`++++*/¬

`/*¬
` * Returns true if the data for the¬
` * next chunk is ready to be read.¬
` */¬

`SOS_BOOLEAN¬
`ChunkDataReady(¬
` AVIDEMUX_CONTEXT * Context¬
`)¬
`{¬
` size_t available = 0;¬
` SOS_BOOLEAN ready = SOS_False;¬

` if (Context->Chunk) {¬
` Riff_DecodeDataAvailable(¬
` Context->Riff,¬
` &available¬
` );¬
` ready = available>=Context->Chunk->Size;¬
` }¬

` return ready;¬
`}¬

`void¬
`FactorReduce(¬
` SOS_UINT32 *Numerator,¬
` SOS_UINT32 *Denominator¬
`)¬
`{¬
` SOS_UINT32 numerator = *Numerator;¬
` SOS_UINT32 denominator = *Denominator;¬
` SOS_UINT32 factor=2;¬

` while (factor<=numerator && factor<=numerator) {¬
` if (!(numerator%factor) &&¬
` !(denominator%factor)) {¬
` numerator/=factor;¬
` denominator/=factor;¬
` } else {¬
` if (factor>2) factor++;¬
`
`Page 13 of 27
`
`Implicit Exhibit 2043
`Sonos v. Implicit, IPR2018-0766, -0767
`
`

`

`/Users/implicit/Desktop/Source Code/2001.11.01/be…/…/main/avidemux.c
`Page 14/27
`Saved: 10/2/01, 4:07:24 PM
`Printed for: Implicit
`
`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
`612
`613
`614
`615
`616
`617
`
` factor++;¬
` }¬
` }¬

` SOS_Debug_StringPrint(¬
` "Rationalized %lu/%lu to %lu/%lu\n",¬
` *Numerator,¬
` *Denominator,¬
` numerator,¬
` denominator¬
` );¬

` *Numerator = numerator;¬
` *Denominator = denominator;¬
`}¬

`/*¬
` * Acts on the next chunk in the data stream.¬
` * Assumes the chunk header has already been¬
` * read into Context->Chunk, and that the entire¬
` * data block associated with the chunk is available¬
` * to be read.¬
` */¬

`void¬
`ChunkProcess(¬
` AVIDEMUX_CONTEXT * Context,¬
` SOS_PATH * Path¬
`)¬
`{¬
` RIFF_CHUNK * chunk = Context->Chunk;¬

` SOS_UINT32 maskedType = chunk->TypeVal & AVI_CHUNKTYPE_STREAMIDMASK;¬

` if (maskedType == Context->AudStreamId) {¬
` /*¬
` * got an audio frame,¬
` * send it along the audio path.¬
` */¬
` SOS_MESSAGE *message;¬

` SOS_DEBUGOUT_DETAIL("Processing audio chunk\n");¬
` ¬
` Riff_DecodeMessageGet(¬
` Context->Riff,¬
`
`Page 14 of 27
`
`Implicit Exhibit 2043
`Sonos v. Implicit, IPR2018-0766, -0767
`
`

`

`/Users/implicit/Desktop/Source Code/2001.11.01/be…/…/main/avidemux.c
`Page 15/27
`Saved: 10/2/01, 4:07:24 PM
`Printed for: Implicit
`
`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
`657
`658
`659
`660
`661
`662
`
` &message,¬
` chunk->Size,¬
` NULL¬
` );¬

` /*¬
` * Note that only bare PCM needs to be¬
` * packed.¬
` */¬
` if (Context->IAudioContext) {¬

` Context->IAudioContext->TimeStampSet(¬
` Context->IAudioContext,¬
` Context->AudioSampleCount¬
` );¬
` Context->IAudioContext->Pack(¬
` Context->IAudioContext,¬
` message¬
` );¬
` Context->AudioSampleCount+=¬
` chunk->Size / Context->AudioSampleBytes;¬
` }¬

` if (1) {¬
` SOS_Path_MessageSend(¬
` Context->AudioPath,¬
` message¬
` );¬
` } else {¬
` SOS_Message_Destroy(message);¬
` }¬
` ¬
` SOS_Sleep(0); /* give audio path a chance to process */¬
` ¬
` } else if (maskedType == Context->VidStreamId) {¬
` /*¬
` * got a video frame,¬
` * Send it along our own path.¬
` */¬
` Context->VidFrameNumber++;¬

` if ((Context->VidFrameNumber%VIDEO_DECIMATE)==0) {¬

` SOS_MESSAGE *message;¬

`
`Page 15 of 27
`
`Implicit Exhibit 2043
`Sonos v. Implicit, IPR2018-0766, -0767
`
`

`

`/Users/implicit/Desktop/Source Code/2001.11.01/be…/…/main/avidemux.c
`Page 16/27
`Saved: 10/2/01, 4:07:24 PM
`Printed for: Implicit
`
`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
`700
`701
`702
`703
`704
`705
`706
`707
`
` SOS_DEBUGOUT_DETAIL("Processing video chunk\n");¬

` Riff_DecodeMessageGet(¬
` Context->Riff,¬
` &message,¬
` chunk->Size,¬
` NULL¬
` );¬

` Context->IVideoContext->Pack(¬
` Context->IVideoContext,¬
` message,¬
` NULL,¬
` Context->VidFrameNumber¬
` );¬
` ¬
` SOS_Path_MessageSend(¬
` Path,¬
` message¬
` );¬

` } else {¬
` SOS_DEBUGOUT_DETAIL("Skipping video chunk\n");¬
` }¬


` } else if (chunk->TypeVal==AVI_CHUNKTYPE_avih) {¬
` /*¬
` * avih chunk.¬
` * We don't use the information within, but we¬
` * dump the contents.¬
` */¬
` AVI_HEADER aviHeader;¬

` SOS_DEBUGOUT_DETAIL("avih chunk\n");¬
` ¬
` Riff_DecodeDataGet(¬
` Context->Riff,¬
` &aviHeader,¬
` sizeof(aviHeader),¬
` NULL¬
` );¬

` DumpAviHeader(&aviHeader);¬
` ¬
`
`Page 16 of 27
`
`Implicit Exhibit 2043
`Sonos v. Implicit, IPR2018-0766, -0767
`
`

`

`/Users/implicit/Desktop/Source Code/2001.11.01/be…/…/main/avidemux.c
`Page 17/27
`Saved: 10/2/01, 4:07:24 PM
`Printed for: Implicit
`
`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
`745
`746
`747
`748
`749
`750
`
` } else if (chunk->TypeVal==AVI_CHUNKTYPE_strh) {¬
` /*¬
` * a strh chunk identifies auds and vids.¬
` * We need to examine it to get the stream id¬
` * for the video and audio streams.¬
` */¬
` AVI_STREAMHEADER streamHeader;¬
` ¬
` SOS_DEBUGOUT_DETAIL("strh chunk\n");¬

` Riff_DecodeDataGet(¬
` Context->Riff,¬
` &streamHeader,¬
` sizeof(streamHeader),¬
` NULL¬
` );¬

` Context->StreamIndex++;¬

` DumpAviStreamHeader(&streamHeader);¬
` ¬
` if (streamHeader.Type == AVI_STREAMHEADER_TYPE_vids) {¬
` /*¬
` * found a video stream.¬
` * Take the first one we find.¬
` */¬
` SOS_DEBUGOUT_DETAIL("vids chunk\n");¬

` if (!Context->VidStreamId) {¬
` Context->VidStreamIndex = Context->StreamIndex;¬
` Context->VidStreamId =
`AVI_STREAMLABEL(Context->StreamIndex-1);¬

` /*¬
` * get the frame rate from here, store it in the video
`clock¬
` */¬
` Context->VidFrameRate = streamHeader.Rate;¬
` Context->VidFrameRateDivisor = streamHeader.Scale;¬
`// {¬
`// SOS_UINT32 numerator = streamHeader.Rate;¬
`// SOS_UINT32 denominator = streamHeader.Scale;¬
`// Context->IVideoClock->FrequencySet(¬
`// Context->IVideoClock,¬
`// streamHeader.Rate,¬
`
`Page 17 of 27
`
`Implicit Exhibit 2043
`Sonos v. Implicit, IPR2018-0766, -0767
`
`

`

`/Users/implicit/Desktop/Source Code/2001.11.01/be…/…/main/avidemux.c
`Page 18/27
`Saved: 10/2/01, 4:07:24 PM
`Printed for: Implicit
`
`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
`788
`789
`790
`791
`792
`
`// streamHeader.Scale * SOS_MSPERSECOND *
`VIDEO_DECIMATE¬
`// );¬
`// }¬

` /*¬
` * The current Path is the video path. We store the
`video¬
` * clock as the render clock, and the audio clock as the¬
` * master clock. This will cause the video to sync¬
` * to the audio.¬
` */¬

` SOS_Path_AttributeSet(¬
` Path,¬
` SOS_RENDERCLOCK_NAME,¬
` SOS_Interface_ObjectPeek(Context->IVideoClock)¬
` );¬

` SOS_Path_AttributeSet(¬
` Path,¬
` SOS_MASTERCLOCK_NAME,¬
` SOS_Interface_ObjectPeek(Context->IAudioClock)¬
` );¬
` }¬
` ¬
` } else if (streamHeader.Type == AVI_STREAMHEADER_TYPE_auds) {¬
` /*¬
` * found an audio stream.¬
` * Take the first one we find.¬
` */¬
` SOS_DEBUGOUT_DETAIL("auds chunk\n");¬

` if (!Context->AudStreamId) {¬
` Context->AudStreamIndex = Context->StreamIndex;¬
` Context->AudStreamId =
`AVI_STREAMLABEL(Context->StreamIndex-1);¬
` }¬
` }¬

` } else if (chunk->TypeVal==AVI_CHUNKTYPE_strf) {¬
` /*¬
` * a strf chunk identifies the specific format¬
` * of the audio or video stream.¬
` */¬
`
`Page 18 of 27
`
`Implicit Exhibit 2043
`Sonos v. Implicit, IPR2018-0766, -0767
`
`

`

`/Users/implicit/Desktop/Source Code/2001.11.01/be…/…/main/avidemux.c
`Page 19/27
`Saved: 10/2/01, 4:07:24 PM
`Printed for: Implicit
`
`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
`833
`834
`835
`836
`837
`
` if (Context->StreamIndex==Context->AudStreamIndex) {¬
` /*¬
` * It appears to be the format for the first audio stream.¬
` * We read it into our own context.¬
` */¬
` SOS_DEBUGOUT_DETAIL("strf chunk for audio stream\n");¬

` Riff_DecodeDataGet(¬
` Context->Riff,¬
` &(Context->AudStreamFormat),¬
` sizeof(Context->AudStreamFormat),¬
` NULL¬
` );¬
` ¬
` DumpWavFormat(&(Context->AudStreamFormat));¬

` AudioPrepare(Context, Path);¬
` ¬
` } else if (Context->StreamIndex==Context->VidStreamIndex) {¬
` /*¬
` * It appears to be the format for the first video stream.¬
` * We sent it along our own path untouched.¬
` */¬

`// SOS_MESSAGE *message;¬

` SOS_DEBUGOUT_DETAIL("strf chunk for video stream\n");¬

` Riff_DecodeDataGet(¬
` Context->Riff,¬
` &(Context->VidStreamFormat),¬
` sizeof(Context->VidStreamFormat),¬
` NULL¬
` );¬

` DumpBmpFormat(&(Context->VidStreamFormat));¬
` VideoPrepare(Context, Path);¬

`/* Riff_DecodeMessageGet(¬
` Context->Riff,¬
` &message,¬
` chunk->Size,¬
` NULL¬
` );¬

`
`Page 19 of 27
`
`Implicit Exhibit 2043
`Sonos v. Implicit, IPR2018-0766, -0767
`
`

`

`/Users/implicit/Desktop/Source Code/2001.11.01/be…/…/main/avidemux.c
`Page 20/27
`Saved: 10/2/01, 4:07:24 PM
`Printed for: Implicit
`
`838
`839
`840
`841
`842
`843
`844
`845
`846
`847
`848
`849
`850
`851
`852
`…
`853
`854
`…
`855
`856
`857
`858
`859
`860
`861
`862
`863
`864
`865
`866
`867
`868
`869
`870
`871
`872
`873
`874
`875
`876
`877
`878
`879
`880
`
` SOS_Path_MessageSend(Path, message);¬
`*/¬
` } else {¬
` SOS_DEBUGOUT_DATA_TRACE(¬
` "Unused strf chunk [id=%d]\n",¬
` Context->StreamIndex);¬
` }¬
` ¬
` } else {¬
` SOS_DEBUGOUT_DATA_TRACE("Unused chunk [%.4s]\n",chunk->Type);¬
` }¬
`}¬


`/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`++++++¬
`Handlers¬
`+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`++++*/¬
`/*¬
` * We don't have any particular identification for¬
` * this session, so we just assign a unique key.¬
` */¬
`static¬
`SOS_STATUS¬
`AviDemux_KeyCreate(¬
` SOS_PATH *Path,¬
` SOS_MESSAGE *Message¬
`)¬
`{¬
` static int s_UniqueId = 0;¬

` SOS_REGOBJECT* uniqueSessionKey =¬
` SOS_Int32_Create(s_UniqueId++);¬

` SOS_DEBUGOUT_FUNC_TRACE("AviDemux_KeyCreate called\n");¬

` SOS_Path_SessionKeySet(Path, uniqueSessionKey);¬
` SOS_RegObject_Release(uniqueSessionKey);¬

` return SOS_PathBuild_Stop;¬
`}¬

`/*¬
` * This is the handler that gets called by Strings when¬
`
`Page 20 of 27
`
`Implicit Exhibit 2043
`Sonos v. Implicit, IPR2018-0766, -0767
`
`

`

`/Users/implicit/Desktop/Source Code/2001.11.01/be…/…/main/avidemux.c
`Page 21/27
`Saved: 10/2/01, 4:07:24 PM
`Printed for: Implicit
`
`881
`882
`883
`884
`885
`886

This document is available on Docket Alarm but you must sign up to view it.


Or .

Accessing this document will incur an additional charge of $.

After purchase, you can access this document again without charge.

Accept $ Charge
throbber

Still Working On It

This document is taking longer than usual to download. This can happen if we need to contact the court directly to obtain the document and their servers are running slowly.

Give it another minute or two to complete, and then try the refresh button.

throbber

A few More Minutes ... Still Working

It can take up to 5 minutes for us to download a document if the court servers are running slowly.

Thank you for your continued patience.

This document could not be displayed.

We could not find this document within its docket. Please go back to the docket page and check the link. If that does not work, go back to the docket and refresh it to pull the newest information.

Your account does not support viewing this document.

You need a Paid Account to view this document. Click here to change your account type.

Your account does not support viewing this document.

Set your membership status to view this document.

With a Docket Alarm membership, you'll get a whole lot more, including:

  • Up-to-date information for this case.
  • Email alerts whenever there is an update.
  • Full text search for other cases.
  • Get email alerts whenever a new case matches your search.

Become a Member

One Moment Please

The filing “” is large (MB) and is being downloaded.

Please refresh this page in a few minutes to see if the filing has been downloaded. The filing will also be emailed to you when the download completes.

Your document is on its way!

If you do not receive the document in five minutes, contact support at support@docketalarm.com.

Sealed Document

We are unable to display this document, it may be under a court ordered seal.

If you have proper credentials to access the file, you may proceed directly to the court's system using your government issued username and password.


Access Government Site

We are redirecting you
to a mobile optimized page.





Document Unreadable or Corrupt

Refresh this Document
Go to the Docket

We are unable to display this document.

Refresh this Document
Go to the Docket