2008-07-16 16:35:59 +08:00
|
|
|
/*
|
2008-07-25 17:08:15 +08:00
|
|
|
* ZoneMinder FFMPEG Interface, $Date$, $Revision$
|
2008-07-25 17:33:23 +08:00
|
|
|
* Copyright (C) 2001-2008 Philip Coombes
|
2008-07-16 16:35:59 +08:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2016-12-26 23:23:16 +08:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2008-07-16 16:35:59 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef ZM_FFMPEG_H
|
|
|
|
#define ZM_FFMPEG_H
|
2013-09-27 19:08:11 +08:00
|
|
|
#include <stdint.h>
|
2013-11-26 22:34:26 +08:00
|
|
|
#include "zm.h"
|
2008-07-25 00:57:39 +08:00
|
|
|
|
2008-07-16 16:35:59 +08:00
|
|
|
extern "C" {
|
2013-10-10 12:16:11 +08:00
|
|
|
|
|
|
|
// AVUTIL
|
2008-07-25 00:57:39 +08:00
|
|
|
#if HAVE_LIBAVUTIL_AVUTIL_H
|
Feature h264 videostorage (#1882)
* Moved writing of configure options from Controller to Model. Fixes #191.
* Initial commit for saving events as videos :)
* Add zm_video.cpp to autotools
* Add zm_video.h to autotools
* Search for MP4V2 header file 3 times: mp4v2/mp4v2.h, mp4v2.h, mp4.h
* Fix serve memory leak
* Few minor code improvements
* Added the ability to override preset, tune, profile and few other improvements
* Correctly write SPS & PPS from x264 encoder headers
* Remove unnessecary SPS & PPS writing code
* Imported missing files from master to feature-h264-videostorage
* Audio support including fixes for dts/pts, split on keyframe and update to mkv extension to prevent ffmpeg problems writing rtsp audio to mp4 containter (header problem)
* Updates to make gcc happy
* Add html5 video control to timeline and event to support mkv playback
* Add zm_videostore.cpp to CMakeLists.txt
* Remove Modern Branch for now
* Fix minor bug
* Option handled added in master, removing duplicate declaration
* Add CaptureandRecord from zm_camera.h
* Putting placeholder in for CaptureAndRecord function
* Removed duplicate code and brackets
* add digest auth file for cmake
Conflicts:
src/CMakeLists.txt
* Add web dir back into Makefile.am
Revert "Removed web from SUBDIRS in Makefile.am"
This reverts commit d9bbcdf3a94cba4d8955fcd03bd965ed2772f34d.
* Add CaptureAndRecord to vlc, still need to make it record
* Resolve SegFault on videostore
* Swap to mp4 container
* mp4 changes
* spaces to tabs, hide video stuff if video writer is turned off
* Make timeline open event.mp4 instead of mkv
* Missed mkv in timeline.js
* Fix some issues from the merge conflict
* Resolve post merge build issues with braces
* Fix whitespace
* Update Jpeg and Video options for passthrough options
* Whitespace fix zm_camera.h
* Fix array mkssing comma
* Add support for Jpeg save options for h264 branch snapshot. Might remove altogether if snapshots not needed
* Update VideoStoreData memory size comment
* Change from config.use_mkv_storage to per monitor option VideoWriter from video branch
* Fix bracket issues post merge
* Clean up comments and add av_free_packet
* Convert from event_directory to event file as per Video branch
* Testing videojs for video playback
* Fixed a missing bracket post merge and also SQL_values now used for EventID and Monitors
* bring recent improvements in ffmpeg capture function into captureandrecord
* Remove pict from writeAudioFramePacket as not used
* Add translate options for h264 Storage options in Monitor and update en_gb file
* Cherry-Pick from iconnor - make it compile on ubuntu 15.04. Which is libav 56.1.0
Conflicts:
src/zm_ffmpeg.cpp
src/zm_remote_camera_rtsp.cpp
Conflicts:
distros/ubuntu1204/changelog
* Clean up videostore code and remove lots of unused code
* proof of concept for dynamic/automatic video rotation using video-js plugin zoomrotate
Conflicts:
web/skins/classic/views/event.php
* removed redundant field in sql query
Conflicts:
web/skins/classic/views/event.php
* local storage of video js plugin
* Beautify!
Make the code somewhat readable.
* added missing videojs.zoomrotate.js file
added missing videojs.zoomrotate.js file
* Typo
added missing "
* Added missing brackets
* fix to display thumbnails when only storing snapshot.jpg
* added control for video playback rate
Conflicts:
web/skins/classic/views/event.php
* dynamically create jpegs from video file for viewing in browser
* fix timeline view for SaveJPEGs monitors (without enabled VideoWriter)
* only expose monitor info which are being used in client
* fix segmentation fault in zma with ubuntu 14.04 and ffmpeg 2.5.8 (gcc 4.8)
when libx264 is not installed
* better way of detecting showing image or video in timeline and event view
instead of Monitor.VideoWriter, Event.DefaultVideo is used, so even if
VideoWriter/SaveJPEG option is changed, a valid image or video will always be
displayed for historical events in both timeline and event view
this also fixes loading videos in timeline view
* Fixes problem of crashing zmc when bad packet arrives causing av_interleaved_write_frame() to return non-zero (-22). Prefilters common packet issues. Add metadata title to generated video file
* Remove syslog.h
* fixed SaveJPEGs are not working
which is caused in errors introduced when merging with master
* Update README.md
* Fix build warnings specific to h264 branch, unused FrameImg, unused ret and int64_t snprintf issues
* Fix PRId64 issue in travis, builds locally fine, but I can see a gcc version issue here
* Fix PRId64 issue in travis, another try
* Try "STDC_FORMAT_MACROS" to see if that helps Travis on gcc 4.6.3
* Revert space removal around PRId64
* video branch ffmpeg 2.9 fixes
ffmpeg 2.9 patched removed SSE2 CPU
* Add FFMPEGInit back
* use webvvt to overlay timestamp (honoring Monitor.LabelFormat) to videos in timeline and event
also fixed bug which prevented seeking in timeline video preview
* ffmpeg 3.0 API build failure fixes
* Update README.md
* merge all the commits from the messed up iconnor_video branch
* fix whitespace
* revert
* whitespace fixes
* spelling fix
* put back some text
* add these back
* fix spelling mistake
* Steal some packet dumping routines from ffmpeg. Convert them to use our logging routines
* add a test and error message if the codec is not h264
* these have been removed in master
* add a view to check auth and just send the video
* add some comments, and dump filename and AVFormatContext on failure to write header
* add the toggle for RecordAudio so that the checkbox works to turn off Audio
* Must init videoStore in constuctor
* more debug and comments, return checking
* Fix dropped part of sql query.
* fix extra else and some whitespace
* Fix missing } from merge that was preventing building.
* fix tabs
* get rid of use of separator, just use \n
* Restore lost fixes for deprecation
* Why are these failing
* Respect record_audio flag when setting up video file so dont try and initiliase mp4 with unsupported audio
* Forgot that I was trying to solve case of stream is true and record_audio
is false.
* Pass swscale_ctx back in to getCachedContext or it will create new
context every frame and leak memory like a mofo.
* Add libx264-dev and libmp4v2-dev to build requires to save hassle of
ensuring they are installed before build.
* Merge my Rotation/Orientation work and fixes for bad h264 streams
* need arpa/inet for reverse lookups
* pull in the new byte range code for viewing videos
* Move our recording flag deeper into closeevent
* add braces and only call closeEvent if there is an event
* deprecate the z_frame_rate stuff which is deprecated in ffmpeg
* remark out some debugging
* fix for video on stream 1
* fix audio_stream to audio_st
* Ignore bad decodes
* fix problems with content-length causing viewing to not work in chrome/android
* change logic of sending file contents to handle an off by one and be more readable
* Some fixes pointed out by Maxim Romanov. Also simply the loading of events to not join the Monitors table
* fix to sql for timeline
* added RecordAudio to sql in README
* Use sub queries instead of joins to fix errors when using new mysql defaults.
* fix sql queries
* Dockerfile to build feature-h264-videostorage
* Must cast codec
* add php-acpu as a dependency
* require php5-acpu
* fix typo
* remove extra /
* Add a line for out-of-tree builds to do api/lib/Cake/bootstrap.php
* delete merge conflict files
* delete merge conflict files
2017-05-16 10:02:48 +08:00
|
|
|
#include "libavutil/avassert.h"
|
2008-07-25 00:57:39 +08:00
|
|
|
#include <libavutil/avutil.h>
|
2013-09-27 19:08:11 +08:00
|
|
|
#include <libavutil/base64.h>
|
2013-10-10 12:16:11 +08:00
|
|
|
#include <libavutil/mathematics.h>
|
2016-08-07 22:55:19 +08:00
|
|
|
#include <libavutil/avstring.h>
|
2015-05-29 23:38:02 +08:00
|
|
|
|
|
|
|
/* LIBAVUTIL_VERSION_CHECK checks for the right version of libav and FFmpeg
|
2015-05-29 23:45:35 +08:00
|
|
|
* The original source is vlc (in modules/codec/avcodec/avcommon_compat.h)
|
2015-05-29 23:38:02 +08:00
|
|
|
* a is the major version
|
|
|
|
* b and c the minor and micro versions of libav
|
|
|
|
* d and e the minor and micro versions of FFmpeg */
|
|
|
|
#define LIBAVUTIL_VERSION_CHECK(a, b, c, d, e) \
|
2017-05-17 00:04:56 +08:00
|
|
|
( (LIBAVUTIL_VERSION_MICRO < 100 && LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(a, b, c) ) || \
|
|
|
|
(LIBAVUTIL_VERSION_MICRO >= 100 && LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(a, d, e) ) )
|
2015-05-29 23:38:02 +08:00
|
|
|
|
|
|
|
#if LIBAVUTIL_VERSION_CHECK(50, 29, 0, 29, 0)
|
2014-10-16 01:23:29 +08:00
|
|
|
#include <libavutil/opt.h>
|
|
|
|
#else
|
|
|
|
#include <libavcodec/opt.h>
|
|
|
|
#endif
|
2016-03-02 22:03:55 +08:00
|
|
|
|
|
|
|
#if LIBAVUTIL_VERSION_CHECK(54, 6, 0, 6, 0)
|
|
|
|
#include <libavutil/imgutils.h>
|
|
|
|
#endif
|
2013-09-27 19:08:11 +08:00
|
|
|
#elif HAVE_FFMPEG_AVUTIL_H
|
|
|
|
#include <ffmpeg/avutil.h>
|
|
|
|
#include <ffmpeg/base64.h>
|
2013-10-10 12:16:11 +08:00
|
|
|
#include <ffmpeg/mathematics.h>
|
2014-10-16 01:23:29 +08:00
|
|
|
#include <ffmpeg/opt.h>
|
2015-05-29 23:38:02 +08:00
|
|
|
#endif /* HAVE_LIBAVUTIL_AVUTIL_H */
|
2017-05-17 00:04:56 +08:00
|
|
|
|
2015-11-04 09:46:26 +08:00
|
|
|
#if defined(HAVE_LIBAVUTIL_AVUTIL_H)
|
|
|
|
#if LIBAVUTIL_VERSION_CHECK(51, 42, 0, 74, 100)
|
2017-05-17 00:04:56 +08:00
|
|
|
#define _AVPIXELFORMAT AVPixelFormat
|
2015-11-04 09:46:26 +08:00
|
|
|
#else
|
2017-05-17 00:04:56 +08:00
|
|
|
#define _AVPIXELFORMAT PixelFormat
|
|
|
|
#define AV_PIX_FMT_NONE PIX_FMT_NONE
|
|
|
|
#define AV_PIX_FMT_RGB444 PIX_FMT_RGB444
|
|
|
|
#define AV_PIX_FMT_RGB555 PIX_FMT_RGB555
|
|
|
|
#define AV_PIX_FMT_RGB565 PIX_FMT_RGB565
|
|
|
|
#define AV_PIX_FMT_BGR24 PIX_FMT_BGR24
|
|
|
|
#define AV_PIX_FMT_RGB24 PIX_FMT_RGB24
|
|
|
|
#define AV_PIX_FMT_BGRA PIX_FMT_BGRA
|
|
|
|
#define AV_PIX_FMT_ARGB PIX_FMT_ARGB
|
|
|
|
#define AV_PIX_FMT_ABGR PIX_FMT_ABGR
|
|
|
|
#define AV_PIX_FMT_RGBA PIX_FMT_RGBA
|
|
|
|
#define AV_PIX_FMT_GRAY8 PIX_FMT_GRAY8
|
|
|
|
#define AV_PIX_FMT_YUYV422 PIX_FMT_YUYV422
|
|
|
|
#define AV_PIX_FMT_YUV422P PIX_FMT_YUV422P
|
|
|
|
#define AV_PIX_FMT_YUV411P PIX_FMT_YUV411P
|
|
|
|
#define AV_PIX_FMT_YUV444P PIX_FMT_YUV444P
|
|
|
|
#define AV_PIX_FMT_YUV410P PIX_FMT_YUV410P
|
|
|
|
#define AV_PIX_FMT_YUV420P PIX_FMT_YUV420P
|
|
|
|
#define AV_PIX_FMT_YUVJ444P PIX_FMT_YUVJ444P
|
|
|
|
#define AV_PIX_FMT_UYVY422 PIX_FMT_UYVY422
|
|
|
|
#define AV_PIX_FMT_YUVJ420P PIX_FMT_YUVJ420P
|
|
|
|
#define AV_PIX_FMT_YUVJ422P PIX_FMT_YUVJ422P
|
|
|
|
#define AV_PIX_FMT_UYVY422 PIX_FMT_UYVY422
|
|
|
|
#define AV_PIX_FMT_UYYVYY411 PIX_FMT_UYYVYY411
|
|
|
|
#define AV_PIX_FMT_BGR565 PIX_FMT_BGR565
|
|
|
|
#define AV_PIX_FMT_BGR555 PIX_FMT_BGR555
|
|
|
|
#define AV_PIX_FMT_BGR8 PIX_FMT_BGR8
|
|
|
|
#define AV_PIX_FMT_BGR4 PIX_FMT_BGR4
|
|
|
|
#define AV_PIX_FMT_BGR4_BYTE PIX_FMT_BGR4_BYTE
|
|
|
|
#define AV_PIX_FMT_RGB8 PIX_FMT_RGB8
|
|
|
|
#define AV_PIX_FMT_RGB4 PIX_FMT_RGB4
|
|
|
|
#define AV_PIX_FMT_RGB4_BYTE PIX_FMT_RGB4_BYTE
|
|
|
|
#define AV_PIX_FMT_NV12 PIX_FMT_NV12
|
|
|
|
#define AV_PIX_FMT_NV21 PIX_FMT_NV21
|
|
|
|
#define AV_PIX_FMT_RGB32_1 PIX_FMT_RGB32_1
|
|
|
|
#define AV_PIX_FMT_BGR32_1 PIX_FMT_BGR32_1
|
|
|
|
#define AV_PIX_FMT_GRAY16BE PIX_FMT_GRAY16BE
|
|
|
|
#define AV_PIX_FMT_GRAY16LE PIX_FMT_GRAY16LE
|
|
|
|
#define AV_PIX_FMT_YUV440P PIX_FMT_YUV440P
|
|
|
|
#define AV_PIX_FMT_YUVJ440P PIX_FMT_YUVJ440P
|
|
|
|
#define AV_PIX_FMT_YUVA420P PIX_FMT_YUVA420P
|
|
|
|
//#define AV_PIX_FMT_VDPAU_H264 PIX_FMT_VDPAU_H264
|
|
|
|
//#define AV_PIX_FMT_VDPAU_MPEG1 PIX_FMT_VDPAU_MPEG1
|
|
|
|
//#define AV_PIX_FMT_VDPAU_MPEG2 PIX_FMT_VDPAU_MPEG2
|
2015-11-04 09:46:26 +08:00
|
|
|
#endif
|
|
|
|
#endif /* HAVE_LIBAVUTIL_AVUTIL_H */
|
2013-10-10 12:16:11 +08:00
|
|
|
|
|
|
|
// AVCODEC
|
2008-07-24 19:30:18 +08:00
|
|
|
#if HAVE_LIBAVCODEC_AVCODEC_H
|
|
|
|
#include <libavcodec/avcodec.h>
|
2015-05-29 23:38:02 +08:00
|
|
|
|
2015-05-29 23:45:35 +08:00
|
|
|
/*
|
|
|
|
* LIBAVCODEC_VERSION_CHECK checks for the right version of libav and FFmpeg
|
|
|
|
* The original source is vlc (in modules/codec/avcodec/avcommon_compat.h)
|
2015-05-29 23:38:02 +08:00
|
|
|
* a is the major version
|
|
|
|
* b and c the minor and micro versions of libav
|
|
|
|
* d and e the minor and micro versions of FFmpeg */
|
|
|
|
#define LIBAVCODEC_VERSION_CHECK(a, b, c, d, e) \
|
2017-05-17 00:04:56 +08:00
|
|
|
( (LIBAVCODEC_VERSION_MICRO < 100 && LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(a, b, c) ) || \
|
|
|
|
(LIBAVCODEC_VERSION_MICRO >= 100 && LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(a, d, e) ) )
|
2015-05-29 23:38:02 +08:00
|
|
|
|
2013-09-27 19:08:11 +08:00
|
|
|
#elif HAVE_FFMPEG_AVCODEC_H
|
|
|
|
#include <ffmpeg/avcodec.h>
|
2015-05-29 23:38:02 +08:00
|
|
|
#endif /* HAVE_LIBAVCODEC_AVCODEC_H */
|
|
|
|
|
2014-10-12 06:14:09 +08:00
|
|
|
#if defined(HAVE_LIBAVCODEC_AVCODEC_H)
|
2015-05-29 23:38:02 +08:00
|
|
|
#if LIBAVCODEC_VERSION_CHECK(54, 25, 0, 51, 100)
|
2017-05-17 00:04:56 +08:00
|
|
|
#define _AVCODECID AVCodecID
|
2014-04-26 04:12:58 +08:00
|
|
|
#else
|
2017-05-17 00:04:56 +08:00
|
|
|
#define _AVCODECID CodecID
|
2014-04-26 04:12:58 +08:00
|
|
|
#endif
|
2015-05-29 23:38:02 +08:00
|
|
|
#endif /* HAVE_LIBAVCODEC_AVCODEC_H */
|
2013-10-10 12:16:11 +08:00
|
|
|
|
|
|
|
// AVFORMAT
|
2008-07-24 19:30:18 +08:00
|
|
|
#if HAVE_LIBAVFORMAT_AVFORMAT_H
|
|
|
|
#include <libavformat/avformat.h>
|
2015-05-29 23:38:02 +08:00
|
|
|
|
|
|
|
/* LIBAVFORMAT_VERSION_CHECK checks for the right version of libav and FFmpeg
|
2015-05-29 23:45:35 +08:00
|
|
|
* The original source is vlc (in modules/codec/avcodec/avcommon_compat.h)
|
2015-05-29 23:38:02 +08:00
|
|
|
* a is the major version
|
|
|
|
* b and c the minor and micro versions of libav
|
|
|
|
* d and e the minor and micro versions of FFmpeg */
|
|
|
|
#define LIBAVFORMAT_VERSION_CHECK(a, b, c, d, e) \
|
2017-05-17 00:04:56 +08:00
|
|
|
( (LIBAVFORMAT_VERSION_MICRO < 100 && LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(a, b, c) ) || \
|
|
|
|
(LIBAVFORMAT_VERSION_MICRO >= 100 && LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(a, d, e) ) )
|
2015-05-29 23:38:02 +08:00
|
|
|
|
2013-09-27 19:08:11 +08:00
|
|
|
#elif HAVE_FFMPEG_AVFORMAT_H
|
|
|
|
#include <ffmpeg/avformat.h>
|
2015-05-29 23:38:02 +08:00
|
|
|
#endif /* HAVE_LIBAVFORMAT_AVFORMAT_H */
|
2013-10-10 12:16:11 +08:00
|
|
|
|
|
|
|
// AVDEVICE
|
|
|
|
#if HAVE_LIBAVDEVICE_AVDEVICE_H
|
|
|
|
#include <libavdevice/avdevice.h>
|
2015-05-29 23:38:02 +08:00
|
|
|
|
|
|
|
/* LIBAVDEVICE_VERSION_CHECK checks for the right version of libav and FFmpeg
|
|
|
|
* a is the major version
|
|
|
|
* b and c the minor and micro versions of libav
|
|
|
|
* d and e the minor and micro versions of FFmpeg */
|
|
|
|
#define LIBAVDEVICE_VERSION_CHECK(a, b, c, d, e) \
|
2017-05-17 00:04:56 +08:00
|
|
|
( (LIBAVDEVICE_VERSION_MICRO < 100 && LIBAVDEVICE_VERSION_INT >= AV_VERSION_INT(a, b, c) ) || \
|
|
|
|
(LIBAVDEVICE_VERSION_MICRO >= 100 && LIBAVDEVICE_VERSION_INT >= AV_VERSION_INT(a, d, e) ) )
|
2015-05-29 23:38:02 +08:00
|
|
|
|
2013-10-10 12:16:11 +08:00
|
|
|
#elif HAVE_FFMPEG_AVDEVICE_H
|
|
|
|
#include <ffmpeg/avdevice.h>
|
2015-05-29 23:38:02 +08:00
|
|
|
#endif /* HAVE_LIBAVDEVICE_AVDEVICE_H */
|
2013-10-10 12:16:11 +08:00
|
|
|
|
|
|
|
// SWSCALE
|
2008-07-24 19:30:18 +08:00
|
|
|
#if HAVE_LIBSWSCALE_SWSCALE_H
|
|
|
|
#include <libswscale/swscale.h>
|
2015-05-29 23:38:02 +08:00
|
|
|
|
|
|
|
/* LIBSWSCALE_VERSION_CHECK checks for the right version of libav and FFmpeg
|
|
|
|
* a is the major version
|
|
|
|
* b and c the minor and micro versions of libav
|
|
|
|
* d and e the minor and micro versions of FFmpeg */
|
|
|
|
#define LIBSWSCALE_VERSION_CHECK(a, b, c, d, e) \
|
2017-05-17 00:04:56 +08:00
|
|
|
( (LIBSWSCALE_VERSION_MICRO < 100 && LIBSWSCALE_VERSION_INT >= AV_VERSION_INT(a, b, c) ) || \
|
|
|
|
(LIBSWSCALE_VERSION_MICRO >= 100 && LIBSWSCALE_VERSION_INT >= AV_VERSION_INT(a, d, e) ) )
|
2015-05-29 23:38:02 +08:00
|
|
|
|
2013-09-27 19:08:11 +08:00
|
|
|
#elif HAVE_FFMPEG_SWSCALE_H
|
|
|
|
#include <ffmpeg/swscale.h>
|
2015-05-29 23:38:02 +08:00
|
|
|
#endif /* HAVE_LIBSWSCALE_SWSCALE_H */
|
2013-10-10 12:16:11 +08:00
|
|
|
|
2008-07-25 17:00:23 +08:00
|
|
|
#ifdef __cplusplus
|
2008-07-16 16:35:59 +08:00
|
|
|
}
|
2008-07-25 17:00:23 +08:00
|
|
|
#endif
|
2008-07-16 16:35:59 +08:00
|
|
|
|
2013-10-10 12:16:11 +08:00
|
|
|
#if ( HAVE_LIBAVUTIL_AVUTIL_H || HAVE_LIBAVCODEC_AVCODEC_H || HAVE_LIBAVFORMAT_AVFORMAT_H || HAVE_LIBAVDEVICE_AVDEVICE_H )
|
|
|
|
|
2015-05-29 23:38:02 +08:00
|
|
|
#if !LIBAVFORMAT_VERSION_CHECK(52, 107, 0, 107, 0)
|
2013-03-17 07:45:21 +08:00
|
|
|
#if defined(AVIO_WRONLY)
|
|
|
|
#define AVIO_FLAG_WRITE AVIO_WRONLY
|
|
|
|
#else
|
|
|
|
#define AVIO_FLAG_WRITE URL_WRONLY
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
Feature h264 videostorage (#1882)
* Moved writing of configure options from Controller to Model. Fixes #191.
* Initial commit for saving events as videos :)
* Add zm_video.cpp to autotools
* Add zm_video.h to autotools
* Search for MP4V2 header file 3 times: mp4v2/mp4v2.h, mp4v2.h, mp4.h
* Fix serve memory leak
* Few minor code improvements
* Added the ability to override preset, tune, profile and few other improvements
* Correctly write SPS & PPS from x264 encoder headers
* Remove unnessecary SPS & PPS writing code
* Imported missing files from master to feature-h264-videostorage
* Audio support including fixes for dts/pts, split on keyframe and update to mkv extension to prevent ffmpeg problems writing rtsp audio to mp4 containter (header problem)
* Updates to make gcc happy
* Add html5 video control to timeline and event to support mkv playback
* Add zm_videostore.cpp to CMakeLists.txt
* Remove Modern Branch for now
* Fix minor bug
* Option handled added in master, removing duplicate declaration
* Add CaptureandRecord from zm_camera.h
* Putting placeholder in for CaptureAndRecord function
* Removed duplicate code and brackets
* add digest auth file for cmake
Conflicts:
src/CMakeLists.txt
* Add web dir back into Makefile.am
Revert "Removed web from SUBDIRS in Makefile.am"
This reverts commit d9bbcdf3a94cba4d8955fcd03bd965ed2772f34d.
* Add CaptureAndRecord to vlc, still need to make it record
* Resolve SegFault on videostore
* Swap to mp4 container
* mp4 changes
* spaces to tabs, hide video stuff if video writer is turned off
* Make timeline open event.mp4 instead of mkv
* Missed mkv in timeline.js
* Fix some issues from the merge conflict
* Resolve post merge build issues with braces
* Fix whitespace
* Update Jpeg and Video options for passthrough options
* Whitespace fix zm_camera.h
* Fix array mkssing comma
* Add support for Jpeg save options for h264 branch snapshot. Might remove altogether if snapshots not needed
* Update VideoStoreData memory size comment
* Change from config.use_mkv_storage to per monitor option VideoWriter from video branch
* Fix bracket issues post merge
* Clean up comments and add av_free_packet
* Convert from event_directory to event file as per Video branch
* Testing videojs for video playback
* Fixed a missing bracket post merge and also SQL_values now used for EventID and Monitors
* bring recent improvements in ffmpeg capture function into captureandrecord
* Remove pict from writeAudioFramePacket as not used
* Add translate options for h264 Storage options in Monitor and update en_gb file
* Cherry-Pick from iconnor - make it compile on ubuntu 15.04. Which is libav 56.1.0
Conflicts:
src/zm_ffmpeg.cpp
src/zm_remote_camera_rtsp.cpp
Conflicts:
distros/ubuntu1204/changelog
* Clean up videostore code and remove lots of unused code
* proof of concept for dynamic/automatic video rotation using video-js plugin zoomrotate
Conflicts:
web/skins/classic/views/event.php
* removed redundant field in sql query
Conflicts:
web/skins/classic/views/event.php
* local storage of video js plugin
* Beautify!
Make the code somewhat readable.
* added missing videojs.zoomrotate.js file
added missing videojs.zoomrotate.js file
* Typo
added missing "
* Added missing brackets
* fix to display thumbnails when only storing snapshot.jpg
* added control for video playback rate
Conflicts:
web/skins/classic/views/event.php
* dynamically create jpegs from video file for viewing in browser
* fix timeline view for SaveJPEGs monitors (without enabled VideoWriter)
* only expose monitor info which are being used in client
* fix segmentation fault in zma with ubuntu 14.04 and ffmpeg 2.5.8 (gcc 4.8)
when libx264 is not installed
* better way of detecting showing image or video in timeline and event view
instead of Monitor.VideoWriter, Event.DefaultVideo is used, so even if
VideoWriter/SaveJPEG option is changed, a valid image or video will always be
displayed for historical events in both timeline and event view
this also fixes loading videos in timeline view
* Fixes problem of crashing zmc when bad packet arrives causing av_interleaved_write_frame() to return non-zero (-22). Prefilters common packet issues. Add metadata title to generated video file
* Remove syslog.h
* fixed SaveJPEGs are not working
which is caused in errors introduced when merging with master
* Update README.md
* Fix build warnings specific to h264 branch, unused FrameImg, unused ret and int64_t snprintf issues
* Fix PRId64 issue in travis, builds locally fine, but I can see a gcc version issue here
* Fix PRId64 issue in travis, another try
* Try "STDC_FORMAT_MACROS" to see if that helps Travis on gcc 4.6.3
* Revert space removal around PRId64
* video branch ffmpeg 2.9 fixes
ffmpeg 2.9 patched removed SSE2 CPU
* Add FFMPEGInit back
* use webvvt to overlay timestamp (honoring Monitor.LabelFormat) to videos in timeline and event
also fixed bug which prevented seeking in timeline video preview
* ffmpeg 3.0 API build failure fixes
* Update README.md
* merge all the commits from the messed up iconnor_video branch
* fix whitespace
* revert
* whitespace fixes
* spelling fix
* put back some text
* add these back
* fix spelling mistake
* Steal some packet dumping routines from ffmpeg. Convert them to use our logging routines
* add a test and error message if the codec is not h264
* these have been removed in master
* add a view to check auth and just send the video
* add some comments, and dump filename and AVFormatContext on failure to write header
* add the toggle for RecordAudio so that the checkbox works to turn off Audio
* Must init videoStore in constuctor
* more debug and comments, return checking
* Fix dropped part of sql query.
* fix extra else and some whitespace
* Fix missing } from merge that was preventing building.
* fix tabs
* get rid of use of separator, just use \n
* Restore lost fixes for deprecation
* Why are these failing
* Respect record_audio flag when setting up video file so dont try and initiliase mp4 with unsupported audio
* Forgot that I was trying to solve case of stream is true and record_audio
is false.
* Pass swscale_ctx back in to getCachedContext or it will create new
context every frame and leak memory like a mofo.
* Add libx264-dev and libmp4v2-dev to build requires to save hassle of
ensuring they are installed before build.
* Merge my Rotation/Orientation work and fixes for bad h264 streams
* need arpa/inet for reverse lookups
* pull in the new byte range code for viewing videos
* Move our recording flag deeper into closeevent
* add braces and only call closeEvent if there is an event
* deprecate the z_frame_rate stuff which is deprecated in ffmpeg
* remark out some debugging
* fix for video on stream 1
* fix audio_stream to audio_st
* Ignore bad decodes
* fix problems with content-length causing viewing to not work in chrome/android
* change logic of sending file contents to handle an off by one and be more readable
* Some fixes pointed out by Maxim Romanov. Also simply the loading of events to not join the Monitors table
* fix to sql for timeline
* added RecordAudio to sql in README
* Use sub queries instead of joins to fix errors when using new mysql defaults.
* fix sql queries
* Dockerfile to build feature-h264-videostorage
* Must cast codec
* add php-acpu as a dependency
* require php5-acpu
* fix typo
* remove extra /
* Add a line for out-of-tree builds to do api/lib/Cake/bootstrap.php
* delete merge conflict files
* delete merge conflict files
2017-05-16 10:02:48 +08:00
|
|
|
/* A single function to initialize ffmpeg, to avoid multiple initializations */
|
|
|
|
void FFMPEGInit();
|
2019-04-02 01:38:13 +08:00
|
|
|
void FFMPEGDeInit();
|
Feature h264 videostorage (#1882)
* Moved writing of configure options from Controller to Model. Fixes #191.
* Initial commit for saving events as videos :)
* Add zm_video.cpp to autotools
* Add zm_video.h to autotools
* Search for MP4V2 header file 3 times: mp4v2/mp4v2.h, mp4v2.h, mp4.h
* Fix serve memory leak
* Few minor code improvements
* Added the ability to override preset, tune, profile and few other improvements
* Correctly write SPS & PPS from x264 encoder headers
* Remove unnessecary SPS & PPS writing code
* Imported missing files from master to feature-h264-videostorage
* Audio support including fixes for dts/pts, split on keyframe and update to mkv extension to prevent ffmpeg problems writing rtsp audio to mp4 containter (header problem)
* Updates to make gcc happy
* Add html5 video control to timeline and event to support mkv playback
* Add zm_videostore.cpp to CMakeLists.txt
* Remove Modern Branch for now
* Fix minor bug
* Option handled added in master, removing duplicate declaration
* Add CaptureandRecord from zm_camera.h
* Putting placeholder in for CaptureAndRecord function
* Removed duplicate code and brackets
* add digest auth file for cmake
Conflicts:
src/CMakeLists.txt
* Add web dir back into Makefile.am
Revert "Removed web from SUBDIRS in Makefile.am"
This reverts commit d9bbcdf3a94cba4d8955fcd03bd965ed2772f34d.
* Add CaptureAndRecord to vlc, still need to make it record
* Resolve SegFault on videostore
* Swap to mp4 container
* mp4 changes
* spaces to tabs, hide video stuff if video writer is turned off
* Make timeline open event.mp4 instead of mkv
* Missed mkv in timeline.js
* Fix some issues from the merge conflict
* Resolve post merge build issues with braces
* Fix whitespace
* Update Jpeg and Video options for passthrough options
* Whitespace fix zm_camera.h
* Fix array mkssing comma
* Add support for Jpeg save options for h264 branch snapshot. Might remove altogether if snapshots not needed
* Update VideoStoreData memory size comment
* Change from config.use_mkv_storage to per monitor option VideoWriter from video branch
* Fix bracket issues post merge
* Clean up comments and add av_free_packet
* Convert from event_directory to event file as per Video branch
* Testing videojs for video playback
* Fixed a missing bracket post merge and also SQL_values now used for EventID and Monitors
* bring recent improvements in ffmpeg capture function into captureandrecord
* Remove pict from writeAudioFramePacket as not used
* Add translate options for h264 Storage options in Monitor and update en_gb file
* Cherry-Pick from iconnor - make it compile on ubuntu 15.04. Which is libav 56.1.0
Conflicts:
src/zm_ffmpeg.cpp
src/zm_remote_camera_rtsp.cpp
Conflicts:
distros/ubuntu1204/changelog
* Clean up videostore code and remove lots of unused code
* proof of concept for dynamic/automatic video rotation using video-js plugin zoomrotate
Conflicts:
web/skins/classic/views/event.php
* removed redundant field in sql query
Conflicts:
web/skins/classic/views/event.php
* local storage of video js plugin
* Beautify!
Make the code somewhat readable.
* added missing videojs.zoomrotate.js file
added missing videojs.zoomrotate.js file
* Typo
added missing "
* Added missing brackets
* fix to display thumbnails when only storing snapshot.jpg
* added control for video playback rate
Conflicts:
web/skins/classic/views/event.php
* dynamically create jpegs from video file for viewing in browser
* fix timeline view for SaveJPEGs monitors (without enabled VideoWriter)
* only expose monitor info which are being used in client
* fix segmentation fault in zma with ubuntu 14.04 and ffmpeg 2.5.8 (gcc 4.8)
when libx264 is not installed
* better way of detecting showing image or video in timeline and event view
instead of Monitor.VideoWriter, Event.DefaultVideo is used, so even if
VideoWriter/SaveJPEG option is changed, a valid image or video will always be
displayed for historical events in both timeline and event view
this also fixes loading videos in timeline view
* Fixes problem of crashing zmc when bad packet arrives causing av_interleaved_write_frame() to return non-zero (-22). Prefilters common packet issues. Add metadata title to generated video file
* Remove syslog.h
* fixed SaveJPEGs are not working
which is caused in errors introduced when merging with master
* Update README.md
* Fix build warnings specific to h264 branch, unused FrameImg, unused ret and int64_t snprintf issues
* Fix PRId64 issue in travis, builds locally fine, but I can see a gcc version issue here
* Fix PRId64 issue in travis, another try
* Try "STDC_FORMAT_MACROS" to see if that helps Travis on gcc 4.6.3
* Revert space removal around PRId64
* video branch ffmpeg 2.9 fixes
ffmpeg 2.9 patched removed SSE2 CPU
* Add FFMPEGInit back
* use webvvt to overlay timestamp (honoring Monitor.LabelFormat) to videos in timeline and event
also fixed bug which prevented seeking in timeline video preview
* ffmpeg 3.0 API build failure fixes
* Update README.md
* merge all the commits from the messed up iconnor_video branch
* fix whitespace
* revert
* whitespace fixes
* spelling fix
* put back some text
* add these back
* fix spelling mistake
* Steal some packet dumping routines from ffmpeg. Convert them to use our logging routines
* add a test and error message if the codec is not h264
* these have been removed in master
* add a view to check auth and just send the video
* add some comments, and dump filename and AVFormatContext on failure to write header
* add the toggle for RecordAudio so that the checkbox works to turn off Audio
* Must init videoStore in constuctor
* more debug and comments, return checking
* Fix dropped part of sql query.
* fix extra else and some whitespace
* Fix missing } from merge that was preventing building.
* fix tabs
* get rid of use of separator, just use \n
* Restore lost fixes for deprecation
* Why are these failing
* Respect record_audio flag when setting up video file so dont try and initiliase mp4 with unsupported audio
* Forgot that I was trying to solve case of stream is true and record_audio
is false.
* Pass swscale_ctx back in to getCachedContext or it will create new
context every frame and leak memory like a mofo.
* Add libx264-dev and libmp4v2-dev to build requires to save hassle of
ensuring they are installed before build.
* Merge my Rotation/Orientation work and fixes for bad h264 streams
* need arpa/inet for reverse lookups
* pull in the new byte range code for viewing videos
* Move our recording flag deeper into closeevent
* add braces and only call closeEvent if there is an event
* deprecate the z_frame_rate stuff which is deprecated in ffmpeg
* remark out some debugging
* fix for video on stream 1
* fix audio_stream to audio_st
* Ignore bad decodes
* fix problems with content-length causing viewing to not work in chrome/android
* change logic of sending file contents to handle an off by one and be more readable
* Some fixes pointed out by Maxim Romanov. Also simply the loading of events to not join the Monitors table
* fix to sql for timeline
* added RecordAudio to sql in README
* Use sub queries instead of joins to fix errors when using new mysql defaults.
* fix sql queries
* Dockerfile to build feature-h264-videostorage
* Must cast codec
* add php-acpu as a dependency
* require php5-acpu
* fix typo
* remove extra /
* Add a line for out-of-tree builds to do api/lib/Cake/bootstrap.php
* delete merge conflict files
* delete merge conflict files
2017-05-16 10:02:48 +08:00
|
|
|
|
2013-11-26 22:34:26 +08:00
|
|
|
#if HAVE_LIBAVUTIL
|
2015-11-04 09:46:26 +08:00
|
|
|
enum _AVPIXELFORMAT GetFFMPEGPixelFormat(unsigned int p_colours, unsigned p_subpixelorder);
|
2013-11-26 22:34:26 +08:00
|
|
|
#endif // HAVE_LIBAVUTIL
|
|
|
|
|
2015-05-30 01:23:00 +08:00
|
|
|
#if !LIBAVCODEC_VERSION_CHECK(54, 25, 0, 51, 100)
|
2014-02-05 17:13:27 +08:00
|
|
|
#define AV_CODEC_ID_NONE CODEC_ID_NONE
|
|
|
|
#define AV_CODEC_ID_PCM_MULAW CODEC_ID_PCM_MULAW
|
|
|
|
#define AV_CODEC_ID_PCM_ALAW CODEC_ID_PCM_ALAW
|
|
|
|
#define AV_CODEC_ID_PCM_S16BE CODEC_ID_PCM_S16BE
|
|
|
|
#define AV_CODEC_ID_QCELP CODEC_ID_QCELP
|
|
|
|
#define AV_CODEC_ID_MP2 CODEC_ID_MP2
|
|
|
|
#define AV_CODEC_ID_MP3 CODEC_ID_MP3
|
|
|
|
#define AV_CODEC_ID_MJPEG CODEC_ID_MJPEG
|
|
|
|
#define AV_CODEC_ID_H261 CODEC_ID_H261
|
|
|
|
#define AV_CODEC_ID_MPEG1VIDEO CODEC_ID_MPEG1VIDEO
|
|
|
|
#define AV_CODEC_ID_MPEG2VIDEO CODEC_ID_MPEG2VIDEO
|
|
|
|
#define AV_CODEC_ID_MPEG2TS CODEC_ID_MPEG2TS
|
|
|
|
#define AV_CODEC_ID_H263 CODEC_ID_H263
|
|
|
|
#define AV_CODEC_ID_H264 CODEC_ID_H264
|
|
|
|
#define AV_CODEC_ID_MPEG4 CODEC_ID_MPEG4
|
|
|
|
#define AV_CODEC_ID_AAC CODEC_ID_AAC
|
|
|
|
#define AV_CODEC_ID_AMR_NB CODEC_ID_AMR_NB
|
|
|
|
#endif
|
|
|
|
|
2014-04-26 04:12:58 +08:00
|
|
|
/*
|
|
|
|
* Some versions of libav does not contain this definition.
|
|
|
|
*/
|
|
|
|
#ifndef AV_ERROR_MAX_STRING_SIZE
|
|
|
|
#define AV_ERROR_MAX_STRING_SIZE 64
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* C++ friendly version of av_err2str taken from http://libav-users.943685.n4.nabble.com/Libav-user-g-4-7-2-fails-to-compile-av-err2str-td4656417.html.
|
|
|
|
* Newer g++ versions fail with "error: taking address of temporary array" when using native libav version.
|
|
|
|
*/
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
2018-01-22 06:18:29 +08:00
|
|
|
inline static const std::string av_make_error_string(int errnum) {
|
|
|
|
static char errbuf[AV_ERROR_MAX_STRING_SIZE];
|
2015-05-29 23:38:02 +08:00
|
|
|
#if LIBAVUTIL_VERSION_CHECK(50, 13, 0, 13, 0)
|
2017-05-17 00:04:56 +08:00
|
|
|
av_strerror(errnum, errbuf, AV_ERROR_MAX_STRING_SIZE);
|
2014-04-26 04:12:58 +08:00
|
|
|
#else
|
2017-05-17 00:04:56 +08:00
|
|
|
snprintf(errbuf, AV_ERROR_MAX_STRING_SIZE, "libav error %d", errnum);
|
2014-04-26 04:12:58 +08:00
|
|
|
#endif
|
2017-05-17 00:04:56 +08:00
|
|
|
return (std::string)errbuf;
|
|
|
|
}
|
2015-05-29 23:38:02 +08:00
|
|
|
|
2017-05-17 00:04:56 +08:00
|
|
|
#undef av_err2str
|
|
|
|
#define av_err2str(errnum) av_make_error_string(errnum).c_str()
|
2014-04-26 04:12:58 +08:00
|
|
|
|
2016-08-07 22:55:19 +08:00
|
|
|
/* The following is copied directly from newer ffmpeg */
|
2016-08-10 01:14:10 +08:00
|
|
|
#if LIBAVUTIL_VERSION_CHECK(52, 7, 0, 17, 100)
|
2016-08-07 22:55:19 +08:00
|
|
|
#else
|
|
|
|
int av_dict_parse_string(AVDictionary **pm, const char *str,
|
|
|
|
const char *key_val_sep, const char *pairs_sep,
|
|
|
|
int flags);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif // __cplusplus
|
2014-04-26 04:12:58 +08:00
|
|
|
|
2014-10-12 04:38:38 +08:00
|
|
|
|
2013-10-10 12:16:11 +08:00
|
|
|
#endif // ( HAVE_LIBAVUTIL_AVUTIL_H || HAVE_LIBAVCODEC_AVCODEC_H || HAVE_LIBAVFORMAT_AVFORMAT_H || HAVE_LIBAVDEVICE_AVDEVICE_H )
|
2008-07-25 00:57:39 +08:00
|
|
|
|
Feature h264 videostorage (#1882)
* Moved writing of configure options from Controller to Model. Fixes #191.
* Initial commit for saving events as videos :)
* Add zm_video.cpp to autotools
* Add zm_video.h to autotools
* Search for MP4V2 header file 3 times: mp4v2/mp4v2.h, mp4v2.h, mp4.h
* Fix serve memory leak
* Few minor code improvements
* Added the ability to override preset, tune, profile and few other improvements
* Correctly write SPS & PPS from x264 encoder headers
* Remove unnessecary SPS & PPS writing code
* Imported missing files from master to feature-h264-videostorage
* Audio support including fixes for dts/pts, split on keyframe and update to mkv extension to prevent ffmpeg problems writing rtsp audio to mp4 containter (header problem)
* Updates to make gcc happy
* Add html5 video control to timeline and event to support mkv playback
* Add zm_videostore.cpp to CMakeLists.txt
* Remove Modern Branch for now
* Fix minor bug
* Option handled added in master, removing duplicate declaration
* Add CaptureandRecord from zm_camera.h
* Putting placeholder in for CaptureAndRecord function
* Removed duplicate code and brackets
* add digest auth file for cmake
Conflicts:
src/CMakeLists.txt
* Add web dir back into Makefile.am
Revert "Removed web from SUBDIRS in Makefile.am"
This reverts commit d9bbcdf3a94cba4d8955fcd03bd965ed2772f34d.
* Add CaptureAndRecord to vlc, still need to make it record
* Resolve SegFault on videostore
* Swap to mp4 container
* mp4 changes
* spaces to tabs, hide video stuff if video writer is turned off
* Make timeline open event.mp4 instead of mkv
* Missed mkv in timeline.js
* Fix some issues from the merge conflict
* Resolve post merge build issues with braces
* Fix whitespace
* Update Jpeg and Video options for passthrough options
* Whitespace fix zm_camera.h
* Fix array mkssing comma
* Add support for Jpeg save options for h264 branch snapshot. Might remove altogether if snapshots not needed
* Update VideoStoreData memory size comment
* Change from config.use_mkv_storage to per monitor option VideoWriter from video branch
* Fix bracket issues post merge
* Clean up comments and add av_free_packet
* Convert from event_directory to event file as per Video branch
* Testing videojs for video playback
* Fixed a missing bracket post merge and also SQL_values now used for EventID and Monitors
* bring recent improvements in ffmpeg capture function into captureandrecord
* Remove pict from writeAudioFramePacket as not used
* Add translate options for h264 Storage options in Monitor and update en_gb file
* Cherry-Pick from iconnor - make it compile on ubuntu 15.04. Which is libav 56.1.0
Conflicts:
src/zm_ffmpeg.cpp
src/zm_remote_camera_rtsp.cpp
Conflicts:
distros/ubuntu1204/changelog
* Clean up videostore code and remove lots of unused code
* proof of concept for dynamic/automatic video rotation using video-js plugin zoomrotate
Conflicts:
web/skins/classic/views/event.php
* removed redundant field in sql query
Conflicts:
web/skins/classic/views/event.php
* local storage of video js plugin
* Beautify!
Make the code somewhat readable.
* added missing videojs.zoomrotate.js file
added missing videojs.zoomrotate.js file
* Typo
added missing "
* Added missing brackets
* fix to display thumbnails when only storing snapshot.jpg
* added control for video playback rate
Conflicts:
web/skins/classic/views/event.php
* dynamically create jpegs from video file for viewing in browser
* fix timeline view for SaveJPEGs monitors (without enabled VideoWriter)
* only expose monitor info which are being used in client
* fix segmentation fault in zma with ubuntu 14.04 and ffmpeg 2.5.8 (gcc 4.8)
when libx264 is not installed
* better way of detecting showing image or video in timeline and event view
instead of Monitor.VideoWriter, Event.DefaultVideo is used, so even if
VideoWriter/SaveJPEG option is changed, a valid image or video will always be
displayed for historical events in both timeline and event view
this also fixes loading videos in timeline view
* Fixes problem of crashing zmc when bad packet arrives causing av_interleaved_write_frame() to return non-zero (-22). Prefilters common packet issues. Add metadata title to generated video file
* Remove syslog.h
* fixed SaveJPEGs are not working
which is caused in errors introduced when merging with master
* Update README.md
* Fix build warnings specific to h264 branch, unused FrameImg, unused ret and int64_t snprintf issues
* Fix PRId64 issue in travis, builds locally fine, but I can see a gcc version issue here
* Fix PRId64 issue in travis, another try
* Try "STDC_FORMAT_MACROS" to see if that helps Travis on gcc 4.6.3
* Revert space removal around PRId64
* video branch ffmpeg 2.9 fixes
ffmpeg 2.9 patched removed SSE2 CPU
* Add FFMPEGInit back
* use webvvt to overlay timestamp (honoring Monitor.LabelFormat) to videos in timeline and event
also fixed bug which prevented seeking in timeline video preview
* ffmpeg 3.0 API build failure fixes
* Update README.md
* merge all the commits from the messed up iconnor_video branch
* fix whitespace
* revert
* whitespace fixes
* spelling fix
* put back some text
* add these back
* fix spelling mistake
* Steal some packet dumping routines from ffmpeg. Convert them to use our logging routines
* add a test and error message if the codec is not h264
* these have been removed in master
* add a view to check auth and just send the video
* add some comments, and dump filename and AVFormatContext on failure to write header
* add the toggle for RecordAudio so that the checkbox works to turn off Audio
* Must init videoStore in constuctor
* more debug and comments, return checking
* Fix dropped part of sql query.
* fix extra else and some whitespace
* Fix missing } from merge that was preventing building.
* fix tabs
* get rid of use of separator, just use \n
* Restore lost fixes for deprecation
* Why are these failing
* Respect record_audio flag when setting up video file so dont try and initiliase mp4 with unsupported audio
* Forgot that I was trying to solve case of stream is true and record_audio
is false.
* Pass swscale_ctx back in to getCachedContext or it will create new
context every frame and leak memory like a mofo.
* Add libx264-dev and libmp4v2-dev to build requires to save hassle of
ensuring they are installed before build.
* Merge my Rotation/Orientation work and fixes for bad h264 streams
* need arpa/inet for reverse lookups
* pull in the new byte range code for viewing videos
* Move our recording flag deeper into closeevent
* add braces and only call closeEvent if there is an event
* deprecate the z_frame_rate stuff which is deprecated in ffmpeg
* remark out some debugging
* fix for video on stream 1
* fix audio_stream to audio_st
* Ignore bad decodes
* fix problems with content-length causing viewing to not work in chrome/android
* change logic of sending file contents to handle an off by one and be more readable
* Some fixes pointed out by Maxim Romanov. Also simply the loading of events to not join the Monitors table
* fix to sql for timeline
* added RecordAudio to sql in README
* Use sub queries instead of joins to fix errors when using new mysql defaults.
* fix sql queries
* Dockerfile to build feature-h264-videostorage
* Must cast codec
* add php-acpu as a dependency
* require php5-acpu
* fix typo
* remove extra /
* Add a line for out-of-tree builds to do api/lib/Cake/bootstrap.php
* delete merge conflict files
* delete merge conflict files
2017-05-16 10:02:48 +08:00
|
|
|
#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.
|
|
|
|
*/
|
|
|
|
int64_t av_rescale_delta(AVRational in_tb, int64_t in_ts, AVRational fs_tb, int duration, int64_t *last, AVRational out_tb);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef av_clip64
|
|
|
|
/**
|
|
|
|
* Clip a signed 64bit integer value into the amin-amax range.
|
|
|
|
* @param a value to clip
|
|
|
|
* @param amin minimum value of the clip range
|
|
|
|
* @param amax maximum value of the clip range
|
|
|
|
* @return clipped value
|
|
|
|
*/
|
|
|
|
static av_always_inline av_const int64_t av_clip64_c(int64_t a, int64_t amin, int64_t amax)
|
|
|
|
{
|
|
|
|
if (a < amin) return amin;
|
|
|
|
else if (a > amax) return amax;
|
|
|
|
else return a;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define av_clip64 av_clip64_c
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void zm_dump_stream_format(AVFormatContext *ic, int i, int index, int is_output);
|
2019-01-14 23:48:06 +08:00
|
|
|
void zm_dump_codec(const AVCodecContext *codec);
|
2017-06-16 01:02:54 +08:00
|
|
|
#if LIBAVCODEC_VERSION_CHECK(57, 64, 0, 64, 0)
|
2019-01-14 23:48:06 +08:00
|
|
|
void zm_dump_codecpar(const AVCodecParameters *par);
|
2017-06-14 22:36:08 +08:00
|
|
|
#endif
|
2019-01-14 23:48:06 +08:00
|
|
|
void zm_dump_frame(const AVFrame *frame, const char *text="Frame");
|
2017-06-14 04:51:51 +08:00
|
|
|
|
2017-05-17 00:04:56 +08:00
|
|
|
#if LIBAVCODEC_VERSION_CHECK(56, 8, 0, 60, 100)
|
|
|
|
#define zm_av_packet_unref( packet ) av_packet_unref( packet )
|
|
|
|
#define zm_av_packet_ref( dst, src ) av_packet_ref( dst, src )
|
|
|
|
#else
|
2018-09-27 04:20:29 +08:00
|
|
|
unsigned int zm_av_packet_ref( AVPacket *dst, AVPacket *src );
|
2017-05-17 00:04:56 +08:00
|
|
|
#define zm_av_packet_unref( packet ) av_free_packet( packet )
|
|
|
|
#endif
|
|
|
|
#if LIBAVCODEC_VERSION_CHECK(52, 23, 0, 23, 0)
|
|
|
|
#define zm_avcodec_decode_video( context, rawFrame, frameComplete, packet ) avcodec_decode_video2( context, rawFrame, frameComplete, packet )
|
|
|
|
#else
|
|
|
|
#define zm_avcodec_decode_video(context, rawFrame, frameComplete, packet ) avcodec_decode_video( context, rawFrame, frameComplete, packet->data, packet->size)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if LIBAVCODEC_VERSION_CHECK(55, 28, 1, 45, 101)
|
|
|
|
#define zm_av_frame_alloc() av_frame_alloc()
|
|
|
|
#else
|
|
|
|
#define zm_av_frame_alloc() avcodec_alloc_frame()
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ! LIBAVCODEC_VERSION_CHECK(55, 28, 1, 45, 101)
|
|
|
|
#define av_frame_free( input_avframe ) av_freep( input_avframe )
|
|
|
|
#endif
|
|
|
|
|
|
|
|
int check_sample_fmt(AVCodec *codec, enum AVSampleFormat sample_fmt);
|
Feature h264 videostorage (#1882)
* Moved writing of configure options from Controller to Model. Fixes #191.
* Initial commit for saving events as videos :)
* Add zm_video.cpp to autotools
* Add zm_video.h to autotools
* Search for MP4V2 header file 3 times: mp4v2/mp4v2.h, mp4v2.h, mp4.h
* Fix serve memory leak
* Few minor code improvements
* Added the ability to override preset, tune, profile and few other improvements
* Correctly write SPS & PPS from x264 encoder headers
* Remove unnessecary SPS & PPS writing code
* Imported missing files from master to feature-h264-videostorage
* Audio support including fixes for dts/pts, split on keyframe and update to mkv extension to prevent ffmpeg problems writing rtsp audio to mp4 containter (header problem)
* Updates to make gcc happy
* Add html5 video control to timeline and event to support mkv playback
* Add zm_videostore.cpp to CMakeLists.txt
* Remove Modern Branch for now
* Fix minor bug
* Option handled added in master, removing duplicate declaration
* Add CaptureandRecord from zm_camera.h
* Putting placeholder in for CaptureAndRecord function
* Removed duplicate code and brackets
* add digest auth file for cmake
Conflicts:
src/CMakeLists.txt
* Add web dir back into Makefile.am
Revert "Removed web from SUBDIRS in Makefile.am"
This reverts commit d9bbcdf3a94cba4d8955fcd03bd965ed2772f34d.
* Add CaptureAndRecord to vlc, still need to make it record
* Resolve SegFault on videostore
* Swap to mp4 container
* mp4 changes
* spaces to tabs, hide video stuff if video writer is turned off
* Make timeline open event.mp4 instead of mkv
* Missed mkv in timeline.js
* Fix some issues from the merge conflict
* Resolve post merge build issues with braces
* Fix whitespace
* Update Jpeg and Video options for passthrough options
* Whitespace fix zm_camera.h
* Fix array mkssing comma
* Add support for Jpeg save options for h264 branch snapshot. Might remove altogether if snapshots not needed
* Update VideoStoreData memory size comment
* Change from config.use_mkv_storage to per monitor option VideoWriter from video branch
* Fix bracket issues post merge
* Clean up comments and add av_free_packet
* Convert from event_directory to event file as per Video branch
* Testing videojs for video playback
* Fixed a missing bracket post merge and also SQL_values now used for EventID and Monitors
* bring recent improvements in ffmpeg capture function into captureandrecord
* Remove pict from writeAudioFramePacket as not used
* Add translate options for h264 Storage options in Monitor and update en_gb file
* Cherry-Pick from iconnor - make it compile on ubuntu 15.04. Which is libav 56.1.0
Conflicts:
src/zm_ffmpeg.cpp
src/zm_remote_camera_rtsp.cpp
Conflicts:
distros/ubuntu1204/changelog
* Clean up videostore code and remove lots of unused code
* proof of concept for dynamic/automatic video rotation using video-js plugin zoomrotate
Conflicts:
web/skins/classic/views/event.php
* removed redundant field in sql query
Conflicts:
web/skins/classic/views/event.php
* local storage of video js plugin
* Beautify!
Make the code somewhat readable.
* added missing videojs.zoomrotate.js file
added missing videojs.zoomrotate.js file
* Typo
added missing "
* Added missing brackets
* fix to display thumbnails when only storing snapshot.jpg
* added control for video playback rate
Conflicts:
web/skins/classic/views/event.php
* dynamically create jpegs from video file for viewing in browser
* fix timeline view for SaveJPEGs monitors (without enabled VideoWriter)
* only expose monitor info which are being used in client
* fix segmentation fault in zma with ubuntu 14.04 and ffmpeg 2.5.8 (gcc 4.8)
when libx264 is not installed
* better way of detecting showing image or video in timeline and event view
instead of Monitor.VideoWriter, Event.DefaultVideo is used, so even if
VideoWriter/SaveJPEG option is changed, a valid image or video will always be
displayed for historical events in both timeline and event view
this also fixes loading videos in timeline view
* Fixes problem of crashing zmc when bad packet arrives causing av_interleaved_write_frame() to return non-zero (-22). Prefilters common packet issues. Add metadata title to generated video file
* Remove syslog.h
* fixed SaveJPEGs are not working
which is caused in errors introduced when merging with master
* Update README.md
* Fix build warnings specific to h264 branch, unused FrameImg, unused ret and int64_t snprintf issues
* Fix PRId64 issue in travis, builds locally fine, but I can see a gcc version issue here
* Fix PRId64 issue in travis, another try
* Try "STDC_FORMAT_MACROS" to see if that helps Travis on gcc 4.6.3
* Revert space removal around PRId64
* video branch ffmpeg 2.9 fixes
ffmpeg 2.9 patched removed SSE2 CPU
* Add FFMPEGInit back
* use webvvt to overlay timestamp (honoring Monitor.LabelFormat) to videos in timeline and event
also fixed bug which prevented seeking in timeline video preview
* ffmpeg 3.0 API build failure fixes
* Update README.md
* merge all the commits from the messed up iconnor_video branch
* fix whitespace
* revert
* whitespace fixes
* spelling fix
* put back some text
* add these back
* fix spelling mistake
* Steal some packet dumping routines from ffmpeg. Convert them to use our logging routines
* add a test and error message if the codec is not h264
* these have been removed in master
* add a view to check auth and just send the video
* add some comments, and dump filename and AVFormatContext on failure to write header
* add the toggle for RecordAudio so that the checkbox works to turn off Audio
* Must init videoStore in constuctor
* more debug and comments, return checking
* Fix dropped part of sql query.
* fix extra else and some whitespace
* Fix missing } from merge that was preventing building.
* fix tabs
* get rid of use of separator, just use \n
* Restore lost fixes for deprecation
* Why are these failing
* Respect record_audio flag when setting up video file so dont try and initiliase mp4 with unsupported audio
* Forgot that I was trying to solve case of stream is true and record_audio
is false.
* Pass swscale_ctx back in to getCachedContext or it will create new
context every frame and leak memory like a mofo.
* Add libx264-dev and libmp4v2-dev to build requires to save hassle of
ensuring they are installed before build.
* Merge my Rotation/Orientation work and fixes for bad h264 streams
* need arpa/inet for reverse lookups
* pull in the new byte range code for viewing videos
* Move our recording flag deeper into closeevent
* add braces and only call closeEvent if there is an event
* deprecate the z_frame_rate stuff which is deprecated in ffmpeg
* remark out some debugging
* fix for video on stream 1
* fix audio_stream to audio_st
* Ignore bad decodes
* fix problems with content-length causing viewing to not work in chrome/android
* change logic of sending file contents to handle an off by one and be more readable
* Some fixes pointed out by Maxim Romanov. Also simply the loading of events to not join the Monitors table
* fix to sql for timeline
* added RecordAudio to sql in README
* Use sub queries instead of joins to fix errors when using new mysql defaults.
* fix sql queries
* Dockerfile to build feature-h264-videostorage
* Must cast codec
* add php-acpu as a dependency
* require php5-acpu
* fix typo
* remove extra /
* Add a line for out-of-tree builds to do api/lib/Cake/bootstrap.php
* delete merge conflict files
* delete merge conflict files
2017-05-16 10:02:48 +08:00
|
|
|
|
2019-04-04 01:21:52 +08:00
|
|
|
bool is_video_stream(AVStream *);
|
|
|
|
bool is_audio_stream(AVStream *);
|
|
|
|
bool is_video_context(AVCodec *);
|
|
|
|
bool is_audio_context(AVCodec *);
|
|
|
|
|
2018-01-22 06:18:29 +08:00
|
|
|
int zm_receive_frame( AVCodecContext *context, AVFrame *frame, AVPacket &packet );
|
2018-09-14 04:18:28 +08:00
|
|
|
void dumpPacket(AVStream *, AVPacket *,const char *text="");
|
2008-07-25 00:57:39 +08:00
|
|
|
#endif // ZM_FFMPEG_H
|