31 #ifndef OPENSHOT_FFMPEG_READER_H
32 #define OPENSHOT_FFMPEG_READER_H
63 int is_near(
AudioLocation location,
int samples_per_frame,
int 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;
109 int num_of_rescalers;
110 int rescaler_position;
111 vector<SwsContext*> image_rescalers;
114 Cache missing_frames;
115 map<AVPacket*, AVPacket*> packets;
116 map<AVPicture*, AVPicture*> frames;
117 map<long int, long int> processing_video_frames;
118 multimap<long int, long int> processing_audio_frames;
119 map<long int, long int> processed_video_frames;
120 map<long int, long int> processed_audio_frames;
121 multimap<long int, long int> missing_video_frames;
122 multimap<long int, long int> duplicate_video_frames;
129 long int pts_counter;
130 long int num_packets_since_video_frame;
131 long int num_checks_since_final;
132 tr1::shared_ptr<Frame> last_video_frame;
135 long int seeking_pts;
136 long int seeking_frame;
139 long int seek_audio_frame_found;
140 long int seek_video_frame_found;
142 long int audio_pts_offset;
143 long int video_pts_offset;
145 long int largest_frame_processed;
146 long int current_video_frame;
152 bool CheckSeek(
bool is_video);
155 bool CheckMissingFrame(
long int requested_frame);
158 void CheckWorkingFrames(
bool end_of_stream,
long int requested_frame);
161 void convert_image(
long int current_frame, AVPicture *copyFrame,
int width,
int height,
PixelFormat pix_fmt);
164 long int ConvertFrameToAudioPTS(
long int frame_number);
167 long int ConvertFrameToVideoPTS(
long int frame_number);
170 long int ConvertVideoPTStoFrame(
long int pts);
173 tr1::shared_ptr<Frame> CreateFrame(
long int requested_frame);
185 long int GetSmallestVideoFrame();
188 long int GetSmallestAudioFrame();
191 long int GetVideoPTS();
197 bool IsPartialFrame(
long int requested_frame);
200 void ProcessVideoPacket(
long int requested_frame);
203 void ProcessAudioPacket(
long int requested_frame,
long int target_frame,
int starting_sample);
206 tr1::shared_ptr<Frame> ReadStream(
long int requested_frame);
209 void RemoveAVFrame(AVPicture*);
212 void RemoveAVPacket(AVPacket*);
215 void RemoveScalers();
218 void Seek(
long int requested_frame)
throw(
TooManySeeks);
221 void UpdatePTSOffset(
bool is_video);
224 void UpdateAudioInfo();
227 void UpdateVideoInfo();
260 string Name() {
return "FFmpegReader"; };
265 Json::Value JsonValue();
266 void SetJsonValue(Json::Value root)
throw(
InvalidFile);
Header file for ReaderBase class.
Header file for OpenMPUtilities (set some common macros)
This abstract class is the base class, used by all readers in libopenshot.
Exception when a reader is closed, and a frame is requested.
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...
Exception when no valid codec is found for a file.
Exception when no streams are found in the file.
Exception for files that can not be found or opened.
Header file for Cache class.
This class is a cache manager for Frame objects.
Cache * GetCache()
Get the cache object used by this reader.
Cache final_cache
Final cache object used to hold final frames.
Exception for frames that are out of bounds.
Exception for invalid JSON.
This struct holds the associated video frame and starting sample # for an audio packet.
string Name()
Return the type name of the class.
Header file for FFmpegUtilities.
Exception when too many seek attempts happen.