mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-29 03:36:40 +00:00
Merge branch 'video_logging' into 'master'
Migrate videoplayer to OSG logging system See merge request OpenMW/openmw!4408
This commit is contained in:
commit
001d39057f
2 changed files with 10 additions and 9 deletions
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
#include <osg/Notify>
|
||||||
#include <osg/Texture2D>
|
#include <osg/Texture2D>
|
||||||
|
|
||||||
#include "audiofactory.hpp"
|
#include "audiofactory.hpp"
|
||||||
|
@ -45,7 +46,7 @@ void VideoPlayer::playVideo(std::unique_ptr<std::istream>&& inputstream, const s
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(std::exception& e) {
|
catch(std::exception& e) {
|
||||||
std::cerr<< "Failed to play video: "<<e.what() <<std::endl;
|
OSG_FATAL << "Failed to play video: " << e.what() << std::endl;
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
16
extern/osg-ffmpeg-videoplayer/videostate.cpp
vendored
16
extern/osg-ffmpeg-videoplayer/videostate.cpp
vendored
|
@ -205,7 +205,7 @@ int VideoPicture::set_dimensions(int w, int h) {
|
||||||
std::unique_ptr<AVFrame, VideoPicture::AVFrameDeleter> frame{
|
std::unique_ptr<AVFrame, VideoPicture::AVFrameDeleter> frame{
|
||||||
av_frame_alloc()};
|
av_frame_alloc()};
|
||||||
if (frame == nullptr) {
|
if (frame == nullptr) {
|
||||||
std::cerr << "av_frame_alloc failed" << std::endl;
|
OSG_FATAL << "av_frame_alloc failed" << std::endl;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,7 +215,7 @@ int VideoPicture::set_dimensions(int w, int h) {
|
||||||
frame->height = h;
|
frame->height = h;
|
||||||
if (av_image_alloc(frame->data, frame->linesize, frame->width, frame->height,
|
if (av_image_alloc(frame->data, frame->linesize, frame->width, frame->height,
|
||||||
kPixFmt, 1) < 0) {
|
kPixFmt, 1) < 0) {
|
||||||
std::cerr << "av_image_alloc failed" << std::endl;
|
OSG_FATAL << "av_image_alloc failed" << std::endl;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -442,7 +442,7 @@ public:
|
||||||
}
|
}
|
||||||
catch(std::exception& e)
|
catch(std::exception& e)
|
||||||
{
|
{
|
||||||
std::cerr << "An error occurred playing the video: " << e.what () << std::endl;
|
OSG_FATAL << "An error occurred playing the video: " << e.what() << std::endl;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
{
|
{
|
||||||
|
@ -567,9 +567,9 @@ public:
|
||||||
{
|
{
|
||||||
// In the FFMpeg 4.0 a "filename" field was replaced by "url"
|
// In the FFMpeg 4.0 a "filename" field was replaced by "url"
|
||||||
#if LIBAVCODEC_VERSION_INT < 3805796
|
#if LIBAVCODEC_VERSION_INT < 3805796
|
||||||
std::cerr << "Error seeking " << self->format_ctx->filename << std::endl;
|
OSG_FATAL << "Error seeking " << self->format_ctx->filename << std::endl;
|
||||||
#else
|
#else
|
||||||
std::cerr << "Error seeking " << self->format_ctx->url << std::endl;
|
OSG_FATAL << "Error seeking " << self->format_ctx->url << std::endl;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -635,7 +635,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(std::exception& e) {
|
catch(std::exception& e) {
|
||||||
std::cerr << "An error occurred playing the video: " << e.what () << std::endl;
|
OSG_FATAL << "An error occurred playing the video: " << e.what() << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
self->mQuit = true;
|
self->mQuit = true;
|
||||||
|
@ -689,7 +689,7 @@ int VideoState::stream_open(int stream_index, AVFormatContext *pFormatCtx)
|
||||||
|
|
||||||
if (!mAudioFactory)
|
if (!mAudioFactory)
|
||||||
{
|
{
|
||||||
std::cerr << "No audio factory registered, can not play audio stream" << std::endl;
|
OSG_FATAL << "No audio factory registered, can not play audio stream" << std::endl;
|
||||||
avcodec_free_context(&this->audio_ctx);
|
avcodec_free_context(&this->audio_ctx);
|
||||||
this->audio_st = nullptr;
|
this->audio_st = nullptr;
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -698,7 +698,7 @@ int VideoState::stream_open(int stream_index, AVFormatContext *pFormatCtx)
|
||||||
mAudioDecoder = mAudioFactory->createDecoder(this);
|
mAudioDecoder = mAudioFactory->createDecoder(this);
|
||||||
if (!mAudioDecoder)
|
if (!mAudioDecoder)
|
||||||
{
|
{
|
||||||
std::cerr << "Failed to create audio decoder, can not play audio stream" << std::endl;
|
OSG_FATAL << "Failed to create audio decoder, can not play audio stream" << std::endl;
|
||||||
avcodec_free_context(&this->audio_ctx);
|
avcodec_free_context(&this->audio_ctx);
|
||||||
this->audio_st = nullptr;
|
this->audio_st = nullptr;
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Loading…
Reference in a new issue