93 lines
3.8 KiB
C
Executable File
93 lines
3.8 KiB
C
Executable File
|
|
#ifndef PLAYER_I_H
|
|
#define PLAYER_I_H
|
|
|
|
#include "player.h"
|
|
#include <sys/time.h>
|
|
#include <unistd.h>
|
|
#include <pthread.h>
|
|
|
|
enum EPLAYERINTERNALNOTIFY //* player internal notify.
|
|
{
|
|
PLAYER_VIDEO_DECODER_NOTIFY_STREAM_UNDERFLOW = 32,
|
|
PLAYER_VIDEO_DECODER_NOTIFY_CRASH,
|
|
PLAYER_VIDEO_DECODER_NOTIFY_EOS,
|
|
PLAYER_VIDEO_DECODER_NOTIFY_SET_SECURE_BUFFER_COUNT,
|
|
PLAYER_VIDEO_DECODER_NOTIFY_SET_SECURE_BUFFERS,
|
|
|
|
PLAYER_VIDEO_RENDER_NOTIFY_FIRST_PICTURE = 64,
|
|
PLAYER_VIDEO_RENDER_NOTIFY_PICTURE_PTS,
|
|
PLAYER_VIDEO_RENDER_NOTIFY_EOS,
|
|
PLAYER_VIDEO_RENDER_NOTIFY_VIDEO_SIZE,
|
|
PLAYER_VIDEO_RENDER_NOTIFY_VIDEO_CROP,
|
|
PLAYER_VIDEO_RENDER_NOTIFY_VIDEO_BUFFER,
|
|
PLAYER_VIDEO_RENDER_NOTIFY_VIDEO_FRAME,
|
|
|
|
PLAYER_AUDIO_DECODER_NOTIFY_STREAM_UNDERFLOW = 96,
|
|
PLAYER_AUDIO_DECODER_NOTIFY_CRASH,
|
|
PLAYER_AUDIO_DECODER_NOTIFY_EOS,
|
|
PLAYER_AUDIO_DECODER_NOTIFY_AUDIORAWPLAY,
|
|
|
|
PLAYER_AUDIO_RENDER_NOTIFY_FIRST_FRAME = 128,
|
|
PLAYER_AUDIO_RENDER_NOTIFY_EOS,
|
|
PLAYER_AUDIO_RENDER_NOTIFY_PTS_AND_CACHETIME,
|
|
PLAYER_AUDIO_RENDER_NOTIFY_AUDIO_INFO,
|
|
PLAYER_AUDIO_RENDER_NOTIFY_AUDIO_BUFFER,
|
|
|
|
PLAYER_SUBTITLE_DECODER_NOTIFY_STREAM_UNDERFLOW = 160,
|
|
PLAYER_SUBTITLE_DECODER_NOTIFY_CRASH,
|
|
PLAYER_SUBTITLE_DECODER_NOTIFY_EOS,
|
|
|
|
PLAYER_SUBTITLE_RENDER_NOTIFY_ITEM_PTS_AND_DURATION = 192,
|
|
PLAYER_SUBTITLE_RENDER_NOTIFY_ITEM_AVAILABLE,
|
|
PLAYER_SUBTITLE_RENDER_NOTIFY_ITEM_EXPIRED,
|
|
PLAYER_SUBTITLE_RENDER_NOTIFY_EOS,
|
|
};
|
|
|
|
//* define message IDs for component threads.
|
|
//* common.
|
|
const int MESSAGE_ID_START = 0x01;
|
|
const int MESSAGE_ID_STOP = 0x02;
|
|
const int MESSAGE_ID_PAUSE = 0x03;
|
|
const int MESSAGE_ID_QUIT = 0x04;
|
|
const int MESSAGE_ID_RESET = 0x05;
|
|
const int MESSAGE_ID_EOS = 0x06;
|
|
//* for decoders.
|
|
const int MESSAGE_ID_DECODE = 0x07;
|
|
//* for renders.
|
|
const int MESSAGE_ID_RENDER = 0x08;
|
|
const int MESSAGE_ID_SET_WINDOW = 0x09; //* video render only.
|
|
const int MESSAGE_ID_SET_3D_MODE = 0x10; //* video render only.
|
|
const int MESSAGE_ID_SET_AUDIO_SINK = 0x11; //* audio render only.
|
|
const int MESSAGE_ID_SET_VIDEO_HIDE = 0x12; //* video render only.
|
|
const int MESSAGE_ID_SET_HOLD_LAST_PICTURE = 0x13; //* video render only.
|
|
const int MESSAGE_ID_SET_TIMESHIFT = 0x14; //* subtitle render only.
|
|
const int MESSAGE_ID_SET_LAYER_INFO = 0x15; //* video render only.
|
|
|
|
#define CONFIG_AUDIO_RENDER_TIME_DIFFERENCE_REPORT_PERIOD (5000000) //* report every 5 seconds.
|
|
#define CONFIG_USE_LARGER_PTS_AS_START_TIME (1) //* choose the larger pts of nFirstVideoPts and nFirstAudioPts as the player start time.
|
|
#define CONFIG_THREASHOLD_OF_PTS_DIFFERENCE_TO_JUDGE_PTS_jUMP (17000000) //* if pts difference is more than 5 seconds, we judge there is a pts jump(loop back) event.
|
|
#define CONFIG_THREASHOLD_OF_PTS_DIFFERENCE_TO_JUDGE_PTS_jUMP_DTMB (1500000) //* if pts difference is more than 5 seconds, we judge there is a pts jump(loop back) event.
|
|
|
|
|
|
#define CONFIG_MAX_WAIT_TIME_FOR_SYNC (17000000) //* don't wait for synchronization for too long, should not smaller than CONFIG_THREASHOLD_OF_PTS_DIFFERENCE_TO_JUDGE_PTS_jUMP.
|
|
#define CONFIG_THREASHOLD_OF_PTS_DIFFERENCE_TO_JUDGE_PTS_jUMP_FOR_SUBTITLE (20000000) //* 20 seconds.
|
|
|
|
#define TIMER_DROP_AUDIO_DATA 0x04
|
|
#define TIMER_DROP_VIDEO_DATA 0x05
|
|
#define TIMER_NEED_NOTIFY_AGAIN 0x06
|
|
|
|
static int64_t GetSysTime(void)
|
|
{
|
|
int64_t time;
|
|
struct timeval t;
|
|
gettimeofday(&t, NULL);
|
|
time = (int64_t)t.tv_sec * 1000000;
|
|
time += t.tv_usec;
|
|
return time;
|
|
}
|
|
|
|
#define CDX_PLAYER_UNUSE(param) (void)param
|
|
|
|
#endif
|