#include "liveMedia.hh"#include "BasicUsageEnvironment.hh"Include dependency graph for testH264VideoToTransportStream.cpp:

Go to the source code of this file.
Functions | |
| void | afterPlaying (void *clientData) |
| int | main (int argc, char **argv) |
Variables | |
| char const * | inputFileName = "in.264" |
| char const * | outputFileName = "out.ts" |
| UsageEnvironment * | env |
| void afterPlaying | ( | void * | clientData | ) |
Definition at line 98 of file testAMRAudioStreamer.cpp.
00098 { 00099 *env << "...done reading from file\n"; 00100 00101 audioSink->stopPlaying(); 00102 Medium::close(audioSource); 00103 // Note that this also closes the input file that this source read from. 00104 00105 play(); 00106 }
| int main | ( | int | argc, | |
| char ** | argv | |||
| ) |
Definition at line 30 of file testH264VideoToTransportStream.cpp.
References MPEG2TransportStreamFromESSource::addNewVideoSource(), afterPlaying(), FileSink::createNew(), MPEG2TransportStreamFromESSource::createNew(), H264VideoStreamFramer::createNew(), ByteStreamFileSource::createNew(), BasicUsageEnvironment::createNew(), BasicTaskScheduler::createNew(), TaskScheduler::doEventLoop(), env, exit, inputFileName, NULL, outputFileName, MediaSink::startPlaying(), UsageEnvironment::taskScheduler(), and True.
00030 { 00031 // Begin by setting up our usage environment: 00032 TaskScheduler* scheduler = BasicTaskScheduler::createNew(); 00033 env = BasicUsageEnvironment::createNew(*scheduler); 00034 00035 // Open the input file as a 'byte-stream file source': 00036 FramedSource* inputSource = ByteStreamFileSource::createNew(*env, inputFileName); 00037 if (inputSource == NULL) { 00038 *env << "Unable to open file \"" << inputFileName 00039 << "\" as a byte-stream file source\n"; 00040 exit(1); 00041 } 00042 00043 // Create a 'framer' filter for this file source, to generate presentation times for each NAL unit: 00044 H264VideoStreamFramer* framer = H264VideoStreamFramer::createNew(*env, inputSource, True/*includeStartCodeInOutput*/); 00045 00046 // Then create a filter that packs the H.264 video data into a Transport Stream: 00047 MPEG2TransportStreamFromESSource* tsFrames = MPEG2TransportStreamFromESSource::createNew(*env); 00048 tsFrames->addNewVideoSource(framer, 5/*mpegVersion: H.264*/); 00049 00050 // Open the output file as a 'file sink': 00051 MediaSink* outputSink = FileSink::createNew(*env, outputFileName); 00052 if (outputSink == NULL) { 00053 *env << "Unable to open file \"" << outputFileName << "\" as a file sink\n"; 00054 exit(1); 00055 } 00056 00057 // Finally, start playing: 00058 *env << "Beginning to read...\n"; 00059 outputSink->startPlaying(*tsFrames, afterPlaying, NULL); 00060 00061 env->taskScheduler().doEventLoop(); // does not return 00062 00063 return 0; // only to prevent compiler warning 00064 }
Definition at line 28 of file testH264VideoToTransportStream.cpp.
| char const* inputFileName = "in.264" |
Definition at line 23 of file testH264VideoToTransportStream.cpp.
| char const* outputFileName = "out.ts" |
1.5.2