1 /* 2 * Copyright 2007-2008, Haiku. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Stephan Aßmus <superstippi@gmx.de> 7 */ 8 #ifndef MEDIA_TRACK_VIDEO_SUPPLIER_H 9 #define MEDIA_TRACK_VIDEO_SUPPLIER_H 10 11 #include "VideoTrackSupplier.h" 12 13 #include <MediaFormats.h> 14 15 class BMediaTrack; 16 17 class MediaTrackVideoSupplier : public VideoTrackSupplier { 18 public: 19 MediaTrackVideoSupplier(BMediaTrack* track, 20 int32 trackIndex, status_t& initStatus); 21 virtual ~MediaTrackVideoSupplier(); 22 23 virtual const media_format& Format() const; 24 virtual status_t GetEncodedFormat(media_format* format) const; 25 virtual status_t GetCodecInfo(media_codec_info* info) const; 26 27 virtual status_t ReadFrame(void* buffer, 28 bigtime_t* performanceTime, 29 const media_raw_video_format& format, 30 bool& wasCached); 31 virtual status_t FindKeyFrameForFrame(int64* frame); 32 virtual status_t SeekToTime(bigtime_t* performanceTime); 33 virtual status_t SeekToFrame(int64* frame); 34 35 virtual bigtime_t Position() const 36 { return fPerformanceTime; } 37 virtual bigtime_t Duration() const 38 { return fDuration; } 39 virtual int64 CurrentFrame() const 40 { return fCurrentFrame; } 41 42 virtual BRect Bounds() const; 43 virtual color_space ColorSpace() const; 44 virtual uint32 BytesPerRow() const; 45 46 virtual int32 TrackIndex() const 47 { return fTrackIndex; } 48 49 private: 50 status_t _SwitchFormat(color_space format, 51 uint32 bytesPerRow); 52 status_t _SetDecodedFormat(uint32 width, uint32 height, 53 color_space format, uint32 bytesPerRow); 54 55 BMediaTrack* fVideoTrack; 56 57 media_format fFormat; 58 59 bigtime_t fPerformanceTime; 60 bigtime_t fDuration; 61 int64 fCurrentFrame; 62 63 int32 fTrackIndex; 64 }; 65 66 #endif // MEDIA_TRACK_VIDEO_SUPPLIER_H 67