changeset 2394:2fe8feb3dcd1

pMovie renamed to pMovie_Track and other
author Ritor1
date Fri, 04 Jul 2014 18:15:46 +0600
parents a29d9609f9b2
children eba7123e4a2d
files Arcomage.cpp Game.cpp MediaPlayer.cpp MediaPlayer.h OSWindow.cpp Render.cpp SaveLoad.cpp UI/UITransition.cpp VideoPlayer.cpp mm7_2.cpp
diffstat 10 files changed, 57 insertions(+), 52 deletions(-) [+]
line wrap: on
line diff
--- a/Arcomage.cpp	Fri Jul 04 13:58:09 2014 +0600
+++ b/Arcomage.cpp	Fri Jul 04 18:15:46 2014 +0600
@@ -1109,7 +1109,7 @@
   pArcomageGame->pSprites.Release();
   pArcomageGame->bGameInProgress = false;
   viewparams->bRedrawGameUI = true;
-  if ( pMovie )
+  if ( pMovie_Track )
     pVideoPlayer->_4BF5B2();
   for( int i = 0; i < 12; ++i )
     pSoundList->UnloadSound(am_sounds[i], 1);
--- a/Game.cpp	Fri Jul 04 13:58:09 2014 +0600
+++ b/Game.cpp	Fri Jul 04 18:15:46 2014 +0600
@@ -96,7 +96,7 @@
   pIndoorCameraD3D->CreateWorldMatrixAndSomeStuff();
   pIndoorCameraD3D->_4374E8_ProllyBuildFrustrum();
 
