<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:΢ÈíÑźÚ
}
--></style>
</head>
<body class='hmmessage'><div dir='ltr'>
<DIV>hi,everyone</DIV>
<DIV> </DIV>
<DIV>i want to revise live/testprogs/testH264VideoToTransportStream.cpp to add the function of multiplexing audio and h264 video into ts file.i add some code here like<SPAN style="COLOR: #ff0000"> red code </SPAN>below.Am i right to complete my goal?any light would be appreciated.thanks a lot.</DIV>
<DIV> </DIV>
<DIV>int main(int argc, char** argv) {<BR> // Begin by setting up our usage environment:<BR> TaskScheduler* scheduler = BasicTaskScheduler::createNew();<BR> env = BasicUsageEnvironment::createNew(*scheduler);</DIV>
<DIV> // Open the input file as a 'byte-stream file source':<BR> FramedSource* inputSource = ByteStreamFileSource::createNew(*env, inputFileName);<BR> if (inputSource == NULL) {<BR> *env << "Unable to open file \"" << inputFileName<BR> << "\" as a byte-stream file source\n";<BR> exit(1);<BR> }</DIV>
<DIV> H264VideoStreamFramer* framer = H264VideoStreamFramer::createNew(*env, inputSource, True/*includeStartCodeInOutput*/);</DIV>
<DIV> MPEG2TransportStreamFromESSource* tsFrames = MPEG2TransportStreamFromESSource::createNew(*env);<BR> tsFrames->addNewVideoSource(framer, 5/*mpegVersion: H.264*/);<BR> <SPAN style="COLOR: #ff0000"><SPAN style="COLOR: #ff0000">tsFrames->addNewaudioSource(audiofileinputsource,?</SPAN><SPAN style="COLOR: #ff0000"></SPAN>) ;</SPAN></DIV>
<DIV><SPAN style="COLOR: #ff0000"><FONT color=#000000> // Open the output file as a 'file sink':<BR> MediaSink* outputSink = FileSink::createNew(*env, outputFileName);<BR> if (outputSink == NULL) {<BR> *env << "Unable to open file \"" << outputFileName << "\" as a file sink\n";<BR> exit(1);<BR> }</FONT>
<DIV> <FONT color=#000000> // Finally, start playing:<BR> *env << "Beginning to read...\n";<BR> outputSink->startPlaying(*tsFrames, afterPlaying, NULL);</FONT></DIV>
<DIV><FONT color=#000000> env->taskScheduler().doEventLoop(); // does not return</FONT></DIV>
<DIV><FONT color=#000000> return 0; // only to prevent compiler warning<BR>}<BR></FONT></DIV><BR></SPAN></DIV> </div></body>
</html>