btrfs: Attempt to fix GCC2 build.
[haiku.git] / src / apps / mediaplayer / supplier / ImageTrackVideoSupplier.cpp
blobeba3b7eab8bfcc5e79de06c544a65285d96c0937
1 /*
2 * Copyright 2011, Haiku Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * SHINTA
7 */
8 #include "ImageTrackVideoSupplier.h"
10 #include <string.h>
13 ImageTrackVideoSupplier::ImageTrackVideoSupplier(BBitmap* bitmap,
14 int32 trackIndex, status_t& initStatus)
16 VideoTrackSupplier(),
17 fPerformanceTime(0),
18 fDuration(0),
19 fCurrentFrame(0),
20 fBitmap(bitmap),
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;
51 initStatus = B_OK;
55 ImageTrackVideoSupplier::~ImageTrackVideoSupplier()
60 const media_format&
61 ImageTrackVideoSupplier::Format() const
63 return fFormat;
67 status_t
68 ImageTrackVideoSupplier::GetEncodedFormat(media_format* format) const
70 *format = fFormat;
71 return B_OK;
75 status_t
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;
83 return B_OK;
87 status_t
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);
93 return B_OK;
97 status_t
98 ImageTrackVideoSupplier::FindKeyFrameForFrame(int64* frame)
100 return B_OK;
104 status_t
105 ImageTrackVideoSupplier::SeekToTime(bigtime_t* performanceTime)
107 return B_OK;
111 status_t
112 ImageTrackVideoSupplier::SeekToFrame(int64* frame)
114 return B_OK;