forked from mirror/openmw-tes3mp
Give a name to video streams for logging purposes
This commit is contained in:
parent
77f733362c
commit
00f4f78717
5 changed files with 9 additions and 10 deletions
|
@ -30,7 +30,7 @@ void VideoWidget::playVideo(const std::string &video)
|
|||
{
|
||||
mPlayer->setAudioFactory(new MWSound::MovieAudioFactory());
|
||||
|
||||
mPlayer->playVideo(mVFS->get(video));
|
||||
mPlayer->playVideo(mVFS->get(video), video);
|
||||
|
||||
osg::ref_ptr<osg::Texture2D> texture = mPlayer->getVideoTexture();
|
||||
if (!texture)
|
||||
|
|
|
@ -25,7 +25,7 @@ void VideoPlayer::setAudioFactory(MovieAudioFactory *factory)
|
|||
mAudioFactory.reset(factory);
|
||||
}
|
||||
|
||||
void VideoPlayer::playVideo(boost::shared_ptr<std::istream> inputstream)
|
||||
void VideoPlayer::playVideo(boost::shared_ptr<std::istream> inputstream, const std::string& name)
|
||||
{
|
||||
if(mState)
|
||||
close();
|
||||
|
@ -33,7 +33,7 @@ void VideoPlayer::playVideo(boost::shared_ptr<std::istream> inputstream)
|
|||
try {
|
||||
mState = new VideoState;
|
||||
mState->setAudioFactory(mAudioFactory.get());
|
||||
mState->init(inputstream);
|
||||
mState->init(inputstream, name);
|
||||
|
||||
// wait until we have the first picture
|
||||
while (mState->video_st && !mState->mTexture.get())
|
||||
|
|
|
@ -41,7 +41,8 @@ namespace Video
|
|||
|
||||
/// Play the given video. If a video is already playing, the old video is closed first.
|
||||
/// @note The video will be unpaused by default. Use the pause() and play() methods to control pausing.
|
||||
void playVideo (boost::shared_ptr<std::istream> inputstream);
|
||||
/// @param name A name for the video stream - only used for logging purposes.
|
||||
void playVideo (boost::shared_ptr<std::istream> inputstream, const std::string& name);
|
||||
|
||||
/// Get the current playback time position in the video, in seconds
|
||||
double getCurrentTime();
|
||||
|
|
8
extern/osg-ffmpeg-videoplayer/videostate.cpp
vendored
8
extern/osg-ffmpeg-videoplayer/videostate.cpp
vendored
|
@ -602,7 +602,7 @@ int VideoState::stream_open(int stream_index, AVFormatContext *pFormatCtx)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void VideoState::init(boost::shared_ptr<std::istream> inputstream)
|
||||
void VideoState::init(boost::shared_ptr<std::istream> inputstream, const std::string &name)
|
||||
{
|
||||
int video_index = -1;
|
||||
int audio_index = -1;
|
||||
|
@ -622,8 +622,6 @@ void VideoState::init(boost::shared_ptr<std::istream> inputstream)
|
|||
if(this->format_ctx)
|
||||
this->format_ctx->pb = ioCtx;
|
||||
|
||||
std::string videoName;
|
||||
|
||||
// Open video file
|
||||
///
|
||||
/// format_ctx->pb->buffer must be freed by hand,
|
||||
|
@ -631,7 +629,7 @@ void VideoState::init(boost::shared_ptr<std::istream> inputstream)
|
|||
///
|
||||
/// https://trac.ffmpeg.org/ticket/1357
|
||||
///
|
||||
if(!this->format_ctx || avformat_open_input(&this->format_ctx, videoName.c_str(), NULL, NULL))
|
||||
if(!this->format_ctx || avformat_open_input(&this->format_ctx, name.c_str(), NULL, NULL))
|
||||
{
|
||||
if (this->format_ctx != NULL)
|
||||
{
|
||||
|
@ -655,7 +653,7 @@ void VideoState::init(boost::shared_ptr<std::istream> inputstream)
|
|||
throw std::runtime_error("Failed to retrieve stream information");
|
||||
|
||||
// Dump information about file onto standard error
|
||||
av_dump_format(this->format_ctx, 0, videoName.c_str(), 0);
|
||||
av_dump_format(this->format_ctx, 0, name.c_str(), 0);
|
||||
|
||||
for(i = 0;i < this->format_ctx->nb_streams;i++)
|
||||
{
|
||||
|
|
2
extern/osg-ffmpeg-videoplayer/videostate.hpp
vendored
2
extern/osg-ffmpeg-videoplayer/videostate.hpp
vendored
|
@ -84,7 +84,7 @@ struct VideoState {
|
|||
|
||||
void setAudioFactory(MovieAudioFactory* factory);
|
||||
|
||||
void init(boost::shared_ptr<std::istream> inputstream);
|
||||
void init(boost::shared_ptr<std::istream> inputstream, const std::string& name);
|
||||
void deinit();
|
||||
|
||||
void setPaused(bool isPaused);
|
||||
|
|
Loading…
Reference in a new issue