1 | /********** |
2 | This library is free software; you can redistribute it and/or modify it under |
3 | 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 | option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.) |
6 | |
7 | This library is distributed in the hope that it will be useful, but WITHOUT |
8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for |
10 | more details. |
11 | |
12 | You should have received a copy of the GNU Lesser General Public License |
13 | along with this library; if not, write to the Free Software Foundation, Inc., |
14 | 51 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 | |
26 | H264VideoFileSink |
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 | |
34 | H264VideoFileSink::~H264VideoFileSink() { |
35 | } |
36 | |
37 | H264VideoFileSink* |
38 | H264VideoFileSink::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 | |