Player.h
2.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#ifndef _PLAYER_H
#define _PLAYER_H
#include <memory>
#include "AVLib.h"
#include "VideoSample.h"
#include "RgbFormat.h"
namespace AVLib
{
class AudioPlaybackEngine;
class AudioPlayer
{
public:
AVLIB_API AudioPlayer();
AVLIB_API ~AudioPlayer();
AVLIB_API bool OpenFile(LPCWSTR filename);
AVLIB_API bool OpenBuffer(const char *buffer, int bufferSize);
AVLIB_API bool PlayStream();
AVLIB_API bool StopStream();
AVLIB_API bool SeekStream(LONGLONG position);
AVLIB_API bool GetCurrentPosition(LONGLONG *currentPosition);
AVLIB_API bool GetDuration(LONGLONG *duration);
AVLIB_API bool GetBitrate(LONGLONG *bitrate);
AVLIB_API bool CloseStream();
AVLIB_API bool IsPlaybackFinished();
AVLIB_API bool IsStreamSeekable();
AVLIB_API bool SetVolume(long volume);
AVLIB_API bool SetRate(double rate);
AVLIB_API void SetCallbackFunction(
void (*callbackFunction)(int, void *), void *callbackData);
private:
// Disallow copy constructor and copy assignment operator
AudioPlayer(const AudioPlayer &);
AudioPlayer& operator=(const AudioPlayer &);
std::auto_ptr<AudioPlaybackEngine> m_PlaybackEngine;
};
//////////////////////////////////////////////////////////////////////////
class VideoPlaybackEngine;
class VideoPlayer
{
public:
AVLIB_API VideoPlayer();
AVLIB_API ~VideoPlayer();
AVLIB_API bool OpenFile(LPCWSTR filename);
AVLIB_API bool OpenBuffer(const char *buffer, int bufferSize);
AVLIB_API bool PlayStream();
AVLIB_API bool StopStream();
AVLIB_API bool SeekStream(LONGLONG position);
AVLIB_API bool GetCurrentPosition(LONGLONG *currentPosition);
AVLIB_API bool GetDuration(LONGLONG *duration);
AVLIB_API bool CloseStream();
AVLIB_API bool IsPlaybackFinished();
AVLIB_API bool IsStreamSeekable();
AVLIB_API bool SetVolume(long volume);
AVLIB_API bool SetRate(double rate);
AVLIB_API void SetCallbackFunction(
void (*callbackFunction)(int, void *), void *callbackData);
AVLIB_API void SetRgbFormat(RgbFormat format);
AVLIB_API VideoSample* GetVideoSample();
AVLIB_API void FreeVideoSample(VideoSample *videoSample);
AVLIB_API std::pair<LONG, LONG> GetVideoResolution();
//for preview
AVLIB_API bool SeekStreamForPreview(LONGLONG position);
AVLIB_API bool IsStreamSeekableForPreview();
AVLIB_API VideoSample* GetVideoSampleForPreview();
private:
// Disallow copy constructor and copy assignment operator
VideoPlayer(const VideoPlayer &);
VideoPlayer& operator=(const VideoPlayer &);
std::auto_ptr<VideoPlaybackEngine> m_PlaybackEngine;
};
}
#endif // _PLAYER_H