-FilterBufferImage::FilterBufferImage (AVPixelFormat p, AVFilterBufferRef* b)
- : Image (p)
- , _buffer (b)
-{
- _line_size = (int *) av_malloc (4 * sizeof (int));
- _line_size[0] = _line_size[1] = _line_size[2] = _line_size[3] = 0;
-
- for (int i = 0; i < components(); ++i) {
- _line_size[i] = size().width * bytes_per_pixel(i);
- }
-}
-
-FilterBufferImage::~FilterBufferImage ()
-{
- avfilter_unref_buffer (_buffer);
- av_free (_line_size);
-}
-
-uint8_t **
-FilterBufferImage::data () const
-{
- return _buffer->data;
-}
-
-int *
-FilterBufferImage::line_size () const
-{
- return _line_size;
-}
-
-int *
-FilterBufferImage::stride () const
-{
- /* I've seen images where the _buffer->linesize is larger than the width
- (by a small amount), suggesting that _buffer->linesize is what we call
- stride. But I'm not sure.
- */
- return _buffer->linesize;
-}
-
-libdcp::Size
-FilterBufferImage::size () const
-{
- return libdcp::Size (_buffer->video->w, _buffer->video->h);
-}
-
-bool
-FilterBufferImage::aligned () const
-{
- /* XXX? */
- return true;
-}
-