This file is indexed.

/usr/include/openh323/codec/opalplugin.h is in libh323plus-dev 1.24.0~dfsg2-1.3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
/*
 * h323plugins.h
 *
 * H.323 codec plugins handler
 *
 * Open H323 Library
 *
 * Copyright (C) 2004 Post Increment
 *
 * The contents of this file are subject to the Mozilla Public License
 * Version 1.0 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
 * the License for the specific language governing rights and limitations
 * under the License.
 *
 * The Original Code is Open H323 Library.
 *
 * The Initial Developer of the Original Code is Post Increment
 *
 * Contributor(s): ______________________________________.
 *
 * $Log: opalplugin.h,v $
 * Revision 1.15  2010/09/19 05:50:50  shorne
 * Remove PLUS_FRAMEHEADER switch, added support for passing input device capabilities to the video plugin
 *
 * Revision 1.14  2010/08/31 04:00:49  shorne
 * Improved H.263/H.263+ interworking
 *
 * Revision 1.13  2010/08/26 15:12:39  shorne
 * Major H.239 upgrade. Special thx again to Marek Domaracky and Igor Pavlov
 *
 * Revision 1.12  2010/08/23 08:26:55  willamowius
 * disable PLUS_FRAMEHEADER for now, it seriously degrades video quality
 *
 * Revision 1.11  2010/08/19 12:42:37  shorne
 * Improved H.239 Support
 *
 * Revision 1.10  2010/06/06 14:27:25  shorne
 * added support for multiple frame decoding, Flow control,aspect ratio management
 *
 * Revision 1.9  2010/05/02 22:36:40  shorne
 * Added Event controller interface
 *
 * Revision 1.8  2010/02/24 02:56:15  shorne
 * Update to match latest Opal SVN
 *
 * Revision 1.7  2009/11/12 06:27:15  shorne
 * Updated definitions
 *
 * Revision 1.6  2009/02/21 14:07:43  shorne
 * Updated with changes from Opal
 *
 * Revision 1.5  2007/11/06 17:45:38  shorne
 * Added h323pluslib definition
 *
 * Revision 1.4  2007/11/06 17:43:33  shorne
 * added i480 standard framesize
 *
 * Revision 1.3  2007/10/30 04:23:43  shorne
 * Corrections and Improvements for H.239 support
 *
 * Revision 1.2  2007/10/19 19:53:43  shorne
 * ported latest Video updates in OpenH323 committed after h323plus initial fork thanks
 *  Robert
 *
 * Revision 1.1  2007/08/20 20:19:53  shorne
 * Moved opalplugin.h to codec directory to be plugin compile compatible with Opal
 *
 * Revision 1.2  2007/08/20 19:13:28  shorne
 * Added Generic Capability support. Fixed Linux compile errors
 *
 * Revision 1.1  2007/08/06 20:50:50  shorne
 * First commit of h323plus
 *
 * Revision 1.10.2.5  2007/09/26 05:14:28  rjongbloed
 * Added some extra RTP magic numbers: min header size, max packet size etc
 *
 * Revision 1.10.2.4  2007/08/17 08:38:22  rjongbloed
 * Back ported OPAL meda options based plug ins and H.323 generic capabilties.
 *
 * Revision 1.10.2.3  2007/02/19 20:12:45  shorne
 * added H.239 support
 *
 * Revision 1.10.2.2  2007/02/19 14:19:36  shorne
 * Added H.239 OIDs
 *
 * Revision 1.10.2.1  2006/12/23 19:08:02  shorne
 * Plugin video codecs & sundry
 *
 * Revision 1.10  2006/05/16 11:26:06  shorne
 * Added more hid key input mask types
 *
 * Revision 1.9  2005/11/21 21:04:10  shorne
 * Added more HID input switches
 *
 * Revision 1.8  2005/08/23 08:13:06  shorne
 * Added HID plugin volume & LCD display support
 *
 * Revision 1.7  2005/07/03 13:54:23  shorne
 * Added Initial LID Plugin Support
 *
 * Revision 1.6  2005/06/07 03:22:22  csoutheren
 * Added patch 1198741 with support for plugin codecs with generic capabilities
 * Added patch 1198754 with support for setting quality level on audio codecs
 * Added patch 1198760 with GSM-AMR codec support
 * Many thanks to Richard van der Hoff for his work
 *
 * Revision 1.5  2004/12/20 23:30:20  csoutheren
 * Added plugin support for packet loss concealment frames
 *
 * Revision 1.4  2004/11/29 06:30:53  csoutheren
 * Added support for wideband codecs
 *
 * Revision 1.3  2004/05/18 22:26:28  csoutheren
 * Initial support for embedded codecs
 * Fixed problems with streamed codec support
 * Updates for abstract factory loading methods
 *
 * Revision 1.2  2004/05/09 14:44:36  csoutheren
 * Added support for streamed plugin audio codecs
 *
 * Revision 1.1  2004/04/09 12:25:25  csoutheren
 * Renamed from h323plugin.h
 *
 * Revision 1.2  2004/04/03 10:38:24  csoutheren
 * Added in initial cut at codec plugin code. Branches are for wimps :)
 *
 * Revision 1.1.2.1  2004/03/31 11:03:16  csoutheren
 * Initial public version
 *
 * Revision 1.8  2004/02/23 13:17:32  craigs
 * Fixed problems with codec interface functions
 *
 * Revision 1.7  2004/02/23 13:04:09  craigs
 * Removed warnings when compliing plugins
 *
 * Revision 1.6  2004/01/27 14:55:46  craigs
 * Implemented static linking of new codecs
 *
 * Revision 1.5  2004/01/23 05:21:15  craigs
 * Updated for changes to the codec plugin interface
 *
 * Revision 1.4  2004/01/09 11:27:46  craigs
 * Plugin codec audio now works :)
 *
 * Revision 1.3  2004/01/09 07:32:22  craigs
 * More fixes for capability problems
 *
 * Revision 1.2  2004/01/06 07:05:03  craigs
 * Changed to support plugin codecs
 *
 * Revision 1.1  2004/01/04 13:37:51  craigs
 * Implementation of codec plugins
 *
 *
 */

