| 1 |
/* |
| 2 |
libheif example application. |
| 3 |
|
| 4 |
MIT License |
| 5 |
|
| 6 |
Copyright (c) 2019 Dirk Farin <[email protected]> |
| 7 |
|
| 8 |
Permission is hereby granted, free of charge, to any person obtaining a copy |
| 9 |
of this software and associated documentation files (the "Software"), to deal |
| 10 |
in the Software without restriction, including without limitation the rights |
| 11 |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 12 |
copies of the Software, and to permit persons to whom the Software is |
| 13 |
furnished to do so, subject to the following conditions: |
| 14 |
|
| 15 |
The above copyright notice and this permission notice shall be included in all |
| 16 |
copies or substantial portions of the Software. |
| 17 |
|
| 18 |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 19 |
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 20 |
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 21 |
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 22 |
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 23 |
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 24 |
SOFTWARE. |
| 25 |
*/ |
| 26 |
#ifndef EXAMPLE_ENCODER_Y4M_H |
| 27 |
#define EXAMPLE_ENCODER_Y4M_H |
| 28 |
|
| 29 |
#include <string> |
| 30 |
|
| 31 |
#include "encoder.h" |
| 32 |
|
| 33 |
class Y4MEncoder : public Encoder |
| 34 |
{ |
| 35 |
public: |
| 36 |
Y4MEncoder(); |
| 37 |
|
| 38 |
heif_colorspace colorspace(bool has_alpha) const override |
| 39 |
{ |
| 40 |
return heif_colorspace_YCbCr; |
| 41 |
} |
| 42 |
|
| 43 |
heif_chroma chroma(bool has_alpha, int bit_depth) const override |
| 44 |
{ |
| 45 |
return heif_chroma_420; |
| 46 |
} |
| 47 |
|
| 48 |
bool supports_alpha() const override { return false; } |
| 49 |
|
| 50 |
void UpdateDecodingOptions(const heif_image_handle* handle, |
| 51 |
heif_decoding_options* options) const override; |
| 52 |
|
| 53 |
bool Encode(const heif_image_handle* handle, |
| 54 |
const heif_image* image, const std::string& filename) override; |
| 55 |
|
| 56 |
private: |
| 57 |
}; |
| 58 |
|
| 59 |
#endif // EXAMPLE_ENCODER_Y4M_H |