1/**********
2This library is free software; you can redistribute it and/or modify it under
3the terms of the GNU Lesser General Public License as published by the
4Free Software Foundation; either version 3 of the License, or (at your
5option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.)
6
7This library is distributed in the hope that it will be useful, but WITHOUT
8ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
9FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
10more details.
11
12You should have received a copy of the GNU Lesser General Public License
13along with this library; if not, write to the Free Software Foundation, Inc.,
1451 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15**********/
16// "liveMedia"
17// Copyright (c) 1996-2020 Live Networks, Inc. All rights reserved.
18// H.264 Video File sinks
19// Implementation
20
21#include "H264VideoFileSink.hh"
22#include "OutputFile.hh"
23
24////////// H264VideoFileSink //////////
25
26H264VideoFileSink
27::H264VideoFileSink(UsageEnvironment& env, FILE* fid,
28 char const* sPropParameterSetsStr,
29 unsigned bufferSize, char const* perFrameFileNamePrefix)
30 : H264or5VideoFileSink(env, fid, bufferSize, perFrameFileNamePrefix,
31 sPropParameterSetsStr, NULL, NULL) {
32}
33
34H264VideoFileSink::~H264VideoFileSink() {
35}
36
37H264VideoFileSink*
38H264VideoFileSink::createNew(UsageEnvironment& env, char const* fileName,
39 char const* sPropParameterSetsStr,
40 unsigned bufferSize, Boolean oneFilePerFrame) {
41 do {
42 FILE* fid;
43 char const* perFrameFileNamePrefix;
44 if (oneFilePerFrame) {
45 // Create the fid for each frame
46 fid = NULL;
47 perFrameFileNamePrefix = fileName;
48 } else {
49 // Normal case: create the fid once
50 fid = OpenOutputFile(env, fileName);
51 if (fid == NULL) break;
52 perFrameFileNamePrefix = NULL;
53 }
54
55 return new H264VideoFileSink(env, fid, sPropParameterSetsStr, bufferSize, perFrameFileNamePrefix);
56 } while (0);
57
58 return NULL;
59}
60