#ifndef __OPAL_CODECPLUGIN_H
#define __OPAL_CODECPLUGIN_H

#ifdef __cplusplus
extern "C" {
#endif

#include <time.h>

// indicator the this is h323plus version of the plugin codec
#define h323pluslib          1 

#ifdef _MSC_VER
#pragma warning(disable:4201)
#endif

#ifdef _WIN32
#  ifdef PLUGIN_CODEC_DLL_EXPORTS
#    define PLUGIN_CODEC_DLL_API __declspec(dllexport)
#  else
#    define PLUGIN_CODEC_DLL_API __declspec(dllimport)
#  endif

#else

#define PLUGIN_CODEC_DLL_API

#endif

#ifdef PWLIB_PLUGIN_API_VERSION
#undef PWLIB_PLUGIN_API_VERSION
#endif
#define PWLIB_PLUGIN_API_VERSION 1

#define  PLUGIN_CODEC_VERSION           1    // initial version
#define  PLUGIN_CODEC_VERSION_WIDEBAND  2    // added wideband
#define  PLUGIN_CODEC_VERSION_VIDEO     3    // added video
#define  PLUGIN_CODEC_VERSION_FAX       4    // added fax
#define  PLUGIN_CODEC_VERSION_OPTIONS   5    // added options handling

#define PLUGIN_CODEC_API_VER_FN       PWLibPlugin_GetAPIVersion
#define PLUGIN_CODEC_API_VER_FN_STR   "PWLibPlugin_GetAPIVersion"

#define PLUGIN_CODEC_GET_CODEC_FN     OpalCodecPlugin_GetCodecs
#define PLUGIN_CODEC_GET_CODEC_FN_STR "OpalCodecPlugin_GetCodecs"

#define PLUGIN_CODEC_API_VER_FN_DECLARE \
PLUGIN_CODEC_DLL_API unsigned int PLUGIN_CODEC_API_VER_FN() \
{ return PWLIB_PLUGIN_API_VERSION; }

enum {
  PluginCodec_License_None                           = 0,
  PluginCodec_Licence_None = PluginCodec_License_None,        // allow for old code with misspelled constant
  PluginCodec_License_GPL                            = 1,
  PluginCodec_License_MPL                            = 2,
  PluginCodec_License_Freeware                       = 3,
  PluginCodec_License_ResearchAndDevelopmentUseOnly  = 4,
  PluginCodec_License_BSD                            = 5,
  PluginCodec_License_LGPL                           = 6,

  PluginCodec_License_NoRoyalties                    = 0x7f,

  // any license codes above here require royalty payments
  PluginCodec_License_RoyaltiesRequired              = 0x80
};

struct PluginCodec_information {
  // start of version 1 fields
  time_t timestamp;                     // codec creation time and date - obtain with command: date -u "+%c = %s"

  const char * sourceAuthor;            // source code author
  const char * sourceVersion;           // source code version
  const char * sourceEmail;             // source code email contact information
  const char * sourceURL;               // source code web site
  const char * sourceCopyright;         // source code copyright
  const char * sourceLicense;           // source code license
  unsigned char sourceLicenseCode;      // source code license

  const char * codecDescription;        // codec description
  const char * codecAuthor;             // codec author
  const char * codecVersion;            // codec version
  const char * codecEmail;              // codec email contact information
  const char * codecURL;                // codec web site
  const char * codecCopyright;          // codec copyright information
  const char * codecLicense;            // codec license
  unsigned short codecLicenseCode;      // codec license code
  // end of version 1 fields

};

enum PluginCodec_Flags {
  PluginCodec_MediaTypeMask          = 0x000f,
  PluginCodec_MediaTypeAudio         = 0x0000,
  PluginCodec_MediaTypeVideo         = 0x0001,
  PluginCodec_MediaTypeAudioStreamed = 0x0002,
  PluginCodec_MediaTypeFax           = 0x0003,
  PluginCodec_MediaTypeExtended      = 0x0005,

  PluginCodec_InputTypeMask          = 0x0010,
  PluginCodec_InputTypeRaw           = 0x0000,
  PluginCodec_InputTypeRTP           = 0x0010,

  PluginCodec_OutputTypeMask         = 0x0020,
  PluginCodec_OutputTypeRaw          = 0x0000,
  PluginCodec_OutputTypeRTP          = 0x0020,

  PluginCodec_RTPTypeMask            = 0x0040,
  PluginCodec_RTPTypeDynamic         = 0x0000,
  PluginCodec_RTPTypeExplicit        = 0x0040,

  PluginCodec_RTPSharedMask          = 0x0080,
  PluginCodec_RTPTypeNotShared       = 0x0000,
  PluginCodec_RTPTypeShared          = 0x0080,

  PluginCodec_DecodeSilenceMask      = 0x0100,
  PluginCodec_NoDecodeSilence        = 0x0000,
  PluginCodec_DecodeSilence          = 0x0100,

  PluginCodec_EncodeSilenceMask      = 0x0200,
  PluginCodec_NoEncodeSilence        = 0x0000,
  PluginCodec_EncodeSilence          = 0x0200,

  PluginCodec_MediaExtensionMask     = 0x0400,
  PluginCodec_MediaTypeExtVideo      = 0x0400,
  PluginCodec_MediaTypeH239          = 0x0401,

  PluginCodec_ComfortNoiseMask       = 0x0800,
  PluginCodec_ComfortNoise           = 0x0800,

  PluginCodec_EmptyPayloadMask       = 0x1000,
  PluginCodec_EmptyPayload           = 0x1000,

  PluginCodec_OtherPayloadMask       = 0x2000,
  PluginCodec_OtherPayload           = 0x2000,

  PluginCodec_BitsPerSamplePos       = 12,
  PluginCodec_BitsPerSampleMask      = 0xf000,
};

enum PluginCodec_CoderFlags {
  PluginCodec_CoderSilenceFrame      = 1,    // request audio codec to create silence frame
  PluginCodec_CoderForceIFrame       = 2     // request video codec to force I frame
};

enum PluginCodec_ReturnCoderFlags {
  PluginCodec_ReturnCoderLastFrame      = 1,    // indicates when video codec returns last data for frame
  PluginCodec_ReturnCoderIFrame         = 2,    // indicates when video returns I frame
  PluginCodec_ReturnCoderRequestIFrame  = 4,    // indicates when video decoder request I frame for resync
  PluginCodec_ReturnCoderBufferTooSmall = 8,    // indicates when output buffer is not large enough to receive
                                                // the data, another call to get_output_data_size is required
  PluginCodec_ReturnCoderMoreFrame      = 16    // indicates that the decoder need to output more frame
};

struct PluginCodec_Definition;

// Control function names

#define PLUGINCODEC_CONTROL_VALID_FOR_PROTOCOL    "valid_for_protocol"
#define PLUGINCODEC_CONTROL_GET_CODEC_OPTIONS     "get_codec_options"
#define PLUGINCODEC_CONTROL_FREE_CODEC_OPTIONS    "free_codec_options"
#define PLUGINCODEC_CONTROL_GET_OUTPUT_DATA_SIZE  "get_output_data_size"
#define PLUGINCODEC_CONTROL_SET_CODEC_OPTIONS     "set_codec_options"
#define PLUGINCODEC_CONTROL_TO_NORMALISED_OPTIONS "to_normalised_options"
#define PLUGINCODEC_CONTROL_TO_CUSTOMISED_OPTIONS "to_customised_options"
#define PLUGINCODEC_CONTROL_SET_INSTANCE_ID       "set_instance_id"
#define PLUGINCODEC_CONTROL_SET_LOG_FUNCTION      "set_log_function"
#define PLUGINCODEC_CONTROL_GET_STATISTICS        "get_statistics"
#define PLUGINCODEC_CONTROL_TERMINATE_CODEC       "terminate_codec"
#define PLUGINCODEC_CONTROL_CODEC_EVENT           "event_codec"
#define PLUGINCODEC_CONTROL_FLOW_OPTIONS          "to_flowcontrol_options"
#define PLUGINCODEC_CONTROL_SET_FORMAT_OPTIONS    "set_format_options"


/* Log function, plug in gets a pointer to this function which allows
   it to use the standard OPAL logging system. The function returns 0 if
   no logging was performed due to the log level. Note if log == NULL
   then this return state is all that happens, so this may be executed
   first to prevent lengthy logs that would not result in any output. */
typedef int (*PluginCodec_LogFunction)(unsigned level,
                                       const char * file,
                                       unsigned line,
                                       const char * section,
                                       const char * log);


struct PluginCodec_ControlDefn {
  const char * name;
  int (*control)(const struct PluginCodec_Definition * codec, void * context,
                 const char * name, void * parm, unsigned * parmLen);

};

enum PluginCodec_OptionTypes {
  PluginCodec_StringOption,
  PluginCodec_BoolOption,
  PluginCodec_IntegerOption,
  PluginCodec_RealOption,
  PluginCodec_EnumOption,
  PluginCodec_OctetsOption,
  PluginCodec_NumOptionTypes,
};

enum PluginCodec_OptionMerge {
  PluginCodec_NoMerge,
  PluginCodec_MinMerge,
  PluginCodec_MaxMerge,
  PluginCodec_EqualMerge,
  PluginCodec_NotEqualMerge,
  PluginCodec_AlwaysMerge,
  PluginCodec_CustomMerge,
  PluginCodec_NumOptionMerge,

  PluginCodec_AndMerge = PluginCodec_MinMerge,
  PluginCodec_OrMerge  = PluginCodec_MaxMerge
};

#define PluginCodec_H245_Collapsing    0x40000000
#define PluginCodec_H245_NonCollapsing 0x20000000
#define PluginCodec_H245_Unsigned32    0x10000000
#define PluginCodec_H245_BooleanArray  0x08000000
#define PluginCodec_H245_TCS           0x04000000
#define PluginCodec_H245_OLC           0x02000000
#define PluginCodec_H245_ReqMode       0x01000000
#define PluginCodec_H245_OrdinalMask   0x0000ffff

typedef int (*PluginCodec_MergeFunction)(char ** result, const char * dest, const char * src);
typedef void (*PluginCodec_FreeFunction)(char * string);

struct PluginCodec_Option {
  // start of version 4 fields
  enum PluginCodec_OptionTypes m_type;
  const char *                 m_name;
  unsigned                     m_readOnly;
  enum PluginCodec_OptionMerge m_merge;
  const char *                 m_value;
  const char *                 m_FMTPName;
  const char *                 m_FMTPDefault;
  int                          m_H245Generic;
  const char *                 m_minimum;
  const char *                 m_maximum;
  PluginCodec_MergeFunction    m_mergeFunction; // Used if m_merge==PluginCodec_CustomMerge
  PluginCodec_FreeFunction     m_freeFunction;
};


// Normalised option names
#define PLUGINCODEC_OPTION_NEEDS_JITTER               "Needs Jitter"
#define PLUGINCODEC_OPTION_CLOCK_RATE                 "Clock Rate"
#define PLUGINCODEC_OPTION_FRAME_TIME                 "Frame Time"
#define PLUGINCODEC_OPTION_MAX_FRAME_SIZE             "Max Frame Size"
#define PLUGINCODEC_OPTION_MAX_BIT_RATE               "Max Bit Rate"
#define PLUGINCODEC_OPTION_TARGET_BIT_RATE            "Target Bit Rate"
#define PLUGINCODEC_OPTION_RX_FRAMES_PER_PACKET       "Rx Frames Per Packet"
#define PLUGINCODEC_OPTION_TX_FRAMES_PER_PACKET       "Tx Frames Per Packet"
#define PLUGINCODEC_OPTION_FRAME_WIDTH                "Frame Width"
#define PLUGINCODEC_OPTION_FRAME_HEIGHT               "Frame Height"
#define PLUGINCODEC_OPTION_MIN_RX_FRAME_WIDTH         "Min Rx Frame Width"
#define PLUGINCODEC_OPTION_MIN_RX_FRAME_HEIGHT        "Min Rx Frame Height"
#define PLUGINCODEC_OPTION_MAX_RX_FRAME_WIDTH         "Max Rx Frame Width"
#define PLUGINCODEC_OPTION_MAX_RX_FRAME_HEIGHT        "Max Rx Frame Height"
#define PLUGINCODEC_OPTION_TEMPORAL_SPATIAL_TRADE_OFF "Temporal Spatial Trade Off"
#define PLUGINCODEC_OPTION_TX_KEY_FRAME_PERIOD        "Tx Key Frame Period"
#define PLUGINCODEC_OPTION_CUSTOM_FORMAT              "CustomFmt"
#define PLUGINCODEC_OPTION_INPUT_FORMAT               "InputFmt"

// Events
#define PLUGINCODEC_EVENT_FASTUPDATE             "on_fast_update"
#define PLUGINCODEC_EVENT_FLOWCONTROL            "on_flow_control"
#define PLUGINCODEC_EVENT_LOSTPARTIAL            "on_lost_partial"
#define PLUGINCODEC_EVENT_LOSTPICTURE            "on_lost_picture"

// Full definition of the codec

struct PluginCodec_Definition {
  unsigned int version;                     // codec structure version

  // start of version 1 fields
  struct PluginCodec_information * info;   // license information

  unsigned int flags;                      // b0-3: 0 = audio,        1 = video
                                           // b4:   0 = raw input,    1 = RTP input
                                           // b5:   0 = raw output,   1 = RTP output
                                           // b6:   0 = dynamic RTP,  1 = explicit RTP
                                           // b7:   0 = no share RTP, 1 = share RTP

  const char * descr;                       // text decription

  const char * sourceFormat;               // source format
  const char * destFormat;                 // destination format

  const void * userData;                   // user data value

  unsigned int sampleRate;                 // samples per second
  unsigned int bitsPerSec;                // raw bits per second
  unsigned int usPerFrame;                 // microseconds per frame

  union _parm {
    struct _audio {
      unsigned int samplesPerFrame;            // audio: samples per frame
      unsigned int bytesPerFrame;              // audio: max bytes per frame
      unsigned int recommendedFramesPerPacket; // audio: recommended number of frames per packet
      unsigned int maxFramesPerPacket;         // audio: maximum number of frames per packet
    } audio;
    struct _video {
      unsigned int maxFrameWidth;              // video: frame width
      unsigned int maxFrameHeight;             // video: frame height
      unsigned int recommendedFrameRate;       // video: recommended frame rate
      unsigned int maxFrameRate;               // video: max frame rate
    } video;
  } parm;

  unsigned char rtpPayload;                 // IANA RTP payload code (if defined)
  const char * sdpFormat;                  // SDP format string (or NULL, if no SDP format)

  void * (*createCodec)(const struct PluginCodec_Definition * codec);                    // create codec
  void (*destroyCodec) (const struct PluginCodec_Definition * codec,  void * context);   // destroy codec
  int (*codecFunction) (const struct PluginCodec_Definition * codec,  void * context,   // do codec function
                                  const void * from, unsigned * fromLen,
                                        void * to,   unsigned * toLen,
                                        unsigned int * flag);
  struct PluginCodec_ControlDefn * codecControls;

  // H323 specific fields
  unsigned char h323CapabilityType;
  const void  * h323CapabilityData;

  // end of version 1 fields

  // NOTE!!!!! Due to an error in judgement, you cannot add ANY more fields
  // to this structure without an API version change!!!!
};

typedef struct PluginCodec_Definition * (* PluginCodec_GetCodecFunction)(unsigned int *, unsigned int);
typedef unsigned (* PluginCodec_GetAPIVersionFunction)();

///////////////////////////////////////////////////////////////////
//
//  H.323 specific values
//


struct PluginCodec_H323CapabilityExtension {
  unsigned int index;
  void * data;
  unsigned dataLength;
};

struct PluginCodec_H323NonStandardCodecData {
  const char * objectId;
  unsigned char  t35CountryCode;
  unsigned char  t35Extension;
  unsigned short manufacturerCode;
  const unsigned char * data;
  unsigned int dataLength;
  int (*capabilityMatchFunction)(struct PluginCodec_H323NonStandardCodecData *);
};


struct PluginCodec_H323GenericParameterDefinition
{
  /* The following used to be a simple integer for the collapsing flag in
     version 3 and earlier. We hope that all those implementations just used
     zero and one (a good bet) and thus the below bit fields will be backward
     compatible, putting the parameter in all three PDU types.
   */ 
#ifndef SOLARIS   
  struct {
#endif  
    int collapsing:1; /* boolean */
    int excludeTCS:1;
    int excludeOLC:1;
    int excludeReqMode:1;
    int readOnly:1;
#ifndef SOLARIS    
  };
#endif  

  unsigned int id;

  enum PluginCodec_H323GenericParameterType {
    /* these need to be in the same order as the choices in
      H245_ParameterValue::Choices, as the value is just cast to that type
    */
    PluginCodec_GenericParameter_Logical = 0,
    PluginCodec_GenericParameter_BooleanArray,
    PluginCodec_GenericParameter_UnsignedMin,
    PluginCodec_GenericParameter_UnsignedMax,
    PluginCodec_GenericParameter_Unsigned32Min,
    PluginCodec_GenericParameter_Unsigned32Max,
    PluginCodec_GenericParameter_OctetString,
    PluginCodec_GenericParameter_GenericParameter,

    PluginCodec_GenericParameter_logical = 0,
    PluginCodec_GenericParameter_booleanArray,
    PluginCodec_GenericParameter_unsignedMin,
    PluginCodec_GenericParameter_unsignedMax,
    PluginCodec_GenericParameter_unsigned32Min,
    PluginCodec_GenericParameter_unsigned32Max,
    PluginCodec_GenericParameter_octetString,
    PluginCodec_GenericParameter_genericParameter
  } type;

  union {
    unsigned long integer;
    const char * octetstring;
    struct PluginCodec_H323GenericParameterDefinition *genericparameter;
  } value;
};

struct PluginCodec_H323GenericCodecData
{
  // some cunning structures & lists, and associated logic in
  // H323CodecPluginGenericAudioCapability::H323CodecPluginGenericAudioCapability()
  const char * standardIdentifier;
  unsigned int maxBitRate; // Zero means use value from OpalMediaFormat

  /* parameters; these are the parameters which are set in the
     'TerminalCapabilitySet' and 'OpenLogicalChannel' requests */
  unsigned int nParameters;
  /* an array of nParameters parameter definitions */
  const struct PluginCodec_H323GenericParameterDefinition *params;
};


struct PluginCodec_H323AudioGSMData {
  int comfortNoise:1;
  int scrambled:1;
};

struct  PluginCodec_H323AudioG7231AnnexC {
  unsigned char maxAl_sduAudioFrames;
  int silenceSuppression:1;
  int highRateMode0:6;          // INTEGER (27..78),  -- units octets
  int  highRateMode1:6;          // INTEGER (27..78),  -- units octets
  int  lowRateMode0:6;            // INTEGER (23..66),  -- units octets
  int  lowRateMode1:6;            // INTEGER (23..66),  -- units octets
  int  sidMode0:4;                // INTEGER (6..17),  -- units octets
  int  sidMode1:4;                // INTEGER (6..17),  -- units octets
};


enum {
  PluginCodec_H323Codec_undefined,      // must be zero, so empty struct is undefined
  PluginCodec_H323Codec_programmed,      // H323ProgrammedCapability
  PluginCodec_H323Codec_nonStandard,    // H323NonStandardData
  PluginCodec_H323Codec_generic,            // H323GenericCodecData

  // audio codecs
  PluginCodec_H323AudioCodec_g711Alaw_64k,        // int
  PluginCodec_H323AudioCodec_g711Alaw_56k,        // int
  PluginCodec_H323AudioCodec_g711Ulaw_64k,        // int
  PluginCodec_H323AudioCodec_g711Ulaw_56k,        // int
  PluginCodec_H323AudioCodec_g722_64k,            // int
  PluginCodec_H323AudioCodec_g722_56k,            // int
  PluginCodec_H323AudioCodec_g722_48k,            // int
  PluginCodec_H323AudioCodec_g7231,                // H323AudioG7231Data
  PluginCodec_H323AudioCodec_g728,                // int
  PluginCodec_H323AudioCodec_g729,                // int
  PluginCodec_H323AudioCodec_g729AnnexA,          // int
  PluginCodec_H323AudioCodec_is11172,             // not yet implemented
  PluginCodec_H323AudioCodec_is13818Audio,        // not yet implemented
  PluginCodec_H323AudioCodec_g729wAnnexB,          // int
  PluginCodec_H323AudioCodec_g729AnnexAwAnnexB,    // int
  PluginCodec_H323AudioCodec_g7231AnnexC,         // H323AudioG7231AnnexC
  PluginCodec_H323AudioCodec_gsmFullRate,          // H323AudioGSMData
  PluginCodec_H323AudioCodec_gsmHalfRate,          // H323AudioGSMData
  PluginCodec_H323AudioCodec_gsmEnhancedFullRate,  // H323AudioGSMData
  PluginCodec_H323AudioCodec_g729Extensions,      // not yet implemented

  // video codecs
  PluginCodec_H323VideoCodec_h261,                // implemented
  PluginCodec_H323VideoCodec_h262,                // not yet implemented
  PluginCodec_H323VideoCodec_h263,                // implemented
  PluginCodec_H323VideoCodec_is11172,             // not yet implemented

  // other capabilities
  PluginCodec_H323VideoCodec_Extended,            // implemented (for use with H.239)
  PluginCodec_H323T38Codec,                       // not yet implemented

  // special codes
  PluginCodec_H323Codec_NoH323 = 0xff,            // used for SIP-only codecs
};

/////////////////
//
// Generic Codec Standard Identifiers
//

// Audio Capabilities
// AMR (as defined in H.245v13 Annex I)
#define OpalPluginCodec_Identifer_AMR             "0.0.8.245.1.1.1"

// AMR-NB\WB  (as defined in H.245v13 Annex R)
#define OpalPluginCodec_Identifer_AMR_NB          "0.0.8.245.1.1.9"
#define OpalPluginCodec_Identifer_AMR_WB          "0.0.8.245.1.1.10"

// G.722.1
#define OpalPluginCodec_Identifer_G7221           "0.0.7.7221.1.0"
#define OpalPluginCodec_Identifer_G7221ext        "0.0.7.7221.1.1.0"

// G.722.2 (aka AMR-WB)
#define OpalPluginCodec_Identifer_G7222           "0.0.7.7222.1.0"

// iLBC (as defined in H.245v13 Annex S)
#define OpalPluginCodec_Identifer_iLBC            "0.0.8.245.1.1.11"


// Video Capabilities

// H264 (as defined in H.241)
#define OpalPluginCodec_Identifer_H264_Aligned        "0.0.8.241.0.0.0.0"
#define OpalPluginCodec_Identifer_H264_NonInterleaved "0.0.8.241.0.0.0.1"
#define OpalPluginCodec_Identifer_H264_Interleaved    "0.0.8.241.0.0.0.2"
#define OpalPluginCodec_Identifer_H264_Generic        "0.0.8.241.0.0.1"

// ISO/IEC 14496-2 MPEG4 part 2 (as defined in H.245v13 Annex E)
#define OpalPluginCodec_Identifer_MPEG4           "0.0.8.245.1.0.0"

// Extended Video Capability (as defined in H.239)
#define OpalPluginCodec_Identifer_H239                   "0.0.8.239.1.1"
#define OpalPluginCodec_Identifer_H239_Video             "0.0.8.239.1.2"
#define OpalPluginCodec_Identifer_H239_GenericMessage    "0.0.8.239.2"

/////////////////
//
// Predefined options for H.323 codecs
//

#define PLUGINCODEC_SQCIF_MPI   "SQCIF MPI"
#define PLUGINCODEC_QCIF_MPI     "QCIF MPI"
#define PLUGINCODEC_CIF_MPI       "CIF MPI"
#define PLUGINCODEC_CIF4_MPI     "CIF4 MPI"
#define PLUGINCODEC_CIF16_MPI   "CIF16 MPI"
#define PLUGINCODEC_480P_MPI	 "480 MPI"
#define PLUGINCODEC_n720P_MPI    "n720 MPI"
#define PLUGINCODEC_w720P_MPI	 "w720 MPI"
#define PLUGINCODEC_w1080P_MPI   "w1080 MPI"
#define PLUGINCODEC_CUSTOM_MPI "Custom MPI"

#define PLUGINCODEC_MPI_DISABLED 33

#define PLUGINCODEC_MEDIA_PACKETIZATION  "Media Packetization"
#define PLUGINCODEC_MEDIA_PACKETIZATIONS "Media Packetizations"

#define H261_ANNEX_D "Annex D - Still Image Transmit"
#define H263_ANNEX_F "Annex F - Advanced Prediction"
#define H263_ANNEX_I "Annex I - Advanced INTRA Coding"
#define H263_ANNEX_J "Annex J - Deblocking Filter"
#define H263_ANNEX_T "Annex T - Modified Quantization"

#define H263_EXPLICIT_MATCH "H263 Exact"

#ifndef STRINGIZE
#define __INTERNAL_STRINGIZE__(v) #v
#define STRINGIZE(v) __INTERNAL_STRINGIZE__(v)
#endif


/////////////////
//
// RTP specific definitions
//

#define PluginCodec_RTP_MaxPacketSize  (1518-14-4-8-20-16)  // Max Ethernet packet (1518 bytes) minus 802.3/CRC, 802.3, IP, UDP headers
#define PluginCodec_RTP_MinHeaderSize  (12)
#define PluginCodec_RTP_MaxPayloadSize (PluginCodec_RTP_MaxPacketSize - PluginCodec_RTP_MinHeaderSize)

#define PluginCodec_RTP_GetHeaderLength(ptr)      ((((unsigned char*)(ptr))[0] & 0x0f)*4 + PluginCodec_RTP_MinHeaderSize)
#define PluginCodec_RTP_GetPayloadPtr(ptr)          ((unsigned char*)(ptr) + PluginCodec_RTP_GetHeaderLength(ptr))
#define PluginCodec_RTP_GetPayloadType(ptr)        (((unsigned char*)(ptr))[1] & 0x7f)
#define PluginCodec_RTP_SetPayloadType(ptr, type)  (((unsigned char*)(ptr))[1] = (((unsigned char*)(ptr))[1] & 0x80) | (type & 0x7f))
#define PluginCodec_RTP_GetMarker(ptr)            ((((unsigned char*)(ptr))[1] & 0x80) != 0)
#define PluginCodec_RTP_SetMarker(ptr, mark)       (((unsigned char*)(ptr))[1] = (((unsigned char*)(ptr))[1] & 0x7f) | (mark != 0 ? 0x80 : 0))
#define PluginCodec_RTP_GetTimestamp(ptr)         ((((unsigned char*)(ptr))[4] << 24) | (((unsigned char*)(ptr))[5] << 16) | (((unsigned char*)(ptr))[6] << 8) | ((unsigned char*)(ptr))[7])
#define PluginCodec_RTP_SetTimestamp(ptr, ts)     ((((unsigned char*)(ptr))[4] = ((ts) >> 24)),(((unsigned char*)(ptr))[5] = ((ts) >> 16)),(((unsigned char*)(ptr))[6] = ((ts) >> 8)),(((unsigned char*)(ptr))[7] = (ts)))
#define PluginCodec_RTP_GetSequenceNumber(ptr)    ((((unsigned char*)(ptr))[2] << 8) | ((unsigned char*)(ptr))[3])
#define PluginCodec_RTP_SetSequenceNumber(ptr, sn)((((unsigned char*)(ptr))[2] = ((sn) >> 8)),(((unsigned char*)(ptr))[3] = (sn)))


/////////////////
//
// video specific definitions
//

struct PluginCodec_Video_FrameHeader {
  unsigned int  x;
  unsigned int  y;
  unsigned int  width;
  unsigned int  height;
};

#ifdef __cplusplus
};

