1 #ifndef _JPEG_FRAME_VIEW_H
2 #define _JPEG_FRAME_VIEW_H 1
9 #include <movit/effect_chain.h>
10 #include <movit/ycbcr_input.h>
19 std::unique_ptr<uint8_t[]> y, cb, cr;
20 unsigned width, height;
21 unsigned chroma_subsampling_x, chroma_subsampling_y;
22 unsigned pitch_y, pitch_chroma;
24 enum CacheMissBehavior {
25 DECODE_IF_NOT_IN_CACHE,
26 RETURN_NULLPTR_IF_NOT_IN_CACHE
29 std::string filename_for_frame(unsigned stream_idx, int64_t pts);
30 std::shared_ptr<Frame> decode_jpeg(const std::string &filename);
31 std::shared_ptr<Frame> decode_jpeg_with_cache(JPEGID id, CacheMissBehavior cache_miss_behavior, bool *did_decode);
33 class JPEGFrameView : public QGLWidget {
37 JPEGFrameView(QWidget *parent);
39 void setFrame(unsigned stream_idx, int64_t pts);
41 void mousePressEvent(QMouseEvent *event) override;
43 unsigned get_stream_idx() const { return current_stream_idx; }
45 void setDecodedFrame(std::shared_ptr<Frame> frame);
51 void initializeGL() override;
52 void resizeGL(int width, int height) override;
53 void paintGL() override;
56 // The stream index of the latest frame we displayed.
57 unsigned current_stream_idx;
59 std::unique_ptr<movit::EffectChain> chain;
60 std::shared_ptr<Frame> current_frame; // So that we hold on to the pixels.
61 movit::YCbCrInput *ycbcr_input;
62 movit::YCbCrFormat ycbcr_format;
65 #endif // !defined(_JPEG_FRAME_VIEW_H)