summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthonyCowley <>2018-07-11 16:11:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2018-07-11 16:11:00 (GMT)
commitb2e4401528530dbbe7d41387c28d6ed39fa83e43 (patch)
treee26a2c7f9c925fc1bf1e0169fba1e790206ac5de
parentfddda8e1dea46f958f6761af3d292fa57cb1490c (diff)
version 0.12.2.1HEAD0.12.2.1master
-rw-r--r--ffmpeg-light.cabal2
-rw-r--r--src/Codec/FFmpeg/Encode.hsc (renamed from src/Codec/FFmpeg/Encode.hs)12
-rw-r--r--src/Codec/FFmpeg/Enums.hsc6
3 files changed, 8 insertions, 12 deletions
diff --git a/ffmpeg-light.cabal b/ffmpeg-light.cabal
index 90c88ca..aa3790b 100644
--- a/ffmpeg-light.cabal
+++ b/ffmpeg-light.cabal
@@ -1,5 +1,5 @@
name: ffmpeg-light
-version: 0.12.2.0
+version: 0.12.2.1
synopsis: Minimal bindings to the FFmpeg library.
description: Stream frames from an encoded video, or stream frames to
diff --git a/src/Codec/FFmpeg/Encode.hs b/src/Codec/FFmpeg/Encode.hsc
index 009ebbb..7f076da 100644
--- a/src/Codec/FFmpeg/Encode.hs
+++ b/src/Codec/FFmpeg/Encode.hsc
@@ -1,4 +1,4 @@
-{-# LANGUAGE CPP, ForeignFunctionInterface #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
-- | Video encoding API. Includes FFI declarations for the underlying
-- FFmpeg functions, wrappers for these functions that wrap error
-- condition checking, and high level Haskellized interfaces.
@@ -30,6 +30,8 @@ import Foreign.Marshal.Utils
import Foreign.Ptr
import Foreign.Storable
+#include <libavformat/avformat.h>
+
-- Based on the FFmpeg muxing example
-- http://www.ffmpeg.org/doxygen/2.1/doc_2examples_2muxing_8c-example.html
@@ -170,7 +172,7 @@ initStream ep oc = do
needsHeader <- checkFlag avfmtGlobalheader <$>
(getOutputFormat oc >>= getFormatFlags)
when needsHeader $
-#if FFMPEG_LIGHT_LEGACY
+#if LIBAVFORMAT_VERSION_MAJOR < 57
getCodecFlags ctx >>= setCodecFlags ctx . (.|. codecFlagGlobalHeader)
#else
getCodecFlags ctx >>= setCodecFlags ctx . (.|. avCodecFlagGlobalHeader)
@@ -352,7 +354,7 @@ frameWriter ep fname = do
-- of scaling the nominal, desired frame rate (given by
-- 'framePeriod') to the stream's time_base.
tb <- getTimeBase st
-#if FFMPEG_LIGHT_LEGACY
+#if LIBAVFORMAT_VERSION_MAJOR < 57
isRaw <- checkFlag avfmtRawpicture <$> (getOutputFormat oc >>= getFormatFlags)
#endif
@@ -400,7 +402,7 @@ frameWriter ep fname = do
False -> (+ frameTime) <$> getPts dstFrame
modifyIORef frameNum (+1)
return ts
-#if FFMPEG_LIGHT_LEGACY
+#if LIBAVFORMAT_VERSION_MAJOR < 57
addRaw Nothing = return ()
addRaw (Just (_, _, pixels)) =
do resetPacket
@@ -438,7 +440,7 @@ frameWriter ep fname = do
-- Make sure the GC hasn't clobbered our palettized pixel data
let (fp,_,_) = V.unsafeToForeignPtr pixels'
touchForeignPtr fp
-#if FFMPEG_LIGHT_LEGACY
+#if LIBAVFORMAT_VERSION_MAJOR < 57
addFrame = if isRaw then addRaw else addEncoded
#else
addFrame = addEncoded
diff --git a/src/Codec/FFmpeg/Enums.hsc b/src/Codec/FFmpeg/Enums.hsc
index 98f0149..f7ff8ca 100644
--- a/src/Codec/FFmpeg/Enums.hsc
+++ b/src/Codec/FFmpeg/Enums.hsc
@@ -12,12 +12,6 @@ import Foreign.Storable (Storable)
#include <libswscale/swscale.h>
#include "nameCompat.h"
-#if LIBAVFORMAT_VERSION_MAJOR < 57
-#define FFMPEG_LIGHT_LEGACY 1
-#else
-#define FFMPEG_LIGHT_LEGACY 0
-#endif
-
newtype AVMediaType = AVMediaType CInt deriving (Eq, Storable)
#enum AVMediaType,AVMediaType \
, AVMEDIA_TYPE_VIDEO\