File indexing completed on 2025-04-27 03:58:10
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2016-04-21 0007 * Description : video thumbnails extraction based on ffmpeg 0008 * 0009 * SPDX-FileCopyrightText: 2010 by Dirk Vanden Boer <dirk dot vdb at gmail dot com> 0010 * SPDX-FileCopyrightText: 2016-2018 by Maik Qualmann <metzpinguin at gmail dot com> 0011 * SPDX-FileCopyrightText: 2016-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0012 * 0013 * SPDX-License-Identifier: GPL-2.0-or-later 0014 * 0015 * ============================================================ */ 0016 0017 #include "videothumbwriter.h" 0018 0019 namespace Digikam 0020 { 0021 0022 VideoFrame::VideoFrame() 0023 : width (0), 0024 height (0), 0025 lineSize(0) 0026 { 0027 } 0028 0029 VideoFrame::VideoFrame(int width, int height, int lineSize) 0030 : width (width), 0031 height (height), 0032 lineSize(lineSize) 0033 { 0034 } 0035 0036 VideoFrame::~VideoFrame() 0037 { 0038 } 0039 0040 // ------------------------------------------------------ 0041 0042 VideoThumbWriter::VideoThumbWriter() 0043 { 0044 } 0045 0046 VideoThumbWriter::~VideoThumbWriter() 0047 { 0048 } 0049 0050 void VideoThumbWriter::writeFrame(VideoFrame& frame, QImage& image) 0051 { 0052 QImage previewImage(frame.width, frame.height, QImage::Format_RGB888); 0053 0054 for (quint32 y = 0 ; y < frame.height ; ++y) 0055 { 0056 // Copy each line... 0057 0058 memcpy(previewImage.scanLine(y), 0059 &frame.frameData[y * frame.lineSize], 0060 frame.width * 3); 0061 } 0062 0063 image = previewImage; 0064 } 0065 0066 } // namespace Digikam