inline unsigned char * OPAL_VIDEO_FRAME_DATA_PTR(struct PluginCodec_Video_FrameHeader * base)
{ return (((unsigned char *)base) + sizeof(PluginCodec_Video_FrameHeader)); }

inline unsigned char * OPAL_VIDEO_FRAME_DATA_PTR(const PluginCodec_Video_FrameHeader * base)
{ return (((unsigned char *)base) + sizeof(PluginCodec_Video_FrameHeader)); }

extern "C" {
#endif

#define PLUGIN_CODEC_VIDEO_SET_FRAME_SIZE_FN    "set_frame_size"    // argument is struct PluginCodec_VideoSetFrameInfo
struct PluginCodec_Video_SetFrameInfo {
  int width;
  int height;
};


/////////////////
//
// experimental definitions for statically linking codecs
//

#ifdef OPAL_STATIC_CODEC

#  undef PLUGIN_CODEC_DLL_API
#  define PLUGIN_CODEC_DLL_API static
#  define PLUGIN_CODEC_IMPLEMENT(name) \
unsigned int Opal_StaticCodec_##name##_GetAPIVersion() \
{ return PWLIB_PLUGIN_API_VERSION; } \
static struct PluginCodec_Definition * PLUGIN_CODEC_GET_CODEC_FN(unsigned * count, unsigned /*version*/); \
struct PluginCodec_Definition * Opal_StaticCodec_##name##_GetCodecs(unsigned * p1, unsigned p2) \
{ return PLUGIN_CODEC_GET_CODEC_FN(p1,p2); } \

#  define PLUGIN_CODEC_IMPLEMENT_ALL(name, table, ver) \
unsigned int Opal_StaticCodec_##name##_GetAPIVersion() \
{ return PWLIB_PLUGIN_API_VERSION; } \
PLUGIN_CODEC_DLL_API struct PluginCodec_Definition * Opal_StaticCodec_##name##_GetCodecs(unsigned * count, unsigned version) \
{ *count = sizeof(table)/sizeof(struct PluginCodec_Definition); return version < ver ? NULL : table; }


#else

#  define PLUGIN_CODEC_IMPLEMENT(name) \
PLUGIN_CODEC_DLL_API unsigned int PLUGIN_CODEC_API_VER_FN() \
{ return PWLIB_PLUGIN_API_VERSION; } \

#  define PLUGIN_CODEC_IMPLEMENT_ALL(name, table, ver) \
PLUGIN_CODEC_IMPLEMENT(name) \
PLUGIN_CODEC_DLL_API struct PluginCodec_Definition * PLUGIN_CODEC_GET_CODEC_FN(unsigned * count, unsigned version) \
{ *count = sizeof(table)/sizeof(struct PluginCodec_Definition); return version < ver ? NULL : table; }


#endif

#ifdef __cplusplus
};
#endif


#ifdef _MSC_VER
#pragma warning(default:4201)
#endif

#endif // __OPAL_CODECPLUGIN_H