]> git.sesse.net Git - casparcg/blobdiff - core/video_format.cpp
git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/trunk@2711...
[casparcg] / core / video_format.cpp
index d5030259e56c5ca3947114a8af0d4378b08b2bfe..6922aa0f95a42490c4ec448cc326f4115e3d305a 100644 (file)
@@ -1,53 +1,72 @@
 /*\r
-* copyright (c) 2010 Sveriges Television AB <info@casparcg.com>\r
+* Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>\r
 *\r
-*  This file is part of CasparCG.\r
+* This file is part of CasparCG (www.casparcg.com).\r
 *\r
-*    CasparCG is free software: you can redistribute it and/or modify\r
-*    it under the terms of the GNU General Public License as published by\r
-*    the Free Software Foundation, either version 3 of the License, or\r
-*    (at your option) any later version.\r
+* CasparCG is free software: you can redistribute it and/or modify\r
+* it under the terms of the GNU General Public License as published by\r
+* the Free Software Foundation, either version 3 of the License, or\r
+* (at your option) any later version.\r
 *\r
-*    CasparCG is distributed in the hope that it will be useful,\r
-*    but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-*    GNU General Public License for more details.\r
-\r
-*    You should have received a copy of the GNU General Public License\r
-*    along with CasparCG.  If not, see <http://www.gnu.org/licenses/>.\r
+* CasparCG is distributed in the hope that it will be useful,\r
+* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+* GNU General Public License for more details.\r
+*\r
+* You should have received a copy of the GNU General Public License\r
+* along with CasparCG. If not, see <http://www.gnu.org/licenses/>.\r
 *\r
+* Author: Robert Nagy, ronag89@gmail.com\r
 */\r
\r
+\r
 #include "StdAfx.h"\r
 \r
 #include "video_format.h"\r
 \r
 #include <boost/algorithm/string.hpp>\r
+#include <boost/assign.hpp>\r
 \r
-#include <array>\r
+#define DEFINE_VIDEOFORMATDESC(fmt, w, h, sw, sh, m, scale, duration, audio_samples, name) \\r
+{ \\r
+       (fmt), \\r
+       (w), \\r
+       (h), \\r
+       (sw),\\r
+       (sh),\\r
+       (m), \\r
+       ((double)scale/(double)duration),\\r
+       (scale),\\r
+       (duration),\\r
+       (m == field_mode::progressive ? 1 : 2),\\r
+       ((w)*(h)*4),\\r
+       (name),\\r
+       (48000),\\r
+       (2),\\r
+       (audio_samples)\\r
+}\r
 \r
-#define DEFINE_VIDEOFORMATDESC(w, h, m, f, s, fmt) { (fmt), (w), (h), (m), (m == video_mode::progressive ? f : f/2.0), (1.0/(m == video_mode::progressive ? f : f/2.0)), ((w)*(h)*4), (s)}\r
 \r
 namespace caspar { namespace core {\r
        \r
-const video_format_desc format_descs[video_format::invalid] =  \r
+const video_format_desc format_descs[video_format::count] =  \r
 {                                                                         \r
-       DEFINE_VIDEOFORMATDESC(720,  576,  video_mode::upper,                   50,                     TEXT("PAL"),            video_format::pal               ), \r
-       //DEFINE_VIDEOFORMATDESC(720,  486,  video_mode::lower,                 60/1.001,       TEXT("NTSC"),           video_format::ntsc              ), \r
-       //DEFINE_VIDEOFORMATDESC(720,  576,  video_mode::progressive,           25,                     TEXT("576p2500"),       video_format::x576p2500 ),\r
-       DEFINE_VIDEOFORMATDESC(1280, 720,  video_mode::progressive,             25,                     TEXT("720p2500"),       video_format::x720p2500 ), \r
-       DEFINE_VIDEOFORMATDESC(1280, 720,  video_mode::progressive,             50,                     TEXT("720p5000"),       video_format::x720p5000 ), \r
-       //DEFINE_VIDEOFORMATDESC(1280, 720,  video_mode::progressive,   60/1.001,       TEXT("720p5994"),       video_format::x720p5994 ),\r
-       //DEFINE_VIDEOFORMATDESC(1280, 720,  video_mode::progressive,   60,                     TEXT("720p6000"),       video_format::x720p6000 ),\r
-       //DEFINE_VIDEOFORMATDESC(1920, 1080, video_mode::progressive,   24/1.001,       TEXT("1080p2397"),      video_format::x1080p2397),\r
-       //DEFINE_VIDEOFORMATDESC(1920, 1080, video_mode::progressive,   24,                     TEXT("1080p2400"),      video_format::x1080p2400),\r
-       DEFINE_VIDEOFORMATDESC(1920, 1080, video_mode::upper,                   50,                     TEXT("1080i5000"),      video_format::x1080i5000),\r
-       //DEFINE_VIDEOFORMATDESC(1920, 1080, video_mode::upper,                 60/1.001,       TEXT("1080i5994"),      video_format::x1080i5994),\r
-       //DEFINE_VIDEOFORMATDESC(1920, 1080, video_mode::upper,                 60,                     TEXT("1080i6000"),      video_format::x1080i6000),\r
-       DEFINE_VIDEOFORMATDESC(1920, 1080, video_mode::progressive,             25,                     TEXT("1080p2500"),      video_format::x1080p2500),\r
-       //DEFINE_VIDEOFORMATDESC(1920, 1080, video_mode::progressive,   30/1.001,       TEXT("1080p2997"),      video_format::x1080p2997),\r
-       //DEFINE_VIDEOFORMATDESC(1920, 1080, video_mode::progressive,   30,                     TEXT("1080p3000"),      video_format::x1080p3000),\r
-       DEFINE_VIDEOFORMATDESC(0,               0, video_mode::invalid,                 -1,                     TEXT("invalid"),        video_format::invalid   )\r
+       DEFINE_VIDEOFORMATDESC(video_format::pal                ,720,  576,  1024, 576,  field_mode::upper,                     25,             1,               boost::assign::list_of(3840),                                                  L"PAL"), \r
+       DEFINE_VIDEOFORMATDESC(video_format::ntsc               ,720,  486,  720,  540,  field_mode::lower,                     30000,  1001,    boost::assign::list_of(3204)(3202)(3204)(3202)(3204),  L"NTSC"), \r
+       DEFINE_VIDEOFORMATDESC(video_format::x576p2500  ,1024, 576,  1024, 576,  field_mode::progressive,       25,             1,               boost::assign::list_of(3840),                                                  L"576p2500"),\r
+       DEFINE_VIDEOFORMATDESC(video_format::x720p2500  ,1280, 720,  1280, 720,  field_mode::progressive,       25,             1,               boost::assign::list_of(3840),                                                  L"720p2500"), \r
+       DEFINE_VIDEOFORMATDESC(video_format::x720p5000  ,1280, 720,  1280, 720,  field_mode::progressive,       50,             1,               boost::assign::list_of(1920),                                                  L"720p5000"), \r
+       DEFINE_VIDEOFORMATDESC(video_format::x720p5994  ,1280, 720,  1280, 720,  field_mode::progressive,       60000,  1001,    boost::assign::list_of(1602)(1601)(1602)(1601)(1602),  L"720p5994"),\r
+       DEFINE_VIDEOFORMATDESC(video_format::x720p6000  ,1280, 720,  1280, 720,  field_mode::progressive,       60,             1,               boost::assign::list_of(1600),                                                  L"720p6000"),\r
+       DEFINE_VIDEOFORMATDESC(video_format::x1080p2397 ,1920, 1080, 1920, 1080, field_mode::progressive,       24000,  1001,    boost::assign::list_of(4004),                                                  L"1080p2398"),\r
+       DEFINE_VIDEOFORMATDESC(video_format::x1080p2400 ,1920, 1080, 1920, 1080, field_mode::progressive,       24,             1,               boost::assign::list_of(4000),                                                  L"1080p2400"),\r
+       DEFINE_VIDEOFORMATDESC(video_format::x1080i5000 ,1920, 1080, 1920, 1080, field_mode::upper,                     25,             1,               boost::assign::list_of(3840),                                                  L"1080i5000"),\r
+       DEFINE_VIDEOFORMATDESC(video_format::x1080i5994 ,1920, 1080, 1920, 1080, field_mode::upper,                     30000,  1001,    boost::assign::list_of(3204)(3202)(3204)(3202)(3204),  L"1080i5994"),\r
+       DEFINE_VIDEOFORMATDESC(video_format::x1080i6000 ,1920, 1080, 1920, 1080, field_mode::upper,                     30,             1,               boost::assign::list_of(3200),                                                  L"1080i6000"),\r
+       DEFINE_VIDEOFORMATDESC(video_format::x1080p2500 ,1920, 1080, 1920, 1080, field_mode::progressive,       25,             1,               boost::assign::list_of(3840),                                                  L"1080p2500"),\r
+       DEFINE_VIDEOFORMATDESC(video_format::x1080p2997 ,1920, 1080, 1920, 1080, field_mode::progressive,       30000,  1001,    boost::assign::list_of(3204)(3202)(3204)(3202)(3204),  L"1080p2997"),\r
+       DEFINE_VIDEOFORMATDESC(video_format::x1080p3000 ,1920, 1080, 1920, 1080, field_mode::progressive,       30,             1,               boost::assign::list_of(3200),                                                  L"1080p3000"),\r
+       DEFINE_VIDEOFORMATDESC(video_format::x1080p5000 ,1920, 1080, 1920, 1080, field_mode::progressive,       50,             1,               boost::assign::list_of(1920),                                                  L"1080p5000"),\r
+       DEFINE_VIDEOFORMATDESC(video_format::invalid    ,0,             0,   0,         0,   field_mode::progressive,   1,              1,               boost::assign::list_of(1),                                                             L"invalid")\r
 };\r
 \r
 const video_format_desc& video_format_desc::get(video_format::type format)     \r