diff --git a/src/zm_rtsp_server_adts_source.cpp b/src/zm_rtsp_server_adts_source.cpp index 1c0c1a5a4..f6d1d81c0 100644 --- a/src/zm_rtsp_server_adts_source.cpp +++ b/src/zm_rtsp_server_adts_source.cpp @@ -34,7 +34,13 @@ ADTS_ZoneMinderDeviceSource::ADTS_ZoneMinderDeviceSource( : ZoneMinderDeviceSource(env, std::move(monitor), stream, queueSize), samplingFrequencyIndex(0), - channels(stream->codecpar->channels) + channels( +#if LIBAVCODEC_VERSION_CHECK(57, 64, 0, 64, 0) + stream->codecpar->channels +#else + stream->codec->channels +#endif + ) { std::ostringstream os; os << diff --git a/src/zm_rtsp_server_adts_source.h b/src/zm_rtsp_server_adts_source.h index d8516bc30..b6f906a12 100644 --- a/src/zm_rtsp_server_adts_source.h +++ b/src/zm_rtsp_server_adts_source.h @@ -28,8 +28,6 @@ class ADTS_ZoneMinderDeviceSource : public ZoneMinderDeviceSource { AVStream * stream, unsigned int queueSize ) { - Debug(1, "m_stream %p codecpar %p channels %d", - stream, stream->codecpar, stream->codecpar->channels); return new ADTS_ZoneMinderDeviceSource(env, std::move(monitor), stream, queueSize); }; protected: @@ -47,15 +45,16 @@ class ADTS_ZoneMinderDeviceSource : public ZoneMinderDeviceSource { virtual unsigned char* findMarker(unsigned char *frame, size_t size, size_t &length); */ public: - int samplingFrequency() { return m_stream->codecpar->sample_rate; }; + int samplingFrequency() { return +#if LIBAVCODEC_VERSION_CHECK(57, 64, 0, 64, 0) + m_stream->codecpar->sample_rate; +#else + m_stream->codec->sample_rate; +#endif + }; const char *configStr() { return config.c_str(); }; int numChannels() { - Debug(1, "this %p m_stream %p channels %d", - this, m_stream, channels); - Debug(1, "m_stream %p codecpar %p channels %d => %d", - m_stream, m_stream->codecpar, m_stream->codecpar->channels, channels); return channels; - return m_stream->codecpar->channels; } protected: diff --git a/src/zm_rtsp_server_h264_device_source.cpp b/src/zm_rtsp_server_h264_device_source.cpp index c10852196..71b641021 100644 --- a/src/zm_rtsp_server_h264_device_source.cpp +++ b/src/zm_rtsp_server_h264_device_source.cpp @@ -32,7 +32,13 @@ H264_ZoneMinderDeviceSource::H264_ZoneMinderDeviceSource( : H26X_ZoneMinderDeviceSource(env, std::move(monitor), stream, queueSize, repeatConfig, keepMarker) { // extradata appears to simply be the SPS and PPS NAL's - this->splitFrames(m_stream->codecpar->extradata, m_stream->codecpar->extradata_size); + this->splitFrames( +#if LIBAVCODEC_VERSION_CHECK(57, 64, 0, 64, 0) + m_stream->codecpar->extradata, m_stream->codecpar->extradata_size +#else + m_stream->codec->extradata, m_stream->codec->extradata_size +#endif + ); } // split packet into frames @@ -97,7 +103,13 @@ H265_ZoneMinderDeviceSource::H265_ZoneMinderDeviceSource( : H26X_ZoneMinderDeviceSource(env, std::move(monitor), stream, queueSize, repeatConfig, keepMarker) { // extradata appears to simply be the SPS and PPS NAL's - this->splitFrames(m_stream->codecpar->extradata, m_stream->codecpar->extradata_size); + this->splitFrames( +#if LIBAVCODEC_VERSION_CHECK(57, 64, 0, 64, 0) + m_stream->codecpar->extradata, m_stream->codecpar->extradata_size +#else + m_stream->codec->extradata, m_stream->codec->extradata_size +#endif + ); } // split packet in frames