[Live-devel] Implementing H263VideoFileSink

halim halim at rfnetech.com
Mon May 6 19:03:09 PDT 2019


Hi.

I am trying to implement H263VideoFileSink. But I can't really figure 
what is really needed at H263VideoFileSink::afterGettingFrame.

I try to refer from H264or5VideoFileSink::afterGettingFrame.
However, it is different from H263 as H263 doesn't have SPropRecord or SPS.
There is H263plusVideoRTPSink which I may be able to refer to. However, 
H263plusVideoRTPSink::doSpecialFrameHandling() is different from
H264or5VideoRTPSink::doSpecialFrameHandling(). So can't really figure 
out what is need to be done.

Below is my H263VideoFileSink.cpp file code. H263VideoFileSink is 
derived from FileSink

H263VideoFileSink::H263VideoFileSink(UsageEnvironment& env, FILE* fid,
         unsigned bufferSize, const char* perFrameFileNamePrefix)
         : FileSink(env, fid, bufferSize, perFrameFileNamePrefix)
{

}

H263VideoFileSink* H263VideoFileSink::createNew(UsageEnvironment& env,
         const char* fileName, unsigned bufferSize, Boolean 
oneFilePerFrame)
{
   do {
     FILE* fid;
     char const* perFrameFileNamePrefix;
     if (oneFilePerFrame) {
       // Create the fid for each frame
       fid = NULL;
       perFrameFileNamePrefix = fileName;
     } else {
       // Normal case: create the fid once
       fid = OpenOutputFile(env, fileName);
       if (fid == NULL)
       {
           printf("H263VideoFileSink::createNew fid = NULL\n");
     //      envir() << "test";
           break;
       }
       perFrameFileNamePrefix = NULL;
     }

     return new H263VideoFileSink(env, fid, bufferSize, 
perFrameFileNamePrefix);

   } while (0);

   return NULL;
}

H263VideoFileSink::~H263VideoFileSink()
{

}

void H263VideoFileSink::afterGettingFrame(unsigned frameSize,
         unsigned numTruncatedBytes, struct timeval presentationTime)
{
     envir() << "H263VideoFileSink::afterGettingFrame called\n";

      // Call the parent class to complete the normal file write with 
the input data:
     FileSink::afterGettingFrame(frameSize, numTruncatedBytes, 
presentationTime);
}

-- 

Regards.

Halim



More information about the live-devel mailing list