1 /*****************************************************************************
2  * Copyright (C) 2013-2020 MulticoreWare, Inc
3  *
4  * Authors: Steve Borho <steve@borho.org>
5  *          Xinyue Lu <i@7086.in>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111, USA.
20  *
21  * This program is also available under a commercial proprietary license.
22  * For more information, contact us at license @ x265.com.
23  *****************************************************************************/
24 
25 #ifndef X265_OUTPUT_H
26 #define X265_OUTPUT_H
27 
28 #include "x265.h"
29 #include "input/input.h"
30 
31 namespace X265_NS {
32 // private x265 namespace
33 
34 class ReconFile
35 {
36 protected:
37 
~ReconFile()38     virtual ~ReconFile()  {}
39 
40 public:
41 
ReconFile()42     ReconFile()           {}
43 
44     static ReconFile* open(const char *fname, int width, int height, uint32_t bitdepth,
45                            uint32_t fpsNum, uint32_t fpsDenom, int csp);
46 
47     virtual bool isFail() const = 0;
48 
49     virtual void release() = 0;
50 
51     virtual bool writePicture(const x265_picture& pic) = 0;
52 
53     virtual const char *getName() const = 0;
54 };
55 
56 class OutputFile
57 {
58 protected:
59 
~OutputFile()60     virtual ~OutputFile() {}
61 
62 public:
63 
OutputFile()64     OutputFile() {}
65 
66     static OutputFile* open(const char* fname, InputFileInfo& inputInfo);
67 
68     virtual bool isFail() const = 0;
69 
70     virtual bool needPTS() const = 0;
71 
72     virtual void release() = 0;
73 
74     virtual const char* getName() const = 0;
75 
76     virtual void setParam(x265_param* param) = 0;
77 
78     virtual int writeHeaders(const x265_nal* nal, uint32_t nalcount) = 0;
79 
80     virtual int writeFrame(const x265_nal* nal, uint32_t nalcount, x265_picture& pic) = 0;
81 
82     virtual void closeFile(int64_t largest_pts, int64_t second_largest_pts) = 0;
83 };
84 }
85 
86 #endif // ifndef X265_OUTPUT_H
87