Merge branch 'master' of github.com:ZoneMinder/zoneminder
This commit is contained in:
commit
b18522b6c0
|
@ -85,7 +85,7 @@ void FFMPEGInit() {
|
|||
Debug(1,"Not enabling ffmpeg logs, as LOG_FFMPEG and/or LOG_DEBUG is disabled in options, or this monitor is not part of your debug targets");
|
||||
av_log_set_level(AV_LOG_QUIET);
|
||||
}
|
||||
#if !LIBAVFORMAT_VERSION_CHECK(58, 9, 0, 64, 0)
|
||||
#if !LIBAVFORMAT_VERSION_CHECK(58, 9, 58, 9, 0)
|
||||
av_register_all();
|
||||
#endif
|
||||
avformat_network_init();
|
||||
|
@ -222,61 +222,6 @@ simple_round:
|
|||
#endif
|
||||
#endif
|
||||
|
||||
int hacked_up_context2_for_older_ffmpeg(AVFormatContext **avctx, AVOutputFormat *oformat, const char *format, const char *filename) {
|
||||
AVFormatContext *s = avformat_alloc_context();
|
||||
int ret = 0;
|
||||
|
||||
*avctx = nullptr;
|
||||
if (!s) {
|
||||
av_log(s, AV_LOG_ERROR, "Out of memory\n");
|
||||
ret = AVERROR(ENOMEM);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (!oformat) {
|
||||
if (format) {
|
||||
oformat = av_guess_format(format, nullptr, nullptr);
|
||||
if (!oformat) {
|
||||
av_log(s, AV_LOG_ERROR, "Requested output format '%s' is not a suitable output format\n", format);
|
||||
ret = AVERROR(EINVAL);
|
||||
}
|
||||
} else {
|
||||
oformat = av_guess_format(nullptr, filename, nullptr);
|
||||
if (!oformat) {
|
||||
ret = AVERROR(EINVAL);
|
||||
av_log(s, AV_LOG_ERROR, "Unable to find a suitable output format for '%s'\n", filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ret) {
|
||||
avformat_free_context(s);
|
||||
return ret;
|
||||
}
|
||||
|
||||
s->oformat = oformat;
|
||||
#if 0
|
||||
if (s->oformat->priv_data_size > 0) {
|
||||
if (s->oformat->priv_class) {
|
||||
// This looks wrong, we just allocated priv_data and now we are losing the pointer to it.FIXME
|
||||
*(const AVClass**)s->priv_data = s->oformat->priv_class;
|
||||
av_opt_set_defaults(s->priv_data);
|
||||
} else {
|
||||
s->priv_data = av_mallocz(s->oformat->priv_data_size);
|
||||
if ( ! s->priv_data) {
|
||||
av_log(s, AV_LOG_ERROR, "Out of memory\n");
|
||||
ret = AVERROR(ENOMEM);
|
||||
return ret;
|
||||
}
|
||||
s->priv_data = nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (filename) strncpy(s->filename, filename, sizeof(s->filename)-1);
|
||||
*avctx = s;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void zm_log_fps(double d, const char *postfix) {
|
||||
uint64_t v = lrintf(d * 100);
|
||||
if (!v) {
|
||||
|
|
|
@ -278,11 +278,6 @@ enum _AVPIXELFORMAT GetFFMPEGPixelFormat(unsigned int p_colours, unsigned p_subp
|
|||
|
||||
#endif // ( HAVE_LIBAVUTIL_AVUTIL_H || HAVE_LIBAVCODEC_AVCODEC_H || HAVE_LIBAVFORMAT_AVFORMAT_H || HAVE_LIBAVDEVICE_AVDEVICE_H )
|
||||
|
||||
#ifndef avformat_alloc_output_context2
|
||||
int hacked_up_context2_for_older_ffmpeg(AVFormatContext **avctx, AVOutputFormat *oformat, const char *format, const char *filename);
|
||||
#define avformat_alloc_output_context2(x,y,z,a) hacked_up_context2_for_older_ffmpeg(x,y,z,a)
|
||||
#endif
|
||||
|
||||
#ifndef av_rescale_delta
|
||||
/**
|
||||
* Rescale a timestamp while preserving known durations.
|
||||
|
|
|
@ -399,7 +399,9 @@ int RtspThread::run() {
|
|||
if ( mFormatContext->nb_streams >= 1 ) {
|
||||
for ( unsigned int i = 0; i < mFormatContext->nb_streams; i++ ) {
|
||||
SessionDescriptor::MediaDescriptor *mediaDesc = mSessDesc->getStream(i);
|
||||
#if (LIBAVCODEC_VERSION_CHECK(52, 64, 0, 64, 0) || LIBAVUTIL_VERSION_CHECK(50, 14, 0, 14, 0))
|
||||
#if LIBAVFORMAT_VERSION_CHECK(57, 33, 0, 33, 0)
|
||||
if ( mFormatContext->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO )
|
||||
#elif (LIBAVCODEC_VERSION_CHECK(52, 64, 0, 64, 0) || LIBAVUTIL_VERSION_CHECK(50, 14, 0, 14, 0))
|
||||
if ( mFormatContext->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO )
|
||||
#else
|
||||
if ( mFormatContext->streams[i]->codec->codec_type == CODEC_TYPE_VIDEO )
|
||||
|
@ -417,7 +419,11 @@ int RtspThread::run() {
|
|||
}
|
||||
}
|
||||
rtpClock = mediaDesc->getClock();
|
||||
#if LIBAVFORMAT_VERSION_CHECK(57, 33, 0, 33, 0)
|
||||
codecId = mFormatContext->streams[i]->codecpar->codec_id;
|
||||
#else
|
||||
codecId = mFormatContext->streams[i]->codec->codec_id;
|
||||
#endif
|
||||
break;
|
||||
} // end if is video
|
||||
} // end foreach stream
|
||||
|
|
Loading…
Reference in New Issue