2 Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #include <libavcodec/avcodec.h>
24 #include <libavformat/avformat.h>
25 #include <libswscale/swscale.h>
33 FFmpegPlayer (wxWindow* parent);
36 void set_file (std::string);
38 wxPanel* panel () const {
42 wxSlider* slider () const {
46 wxToggleButton* play_button () const {
50 void set_top_crop (int t);
51 void set_bottom_crop (int b);
52 void set_left_crop (int l);
53 void set_right_crop (int r);
54 void set_ratio (float r);
57 void timer (wxTimerEvent& ev);
59 void convert_frame ();
60 void paint_panel (wxPaintEvent& ev);
61 void slider_moved (wxCommandEvent& ev);
62 float frames_per_second () const;
63 void allocate_buffer_and_scaler ();
64 float width_source_to_view_scaling () const;
65 float height_source_to_view_scaling () const;
66 int cropped_width_in_view () const;
67 int cropped_height_in_view () const;
68 int left_crop_in_view () const;
69 int top_crop_in_view () const;
70 void panel_sized (wxSizeEvent &);
71 void play_clicked (wxCommandEvent &);
72 void check_play_state ();
74 bool can_display () const;
76 AVFormatContext* _format_context;
79 AVCodecContext* _video_codec_context;
80 AVCodec* _video_codec;
82 struct SwsContext* _scale_context;
89 wxToggleButton* _play_button;
96 int _top_crop_in_source;
97 int _bottom_crop_in_source;
98 int _left_crop_in_source;
99 int _right_crop_in_source;