~ubuntu-branches/ubuntu/natty/kdemultimedia/natty-proposed

« back to all changes in this revision

Viewing changes to ffmpegthumbs/ffmpegthumbnailer/videothumbnailer.h

  • Committer: Bazaar Package Importer
  • Author(s): Debian Qt/KDE Maintainers
  • Date: 2011-05-26 02:41:36 UTC
  • mfrom: (0.2.3 upstream)
  • mto: This revision was merged to the branch mainline in revision 108.
  • Revision ID: james.westby@ubuntu.com-20110526024136-jjwsigfy402jhupm
Tags: upstream-4.6.3
ImportĀ upstreamĀ versionĀ 4.6.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//    Copyright (C) 2010 Dirk Vanden Boer <dirk.vdb@gmail.com>
 
2
//
 
3
//    This program is free software; you can redistribute it and/or modify
 
4
//    it under the terms of the GNU General Public License as published by
 
5
//    the Free Software Foundation; either version 2 of the License, or
 
6
//    (at your option) any later version.
 
7
//
 
8
//    This program is distributed in the hope that it will be useful,
 
9
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
//    GNU General Public License for more details.
 
12
//
 
13
//    You should have received a copy of the GNU General Public License
 
14
//    along with this program; if not, write to the Free Software
 
15
//    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
16
 
 
17
#ifndef VIDEO_THUMBNAILER_H
 
18
#define VIDEO_THUMBNAILER_H
 
19
 
 
20
#include <string>
 
21
#include <vector>
 
22
#include <map>
 
23
#include <inttypes.h>
 
24
 
 
25
#include "ifilter.h"
 
26
#include "histogram.h"
 
27
#include <QString>
 
28
#include <QImage>
 
29
 
 
30
 
 
31
namespace ffmpegthumbnailer
 
32
{
 
33
 
 
34
class VideoFrame;
 
35
class ImageWriter;
 
36
class MovieDecoder;
 
37
 
 
38
class VideoThumbnailer
 
39
{
 
40
public:
 
41
    VideoThumbnailer();
 
42
    VideoThumbnailer(int thumbnailSize, bool workaroundIssues, bool maintainAspectRatio, bool smartFrameSelection);
 
43
    ~VideoThumbnailer();
 
44
 
 
45
    void generateThumbnail(const QString& videoFile, QImage &image);
 
46
 
 
47
    void setThumbnailSize(int size);
 
48
    void setSeekPercentage(int percentage);
 
49
    void setSeekTime(const QString& seekTime);
 
50
    void setWorkAroundIssues(bool workAround);
 
51
    void setMaintainAspectRatio(bool enabled);
 
52
    void setSmartFrameSelection(bool enabled);
 
53
    void addFilter(IFilter* filter);
 
54
    void removeFilter(IFilter* filter);
 
55
    void clearFilters();
 
56
 
 
57
private:
 
58
    void generateThumbnail(const QString& videoFile, ImageWriter& imageWriter, QImage& image);
 
59
    void generateSmartThumbnail(MovieDecoder& movieDecoder, VideoFrame& videoFrame);
 
60
 
 
61
    QString getMimeType(const QString& videoFile);
 
62
    QString getExtension(const QString& videoFilename);
 
63
 
 
64
    void generateHistogram(const VideoFrame& videoFrame, Histogram<int>& histogram);
 
65
    int getBestThumbnailIndex(std::vector<VideoFrame>& videoFrames, const std::vector<Histogram<int> >& histograms);
 
66
    void applyFilters(VideoFrame& frameData);
 
67
 
 
68
private:
 
69
    int                         m_ThumbnailSize;
 
70
    quint16                     m_SeekPercentage;
 
71
    bool                        m_OverlayFilmStrip;
 
72
    bool                        m_WorkAroundIssues;
 
73
    bool                        m_MaintainAspectRatio;
 
74
    bool                        m_SmartFrameSelection;
 
75
    QString                     m_SeekTime;
 
76
    std::vector<IFilter*>       m_Filters;
 
77
};
 
78
 
 
79
}
 
80
 
 
81
#endif