|
|
|
@ -205,7 +205,7 @@ int VideoPicture::set_dimensions(int w, int h) {
|
|
|
|
|
std::unique_ptr<AVFrame, VideoPicture::AVFrameDeleter> frame{
|
|
|
|
|
av_frame_alloc()};
|
|
|
|
|
if (frame == nullptr) {
|
|
|
|
|
std::cerr << "av_frame_alloc failed" << std::endl;
|
|
|
|
|
OSG_FATAL << "av_frame_alloc failed" << std::endl;
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -215,7 +215,7 @@ int VideoPicture::set_dimensions(int w, int h) {
|
|
|
|
|
frame->height = h;
|
|
|
|
|
if (av_image_alloc(frame->data, frame->linesize, frame->width, frame->height,
|
|
|
|
|
kPixFmt, 1) < 0) {
|
|
|
|
|
std::cerr << "av_image_alloc failed" << std::endl;
|
|
|
|
|
OSG_FATAL << "av_image_alloc failed" << std::endl;
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -442,7 +442,7 @@ public:
|
|
|
|
|
}
|
|
|
|
|
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"
|
|
|
|
|
#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
|
|
|
|
|
std::cerr << "Error seeking " << self->format_ctx->url << std::endl;
|
|
|
|
|
OSG_FATAL << "Error seeking " << self->format_ctx->url << std::endl;
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@ -635,7 +635,7 @@ public:
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
@ -689,7 +689,7 @@ int VideoState::stream_open(int stream_index, AVFormatContext *pFormatCtx)
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
this->audio_st = nullptr;
|
|
|
|
|
return -1;
|
|
|
|
@ -698,7 +698,7 @@ int VideoState::stream_open(int stream_index, AVFormatContext *pFormatCtx)
|
|
|
|
|
mAudioDecoder = mAudioFactory->createDecoder(this);
|
|
|
|
|
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);
|
|
|
|
|
this->audio_st = nullptr;
|
|
|
|
|
return -1;
|
|
|
|
|