123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716 |
- #include <stdio.h>
- #include <stdbool.h>
- #include <assert.h>
- #include "player.h"
- #include "frame.h"
- #include "packet.h"
- #include "demux.h"
- #include "video.h"
- #include "audio.h"
- static int initialized = 0;
- // 返回值:返回上一帧的pts更新值(上一帧pts+流逝的时间)
- double get_clock(play_clock_t *c)
- {
- if (*c->queue_serial != c->serial)
- {
- return NAN;
- }
- if (c->paused)
- {
- return c->pts;
- }
- else
- {
- double time = av_gettime_relative() / 1000000.0;
- double ret = c->pts_drift + time; // 展开得: c->pts + (time - c->last_updated)
- return ret;
- }
- }
- void set_clock_at(play_clock_t *c, double pts, int serial, double time)
- {
- c->pts = pts;
- c->last_updated = time;
- c->pts_drift = c->pts - time;
- c->serial = serial;
- }
- void set_clock(play_clock_t *c, double pts, int serial)
- {
- double time = av_gettime_relative() / 1000000.0;
- set_clock_at(c, pts, serial, time);
- }
- static void set_clock_speed(play_clock_t *c, double speed)
- {
- set_clock(c, get_clock(c), c->serial);
- c->speed = speed;
- }
- void init_clock(play_clock_t *c, int *queue_serial)
- {
- c->speed = 1.0;
- c->paused = 0;
- c->queue_serial = queue_serial;
- set_clock(c, NAN, -1);
- }
- static void sync_play_clock_to_slave(play_clock_t *c, play_clock_t *slave)
- {
- double clock = get_clock(c);
- double slave_clock = get_clock(slave);
- if (!isnan(slave_clock) && (isnan(clock) || fabs(clock - slave_clock) > AV_NOSYNC_THRESHOLD))
- set_clock(c, slave_clock, slave->serial);
- }
- /* pause or resume the video */
- static void stream_toggle_pause(player_stat_t *is)
- {
- if (is->m_ipaused)
- {
- // 这里表示当前是暂停状态,将切换到继续播放状态。在继续播放之前,先将暂停期间流逝的时间加到frame_timer中
- is->frame_timer += av_gettime_relative() / 1000000.0 - is->video_clk.last_updated;
- set_clock(&is->video_clk, get_clock(&is->video_clk), is->video_clk.serial);
- }
- is->m_ipaused = is->audio_clk.paused = is->video_clk.paused = !is->m_ipaused;
- }
- static void toggle_pause(player_stat_t *is)
- {
- stream_toggle_pause(is);
- is->m_istep = 0;
- }
- static void toggle_full_screen(player_stat_t* is)
- {
- SDL_SetWindowFullscreen(is->sdl_video.window, SDL_WINDOW_FULLSCREEN_DESKTOP);
- }
- CMediaPlayer::CMediaPlayer(CMediaHostApi* pHostApi)
- {
- m_hostapi = pHostApi;
- m_player_stat = NULL;
- m_uvolume = SDL_MIX_MAXVOLUME/2;
- m_bplaying = false;
- m_piconpath = NULL;
- m_paudiodev = NULL;
- m_bmediaplay_started_flag = false;
- m_mediaplay_started_sem = NULL;
- m_bmediaplay_start_failed = false;
- m_meida_play_start_wait_mutex = SDL_CreateMutex();
- if (NULL != m_hostapi){
- char str_iconpath[MAX_PATH] = {0};
- if (0 == pHostApi->GetMediaPlayerIcoPath(str_iconpath, MAX_PATH)){
- m_piconpath = av_strdup(str_iconpath);
- }
- char str_audiodev[MAX_PATH] = { 0 };
- if (0 == pHostApi->GetAudioOutDevName(str_audiodev, MAX_PATH)) {
- m_paudiodev = av_strdup(str_audiodev);
- }
- else {
- m_paudiodev = NULL;
- }
- }
- else {
- m_hostapi->Debug(MEDIA_LOG_ERROR, "new CMediaPlayer failed!");
- }
- if (initialized){
- ++initialized;
- }
- else {
- if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER)){
- m_hostapi->Debug(MEDIA_LOG_ERROR, "Could not initialize SDL - %s", SDL_GetError());
- m_hostapi->Debug(MEDIA_LOG_ERROR, "(Did you set the DISPLAY variable?)");
- }
- else {
- initialized++;
- }
- }
- }
- CMediaPlayer::~CMediaPlayer()
- {
- if (NULL != m_meida_play_start_wait_mutex) {
- SDL_DestroyMutex(m_meida_play_start_wait_mutex);
- m_meida_play_start_wait_mutex = NULL;
- }
- if (NULL != m_player_stat) {
- UnInitialize_Player_Stat();
- }
- if (NULL != m_piconpath) {
- av_free(m_piconpath);
- m_piconpath = NULL;
- }
- if (NULL != m_paudiodev){
- av_free(m_paudiodev);
- m_paudiodev = NULL;
- }
- if (--initialized == 0){
- SDL_Quit();
- }
- }
- static int audio_volume_callback(int* audiovolume, void* userdata)
- {
- CMediaPlayer* player = (CMediaPlayer*)userdata;
- *audiovolume = player->GetVolume();
- return 0;
- }
- static int audio_play_finished_callback(void* userdata)
- {
- CMediaPlayer* player = (CMediaPlayer*)userdata;
- if (NULL != player){
- player->SetFinishedFlag();
- }
- return 0;
- }
- static int mediaplay_thread_func(void* arg)
- {
- int iret = -1;
- int icount = 0;
- CMediaPlayer* pPlayer = (CMediaPlayer*)arg;
- if (0 != open_demux(pPlayer->GetPlayerStat())) {
- pPlayer->GetMediaHostApi()->Debug(MEDIA_LOG_ERROR, "open_demux function call failed.");
- return iret;
- }
- if (eVideo_Type == pPlayer->GetPlayerStat()->m_eMType) {
- iret = open_video(pPlayer->GetPlayerStat());
- if (0 != iret) {
- pPlayer->GetMediaHostApi()->Debug(MEDIA_LOG_ERROR, "open video failed.");
- pPlayer->StartMediaPlayFailed();
- return iret;
- }
- }
- iret = open_audio(pPlayer->GetPlayerStat());
- if (0 == iret) {
- bool baudioplay_thread_exit = false;
- do {
- if (NULL != pPlayer->GetPlayerStat()->m_audio_play_wait_sem) {
- int iWait = SDL_SemWaitTimeout(pPlayer->GetPlayerStat()->m_audio_play_wait_sem, 5);
- if (0 != iWait) {
- if (SDL_MUTEX_TIMEDOUT == iWait) {
- if (false == pPlayer->GetMediaPlayStartedFlag()) {
- pPlayer->SetMediaPlayStartedFlag(true);
- }
- }
- else {
- pPlayer->GetMediaHostApi()->Debug(MEDIA_LOG_ERROR, "SDL_SemWaitTimeout error.");
- }
- }
- else {
- baudioplay_thread_exit = true;
- }
- }
- else {
- pPlayer->GetMediaHostApi()->Debug(MEDIA_LOG_ERROR, "invalid m_audio_play_wait_sem");
- baudioplay_thread_exit = true;
- }
- } while (!baudioplay_thread_exit);
- SDL_CloseAudioDevice(pPlayer->GetPlayerStat()->m_audio_dev);
- }
- else {
- pPlayer->StartMediaPlayFailed();
- return iret;
- }
- return iret;
- }
- bool CMediaPlayer::SetFinishedFlag()
- {
- if (NULL != m_player_stat){
- if (NULL != m_hostapi) {
- m_hostapi->Debug(MEDIA_LOG_DEBUG, "%s:%d set baudio_finished to true.", __FUNCTION__, __LINE__);
- }
- }
- else {
- if (NULL != m_hostapi) {
- m_hostapi->Debug(MEDIA_LOG_INFO, "%s:%d m_player_stat is null and set audio finished flag failed.", __FUNCTION__, __LINE__);
- }
- }
-
- return true;
- }
- uint8_t CMediaPlayer::GetVolume()
- {
- return m_uvolume;
- }
- eMediaType_t CMediaPlayer::GetPlayingMediaType()
- {
- return m_player_stat->m_eMType;
- }
- player_stat_t* CMediaPlayer::GetPlayerStat()
- {
- return m_player_stat;
- }
- CMediaHostApi* CMediaPlayer::GetMediaHostApi()
- {
- return m_hostapi;
- }
- bool CMediaPlayer::GetMediaPlayStartedFlag()
- {
- return m_bmediaplay_started_flag;
- }
- void CMediaPlayer::SetMediaPlayStartedFlag(bool bflag)
- {
- m_bmediaplay_started_flag = bflag;
- }
- void CMediaPlayer::StartMediaPlayFailed()
- {
- m_bmediaplay_start_failed = true;
- }
- SDL_mutex* CMediaPlayer::GetMeidaPlayStartWaitMutex()
- {
- return m_meida_play_start_wait_mutex;
- }
- int CMediaPlayer::Initialize_Player_Stat(rvc_media_player_param_t* pMedia_Player)
- {
- int iRet = -1;
- if (NULL == pMedia_Player) {
- return iRet;
- }
- if (NULL != m_player_stat) {
- UnInitialize_Player_Stat();
- }
- m_player_stat = (player_stat_t*)av_mallocz(sizeof(player_stat_t));
- if (NULL == m_player_stat) {
- m_hostapi->Debug(MEDIA_LOG_ERROR, "player_stat_t struct malloc failed!");
- return iRet;
- }
- m_player_stat->buser_stop = false;
- m_player_stat->rvc_hostapi = m_hostapi;
- m_player_stat->m_prvc_cb = pMedia_Player->cb;
- m_player_stat->m_eMType = pMedia_Player->eType;
- m_player_stat->m_eWindType = pMedia_Player->m_eWindType;
- m_player_stat->bvice_monitor = pMedia_Player->bvicemonitor;
- m_player_stat->iDisplayCx = pMedia_Player->idisplaycx;
- m_player_stat->iDisplayCy = pMedia_Player->idisplaycy;
- m_player_stat->iDisplayWidth = pMedia_Player->idisplaywidth;
- m_player_stat->iDisplayHeight = pMedia_Player->idisplayheight;
- m_player_stat->on_audio_volume = &audio_volume_callback;
- m_player_stat->on_audio_play_finished = &audio_play_finished_callback;
- m_player_stat->user_data = this;
- if (NULL != m_piconpath){
- m_player_stat->m_piconpath = av_strdup(m_piconpath);
- }
- if (NULL != m_paudiodev){
- m_player_stat->m_paudiodev = av_strdup(m_paudiodev);
- }
- m_player_stat->uVolume = m_uvolume;
- m_player_stat->m_uFilesCount = pMedia_Player->m_uFilesCount;
- m_player_stat->m_icurrent_index = 0;
- m_player_stat->m_iaudio_dec_index = 0;
- for (size_t i = 0; i < pMedia_Player->m_uFilesCount; i++){
- memcpy(m_player_stat->m_strPlayLists[i], pMedia_Player->m_strPlayLists[i], strlen(pMedia_Player->m_strPlayLists[i]));
- }
- if (0 == pMedia_Player->m_uFilesCount || NULL == m_player_stat->rvc_hostapi || NULL == m_player_stat->m_prvc_cb || NULL == m_player_stat->m_piconpath) {
- UnInitialize_Player_Stat();
- return iRet;
- }
- else{
- iRet = 0;
- }
- return iRet;
- }
- int CMediaPlayer::UnInitialize_Player_Stat()
- {
- /* XXX: use a special url_shutdown call to abort parse cleanly */
- if (NULL == m_player_stat) {
- return -1;
- }
- for (int index = 0; index < m_player_stat->m_uFilesCount; index++) {
- if (NULL != m_player_stat->m_pfmt_ctx[index]) {
- avformat_close_input(&m_player_stat->m_pfmt_ctx[index]);
- avformat_free_context(m_player_stat->m_pfmt_ctx[index]);
- m_player_stat->m_pfmt_ctx[index] = NULL;
- }
- if (NULL != m_player_stat->m_pacodec_ctx[index]) {
- avcodec_close(m_player_stat->m_pacodec_ctx[index]);
- avcodec_free_context(&m_player_stat->m_pacodec_ctx[index]);
- }
- if (NULL != m_player_stat->m_pvcodec_ctx[index]) {
- avcodec_close(m_player_stat->m_pvcodec_ctx[index]);
- avcodec_free_context(&m_player_stat->m_pvcodec_ctx[index]);
- }
- }
-
- SDL_DestroyCond(m_player_stat->m_continue_read_thread);
- SDL_DestroySemaphore(m_player_stat->m_audio_play_wait_sem);
- m_player_stat->m_audio_play_wait_sem = NULL;
- if (m_player_stat->m_eMType == eVideo_Type) {
- for (int index = 0; index < m_player_stat->m_uFilesCount; index++) {
- if (NULL != m_player_stat->m_pimg_convert_ctx[index]) {
- sws_freeContext(m_player_stat->m_pimg_convert_ctx[index]);
- m_player_stat->m_pimg_convert_ctx[index] = NULL;
- }
- if (NULL != m_player_stat->m_pfrm_yuv[index]) {
- av_frame_free(&m_player_stat->m_pfrm_yuv[index]);
- av_frame_unref(m_player_stat->m_pfrm_yuv[index]);
- }
- if (NULL != m_player_stat->m_pvideo_buffer[index]) {
- av_free(m_player_stat->m_pvideo_buffer[index]);
- m_player_stat->m_pvideo_buffer[index] = NULL;
- }
- }
- }
- packet_queue_destroy(&m_player_stat->video_pkt_queue, m_hostapi);
- packet_queue_destroy(&m_player_stat->audio_pkt_queue, m_hostapi);
- ///* free all pictures */
- frame_queue_destory(&m_player_stat->video_frm_queue);
- frame_queue_destory(&m_player_stat->audio_frm_queue);
- swr_free(&m_player_stat->m_paudio_swr_ctx);
- //if (NULL != m_player_stat->m_paudio_frm) {
- // av_free(m_player_stat->m_paudio_frm);
- // m_player_stat->m_paudio_frm = NULL;
- //}
- if (NULL != m_player_stat->m_paudio_frm_rwr) {
- av_free(m_player_stat->m_paudio_frm_rwr);
- m_player_stat->m_paudio_frm_rwr = NULL;
- }
- if (m_player_stat->m_piconpath){
- av_free(m_player_stat->m_piconpath);
- m_player_stat->m_piconpath = NULL;
- }
- if (m_player_stat->m_paudiodev) {
- av_free(m_player_stat->m_paudiodev);
- m_player_stat->m_paudiodev = NULL;
- }
- if (m_player_stat->m_straudiodev) {
- av_free(m_player_stat->m_straudiodev);
- m_player_stat->m_straudiodev = NULL;
- }
- av_free(m_player_stat);
- m_player_stat = NULL;
- return 0;
- }
- int CMediaPlayer::GetViceVideoDisplayInfo(int* icx, int* icy, int* iwidth, int* iheight)
- {
- int iRet = -1;
- size_t uCount = SDL_GetNumVideoDisplays();
- //m_hostapi->Debug(MEDIA_LOG_DEBUG, "VideoDisplays Number is %d.", uCount);
- SDL_DisplayMode dispalymode[RVC_MAX_DISPLAYNUM] = { 0 };
- for (size_t i = 0; i < uCount && i < RVC_MAX_DISPLAYNUM; i++) {
- SDL_GetDesktopDisplayMode(i, &dispalymode[i]);
- //m_hostapi->Debug(MEDIA_LOG_DEBUG, "VideoDisplays{%d} format = %d", i, dispalymode[i].format);
- //m_hostapi->Debug(MEDIA_LOG_DEBUG, "VideoDisplays{%d} w = %d", i, dispalymode[i].w);
- //m_hostapi->Debug(MEDIA_LOG_DEBUG, "VideoDisplays{%d} h = %d", i, dispalymode[i].h);
- //m_hostapi->Debug(MEDIA_LOG_DEBUG, "VideoDisplays{%d} refresh_rate = %d", i, dispalymode[i].refresh_rate);
- }
- if (uCount > 1) {
- *icx = dispalymode[0].w;
- *icy = 0;
- *iwidth = dispalymode[1].w;
- *iheight = dispalymode[1].h;
- iRet = 0;
- }
- return iRet;
- }
- int CMediaPlayer::InitParam(rvc_media_player_param_t* pMedia_Player)
- {
- int iRet = -1;
- if (0 != Initialize_Player_Stat(pMedia_Player)){
- return iRet;
- }
- //m_hostapi->Debug(MEDIA_LOG_DEBUG, "initialize player stat success.");
- /* start video display */
- if (frame_queue_init(&m_player_stat->video_frm_queue, &m_player_stat->video_pkt_queue, VIDEO_PICTURE_QUEUE_SIZE, 1) < 0 ||
- frame_queue_init(&m_player_stat->audio_frm_queue, &m_player_stat->audio_pkt_queue, SAMPLE_QUEUE_SIZE, 1) < 0)
- {
- m_hostapi->Debug(MEDIA_LOG_DEBUG, "media frame queue init failed!");
- UnInitialize_Player_Stat();
- return iRet;
- }
- /* init packet queue */
- if (packet_queue_init(&m_player_stat->video_pkt_queue, m_hostapi) < 0 ||
- packet_queue_init(&m_player_stat->audio_pkt_queue, m_hostapi) < 0)
- {
- m_hostapi->Debug(MEDIA_LOG_DEBUG, "media packet queue init failed!");
- UnInitialize_Player_Stat();
- return iRet;
- }
- /* put end pkt into packet queue */
- AVPacket flush_pkt = {0};
- flush_pkt.data = NULL;
- packet_queue_put(&m_player_stat->video_pkt_queue, &flush_pkt, m_hostapi);
- packet_queue_put(&m_player_stat->audio_pkt_queue, &flush_pkt, m_hostapi);
- if (!(m_player_stat->m_continue_read_thread = SDL_CreateCond())){
- m_hostapi->Debug(MEDIA_LOG_DEBUG, "SDL_CreateCond(): %s.", SDL_GetError());
- UnInitialize_Player_Stat();
- return iRet;
- }
- m_player_stat->m_audio_play_wait_sem = SDL_CreateSemaphore(0);
- init_clock(&m_player_stat->video_clk, &m_player_stat->video_pkt_queue.serial);
- init_clock(&m_player_stat->audio_clk, &m_player_stat->audio_pkt_queue.serial);
- if (m_player_stat->bvice_monitor){
- if (0 == GetViceVideoDisplayInfo(&m_player_stat->iDisplayCx, &m_player_stat->iDisplayCy, &m_player_stat->iDisplayWidth, &m_player_stat->iDisplayHeight)){
-
- }
- }
- iRet = 0;
- return iRet;
- }
- int CMediaPlayer::SetVolume(uint8_t uVolume)
- {
- int iRet = -1;
-
- m_uvolume = uVolume * SDL_MIX_MAXVOLUME/100;
- iRet = 0;
- return iRet;
- }
- bool CMediaPlayer::GetPlayingFlag()
- {
- return m_bplaying;
- }
- int CMediaPlayer::StartMediaPlay()
- {
- int iRet = -1;
- m_bplaying = true;
- SDL_LockMutex(m_meida_play_start_wait_mutex);
- m_bmediaplay_started_flag = false;
- m_bmediaplay_start_failed = false;
-
- m_mediaplay_started_sem = SDL_CreateSemaphore(0);
- m_mediaplay_tid = SDL_CreateThread(mediaplay_thread_func, "mediaplay_thread", this);
- if (NULL == m_mediaplay_tid) {
- SDL_UnlockMutex(m_meida_play_start_wait_mutex);
- m_hostapi->Debug(MEDIA_LOG_ERROR, "SDL_CreateThread() failed: %s.", SDL_GetError());
- return iRet;
- }
- else {
- m_hostapi->Debug(MEDIA_LOG_DEBUG, "create %s success, and thread id is %u.", SDL_GetThreadName(m_mediaplay_tid), SDL_GetThreadID(m_mediaplay_tid));
-
- bool bmediaplay_thread_exit = false;
- do {
- int iWaitRet = SDL_SemWaitTimeout(m_mediaplay_started_sem, 10);
- if (0 != iWaitRet) {
- if (SDL_MUTEX_TIMEDOUT == iWaitRet) {
- if (m_bmediaplay_started_flag) {
- break;
- }
- else {
- if (m_bmediaplay_start_failed) {
- m_hostapi->Debug(MEDIA_LOG_ERROR, "media play start failed.");
- break;
- }
- }
- }
- }
- else {
- bmediaplay_thread_exit = true;
- }
- } while (!bmediaplay_thread_exit);
- }
- SDL_DestroySemaphore(m_mediaplay_started_sem);
- m_mediaplay_started_sem = NULL;
- SDL_UnlockMutex(m_meida_play_start_wait_mutex);
- SDL_WaitThread(m_mediaplay_tid, NULL);
- m_mediaplay_tid = NULL;
-
- if (NULL != m_player_stat->m_audio_decode_tid) {
- SDL_WaitThread(m_player_stat->m_audio_decode_tid, NULL);
- m_player_stat->m_audio_decode_tid = NULL;
- }
- if (m_player_stat->m_eMType == eVideo_Type) {
- if (NULL != m_player_stat->m_video_decode_tid) {
- SDL_WaitThread(m_player_stat->m_video_decode_tid, NULL);
- m_player_stat->m_video_decode_tid = NULL;
- }
- if (NULL != m_player_stat->m_video_playing_tid) {
- SDL_WaitThread(m_player_stat->m_video_playing_tid, NULL);
- m_player_stat->m_video_playing_tid = NULL;
- }
- }
- if (NULL != m_player_stat->m_read_tid) {
- SDL_WaitThread(m_player_stat->m_read_tid, NULL);
- m_player_stat->m_read_tid = NULL;
- }
-
- ExitMediaPlayingThread();
- iRet = 0;
-
- return iRet;
- }
- int CMediaPlayer::StopMediaPlay()
- {
- int iRet = -1;
- if (NULL == m_player_stat) {
- return iRet;
- }
- if (NULL != m_mediaplay_started_sem) {
- SDL_SemPost(m_mediaplay_started_sem);
- }
- m_player_stat->buser_stop = true;
- SDL_LockMutex(m_meida_play_start_wait_mutex);
- if (NULL != m_player_stat->m_audio_play_wait_sem) {
- SDL_SemPost(m_player_stat->m_audio_play_wait_sem);
- }
- packet_queue_abort(&m_player_stat->video_pkt_queue, m_hostapi);
- packet_queue_abort(&m_player_stat->audio_pkt_queue, m_hostapi);
- frame_queue_signal(&m_player_stat->video_frm_queue);
- frame_queue_signal(&m_player_stat->audio_frm_queue);
- SDL_UnlockMutex(m_meida_play_start_wait_mutex);
- iRet = 0;
- return iRet;
- }
- int CMediaPlayer::ExitMediaPlayingThread()
- {
- int iRet = -1;
- if (NULL == m_player_stat){
- return iRet;
- }
- if(eVideo_Type == m_player_stat->m_eMType){
- if (m_player_stat->sdl_video.texture) {
- SDL_DestroyTexture(m_player_stat->sdl_video.texture);
- }
- if (m_player_stat->sdl_video.renderer){
- SDL_DestroyRenderer(m_player_stat->sdl_video.renderer);
- }
-
- if (m_player_stat->sdl_video.window){
- SDL_DestroyWindow(m_player_stat->sdl_video.window);
- }
- }
- if (m_player_stat->m_prvc_cb){
- if (m_player_stat->m_prvc_cb->cb_play_media_finished) {
- m_player_stat->m_prvc_cb->cb_play_media_finished(m_player_stat->m_prvc_cb->user_data);
- }
- }
- UnInitialize_Player_Stat();
- m_bplaying = false;
- iRet = 0;
- return iRet;
- }
- int64_t CMediaPlayer::GetMediaPlayingThreadId()
- {
- int64_t iRet = 0;
- if (NULL != m_player_stat)
- {
- if (NULL != m_player_stat->m_read_tid)
- {
- iRet = SDL_GestureID(m_player_stat->m_read_tid);
- }
- }
- return iRet;
- }
|