mirror of
https://github.com/Motion-Project/motion.git
synced 2026-01-20 12:48:36 -05:00
Revisions to configuration options.
1. Revise config options to be `movie_` and `picture_`
2. Revise config options to align with topic and code.
* motion_video_pipe, ipv6_enabled, rtsp_uses_tcp
* switchfilter, logfile, process_id_file
3. Revise depreciated options to still be valid for webcontrol and config files.
4. Revise distributed config files to only include most common options
5. Revise sequence of config options to be arranged by topic.
6. Revise code to use names consistent with config parms.
7. Revise manual, guide and code to specify same default values.
8. Update guide and manual to reflect revised option names.
112 lines
3.1 KiB
C
112 lines
3.1 KiB
C
#ifndef _INCLUDE_FFMPEG_H_
|
|
#define _INCLUDE_FFMPEG_H_
|
|
|
|
#include <stdio.h>
|
|
#include <stdarg.h>
|
|
#include <sys/time.h>
|
|
#include <stdint.h>
|
|
#include "config.h"
|
|
struct image_data; /* forward declare for functions */
|
|
struct rtsp_context;
|
|
|
|
enum TIMELAPSE_TYPE {
|
|
TIMELAPSE_NONE, /* No timelapse, regular processing */
|
|
TIMELAPSE_APPEND, /* Use append version of timelapse */
|
|
TIMELAPSE_NEW /* Use create new file version of timelapse */
|
|
};
|
|
|
|
#ifdef HAVE_FFMPEG
|
|
|
|
#include <errno.h>
|
|
#include <libavformat/avformat.h>
|
|
#include <libavutil/imgutils.h>
|
|
#include <libavutil/mathematics.h>
|
|
#include <libavdevice/avdevice.h>
|
|
|
|
#if (LIBAVFORMAT_VERSION_MAJOR >= 56)
|
|
#define MY_PIX_FMT_YUV420P AV_PIX_FMT_YUV420P
|
|
#define MY_PIX_FMT_YUVJ420P AV_PIX_FMT_YUVJ420P
|
|
#define MyPixelFormat AVPixelFormat
|
|
#else //Old ffmpeg pixel formats
|
|
#define MY_PIX_FMT_YUV420P PIX_FMT_YUV420P
|
|
#define MY_PIX_FMT_YUVJ420P PIX_FMT_YUVJ420P
|
|
#define MyPixelFormat PixelFormat
|
|
#endif //Libavformat >= 56
|
|
|
|
#endif // HAVE_FFMPEG
|
|
|
|
#ifdef HAVE_FFMPEG
|
|
struct ffmpeg {
|
|
AVFormatContext *oc;
|
|
AVStream *video_st;
|
|
AVCodecContext *ctx_codec;
|
|
AVCodec *codec;
|
|
AVPacket pkt;
|
|
AVFrame *picture; /* contains default image pointers */
|
|
AVDictionary *opts;
|
|
struct rtsp_context *rtsp_data;
|
|
int width;
|
|
int height;
|
|
enum TIMELAPSE_TYPE tlapse;
|
|
int fps;
|
|
int bps;
|
|
char *filename;
|
|
int quality;
|
|
const char *codec_name;
|
|
int64_t last_pts;
|
|
int64_t base_pts;
|
|
int test_mode;
|
|
int gop_cnt;
|
|
struct timeval start_time;
|
|
int high_resolution;
|
|
int motion_images;
|
|
int passthrough;
|
|
};
|
|
#else
|
|
struct ffmpeg {
|
|
struct rtsp_context *rtsp_data;
|
|
int width;
|
|
int height;
|
|
enum TIMELAPSE_TYPE tlapse;
|
|
int fps;
|
|
int bps;
|
|
char *filename;
|
|
int quality;
|
|
const char *codec_name;
|
|
int64_t last_pts;
|
|
int64_t base_pts;
|
|
int test_mode;
|
|
int gop_cnt;
|
|
struct timeval start_time;
|
|
int high_resolution;
|
|
int motion_images;
|
|
int passthrough;
|
|
};
|
|
#endif // HAVE_FFMPEG
|
|
|
|
|
|
|
|
#ifdef HAVE_FFMPEG
|
|
|
|
AVFrame *my_frame_alloc(void);
|
|
void my_frame_free(AVFrame *frame);
|
|
void my_packet_unref(AVPacket pkt);
|
|
void my_avcodec_close(AVCodecContext *codec_context);
|
|
int my_image_get_buffer_size(enum MyPixelFormat pix_fmt, int width, int height);
|
|
int my_image_copy_to_buffer(AVFrame *frame,uint8_t *buffer_ptr,enum MyPixelFormat pix_fmt,int width,int height,int dest_size);
|
|
int my_image_fill_arrays(AVFrame *frame,uint8_t *buffer_ptr,enum MyPixelFormat pix_fmt,int width,int height);
|
|
int my_copy_packet(AVPacket *dest_pkt, AVPacket *src_pkt);
|
|
|
|
#endif /* HAVE_FFMPEG */
|
|
|
|
void ffmpeg_global_init(void);
|
|
void ffmpeg_global_deinit(void);
|
|
void ffmpeg_avcodec_log(void *, int, const char *, va_list);
|
|
|
|
int ffmpeg_open(struct ffmpeg *ffmpeg);
|
|
int ffmpeg_put_image(struct ffmpeg *ffmpeg, struct image_data *img_data, const struct timeval *tv1);
|
|
void ffmpeg_close(struct ffmpeg *ffmpeg);
|
|
void ffmpeg_reset_movie_start_time(struct ffmpeg *ffmpeg, const struct timeval *tv1);
|
|
|
|
#endif /* _INCLUDE_FFMPEG_H_ */
|