+ case 0x7f: /* DVB extension descriptor */
+ ext_desc_tag = get8(pp, desc_end);
+ if (ext_desc_tag < 0)
+ return AVERROR_INVALIDDATA;
+ if (st->codec->codec_id == AV_CODEC_ID_OPUS &&
+ ext_desc_tag == 0x80) { /* User defined (provisional Opus) */
+ if (!st->codec->extradata) {
+ st->codec->extradata = av_mallocz(sizeof(opus_default_extradata) +
+ FF_INPUT_BUFFER_PADDING_SIZE);
+ if (!st->codec->extradata)
+ return AVERROR(ENOMEM);
+
+ st->codec->extradata_size = sizeof(opus_default_extradata);
+ memcpy(st->codec->extradata, opus_default_extradata, sizeof(opus_default_extradata));
+
+ channel_config_code = get8(pp, desc_end);
+ if (channel_config_code < 0)
+ return AVERROR_INVALIDDATA;
+ if (channel_config_code <= 0x8) {
+ st->codec->extradata[9] = channels = channel_config_code ? channel_config_code : 2;
+ st->codec->extradata[18] = channels > 2;
+ st->codec->extradata[19] = channel_config_code;
+ if (channel_config_code == 0) { /* Dual Mono */
+ st->codec->extradata[18] = 255; /* Mapping */
+ st->codec->extradata[19] = 2; /* Stream Count */
+ }
+ st->codec->extradata[20] = opus_coupled_stream_cnt[channel_config_code];
+ memcpy(&st->codec->extradata[21], opus_channel_map[channels - 1], channels);
+ } else {
+ avpriv_request_sample(fc, "Opus in MPEG-TS - channel_config_code > 0x8");
+ }
+ st->need_parsing = AVSTREAM_PARSE_FULL;
+ }
+ }
+ break;