This repository has been archived by the owner on Jul 28, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f1ea660
Showing
10 changed files
with
1,678 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/dist | ||
/dist-newstyle | ||
/.stack-work |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# FastCut Changelog | ||
|
||
* **0.1.0*** | ||
- Initial version of FastCut! |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import Distribution.Simple | ||
main = defaultMain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: fastcut | ||
version: 0.1.0 | ||
synopsis: High-productivity video and audio editing | ||
-- description: | ||
license: MPL-2.0 | ||
license-file: LICENSE | ||
author: Oskar Wickström | ||
maintainer: oskar.wickstrom@gmail.com | ||
copyright: Oskar Wickström | ||
category: Multimedia | ||
build-type: Simple | ||
cabal-version: >=1.10 | ||
|
||
extra-source-files: CHANGELOG.md | ||
data-dir: src/data | ||
data-files: gui.glade | ||
|
||
executable fastcut | ||
main-is: Main.hs | ||
other-modules: Paths_fastcut | ||
, FastCut.Scene | ||
-- other-extensions: | ||
build-depends: base >=4.10 && <4.12 | ||
, gi-gobject | ||
, gi-gtk | ||
, haskell-gi | ||
, haskell-gi-base | ||
, text | ||
, time | ||
hs-source-dirs: src | ||
default-language: Haskell2010 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{-# LANGUAGE DataKinds #-} | ||
{-# LANGUAGE DuplicateRecordFields #-} | ||
{-# LANGUAGE GADTs #-} | ||
{-# LANGUAGE KindSignatures #-} | ||
{-# LANGUAGE OverloadedLabels #-} | ||
{-# LANGUAGE OverloadedStrings #-} | ||
{-# LANGUAGE RankNTypes #-} | ||
{-# LANGUAGE StandaloneDeriving #-} | ||
module FastCut.Scene where | ||
|
||
import Data.Text (Text) | ||
import qualified Data.Text as Text | ||
import Data.Time.Clock (NominalDiffTime) | ||
|
||
type Duration = NominalDiffTime | ||
|
||
data ClipMetadata = ClipMetadata | ||
{ name :: Text | ||
, path :: FilePath | ||
, duration :: Duration | ||
} deriving (Eq, Show) | ||
|
||
data ClipType = Video | Audio | ||
|
||
data Clip (a :: ClipType) where | ||
VideoClip :: ClipMetadata -> Clip Video | ||
AudioClip :: ClipMetadata -> Clip Audio | ||
VideoGap :: Duration -> Clip Video | ||
AudioGap :: Duration -> Clip Audio | ||
|
||
deriving instance Eq (Clip a) | ||
deriving instance Show (Clip a) | ||
|
||
data Sequence | ||
= Sequenced [Sequence] | ||
| Composed [Clip Video] [Clip Audio] | ||
deriving (Eq, Show) | ||
|
||
single :: Clip a -> Sequence | ||
single c = case c of | ||
VideoClip{} -> Composed [c] [] | ||
VideoGap{} -> Composed [c] [] | ||
AudioClip{} -> Composed [] [c] | ||
AudioGap{} -> Composed [] [c] | ||
|
||
instance Semigroup Sequence where | ||
Sequenced a <> Sequenced b = Sequenced (a <> b) | ||
Sequenced a <> b = Sequenced (a <> [b]) | ||
a <> Sequenced b = Sequenced (a : b) | ||
a <> b = Sequenced [a, b] | ||
|
||
instance Monoid Sequence where | ||
mempty = Sequenced [] | ||
|
||
data Scene = Scene { name :: Text, sequence :: Sequence } | ||
deriving (Eq, Show) | ||
|
||
testClip = VideoClip (ClipMetadata "hello" "/tmp/hello.mp4" 5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{-# LANGUAGE OverloadedLabels #-} | ||
{-# LANGUAGE OverloadedStrings #-} | ||
|
||
import Data.GI.Base | ||
import Data.GI.Base.Properties | ||
import Data.Maybe | ||
import Data.Text | ||
import GI.GObject | ||
import qualified GI.Gtk as Gtk | ||
import GI.Gtk.Objects.Window (windowResize) | ||
|
||
import Paths_fastcut | ||
|
||
main :: IO () | ||
main = do | ||
Gtk.init Nothing | ||
|
||
gladeFile <- getDataFileName "gui.glade" | ||
builder <- Gtk.builderNewFromFile (pack gladeFile) | ||
|
||
window <- builderGetObject Gtk.Window builder "window" | ||
fileChooserButton <- builderGetObject Gtk.Button builder "file-chooser-button" | ||
|
||
on window #destroy Gtk.mainQuit | ||
|
||
windowResize window 640 480 | ||
|
||
|
||
on fileChooserButton #clicked $ set | ||
fileChooserButton | ||
[#sensitive := False, #label := "Thanks for clicking me"] | ||
|
||
#showAll window | ||
|
||
Gtk.main | ||
|
||
builderGetObject | ||
:: (GI.GObject.GObject b, Gtk.IsBuilder a) | ||
=> (Data.GI.Base.ManagedPtr b -> b) | ||
-> a | ||
-> Prelude.String | ||
-> IO b | ||
builderGetObject objectTypeClass builder objectId = | ||
fromJust | ||
<$> Gtk.builderGetObject builder (pack objectId) | ||
>>= Gtk.unsafeCastTo objectTypeClass |
Oops, something went wrong.