hi,everyone
 
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 red code below.Am i right to complete my goal?any light would be 
appreciated.thanks a lot.
 
int main(int argc, char** argv) {
  // Begin by setting up our usage environment:
  TaskScheduler* scheduler = BasicTaskScheduler::createNew();
  env = BasicUsageEnvironment::createNew(*scheduler);
  // Open the input file as a 'byte-stream file source':
  FramedSource* inputSource = ByteStreamFileSource::createNew(*env, 
inputFileName);
  if (inputSource == NULL) {
    *env << "Unable to open file \"" << inputFileName
  << "\" as a byte-stream file source\n";
    exit(1);
  }
   H264VideoStreamFramer* framer = H264VideoStreamFramer::createNew(*env, 
inputSource, True/*includeStartCodeInOutput*/);
    MPEG2TransportStreamFromESSource* tsFrames = 
MPEG2TransportStreamFromESSource::createNew(*env);
  tsFrames->addNewVideoSource(framer, 5/*mpegVersion: H.264*/);
 tsFrames->addNewaudioSource(audiofileinputsource,?)  ;
  // Open the output file as a 'file sink':
  MediaSink* outputSink = FileSink::createNew(*env, outputFileName);
  if (outputSink == NULL) {
    *env << "Unable to open file \"" << outputFileName << "\" as a file sink\n";
    exit(1);
  } 
  // Finally, start playing:
  *env << "Beginning to read...\n";
  outputSink->startPlaying(*tsFrames, afterPlaying, NULL);
  env->taskScheduler().doEventLoop(); // does not return
  return 0; // only to prevent compiler warning
}

                                          
_______________________________________________
live-devel mailing list
live-devel@lists.live555.com
http://lists.live555.com/mailman/listinfo/live-devel

Reply via email to