22 #include <com/avpkit/ferry/RefPointer.h>
23 #include <com/avpkit/ferry/Logger.h>
24 #include <com/avpkit/ferry/IBuffer.h>
25 #include <com/avpkit/core/IVideoPicture.h>
26 #include <com/avpkit/core/IPixelFormat.h>
27 #include <com/avpkit/core/PixelFormat.h>
29 VS_LOG_SETUP(VS_CPP_PACKAGE);
31 namespace com {
namespace avpkit {
namespace core
35 IPixelFormat :: IPixelFormat()
40 IPixelFormat :: ~IPixelFormat()
48 unsigned char result = 0;
50 int offset = getYUV420PPixelOffset(frame, x, y, c);
52 unsigned char * bytes = (
unsigned char*)buffer->getBytes(0, offset+1);
55 throw std::runtime_error(
"could not find bytes in frame");
56 result = bytes[offset];
63 int offset = getYUV420PPixelOffset(frame, x, y, c);
65 unsigned char * bytes = (
unsigned char*)buffer->getBytes(0, offset+1);
69 VS_LOG_DEBUG(
"Could not find buffer of length: %d", offset+1);
70 throw std::runtime_error(
"could not find bytes in frame");
72 bytes[offset] = value;
79 throw std::runtime_error(
"no frame");
82 if (x < 0 || x >= width)
83 throw std::runtime_error(
"x value invalid for input frame");
86 if (y < 0 || y >= height)
87 throw std::runtime_error(
"y value invalid for input frame");
90 throw std::runtime_error(
"pixel type of input frame is incorrect");
92 int offset = PixelFormat::getFastYUV420PPixelOffset(frame->
getWidth(), frame->
getHeight(), x, y, c);
93 VS_LOG_TRACE(
"w: %d; h: %d; x: %d; y: %d; c: %d; offset: %d",
Represents one raw (undecoded) picture in a video stream, plus a timestamp for when to display that v...
virtual int getWidth()=0
What is the width of the picture.
virtual int getHeight()=0
What is the height of the picture.
virtual IPixelFormat::Type getPixelType()=0
Returns the pixel format of the picture.
This class is only useful from C++.
This library contains routines used by AVPKit libraries for "ferry"ing Java objects to and from nativ...
WARNING: Do not use logging in this class, and do not set any static file variables to values other t...