Fix setAudioStream

This commit is contained in:
sum2012
2026-06-08 23:04:29 +08:00
parent 9c78c886e1
commit d6477e808f
4 changed files with 21 additions and 3 deletions
+11
View File
@@ -569,6 +569,17 @@ bool MediaEngine::setVideoStream(int streamNum, bool force) {
return true;
}
bool MediaEngine::setAudioStream(int streamNum) {
if (m_audioStream == streamNum)
return true;
m_audioStream = streamNum;
if (m_demux) {
m_demux->setAudioChannel(streamNum);
}
return true;
}
bool MediaEngine::setVideoDim(int width, int height)
{
#ifdef USE_FFMPEG
+1 -1
View File
@@ -69,7 +69,7 @@ public:
bool setVideoStream(int streamNum, bool force = false);
// TODO: Return false if the stream doesn't exist.
bool setAudioStream(int streamNum) { m_audioStream = streamNum; return true; }
bool setAudioStream(int streamNum);
u8 *getFrameImage();
int getRemainSize();
+8 -2
View File
@@ -187,10 +187,16 @@ bool MpegDemux::skipPackHeader() {
return true;
}
void MpegDemux::setAudioChannel(int audioChannel) {
if (m_audioChannel != audioChannel) {
m_audioChannel = audioChannel;
m_audioStream.clear();
}
}
bool MpegDemux::demux(int audioChannel)
{
if (audioChannel >= 0)
m_audioChannel = audioChannel;
setAudioChannel(audioChannel);
bool looksValid = false;
bool needMore = false;
+1
View File
@@ -16,6 +16,7 @@ public:
bool addStreamData(const u8 *buf, int addSize);
bool demux(int audioChannel);
void setAudioChannel(int audioChannel);
// return its framesize
int getNextAudioFrame(u8 **buf, int *headerCode1, int *headerCode2, s64 *pts = NULL);