Commit 5318cf52 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '9cfa68c5'

* commit '9cfa68c5':
  mpegts: add support for Opus

Conflicts:
	libavcodec/opus_parser.c
	libavformat/mpegts.c

See: 74141f69Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 988ca9bd 9cfa68c5
...@@ -26,9 +26,9 @@ ...@@ -26,9 +26,9 @@
*/ */
#include "avcodec.h" #include "avcodec.h"
#include "bytestream.h"
#include "opus.h" #include "opus.h"
#include "parser.h" #include "parser.h"
#include "bytestream.h"
typedef struct OpusParseContext { typedef struct OpusParseContext {
OpusContext ctx; OpusContext ctx;
......
...@@ -1515,6 +1515,10 @@ static const uint8_t opus_coupled_stream_cnt[9] = { ...@@ -1515,6 +1515,10 @@ static const uint8_t opus_coupled_stream_cnt[9] = {
1, 0, 1, 1, 2, 2, 2, 3, 3 1, 0, 1, 1, 2, 2, 2, 3, 3
}; };
static const uint8_t opus_stream_cnt[9] = {
1, 1, 1, 2, 2, 3, 4, 4, 5,
};
static const uint8_t opus_channel_map[8][8] = { static const uint8_t opus_channel_map[8][8] = {
{ 0 }, { 0 },
{ 0,1 }, { 0,1 },
...@@ -1760,11 +1764,8 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type ...@@ -1760,11 +1764,8 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
if (channel_config_code <= 0x8) { if (channel_config_code <= 0x8) {
st->codec->extradata[9] = channels = channel_config_code ? channel_config_code : 2; st->codec->extradata[9] = channels = channel_config_code ? channel_config_code : 2;
st->codec->extradata[18] = channels > 2; st->codec->extradata[18] = channel_config_code ? (channels > 2) : /* Dual Mono */ 255;
st->codec->extradata[19] = channels - opus_coupled_stream_cnt[channel_config_code]; st->codec->extradata[19] = opus_stream_cnt[channel_config_code];
if (channel_config_code == 0) { /* Dual Mono */
st->codec->extradata[18] = 255; /* Mapping */
}
st->codec->extradata[20] = opus_coupled_stream_cnt[channel_config_code]; st->codec->extradata[20] = opus_coupled_stream_cnt[channel_config_code];
memcpy(&st->codec->extradata[21], opus_channel_map[channels - 1], channels); memcpy(&st->codec->extradata[21], opus_channel_map[channels - 1], channels);
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment