LCOV - code coverage report
Current view: top level - src/media/video - filter_transpose.cpp (source / functions) Coverage Total Hit
Test: jami-coverage-filtered.info Lines: 0.0 % 36 0
Test Date: 2026-06-13 09:18:46 Functions: 0.0 % 5 0

            Line data    Source code
       1              : /*
       2              :  *  Copyright (C) 2004-2026 Savoir-faire Linux Inc.
       3              :  *
       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 3 of the License, or
       7              :  *  (at your option) any later version.
       8              :  *
       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.
      13              :  *
      14              :  *  You should have received a copy of the GNU General Public License
      15              :  *  along with this program. If not, see <https://www.gnu.org/licenses/>.
      16              :  */
      17              : 
      18              : #include "filter_transpose.h"
      19              : #include "logger.h"
      20              : 
      21              : namespace jami {
      22              : namespace video {
      23              : 
      24              : std::unique_ptr<MediaFilter>
      25            0 : getTransposeFilter(int rotation, std::string inputName, int width, int height, int format, bool rescale)
      26              : {
      27            0 :     JAMI_WARNING("Rotation set to {}", rotation);
      28            0 :     if (rotation == 0) {
      29            0 :         return {};
      30              :     }
      31              : 
      32            0 :     std::stringstream ss;
      33            0 :     ss << "[" << inputName << "] ";
      34              : 
      35            0 :     switch (rotation) {
      36            0 :     case 90:
      37              :     case -270:
      38            0 :         ss << "transpose=2";
      39            0 :         if (rescale) {
      40            0 :             if (width > height)
      41            0 :                 ss << ", scale=w=-1:h=" << height << ", pad=" << width << ":" << height << ":(ow-iw)/2";
      42              :             else
      43            0 :                 ss << ", scale=w=" << width << ":h=-1" << ", pad=" << width << ":" << height << ":0:(oh-ih)/2";
      44              :         }
      45            0 :         break;
      46            0 :     case 180:
      47              :     case -180:
      48            0 :         ss << "transpose=1, transpose=1";
      49            0 :         break;
      50            0 :     case 270:
      51              :     case -90:
      52            0 :         ss << "transpose=1";
      53            0 :         if (rescale) {
      54            0 :             if (width > height)
      55            0 :                 ss << ", scale=w=-1:h=" << height << ", pad=" << width << ":" << height << ":(ow-iw)/2";
      56              :             else
      57            0 :                 ss << ", scale=w=" << width << ":h=-1" << ", pad=" << width << ":" << height << ":0:(oh-ih)/2";
      58              :         }
      59            0 :         break;
      60            0 :     default:
      61            0 :         return {};
      62              :     }
      63              : 
      64            0 :     constexpr auto one = rational<int>(1);
      65            0 :     std::vector<MediaStream> msv;
      66            0 :     msv.emplace_back(inputName, format, one, width, height, 0, one);
      67              : 
      68            0 :     std::unique_ptr<MediaFilter> filter(new MediaFilter);
      69            0 :     auto ret = filter->initialize(ss.str(), msv);
      70            0 :     if (ret < 0) {
      71            0 :         JAMI_ERROR("filter init fail");
      72            0 :         return {};
      73              :     }
      74            0 :     return filter;
      75            0 : }
      76              : 
      77              : } // namespace video
      78              : } // namespace jami
        

Generated by: LCOV version 2.0-1