zoneminder/src/zm_ffmpeg_input.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

63 lines
1.4 KiB
C
Raw Normal View History

#ifndef ZM_FFMPEG_INPUT_H
#define ZM_FFMPEG_INPUT_H
#include "zm_define.h"
#ifdef __cplusplus
extern "C" {
#endif
#include "libavformat/avformat.h"
#include "libavformat/avio.h"
#include "libavcodec/avcodec.h"
#ifdef __cplusplus
}
#endif
class FFmpeg_Input {
public:
FFmpeg_Input();
~FFmpeg_Input();
int Open(const char *filename );
int Open(
const AVStream *,
const AVCodecContext *,
const AVStream *,
const AVCodecContext *);
int Close();
AVFrame *get_frame(int stream_id=-1);
AVFrame *get_frame(int stream_id, double at);
int get_video_stream_id() const {
return video_stream_id;
}
int get_audio_stream_id() const {
return audio_stream_id;
}
AVStream *get_video_stream() {
return ( video_stream_id >= 0 ) ? input_format_context->streams[video_stream_id] : nullptr;
}
AVStream *get_audio_stream() {
return ( audio_stream_id >= 0 ) ? input_format_context->streams[audio_stream_id] : nullptr;
}
AVFormatContext *get_format_context() { return input_format_context; };
private:
typedef struct {
AVCodecContext *context;
AVCodec *codec;
int frame_count;
} stream;
2017-11-19 05:00:10 +08:00
stream *streams;
int video_stream_id;
int audio_stream_id;
AVFormatContext *input_format_context;
2018-11-20 05:45:56 +08:00
AVFrame *frame;
2019-12-14 07:12:33 +08:00
int64_t last_seek_request;
2017-06-27 04:55:49 +08:00
};
#endif