-  if ( pMovie )
+  if ( pMovie_Track )
   {
     /*if ( !pRenderer->pRenderD3D )
     {
@@ -166,7 +166,7 @@
     GameUI_Footer_2();
     viewparams->bRedrawGameUI = false;
   }
-  if (!pMovie)//!pVideoPlayer->pSmackerMovie)
+  if (!pMovie_Track)//!pVideoPlayer->pSmackerMovie)
   {
     GameUI_DrawMinimap(488, 16, 625, 133, viewparams->uMinimapZoom, true);//redraw = pParty->uFlags & 2);
     if (v4)
@@ -190,7 +190,7 @@
   GameUI_DrawCharacterSelectionFrame();
   if ( _44100D_should_alter_right_panel() )
     GameUI_DrawRightPanel();
-  if ( !pMovie )
+  if ( !pMovie_Track )
   {
     pStru6Instance->DrawPlayerBuffAnims();
     pOtherOverlayList->DrawTurnBasedIcon(v4);
@@ -425,7 +425,7 @@
             pNPCStats->pNewNPCData[i].uFlags &= 0xFFFFFF7Fu;
         }
         pVideoPlayer->PlayDeathMovie();
-        if ( pMovie )
+        if ( pMovie_Track )
           pVideoPlayer->Unload();
         SaveGame(0, 0);
         ++pParty->uNumDeaths;
--- a/MediaPlayer.cpp	Fri Jul 04 13:58:09 2014 +0600
+++ b/MediaPlayer.cpp	Fri Jul 04 18:15:46 2014 +0600
@@ -26,8 +26,8 @@
 using namespace Media;
 
 Media::MPlayer *pMediaPlayer;
-Media::IMovie *pMovie;
-Media::ITrack *pTrack;
+Media::IMovie *pMovie_Track;
+Media::ITrack *pAudio_Track;
 Movie *movie;
 
 int mSourceID;
@@ -187,8 +187,9 @@
     if (dec_ctx)
     {
 	  // Close the codec
-      // закрытие видео кодека
+      // закрытие кодека
       avcodec_close(dec_ctx);
+	  Log::Warning(L"close decoder context file\n");
       dec_ctx = nullptr;
     }
   }
@@ -671,6 +672,7 @@
       {
         // закрытие контекста файла
         av_close_input_file(format_ctx);
+		Log::Warning(L"close audio format context file\n");
         format_ctx = nullptr;
       }
     }
@@ -775,9 +777,9 @@
       memset(last_resampled_frame_linesize, 0, sizeof(last_resampled_frame_linesize));
 
       decoding_packet = nullptr;
-		ioBuffer = nullptr;
-		format_ctx = nullptr;
-		avioContext = nullptr;
+	  ioBuffer = nullptr;
+	  format_ctx = nullptr;
+	  avioContext = nullptr;
     }
  
     inline void Release()
@@ -795,6 +797,7 @@
 		// Close the video file
         // закрытие контекста файла(видео файла)
         av_close_input_file(format_ctx);
+		Log::Warning(L"close video format context file\n");
         format_ctx = nullptr;
 	  }
 	  if(avioContext)
@@ -877,7 +880,6 @@
           decoding_frame = avcodec_alloc_frame();
 
           audio_data_in_device = provider->CreateStreamingTrack16(audio.dec_ctx->channels, audio.dec_ctx->sample_rate, 2);
-
           return true;
         }
         fprintf(stderr, "ffmpeg: Unable to find stream info\n");
@@ -1032,25 +1034,25 @@
 
 ITrack *MPlayer::LoadTrack(const wchar_t *filename) //Загрузить mp3
 {
-  auto track = new Track;
-  Log::Warning(L"allocation dynamic memory for Track\n");
-  if (!track->LoadAudio(filename))
+  auto audio_track = new Track;
+  Log::Warning(L"allocation dynamic memory for audio_track\n");
+  if (!audio_track->LoadAudio(filename))
   {
-    delete track;
-	Log::Warning(L"delete dynamic memory for Track\n");
-    track = nullptr;
+    delete audio_track;
+	Log::Warning(L"delete dynamic memory for audio_track\n");
+    audio_track = nullptr;
   }
-  return track;
+  return audio_track;
 }
 
 IMovie *MPlayer::LoadMovie(const wchar_t *filename, int width, int height, int cache_ms)	//Загрузить видео
 {
   movie = new Movie;
-  Log::Warning(L"allocation dynamic memory for Movie\n");
+  Log::Warning(L"allocation dynamic memory for movie\n");
   if (!movie->Load(filename, width, height, cache_ms))
   {
     delete movie;
-	Log::Warning(L"delete dynamic memory for Movie\n");
+	Log::Warning(L"delete dynamic memory for movie\n");
     movie = nullptr;
   }
   return movie;
@@ -1059,13 +1061,13 @@
 IMovie *MPlayer::LoadMovieFromLOD(HANDLE h, int readFunction(void*, uint8_t*, int), int64_t seekFunction(void*, int64_t, int), int width, int height)
 {
 	movie = new Movie;
-	Log::Warning(L"allocation dynamic memory for Movie\n");
+	Log::Warning(L"allocation dynamic memory for movie\n");
 	if (movie)
 	{
 		if (movie->LoadFromLOD(h, readFunction, seekFunction, width, height))
-			return movie;
+		  return movie;
 		delete movie;
-		Log::Warning(L"delete dynamic memory for Movie\n");
+		Log::Warning(L"delete dynamic memory for movie\n");
 	}
 	return nullptr;
 }
@@ -1115,21 +1117,24 @@
 
 void PlayAudio(const wchar_t * pFilename)
 {
-  pTrack = pMediaPlayer->LoadTrack(pFilename);
-  pTrack->Play();
+  pAudio_Track = pMediaPlayer->LoadTrack(pFilename);
+  pAudio_Track->Play();
+  delete pAudio_Track;
+  Log::Warning(L"delete dynamic memory for pAudio_Track\n");
+  pAudio_Track = nullptr;
 }
 
 void PlayMovie(const wchar_t * pFilename)
 {
-  Media::IMovie *track = pMediaPlayer->LoadMovie(pFilename, 640, 480, 0);
-  track->Play();
+  Media::IMovie *Movie_track = pMediaPlayer->LoadMovie(pFilename, 640, 480, 0);
+  Movie_track->Play();
 }
 
 void MovieRelease()
 {
   movie->Release();
   delete movie;
-  Log::Warning(L"delete dynamic memory for Movie\n");
+  Log::Warning(L"delete dynamic memory for movie\n");
   movie = nullptr;
 }
 
--- a/MediaPlayer.h	Fri Jul 04 13:58:09 2014 +0600
+++ b/MediaPlayer.h	Fri Jul 04 18:15:46 2014 +0600
@@ -28,8 +28,8 @@
 };
 
 extern Media::MPlayer *pMediaPlayer;
-extern Media::IMovie *pMovie;
-extern Media::ITrack *pTrack;
+extern Media::IMovie *pMovie_Track;
+extern Media::ITrack *pAudio_Track;
 extern class Movie *movie;
 
 extern bool end_current_file;
--- a/OSWindow.cpp	Fri Jul 04 13:58:09 2014 +0600
+++ b/OSWindow.cpp	Fri Jul 04 18:15:46 2014 +0600
@@ -316,14 +316,14 @@
               pMiscTimer->Resume();
 
             viewparams->bRedrawGameUI = true;
-            if ( pMovie)//pVideoPlayer->pSmackerMovie )
+            if ( pMovie_Track)//pVideoPlayer->pSmackerMovie )
             {
               pRenderer->RestoreFrontBuffer();
               pRenderer->RestoreBackBuffer();
               //pVideoPlayer->_4BF5B2();
             }
           }
-          if ( pAudioPlayer->hAILRedbook && !bGameoverLoop && !pMovie)//!pVideoPlayer->pSmackerMovie )
+          if ( pAudioPlayer->hAILRedbook && !bGameoverLoop && !pMovie_Track)//!pVideoPlayer->pSmackerMovie )
             AIL_redbook_resume(pAudioPlayer->hAILRedbook);
         }
       }
@@ -332,7 +332,7 @@
         if (!(dword_6BE364_game_settings_1 & GAME_SETTINGS_APP_INACTIVE))
         {
           dword_4E98BC_bApplicationActive = 0;
-          if ( pMovie//(pVideoPlayer->pSmackerMovie || pVideoPlayer->pBinkMovie) 
+          if ( pMovie_Track//(pVideoPlayer->pSmackerMovie || pVideoPlayer->pBinkMovie) 
 			  && pVideoPlayer->bPlayingMovie )
             pVideoPlayer->bStopBeforeSchedule = 1;
 
--- a/Render.cpp	Fri Jul 04 13:58:09 2014 +0600
+++ b/Render.cpp	Fri Jul 04 18:15:46 2014 +0600
@@ -9001,7 +9001,7 @@
     && pCurrentScreen != SCREEN_CHANGE_LOCATION )
   {
 	  if (pCurrentScreen == SCREEN_INPUT_BLV)
-		  return pMovie;//pSmackerMovie != 0;
+		  return pMovie_Track;//pSmackerMovie != 0;
     if ( pCurrentScreen != SCREEN_BRANCHLESS_NPC_DIALOG )
       return true;
   }
--- a/SaveLoad.cpp	Fri Jul 04 13:58:09 2014 +0600
+++ b/SaveLoad.cpp	Fri Jul 04 18:15:46 2014 +0600
@@ -569,7 +569,7 @@
   FILE *file; // eax@7
   void *pSave; // [sp+170h] [bp-8h]@3
 
-  if ( pMovie )
+  if ( pMovie_Track )
     pVideoPlayer->Unload();
   pSave = malloc(1000000);
   pNew_LOD->CloseWriteFile();
--- a/UI/UITransition.cpp	Fri Jul 04 13:58:09 2014 +0600
+++ b/UI/UITransition.cpp	Fri Jul 04 18:15:46 2014 +0600
@@ -178,7 +178,7 @@
   pRenderer->DrawTextureIndexed(556, 451, pIcons_LOD->GetTexture(uTextureID_x_x_u));
   pRenderer->DrawTextureIndexed(476, 451, pIcons_LOD->GetTexture(uTextureID_x_ok_u));
   map_id = pMapStats->GetMapInfo(pCurrentMapName);
-  if ( (pMovie || v9) && *dword_591164_teleport_map_name != ' ' )
+  if ( (pMovie_Track || v9) && *dword_591164_teleport_map_name != ' ' )
     map_id = pMapStats->GetMapInfo(dword_591164_teleport_map_name);
   transition_window.uFrameX = 493;
   transition_window.uFrameWidth = 126;
--- a/VideoPlayer.cpp	Fri Jul 04 13:58:09 2014 +0600
+++ b/VideoPlayer.cpp	Fri Jul 04 18:15:46 2014 +0600
@@ -144,7 +144,7 @@
 
       auto image = new char[client_width * client_height * 4];
 
-      pMovie->GetNextFrame(dt, image);	//получить следующий кадр
+      pMovie_Track->GetNextFrame(dt, image);	//получить следующий кадр
 
       if (end_current_file)//достигнут ли конец видео?
         break;
@@ -254,14 +254,14 @@
     AIL_redbook_resume(pAudioPlayer->hAILRedbook);
   pEventTimer->Resume();
 
-	delete pMovie;
-	Log::Warning(L"delete dynamic memory for pMovie\n");
-	pMovie = nullptr;
+  delete pMovie_Track;
+  Log::Warning(L"delete dynamic memory for pMovie_Track\n");
+  pMovie_Track = nullptr;
 }
 
 void VideoPlayer::_inlined_in_463149()
 {
-	if (pMovie)
+	if (pMovie_Track)
 	{
 		pRenderer->BeginScene();
 		pMouse->DrawCursorToTarget();
@@ -283,9 +283,9 @@
 	MovieRelease();
 
     SetFilePointer(hVidFile, uOffset, nullptr, FILE_BEGIN);
-    pMovie = nullptr;
-	Log::Warning(L"reload pMovie");
-    pMovie = pMediaPlayer->LoadMovieFromLOD(hVidFile, &readFunction, &seekFunction, width, height);
+    pMovie_Track = nullptr;
+	Log::Warning(L"reload pMovie_Track");
+    pMovie_Track = pMediaPlayer->LoadMovieFromLOD(hVidFile, &readFunction, &seekFunction, width, height);
 	end_current_file = false;
   }
   //else 
@@ -298,7 +298,7 @@
 
       auto image = new char[current_movie_width * current_movie_height * 4];
 
-      pMovie->GetNextFrame(dt, image);
+      pMovie_Track->GetNextFrame(dt, image);
 
     int image_array[460 * 344];//game_viewport_width * game_viewport_height
     if (image)
@@ -349,7 +349,7 @@
 //----- (004BF3F9) --------------------------------------------------------
 bool VideoPlayer::AnyMovieLoaded()
 {
-	return pMovie;// pSmackerMovie || pBinkMovie;
+	return pMovie_Track;// pSmackerMovie || pBinkMovie;
 }
 
 //----- (004BF411) --------------------------------------------------------
@@ -397,7 +397,7 @@
     }
   }*/
   pMouse->_469E24();
-  if ( window_SpeakInHouse && window_SpeakInHouse->ptr_1C == (void *)165 && !pMovie)//!this->pSmackerMovie )
+  if ( window_SpeakInHouse && window_SpeakInHouse->ptr_1C == (void *)165 && !pMovie_Track)//!this->pSmackerMovie )
   {
     bGameoverLoop = true;
     HouseDialogPressCloseBtn();
@@ -452,7 +452,7 @@
   pResetflag = 0;
   pMediaPlayer = new Media::MPlayer;//создаётся плеер
   Log::Warning(L"allocation dynamic memory for pMediaPlayer\n");
-  pMovie = nullptr;
+  pMovie_Track = nullptr;
   //pBinkMovie = nullptr;
 }
 
@@ -532,6 +532,6 @@
       client_height = rc_client.bottom - rc_client.top;
 
 
-  pMovie = pMediaPlayer->LoadMovieFromLOD(hVidFile, &readFunction, &seekFunction, client_width, client_height);
+  pMovie_Track = pMediaPlayer->LoadMovieFromLOD(hVidFile, &readFunction, &seekFunction, client_width, client_height);
 
 }
--- a/mm7_2.cpp	Fri Jul 04 13:58:09 2014 +0600
+++ b/mm7_2.cpp	Fri Jul 04 18:15:46 2014 +0600
@@ -1414,7 +1414,7 @@
     Log::Warning(L"Checking for CD...");
     if (!FindMM7CD(nullptr, &cMM7GameCDDriveLetter))
       return false;
-    Log::Warning(L"...done.\n");
+    Log::Warning(L"...done.");
   }
 
 
@@ -2059,7 +2059,7 @@
   //Ritor1: include
   MMT_MainMenu_Loop();
 
-  Log::Warning(L"MM: entering main loop \n");
+  Log::Warning(L"MM: entering main loop");
   while ( 1 )
   {
     MainMenuWindow* main_menu_window = MainMenuWindow::Create();