31 #ifndef OPENSHOT_FFMPEG_READER_H 32 #define OPENSHOT_FFMPEG_READER_H 63 bool is_near(
AudioLocation location,
int samples_per_frame, int64_t amount);
97 AVFormatContext *pFormatCtx;
98 int i, videoStream, audioStream;
99 AVCodecContext *pCodecCtx, *aCodecCtx;
100 AVStream *pStream, *aStream;
104 bool is_duration_known;
105 bool check_interlace;
107 bool has_missing_frames;
111 map<int64_t, int64_t> processing_video_frames;
112 multimap<int64_t, int64_t> processing_audio_frames;
113 map<int64_t, int64_t> processed_video_frames;
114 map<int64_t, int64_t> processed_audio_frames;
115 multimap<int64_t, int64_t> missing_video_frames;
116 multimap<int64_t, int64_t> missing_video_frames_source;
117 multimap<int64_t, int64_t> missing_audio_frames;
118 multimap<int64_t, int64_t> missing_audio_frames_source;
119 map<int64_t, int> checked_frames;
127 int64_t num_packets_since_video_frame;
128 int64_t num_checks_since_final;
129 std::shared_ptr<Frame> last_video_frame;
133 int64_t seeking_frame;
136 int64_t seek_audio_frame_found;
137 int64_t seek_video_frame_found;
139 int64_t audio_pts_offset;
140 int64_t video_pts_offset;
142 int64_t largest_frame_processed;
143 int64_t current_video_frame;
149 bool CheckSeek(
bool is_video);
152 bool CheckMissingFrame(int64_t requested_frame);
155 void CheckWorkingFrames(
bool end_of_stream, int64_t requested_frame);
158 void convert_image(int64_t current_frame, AVPicture *copyFrame,
int width,
int height,
PixelFormat pix_fmt);
161 int64_t ConvertFrameToAudioPTS(int64_t frame_number);
164 int64_t ConvertFrameToVideoPTS(int64_t frame_number);
167 int64_t ConvertVideoPTStoFrame(int64_t pts);
170 std::shared_ptr<Frame> CreateFrame(int64_t requested_frame);
182 int64_t GetSmallestVideoFrame();
185 int64_t GetSmallestAudioFrame();
188 int64_t GetVideoPTS();
191 bool IsPartialFrame(int64_t requested_frame);
194 void ProcessVideoPacket(int64_t requested_frame);
197 void ProcessAudioPacket(int64_t requested_frame, int64_t target_frame,
int starting_sample);
200 std::shared_ptr<Frame> ReadStream(int64_t requested_frame);
203 void RemoveAVFrame(AVPicture*);
206 void RemoveAVPacket(AVPacket*);
209 void Seek(int64_t requested_frame);
212 void UpdatePTSOffset(
bool is_video);
215 void UpdateAudioInfo();
218 void UpdateVideoInfo();
250 std::shared_ptr<Frame> GetFrame(int64_t requested_frame);
256 string Name() {
return "FFmpegReader"; };
260 void SetJson(
string value);
261 Json::Value JsonValue();
262 void SetJsonValue(Json::Value root);
Header file for ReaderBase class.
Header file for OpenMPUtilities (set some common macros)
CacheMemory * GetCache()
Get the cache object used by this reader.
This abstract class is the base class, used by all readers in libopenshot.
Header file for CacheMemory class.
bool IsOpen()
Determine if reader is open or closed.
Header file for all Exception classes.
This class uses the FFmpeg libraries, to open video files and audio files, and return openshot::Frame...
This namespace is the default namespace for all code in the openshot library.
This struct holds the associated video frame and starting sample # for an audio packet.
CacheMemory final_cache
Final cache object used to hold final frames.
string Name()
Return the type name of the class.
Header file for FFmpegUtilities.
This class is a memory-based cache manager for Frame objects.