Update MediaClient
This commit is contained in:
86
MediaClient/MediaClientForMobile/media/file_player.h
Normal file
86
MediaClient/MediaClientForMobile/media/file_player.h
Normal file
@@ -0,0 +1,86 @@
|
||||
/***************************************************************************************
|
||||
*
|
||||
* IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
*
|
||||
* By downloading, copying, installing or using the software you agree to this license.
|
||||
* If you do not agree to this license, do not download, install,
|
||||
* copy or use the software.
|
||||
*
|
||||
* Copyright (C) 2014-2024, Happytimesoft Corporation, all rights reserved.
|
||||
*
|
||||
* Redistribution and use in binary forms, with or without modification, are permitted.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed
|
||||
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
||||
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef FILE_PLAYER_H
|
||||
#define FILE_PLAYER_H
|
||||
|
||||
#include "video_player.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8 * data;
|
||||
int size;
|
||||
int64 ts;
|
||||
int waitnext;
|
||||
} HTPACKET;
|
||||
|
||||
class CFilePlayer : public CVideoPlayer
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CFilePlayer(QObject * parent = 0);
|
||||
virtual ~CFilePlayer();
|
||||
|
||||
BOOL open(QString fileName, WId hWnd);
|
||||
void close();
|
||||
BOOL play();
|
||||
void stop();
|
||||
BOOL pause();
|
||||
BOOL seek(int pos);
|
||||
int64 getElapse() {return m_nCurPos;};
|
||||
int64 getDuration() {return m_nDuration;}
|
||||
int getVideoCodec();
|
||||
int getAudioCodec();
|
||||
|
||||
void readThread();
|
||||
void videoThread();
|
||||
void audioThread();
|
||||
|
||||
private:
|
||||
BOOL openFile(const char * filename);
|
||||
BOOL readFrame();
|
||||
void videoData(uint8 * data, int size, int64 pts, int waitnext);
|
||||
void audioData(uint8 * data, int size, int64 pts);
|
||||
void clearQueue(HQUEUE * queue);
|
||||
BOOL seekStream(double pos);
|
||||
double getFramerate();
|
||||
|
||||
private:
|
||||
int m_nAudioIndex; // audio stream index
|
||||
int m_nVideoIndex; // video stream index
|
||||
int64 m_nDuration; // the stream duration, unit is millisecond
|
||||
int64 m_nCurPos; // the current play position, unit is millisecond
|
||||
int m_bSeek; // seek request
|
||||
double m_dSeekPos; // seek position, nit is millisecond
|
||||
int m_nNalLength;
|
||||
|
||||
AVFormatContext * m_pFormatContext; // format context
|
||||
|
||||
pthread_t m_hReadThread; // read thread
|
||||
pthread_t m_hVideoThread; // video thread
|
||||
pthread_t m_hAudioThread; // audio thread
|
||||
|
||||
HQUEUE * m_pVideoQueue; // video queue
|
||||
HQUEUE * m_pAudioQueue; // audio queue
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user