2 * Copyright 2011, Haiku Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
8 #include "ImageTrackVideoSupplier.h"
13 ImageTrackVideoSupplier::ImageTrackVideoSupplier(BBitmap
* bitmap
,
14 int32 trackIndex
, status_t
& initStatus
)
21 fTrackIndex(trackIndex
)
23 fFormat
.type
= B_MEDIA_ENCODED_VIDEO
;
24 fFormat
.u
.encoded_video
.output
.field_rate
= 0.0;
25 fFormat
.u
.encoded_video
.output
.interlace
= 1;
26 fFormat
.u
.encoded_video
.output
.first_active
= 0;
27 fFormat
.u
.encoded_video
.output
.orientation
= B_VIDEO_TOP_LEFT_RIGHT
;
28 fFormat
.u
.encoded_video
.output
.display
.format
= B_RGB32
;
29 fFormat
.u
.encoded_video
.output
.pixel_width_aspect
30 = fFormat
.u
.raw_video
.display
.line_width
31 = static_cast<int32
>(fBitmap
->Bounds().right
) + 1;
32 fFormat
.u
.encoded_video
.output
.pixel_height_aspect
33 = fFormat
.u
.raw_video
.display
.line_count
34 = static_cast<int32
>(fBitmap
->Bounds().bottom
) + 1;
35 fFormat
.u
.encoded_video
.output
.display
.bytes_per_row
36 = fFormat
.u
.raw_video
.display
.line_width
* sizeof(int32
);
37 fFormat
.u
.encoded_video
.output
.display
.pixel_offset
= 0;
38 fFormat
.u
.encoded_video
.output
.display
.line_offset
= 0;
39 fFormat
.u
.encoded_video
.output
.display
.flags
= 0;
40 fFormat
.u
.encoded_video
.output
.last_active
41 = fFormat
.u
.raw_video
.display
.line_count
- 1;
42 fFormat
.u
.encoded_video
.avg_bit_rate
= 0.0;
43 fFormat
.u
.encoded_video
.max_bit_rate
= 0.0;
44 fFormat
.u
.encoded_video
.encoding
= media_encoded_video_format::B_ANY
;
45 fFormat
.u
.encoded_video
.frame_size
46 = fFormat
.u
.encoded_video
.output
.display
.bytes_per_row
*
47 fFormat
.u
.raw_video
.display
.line_count
;
48 fFormat
.u
.encoded_video
.forward_history
= 0;
49 fFormat
.u
.encoded_video
.backward_history
= 0;
55 ImageTrackVideoSupplier::~ImageTrackVideoSupplier()
61 ImageTrackVideoSupplier::Format() const
68 ImageTrackVideoSupplier::GetEncodedFormat(media_format
* format
) const
76 ImageTrackVideoSupplier::GetCodecInfo(media_codec_info
* info
) const
78 strlcpy(info
->pretty_name
, "Artwork (static image)",
79 sizeof(info
->pretty_name
));
80 strlcpy(info
->short_name
, "Artwork", sizeof(info
->short_name
));
81 info
->id
= info
->sub_id
= 0;
88 ImageTrackVideoSupplier::ReadFrame(void* buffer
, bigtime_t
* performanceTime
,
89 const media_raw_video_format
& format
, bool& wasCached
)
91 uint32 size
= format
.display
.bytes_per_row
* format
.display
.line_count
;
92 memcpy(buffer
, fBitmap
->Bits(), size
);
98 ImageTrackVideoSupplier::FindKeyFrameForFrame(int64
* frame
)
105 ImageTrackVideoSupplier::SeekToTime(bigtime_t
* performanceTime
)
112 ImageTrackVideoSupplier::SeekToFrame(int64
* frame
)