2019-12-05 15:24:12 +01:00
<!DOCTYPE html>
< html lang = "en" >
< head >
2020-03-31 15:35:51 +02:00
< meta charset = "utf-8" >
2019-12-05 15:24:12 +01:00
<!-- createimportvideo.cpp -->
2020-01-30 15:47:04 +01:00
< title > CreateImportVideo Class | ScreenPlay< / title >
2019-12-05 15:24:12 +01:00
< link rel = "stylesheet" type = "text/css" href = "../css/style.css" / > < link rel = "stylesheet" type = "text/css" href = "../css/bootstrap.min.css" / >
< / head >
< body >
2019-12-05 15:30:08 +01:00
< div class = "container-fullwidth nav" > < div class = "container navWrapper" > < a href = "../index.html" > < span class = "logo" > ScreenPlay Generated Docs < / span > < / a > < span class = "navHome" > < a href = "../index.html" > Home< / a > < / span > < / div > < / div > < div id = mainWrapper class = "wrapper container " >
2019-12-05 15:24:12 +01:00
< li > CreateImportVideo< / li >
< div class = "sidebar" >
< div class = "toc" >
< h3 > < a name = "toc" > Contents< / a > < / h3 >
< ul >
< li class = "level1" > < a href = "#public-functions" > Public Functions< / a > < / li >
< li class = "level1" > < a href = "#public-slots" > Public Slots< / a > < / li >
< li class = "level1" > < a href = "#signals" > Signals< / a > < / li >
< li class = "level1" > < a href = "#details" > Detailed Description< / a > < / li >
< / ul >
< / div >
< div class = "sidebar-content" id = "sidebar-content" > < / div > < / div >
< h1 class = "title" > CreateImportVideo Class< / h1 >
2020-03-31 15:35:51 +02:00
< span class = "small-subtitle" > class < a href = "screenplay.html" > ScreenPlay< / a > ::CreateImportVideo< / span >
2019-12-05 15:24:12 +01:00
<!-- $$$CreateImportVideo - brief -->
< p > This class imports (copies) and creates wallaper previews. < a href = "#details" > More...< / a > < / p >
<!-- @@@CreateImportVideo -->
< div class = "table" > < table class = "alignedsummary" >
< tr > < td class = "memItemLeft rightAlign topAlign" > Header:< / td > < td class = "memItemRight bottomAlign" > < span class = "preprocessor" > #include < CreateImportVideo> < / span >
< / td > < / tr > < / table > < / div > < ul >
< li > < a href = "screenplay-createimportvideo-members.html" > List of all members, including inherited members< / a > < / li >
< / ul >
< a name = "public-functions" > < / a >
< h2 id = "public-functions" > Public Functions< / h2 >
< div class = "table" > < table class = "alignedsummary" >
2020-03-31 15:35:51 +02:00
< tr > < td class = "memItemLeft rightAlign topAlign" > < / td > < td class = "memItemRight bottomAlign" > < b > < a href = "screenplay-createimportvideo.html#CreateImportVideo-2" > CreateImportVideo< / a > < / b > (const QString & < i > videoPath< / i > , const QString & < i > exportPath< / i > , const QStringList & < i > codecs< / i > , QObject *< i > parent< / i > = nullptr)< / td > < / tr >
2019-12-08 11:38:48 +01:00
< tr > < td class = "memItemLeft rightAlign topAlign" > < / td > < td class = "memItemRight bottomAlign" > < b > < a href = "screenplay-createimportvideo.html#CreateImportVideo-1" > CreateImportVideo< / a > < / b > (QObject *< i > parent< / i > = nullptr)< / td > < / tr >
2019-12-05 15:24:12 +01:00
< tr > < td class = "memItemLeft rightAlign topAlign" > float < / td > < td class = "memItemRight bottomAlign" > < b > < a href = "screenplay-createimportvideo.html#progress-prop" > progress< / a > < / b > () const< / td > < / tr >
< / table > < / div >
< a name = "public-slots" > < / a >
< h2 id = "public-slots" > Public Slots< / h2 >
< div class = "table" > < table class = "alignedsummary" >
2019-12-08 11:38:48 +01:00
< tr > < td class = "memItemLeft rightAlign topAlign" > bool < / td > < td class = "memItemRight bottomAlign" > < b > < a href = "screenplay-createimportvideo.html#createWallpaperGifPreview" > createWallpaperGifPreview< / a > < / b > ()< / td > < / tr >
2020-03-31 15:35:51 +02:00
< tr > < td class = "memItemLeft rightAlign topAlign" > bool < / td > < td class = "memItemRight bottomAlign" > < b > < a href = "screenplay-createimportvideo.html#createWallpaperImagePreview" > createWallpaperImagePreview< / a > < / b > ()< / td > < / tr >
2020-01-30 15:47:04 +01:00
< tr > < td class = "memItemLeft rightAlign topAlign" > bool < / td > < td class = "memItemRight bottomAlign" > < b > < a href = "screenplay-createimportvideo.html#createWallpaperImageThumbnailPreview" > createWallpaperImageThumbnailPreview< / a > < / b > ()< / td > < / tr >
2019-12-08 11:38:48 +01:00
< tr > < td class = "memItemLeft rightAlign topAlign" > bool < / td > < td class = "memItemRight bottomAlign" > < b > < a href = "screenplay-createimportvideo.html#createWallpaperInfo" > createWallpaperInfo< / a > < / b > ()< / td > < / tr >
2020-03-31 15:35:51 +02:00
< tr > < td class = "memItemLeft rightAlign topAlign" > bool < / td > < td class = "memItemRight bottomAlign" > < b > < a href = "screenplay-createimportvideo.html#createWallpaperVideo" > createWallpaperVideo< / a > < / b > (const QString & < i > codec< / i > )< / td > < / tr >
2019-12-08 11:38:48 +01:00
< tr > < td class = "memItemLeft rightAlign topAlign" > bool < / td > < td class = "memItemRight bottomAlign" > < b > < a href = "screenplay-createimportvideo.html#createWallpaperVideoPreview" > createWallpaperVideoPreview< / a > < / b > ()< / td > < / tr >
< tr > < td class = "memItemLeft rightAlign topAlign" > bool < / td > < td class = "memItemRight bottomAlign" > < b > < a href = "screenplay-createimportvideo.html#extractWallpaperAudio" > extractWallpaperAudio< / a > < / b > ()< / td > < / tr >
< tr > < td class = "memItemLeft rightAlign topAlign" > void < / td > < td class = "memItemRight bottomAlign" > < b > < a href = "screenplay-createimportvideo.html#process" > process< / a > < / b > ()< / td > < / tr >
2019-12-05 15:24:12 +01:00
< tr > < td class = "memItemLeft rightAlign topAlign" > void < / td > < td class = "memItemRight bottomAlign" > < b > < a href = "screenplay-createimportvideo.html#progress-prop" > setProgress< / a > < / b > (float < i > progress< / i > )< / td > < / tr >
< / table > < / div >
< a name = "signals" > < / a >
< h2 id = "signals" > Signals< / h2 >
< div class = "table" > < table class = "alignedsummary" >
< tr > < td class = "memItemLeft rightAlign topAlign" > void < / td > < td class = "memItemRight bottomAlign" > < b > < a href = "screenplay-createimportvideo.html#progress-prop" > progressChanged< / a > < / b > (float < i > progress< / i > )< / td > < / tr >
< / table > < / div >
< a name = "details" > < / a >
<!-- $$$CreateImportVideo - description -->
< div class = "descr" >
< h2 id = "details" > Detailed Description< / h2 >
< p > This lass only exsits as long as the user creates a wallpaper and gets destroyed if the creation was successful or not. The state get propagated via createWallpaperStateChanged(ImportVideoState state);< / p >
< / div >
<!-- @@@CreateImportVideo -->
2019-12-08 11:38:48 +01:00
< div class = "func" >
< h2 > Member Function Documentation< / h2 >
2020-03-31 15:35:51 +02:00
<!-- $$$CreateImportVideo$$$CreateImportVideoconstQString&constQString&constQStringList&QObject* -->
< h3 class = "fn" id = "CreateImportVideo-2" > < a name = "CreateImportVideo-2" > < / a > CreateImportVideo::< span class = "name" > CreateImportVideo< / span > (const < span class = "type" > QString< / span > & < i > videoPath< / i > , const < span class = "type" > QString< / span > & < i > exportPath< / i > , const < span class = "type" > QStringList< / span > & < i > codecs< / i > , < span class = "type" > QObject< / span > *< i > parent< / i > = nullptr)< / h3 >
2019-12-08 11:38:48 +01:00
< p > Creates a CreateImportVideo object to be used in a different thread. A < i > videoPath< / i > and a < i > exportPath< / i > are needed for convertion.< / p >
<!-- @@@CreateImportVideo -->
<!-- $$$CreateImportVideo$$$CreateImportVideoQObject* -->
< h3 class = "fn" id = "CreateImportVideo-1" > < a name = "CreateImportVideo-1" > < / a > CreateImportVideo::< span class = "name" > CreateImportVideo< / span > (< span class = "type" > QObject< / span > *< i > parent< / i > = nullptr)< / h3 >
< p > This constructor is only needed for calling qRegisterMetaType on CreateImportVideo to register the enums.< / p >
< pre class = "cpp" > qRegisterMetaType< span class = "operator" > < < / span > CreateImportVideo< span class = "operator" > ::< / span > ImportVideoState< span class = "operator" > > < / span > (< span class = "string" > " CreateImportVideo::ImportVideoState" < / span > );< / pre >
<!-- @@@CreateImportVideo -->
<!-- $$$createWallpaperGifPreview[overload1]$$$createWallpaperGifPreview -->
< h3 class = "fn" id = "createWallpaperGifPreview" > < a name = "createWallpaperGifPreview" > < / a > < code > [slot] < / code > < span class = "type" > bool< / span > CreateImportVideo::< span class = "name" > createWallpaperGifPreview< / span > ()< / h3 >
< p > Starts ffmpeg and tries to covert the given video to a 5 second preview gif.< / p >
< pre class = "cpp" > < span class = "comment" > //[...]< / span >
args< span class = "operator" > .< / span > append(< span class = "string" > " -filter_complex" < / span > );
args< span class = "operator" > .< / span > append(< span class = "string" > " [0:v] fps=12,scale=w=480:h=-1,split [a][b];[a] palettegen=stats_mode=single [p];[b][p] paletteuse=new=1" < / span > );
args< span class = "operator" > .< / span > append(m_exportPath < span class = "operator" > +< / span > < span class = "string" > " /preview.gif" < / span > );< / pre >
2020-01-30 15:47:04 +01:00
< p > Returns < code > false< / code > if :< / p >
2019-12-08 11:38:48 +01:00
< ul >
< li > Cannot convert the video< / li >
< li > Generally broken.< / li >
< / ul >
<!-- @@@createWallpaperGifPreview -->
2020-03-31 15:35:51 +02:00
<!-- $$$createWallpaperImagePreview[overload1]$$$createWallpaperImagePreview -->
< h3 class = "fn" id = "createWallpaperImagePreview" > < a name = "createWallpaperImagePreview" > < / a > < code > [slot] < / code > < span class = "type" > bool< / span > CreateImportVideo::< span class = "name" > createWallpaperImagePreview< / span > ()< / h3 >
< p > .< / p >
<!-- @@@createWallpaperImagePreview -->
2020-01-30 15:47:04 +01:00
<!-- $$$createWallpaperImageThumbnailPreview[overload1]$$$createWallpaperImageThumbnailPreview -->
< h3 class = "fn" id = "createWallpaperImageThumbnailPreview" > < a name = "createWallpaperImageThumbnailPreview" > < / a > < code > [slot] < / code > < span class = "type" > bool< / span > CreateImportVideo::< span class = "name" > createWallpaperImageThumbnailPreview< / span > ()< / h3 >
< p > Starts ffmpeg and tries to covert the given video to a image preview. Returns < code > false< / code > if :< / p >
2019-12-08 11:38:48 +01:00
< ul >
< li > Cannot convert the video< / li >
< li > Generally broken.< / li >
< / ul >
2020-01-30 15:47:04 +01:00
<!-- @@@createWallpaperImageThumbnailPreview -->
2019-12-08 11:38:48 +01:00
<!-- $$$createWallpaperInfo[overload1]$$$createWallpaperInfo -->
< h3 class = "fn" id = "createWallpaperInfo" > < a name = "createWallpaperInfo" > < / a > < code > [slot] < / code > < span class = "type" > bool< / span > CreateImportVideo::< span class = "name" > createWallpaperInfo< / span > ()< / h3 >
2020-01-30 15:47:04 +01:00
< p > Starts ffprobe and tries to parse the resulting json. Returns < code > false< / code > if :< / p >
2019-12-08 11:38:48 +01:00
< ul >
< li > Parsing the output json of ffprobe fails.< / li >
< li > Has no video.< / li >
< li > Cannot parse number of frames.< / li >
< li > Is a wrong file format or generally broken.< / li >
< / ul >
<!-- @@@createWallpaperInfo -->
2020-03-31 15:35:51 +02:00
<!-- $$$createWallpaperVideo[overload1]$$$createWallpaperVideoconstQString& -->
< h3 class = "fn" id = "createWallpaperVideo" > < a name = "createWallpaperVideo" > < / a > < code > [slot] < / code > < span class = "type" > bool< / span > CreateImportVideo::< span class = "name" > createWallpaperVideo< / span > (const < span class = "type" > QString< / span > & < i > codec< / i > )< / h3 >
2019-12-08 11:38:48 +01:00
< p > Starts ffmpeg and tries to covert the given video to a webm video.< / p >
< pre class = "cpp" > < span class = "comment" > //[...]< / span >
args< span class = "operator" > .< / span > append(< span class = "string" > " -c:v" < / span > );
args< span class = "operator" > .< / span > append(< span class = "string" > " libvpx-vp8" < / span > );
args< span class = "operator" > .< / span > append(< span class = "string" > " -crf" < / span > );
args< span class = "operator" > .< / span > append(< span class = "string" > " 30" < / span > );
args< span class = "operator" > .< / span > append(< span class = "string" > " -pix_fmt" < / span > );
args< span class = "operator" > .< / span > append(< span class = "string" > " yuv420p" < / span > );
args< span class = "operator" > .< / span > append(< span class = "string" > " -b:v" < / span > );
args< span class = "operator" > .< / span > append(< span class = "string" > " 0" < / span > );< / pre >
2020-01-30 15:47:04 +01:00
< p > Returns < code > false< / code > if :< / p >
2019-12-08 11:38:48 +01:00
< ul >
< li > Cannot convert the video< / li >
< li > Generally broken.< / li >
< / ul >
<!-- @@@createWallpaperVideo -->
<!-- $$$createWallpaperVideoPreview[overload1]$$$createWallpaperVideoPreview -->
< h3 class = "fn" id = "createWallpaperVideoPreview" > < a name = "createWallpaperVideoPreview" > < / a > < code > [slot] < / code > < span class = "type" > bool< / span > CreateImportVideo::< span class = "name" > createWallpaperVideoPreview< / span > ()< / h3 >
< p > Starts ffmpeg and tries to covert the given video to a five second preview.< / p >
< pre class = "cpp" > < span class = "comment" > //[...]< / span >
args< span class = "operator" > .< / span > append(< span class = "string" > " -vf" < / span > );
< span class = "comment" > // We allways want to have a 5 second clip via 24fps -> 120 frames< / span >
< span class = "comment" > // Divided by the number of frames we can skip (timeInSeconds * Framrate)< / span >
< span class = "comment" > // scale & crop parameter: https://unix.stackexchange.com/a/284731< / span >
args< span class = "operator" > .< / span > append(< span class = "string" > " select='not(mod(n," < / span > < span class = "operator" > +< / span > < span class = "type" > QString< / span > < span class = "operator" > ::< / span > number((m_length < span class = "operator" > /< / span > < span class = "number" > 5< / span > )) < span class = "operator" > +< / span > < span class = "string" > " ))',setpts=N/FRAME_RATE/TB,crop=in_h*16/9:in_h,scale=-2:400" < / span > );
< span class = "comment" > // Disable audio< / span >
args< span class = "operator" > .< / span > append(< span class = "string" > " -an" < / span > );
args< span class = "operator" > .< / span > append(m_exportPath < span class = "operator" > +< / span > < span class = "string" > " /preview.webm" < / span > );< / pre >
2020-01-30 15:47:04 +01:00
< p > Returns < code > false< / code > if :< / p >
2019-12-08 11:38:48 +01:00
< ul >
< li > Cannot convert the video< / li >
< li > Generally broken.< / li >
< / ul >
<!-- @@@createWallpaperVideoPreview -->
<!-- $$$extractWallpaperAudio[overload1]$$$extractWallpaperAudio -->
< h3 class = "fn" id = "extractWallpaperAudio" > < a name = "extractWallpaperAudio" > < / a > < code > [slot] < / code > < span class = "type" > bool< / span > CreateImportVideo::< span class = "name" > extractWallpaperAudio< / span > ()< / h3 >
< p > Starts ffmpeg and tries to covert the given audio into a seperate mp3.< / p >
< pre class = "cpp" > < span class = "comment" > //[...]< / span >
args< span class = "operator" > .< / span > append(< span class = "string" > " mp3" < / span > );
args< span class = "operator" > .< / span > append(< span class = "string" > " -ab" < / span > );
args< span class = "operator" > .< / span > append(< span class = "string" > " 192000" < / span > );
args< span class = "operator" > .< / span > append(< span class = "string" > " -vn" < / span > );
args< span class = "operator" > .< / span > append(m_exportPath < span class = "operator" > +< / span > < span class = "string" > " /audio.mp3" < / span > );< / pre >
2020-01-30 15:47:04 +01:00
< p > Returns < code > false< / code > if :< / p >
2019-12-08 11:38:48 +01:00
< ul >
< li > Cannot convert the audio< / li >
< li > Generally broken.< / li >
< / ul >
<!-- @@@extractWallpaperAudio -->
<!-- $$$process[overload1]$$$process -->
< h3 class = "fn" id = "process" > < a name = "process" > < / a > < code > [slot] < / code > < span class = "type" > void< / span > CreateImportVideo::< span class = "name" > process< / span > ()< / h3 >
< p > Processes the multiple steps of creating a wallpaper.< / p >
< ol class = "1" type = "1" > < li > < a href = "screenplay-createimportvideo.html#createWallpaperInfo" > createWallpaperInfo< / a > ()< / li >
2020-03-31 15:35:51 +02:00
< li > < a href = "screenplay-createimportvideo.html#createWallpaperImagePreview" > createWallpaperImagePreview< / a > ()< / li >
2019-12-08 11:38:48 +01:00
< li > < a href = "screenplay-createimportvideo.html#createWallpaperVideoPreview" > createWallpaperVideoPreview< / a > ()< / li >
< li > < a href = "screenplay-createimportvideo.html#createWallpaperGifPreview" > createWallpaperGifPreview< / a > ()< / li >
< li > < a href = "screenplay-createimportvideo.html#createWallpaperVideo" > createWallpaperVideo< / a > () - skiped if already a webm< / li >
< li > < a href = "screenplay-createimportvideo.html#extractWallpaperAudio" > extractWallpaperAudio< / a > () - skiped if no audio< / li >
< li > emit createWallpaperStateChanged(ImportVideoState::Finished);< / li >
< / ol >
<!-- @@@process -->
< / div >
< div id = license class = "footer center" > < p > This documentation is licensed under a < a rel = "license" href = "http://creativecommons.org/licenses/by/4.0/" > Creative Commons Attribution 4.0 International License< / a > .< / p > < / div > < script src = "../js/mermaid.min.js" > < / script > < script > var config = { startOnLoad : true , flowchart : { useMaxWidth : true , htmlLabels : true } } ; mermaid . initialize ( config ) ; < / script > < / body >
2019-12-05 15:24:12 +01:00
< / html >