@@ -90,96 +90,6 @@ extern void ReleaseDRMLicenseAcquireThread(PrivateInstanceAAMP *aamp);
90
90
#endif
91
91
92
92
#define UseProgramDateTimeIfAvailable () (ISCONFIGSET(eAAMPConfig_HLSAVTrackSyncUsingStartTime) || aamp->mIsVSS )
93
- /* *
94
- * @struct FormatMap
95
- * @brief FormatMap structure for stream codec/format information
96
- */
97
- struct FormatMap
98
- {
99
- const char * codec;
100
- StreamOutputFormat format;
101
- };
102
-
103
- // / Variable initialization for various audio formats
104
- static const FormatMap mAudioFormatMap [] =
105
- {
106
- { " mp4a.40.2" , FORMAT_AUDIO_ES_AAC },
107
- { " mp4a.40.5" , FORMAT_AUDIO_ES_AAC },
108
- { " ac-3" , FORMAT_AUDIO_ES_AC3 },
109
- { " mp4a.a5" , FORMAT_AUDIO_ES_AC3 },
110
- { " ac-4.02.01.01" , FORMAT_AUDIO_ES_AC4 },
111
- { " ac-4.02.01.02" , FORMAT_AUDIO_ES_AC4 },
112
- { " ec-3" , FORMAT_AUDIO_ES_EC3 },
113
- { " ec+3" , FORMAT_AUDIO_ES_ATMOS },
114
- { " eac3" , FORMAT_AUDIO_ES_EC3 }
115
- };
116
- #define AAMP_AUDIO_FORMAT_MAP_LEN ARRAY_SIZE (mAudioFormatMap )
117
-
118
- // / Variable initialization for various video formats
119
- static const FormatMap * GetAudioFormatForCodec( const char *codecs )
120
- {
121
- if ( codecs )
122
- {
123
- for ( int i=0 ; i<AAMP_AUDIO_FORMAT_MAP_LEN; i++ )
124
- {
125
- if ( strstr ( codecs, mAudioFormatMap [i].codec ) )
126
- {
127
- return &mAudioFormatMap [i];
128
- }
129
- }
130
- }
131
- return NULL ;
132
- }
133
-
134
- /* **************************************************************************
135
- * @fn GetAudioFormatStringForCodec
136
- * @brief Function to get audio codec string from the map.
137
- *
138
- * @param[in] input Audio codec type
139
- * @return Audio codec string
140
- ***************************************************************************/
141
- static const char * GetAudioFormatStringForCodec ( StreamOutputFormat input)
142
- {
143
- const char *codec = " UNKNOWN" ;
144
- if (input < FORMAT_UNKNOWN)
145
- {
146
- for ( int i=0 ; i<AAMP_AUDIO_FORMAT_MAP_LEN; i++ )
147
- {
148
- if (mAudioFormatMap [i].format == input )
149
- {
150
- codec = mAudioFormatMap [i].codec ;
151
- break ;
152
- }
153
- }
154
- }
155
- return codec;
156
- }
157
-
158
-
159
- // / Variable initialization for various video formats
160
- static const FormatMap mVideoFormatMap [] =
161
- {
162
- { " avc1." , FORMAT_VIDEO_ES_H264 },
163
- { " hvc1." , FORMAT_VIDEO_ES_HEVC },
164
- { " hev1." , FORMAT_VIDEO_ES_HEVC },
165
- { " mpeg2v" , FORMAT_VIDEO_ES_MPEG2 }// For testing.
166
- };
167
- #define AAMP_VIDEO_FORMAT_MAP_LEN ARRAY_SIZE (mVideoFormatMap )
168
-
169
- static const FormatMap * GetVideoFormatForCodec( const char *codecs )
170
- {
171
- if ( codecs )
172
- {
173
- for ( int i=0 ; i<AAMP_VIDEO_FORMAT_MAP_LEN; i++ )
174
- {
175
- if ( strstr ( codecs, mVideoFormatMap [i].codec ) )
176
- {
177
- return &mVideoFormatMap [i];
178
- }
179
- }
180
- }
181
- return NULL ;
182
- }
183
93
184
94
// / Variable initialization for media profiler buckets
185
95
static const ProfilerBucketType mediaTrackBucketTypes[AAMP_TRACK_COUNT] =
@@ -4719,6 +4629,14 @@ AAMPStatusType StreamAbstractionAAMP_HLS::Init(TuneType tuneType)
4719
4629
{
4720
4630
AAMPLOG_WARN (" StreamAbstractionAAMP_HLS: Configure audio TS track demuxing" );
4721
4631
ts->playContext = new TSProcessor (mLogObj , aamp, eStreamOp_DEMUX_AUDIO);
4632
+ if (ts->playContext )
4633
+ {
4634
+ if (currentAudioProfileIndex >= 0 )
4635
+ {
4636
+ std::string groupId = mediaInfo[currentAudioProfileIndex].group_id ;
4637
+ ts->playContext ->SetAudioGroupId (groupId);
4638
+ }
4639
+ }
4722
4640
}
4723
4641
else
4724
4642
{
@@ -4802,7 +4720,15 @@ AAMPStatusType StreamAbstractionAAMP_HLS::Init(TuneType tuneType)
4802
4720
}
4803
4721
AAMPLOG_WARN (" StreamAbstractionAAMP_HLS::Init : Configure video TS track demuxing demuxOp %d" , demuxOp);
4804
4722
ts->playContext = new TSProcessor (mLogObj , aamp, demuxOp, eMEDIATYPE_VIDEO, static_cast <TSProcessor*> (trackState[eMEDIATYPE_AUDIO]->playContext ), static_cast <TSProcessor*> (trackState[eMEDIATYPE_AUX_AUDIO]->playContext ));
4805
- ts->playContext ->setThrottleEnable (this ->enableThrottle );
4723
+ if (ts->playContext )
4724
+ {
4725
+ ts->playContext ->setThrottleEnable (this ->enableThrottle );
4726
+ if (currentAudioProfileIndex >= 0 )
4727
+ {
4728
+ std::string groupId = mediaInfo[currentAudioProfileIndex].group_id ;
4729
+ ts->playContext ->SetAudioGroupId (groupId);
4730
+ }
4731
+ }
4806
4732
if (this ->rate == AAMP_NORMAL_PLAY_RATE)
4807
4733
{
4808
4734
ts->playContext ->setRate (this ->rate , PlayMode_normal);
@@ -7956,6 +7882,28 @@ StreamInfo * StreamAbstractionAAMP_HLS::GetStreamInfo(int idx)
7956
7882
return &streamInfo[userData];
7957
7883
}
7958
7884
7885
+
7886
+ /* ***************************************************************************
7887
+ * @brief Change muxed audio track index
7888
+ *
7889
+ * @param[in] string index
7890
+ * @return void
7891
+ ****************************************************************************/
7892
+ void StreamAbstractionAAMP_HLS::ChangeMuxedAudioTrackIndex (std::string& index)
7893
+ {
7894
+ std::string muxPrefix = " mux-" ;
7895
+ std::string trackIndex = index .substr (muxPrefix.size ());
7896
+ unsigned char indexNum = (unsigned char ) stoi (trackIndex);
7897
+ if (trackState[eMEDIATYPE_AUDIO] && trackState[eMEDIATYPE_AUDIO]->playContext )
7898
+ {
7899
+ trackState[eMEDIATYPE_AUDIO]->playContext ->ChangeMuxedAudioTrack (indexNum);
7900
+ }
7901
+ else if (trackState[eMEDIATYPE_VIDEO] && trackState[eMEDIATYPE_VIDEO]->playContext && IsMuxedStream ())
7902
+ {
7903
+ trackState[eMEDIATYPE_VIDEO]->playContext ->ChangeMuxedAudioTrack (indexNum);
7904
+ }
7905
+ }
7906
+
7959
7907
/* *
7960
7908
* @}
7961
7909
*/
0 commit comments