mirror of
https://github.com/mpromonet/v4l2rtspserver
synced 2024-11-02 03:40:13 +00:00
try to add audio/mpeg capture
This commit is contained in:
parent
bfed182731
commit
bf6f241947
@ -15,29 +15,30 @@ TSServerMediaSubsession::TSServerMediaSubsession(UsageEnvironment& env, StreamRe
|
||||
{
|
||||
// Create a source
|
||||
FramedSource* source = videoreplicator->createStreamReplica();
|
||||
|
||||
MPEG2TransportStreamFromESSource* muxer = MPEG2TransportStreamFromESSource::createNew(env);
|
||||
|
||||
if (videoformat == "video/H264") {
|
||||
// add marker
|
||||
FramedSource* filter = new AddH26xMarkerFilter(env, source);
|
||||
// mux to TS
|
||||
MPEG2TransportStreamFromESSource* muxer = MPEG2TransportStreamFromESSource::createNew(env);
|
||||
muxer->addNewVideoSource(filter, 5);
|
||||
source = muxer;
|
||||
} else if (videoformat == "video/H265") {
|
||||
// add marker
|
||||
FramedSource* filter = new AddH26xMarkerFilter(env, source);
|
||||
// mux to TS
|
||||
MPEG2TransportStreamFromESSource* muxer = MPEG2TransportStreamFromESSource::createNew(env);
|
||||
muxer->addNewVideoSource(filter, 6);
|
||||
source = muxer;
|
||||
}
|
||||
|
||||
if (audioformat == "audio/MPEG") {
|
||||
// mux to TS
|
||||
muxer->addNewAudioSource(source, 1);
|
||||
}
|
||||
|
||||
FramedSource* videoSource = createSource(env, source, m_format);
|
||||
FramedSource* tsSource = createSource(env, muxer, m_format);
|
||||
|
||||
// Start Playing the HLS Sink
|
||||
m_hlsSink = MemoryBufferSink::createNew(env, OutPacketBuffer::maxSize, sliceDuration);
|
||||
m_hlsSink->startPlaying(*videoSource, NULL, NULL);
|
||||
m_hlsSink->startPlaying(*tsSource, NULL, NULL);
|
||||
}
|
||||
|
||||
TSServerMediaSubsession::~TSServerMediaSubsession()
|
||||
|
@ -214,6 +214,8 @@ snd_pcm_format_t decodeAudioFormat(const std::string& fmt)
|
||||
audioFmt = SND_PCM_FORMAT_MU_LAW;
|
||||
} else if (fmt == "S8") {
|
||||
audioFmt = SND_PCM_FORMAT_S8;
|
||||
} else if (fmt == "MPEG") {
|
||||
audioFmt = SND_PCM_FORMAT_MPEG;
|
||||
}
|
||||
return audioFmt;
|
||||
}
|
||||
@ -239,6 +241,9 @@ std::string getAudioRtpFormat(snd_pcm_format_t format, int sampleRate, int chann
|
||||
case SND_PCM_FORMAT_S32_LE:
|
||||
os << "L32";
|
||||
break;
|
||||
case SND_PCM_FORMAT_MPEG:
|
||||
os << "MPEG";
|
||||
break;
|
||||
default:
|
||||
os << "L16";
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user