H265VideoFileSink.cpp 2.13 KB
Newer Older
1 2 3
/**********
This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the
4
Free Software Foundation; either version 3 of the License, or (at your
5 6 7 8 9 10 11 12 13 14 15 16
option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.)

This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
more details.

You should have received a copy of the GNU Lesser General Public License
along with this library; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
**********/
// "liveMedia"
17
// Copyright (c) 1996-2019 Live Networks, Inc.  All rights reserved.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
// H.265 Video File sinks
// Implementation

#include "H265VideoFileSink.hh"
#include "OutputFile.hh"

////////// H265VideoFileSink //////////

H265VideoFileSink
::H265VideoFileSink(UsageEnvironment& env, FILE* fid,
		    char const* sPropVPSStr,
                    char const* sPropSPSStr,
                    char const* sPropPPSStr,
		    unsigned bufferSize, char const* perFrameFileNamePrefix)
  : H264or5VideoFileSink(env, fid, bufferSize, perFrameFileNamePrefix,
			 sPropVPSStr, sPropSPSStr, sPropPPSStr) {
}

H265VideoFileSink::~H265VideoFileSink() {
}

H265VideoFileSink*
H265VideoFileSink::createNew(UsageEnvironment& env, char const* fileName,
			     char const* sPropVPSStr,
			     char const* sPropSPSStr,
			     char const* sPropPPSStr,
			     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) break;
      perFrameFileNamePrefix = NULL;
    }

    return new H265VideoFileSink(env, fid, sPropVPSStr, sPropSPSStr, sPropPPSStr, bufferSize, perFrameFileNamePrefix);
  } while (0);

  return NULL;
}