From 5b94e486f0880d44b3f48e4691d371f5e0d11e59 Mon Sep 17 00:00:00 2001 From: Wim van Aarle Date: Fri, 14 Dec 2018 10:34:52 +0100 Subject: [PATCH 01/31] moved library files to the common directory structure --- .../ffmpeg-cpp => include/ffmpegcpp}/AudioFormatConverter.h | 0 .../ffmpeg-cpp/ffmpeg-cpp => include/ffmpegcpp}/CodecDeducer.h | 0 .../ffmpeg-cpp => include/ffmpegcpp}/Codecs/AudioCodec.h | 0 .../ffmpeg-cpp/ffmpeg-cpp => include/ffmpegcpp}/Codecs/Codec.h | 0 .../codecs => include/ffmpegcpp/Codecs}/H264NVEncCodec.h | 0 .../codecs => include/ffmpegcpp/Codecs}/H265NVEncCodec.h | 0 .../ffmpeg-cpp/ffmpeg-cpp => include/ffmpegcpp}/Codecs/JPGCodec.h | 0 .../ffmpeg-cpp/ffmpeg-cpp => include/ffmpegcpp}/Codecs/PNGCodec.h | 0 .../ffmpeg-cpp/ffmpeg-cpp => include/ffmpegcpp}/Codecs/VP9Codec.h | 0 .../ffmpeg-cpp => include/ffmpegcpp}/Codecs/VideoCodec.h | 0 .../ffmpeg-cpp => include/ffmpegcpp}/ConvertedAudioProcessor.h | 0 .../ffmpeg-cpp => include/ffmpegcpp}/Demuxing/AudioInputStream.h | 0 .../ffmpeg-cpp => include/ffmpegcpp}/Demuxing/InputStream.h | 0 .../ffmpeg-cpp => include/ffmpegcpp}/Demuxing/VideoInputStream.h | 0 .../ffmpeg-cpp/ffmpeg-cpp => include/ffmpegcpp}/FFmpegException.h | 0 .../Frame Sinks => include/ffmpegcpp/FrameSinks}/AudioEncoder.h | 0 .../Frame Sinks => include/ffmpegcpp/FrameSinks}/AudioFrameSink.h | 0 .../Frame Sinks => include/ffmpegcpp/FrameSinks}/FrameSink.h | 0 .../Frame Sinks => include/ffmpegcpp/FrameSinks}/VideoEncoder.h | 0 .../Frame Sinks => include/ffmpegcpp/FrameSinks}/VideoFilter.h | 0 .../Frame Sinks => include/ffmpegcpp/FrameSinks}/VideoFrameSink.h | 0 .../ffmpeg-cpp => include/ffmpegcpp}/Muxing/AudioOutputStream.h | 0 .../ffmpeg-cpp/ffmpeg-cpp => include/ffmpegcpp}/Muxing/Muxer.h | 0 .../ffmpeg-cpp => include/ffmpegcpp}/Muxing/OutputStream.h | 0 .../ffmpeg-cpp => include/ffmpegcpp}/Muxing/VideoOutputStream.h | 0 {source/ffmpeg-cpp/ffmpeg-cpp => include/ffmpegcpp}/OpenCodec.h | 0 .../ffmpeg-cpp/ffmpeg-cpp => include/ffmpegcpp}/Sources/Demuxer.h | 0 .../ffmpeg-cpp => include/ffmpegcpp}/Sources/EncodedFileSource.h | 0 .../ffmpeg-cpp => include/ffmpegcpp}/Sources/InputSource.h | 0 .../ffmpeg-cpp => include/ffmpegcpp}/Sources/RawAudioDataSource.h | 0 .../ffmpeg-cpp => include/ffmpegcpp}/Sources/RawAudioFileSource.h | 0 .../ffmpeg-cpp => include/ffmpegcpp}/Sources/RawVideoDataSource.h | 0 .../ffmpeg-cpp => include/ffmpegcpp}/Sources/RawVideoFileSource.h | 0 .../ffmpeg-cpp => include/ffmpegcpp}/VideoFormatConverter.h | 0 {source/ffmpeg-cpp/ffmpeg-cpp => include/ffmpegcpp}/ffmpeg.h | 0 {source/ffmpeg-cpp/ffmpeg-cpp => include/ffmpegcpp}/ffmpegcpp.h | 0 {source/ffmpeg-cpp/ffmpeg-cpp => include/ffmpegcpp}/std.h | 0 {source/ffmpeg-cpp/ffmpeg-cpp => src}/AudioFormatConverter.cpp | 0 {source/ffmpeg-cpp/ffmpeg-cpp => src}/CodecDeducer.cpp | 0 {source/ffmpeg-cpp/ffmpeg-cpp => src}/Codecs/AudioCodec.cpp | 0 {source/ffmpeg-cpp/ffmpeg-cpp => src}/Codecs/Codec.cpp | 0 .../ffmpeg-cpp/codecs => src/Codecs}/H264NVEncCodec.cpp | 0 .../ffmpeg-cpp/codecs => src/Codecs}/H265NVEncCodec.cpp | 0 {source/ffmpeg-cpp/ffmpeg-cpp => src}/Codecs/JPGCodec.cpp | 0 {source/ffmpeg-cpp/ffmpeg-cpp => src}/Codecs/PNGCodec.cpp | 0 {source/ffmpeg-cpp/ffmpeg-cpp => src}/Codecs/VP9Codec.cpp | 0 {source/ffmpeg-cpp/ffmpeg-cpp => src}/Codecs/VideoCodec.cpp | 0 .../ffmpeg-cpp/ffmpeg-cpp => src}/Demuxing/AudioInputStream.cpp | 0 {source/ffmpeg-cpp/ffmpeg-cpp => src}/Demuxing/InputStream.cpp | 0 .../ffmpeg-cpp/ffmpeg-cpp => src}/Demuxing/VideoInputStream.cpp | 0 {source/ffmpeg-cpp/ffmpeg-cpp => src}/FFmpegException.cpp | 0 .../ffmpeg-cpp/Frame Sinks => src/FrameSinks}/AudioEncoder.cpp | 0 .../ffmpeg-cpp/Frame Sinks => src/FrameSinks}/VideoEncoder.cpp | 0 .../ffmpeg-cpp/Frame Sinks => src/FrameSinks}/VideoFilter.cpp | 0 .../ffmpeg-cpp/ffmpeg-cpp => src}/Muxing/AudioOutputStream.cpp | 0 {source/ffmpeg-cpp/ffmpeg-cpp => src}/Muxing/Muxer.cpp | 0 {source/ffmpeg-cpp/ffmpeg-cpp => src}/Muxing/OutputStream.cpp | 0 .../ffmpeg-cpp/ffmpeg-cpp => src}/Muxing/VideoOutputStream.cpp | 0 {source/ffmpeg-cpp/ffmpeg-cpp => src}/OpenCodec.cpp | 0 {source/ffmpeg-cpp/ffmpeg-cpp => src}/Sources/Demuxer.cpp | 0 .../ffmpeg-cpp/ffmpeg-cpp => src}/Sources/EncodedFileSource.cpp | 0 .../ffmpeg-cpp/ffmpeg-cpp => src}/Sources/RawAudioDataSource.cpp | 0 .../ffmpeg-cpp/ffmpeg-cpp => src}/Sources/RawAudioFileSource.cpp | 0 .../ffmpeg-cpp/ffmpeg-cpp => src}/Sources/RawVideoDataSource.cpp | 0 .../ffmpeg-cpp/ffmpeg-cpp => src}/Sources/RawVideoFileSource.cpp | 0 {source/ffmpeg-cpp/ffmpeg-cpp => src}/VideoFormatConverter.cpp | 0 66 files changed, 0 insertions(+), 0 deletions(-) rename {source/ffmpeg-cpp/ffmpeg-cpp => include/ffmpegcpp}/AudioFormatConverter.h (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => include/ffmpegcpp}/CodecDeducer.h (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => include/ffmpegcpp}/Codecs/AudioCodec.h (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => include/ffmpegcpp}/Codecs/Codec.h (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp/codecs => include/ffmpegcpp/Codecs}/H264NVEncCodec.h (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp/codecs => include/ffmpegcpp/Codecs}/H265NVEncCodec.h (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => include/ffmpegcpp}/Codecs/JPGCodec.h (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => include/ffmpegcpp}/Codecs/PNGCodec.h (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => include/ffmpegcpp}/Codecs/VP9Codec.h (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => include/ffmpegcpp}/Codecs/VideoCodec.h (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => include/ffmpegcpp}/ConvertedAudioProcessor.h (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => include/ffmpegcpp}/Demuxing/AudioInputStream.h (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => include/ffmpegcpp}/Demuxing/InputStream.h (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => include/ffmpegcpp}/Demuxing/VideoInputStream.h (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => include/ffmpegcpp}/FFmpegException.h (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp/Frame Sinks => include/ffmpegcpp/FrameSinks}/AudioEncoder.h (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp/Frame Sinks => include/ffmpegcpp/FrameSinks}/AudioFrameSink.h (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp/Frame Sinks => include/ffmpegcpp/FrameSinks}/FrameSink.h (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp/Frame Sinks => include/ffmpegcpp/FrameSinks}/VideoEncoder.h (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp/Frame Sinks => include/ffmpegcpp/FrameSinks}/VideoFilter.h (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp/Frame Sinks => include/ffmpegcpp/FrameSinks}/VideoFrameSink.h (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => include/ffmpegcpp}/Muxing/AudioOutputStream.h (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => include/ffmpegcpp}/Muxing/Muxer.h (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => include/ffmpegcpp}/Muxing/OutputStream.h (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => include/ffmpegcpp}/Muxing/VideoOutputStream.h (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => include/ffmpegcpp}/OpenCodec.h (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => include/ffmpegcpp}/Sources/Demuxer.h (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => include/ffmpegcpp}/Sources/EncodedFileSource.h (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => include/ffmpegcpp}/Sources/InputSource.h (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => include/ffmpegcpp}/Sources/RawAudioDataSource.h (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => include/ffmpegcpp}/Sources/RawAudioFileSource.h (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => include/ffmpegcpp}/Sources/RawVideoDataSource.h (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => include/ffmpegcpp}/Sources/RawVideoFileSource.h (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => include/ffmpegcpp}/VideoFormatConverter.h (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => include/ffmpegcpp}/ffmpeg.h (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => include/ffmpegcpp}/ffmpegcpp.h (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => include/ffmpegcpp}/std.h (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => src}/AudioFormatConverter.cpp (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => src}/CodecDeducer.cpp (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => src}/Codecs/AudioCodec.cpp (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => src}/Codecs/Codec.cpp (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp/codecs => src/Codecs}/H264NVEncCodec.cpp (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp/codecs => src/Codecs}/H265NVEncCodec.cpp (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => src}/Codecs/JPGCodec.cpp (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => src}/Codecs/PNGCodec.cpp (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => src}/Codecs/VP9Codec.cpp (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => src}/Codecs/VideoCodec.cpp (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => src}/Demuxing/AudioInputStream.cpp (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => src}/Demuxing/InputStream.cpp (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => src}/Demuxing/VideoInputStream.cpp (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => src}/FFmpegException.cpp (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp/Frame Sinks => src/FrameSinks}/AudioEncoder.cpp (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp/Frame Sinks => src/FrameSinks}/VideoEncoder.cpp (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp/Frame Sinks => src/FrameSinks}/VideoFilter.cpp (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => src}/Muxing/AudioOutputStream.cpp (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => src}/Muxing/Muxer.cpp (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => src}/Muxing/OutputStream.cpp (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => src}/Muxing/VideoOutputStream.cpp (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => src}/OpenCodec.cpp (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => src}/Sources/Demuxer.cpp (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => src}/Sources/EncodedFileSource.cpp (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => src}/Sources/RawAudioDataSource.cpp (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => src}/Sources/RawAudioFileSource.cpp (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => src}/Sources/RawVideoDataSource.cpp (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => src}/Sources/RawVideoFileSource.cpp (100%) rename {source/ffmpeg-cpp/ffmpeg-cpp => src}/VideoFormatConverter.cpp (100%) diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/AudioFormatConverter.h b/include/ffmpegcpp/AudioFormatConverter.h similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/AudioFormatConverter.h rename to include/ffmpegcpp/AudioFormatConverter.h diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/CodecDeducer.h b/include/ffmpegcpp/CodecDeducer.h similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/CodecDeducer.h rename to include/ffmpegcpp/CodecDeducer.h diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/Codecs/AudioCodec.h b/include/ffmpegcpp/Codecs/AudioCodec.h similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/Codecs/AudioCodec.h rename to include/ffmpegcpp/Codecs/AudioCodec.h diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/Codecs/Codec.h b/include/ffmpegcpp/Codecs/Codec.h similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/Codecs/Codec.h rename to include/ffmpegcpp/Codecs/Codec.h diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/codecs/H264NVEncCodec.h b/include/ffmpegcpp/Codecs/H264NVEncCodec.h similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/codecs/H264NVEncCodec.h rename to include/ffmpegcpp/Codecs/H264NVEncCodec.h diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/codecs/H265NVEncCodec.h b/include/ffmpegcpp/Codecs/H265NVEncCodec.h similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/codecs/H265NVEncCodec.h rename to include/ffmpegcpp/Codecs/H265NVEncCodec.h diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/Codecs/JPGCodec.h b/include/ffmpegcpp/Codecs/JPGCodec.h similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/Codecs/JPGCodec.h rename to include/ffmpegcpp/Codecs/JPGCodec.h diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/Codecs/PNGCodec.h b/include/ffmpegcpp/Codecs/PNGCodec.h similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/Codecs/PNGCodec.h rename to include/ffmpegcpp/Codecs/PNGCodec.h diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/Codecs/VP9Codec.h b/include/ffmpegcpp/Codecs/VP9Codec.h similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/Codecs/VP9Codec.h rename to include/ffmpegcpp/Codecs/VP9Codec.h diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/Codecs/VideoCodec.h b/include/ffmpegcpp/Codecs/VideoCodec.h similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/Codecs/VideoCodec.h rename to include/ffmpegcpp/Codecs/VideoCodec.h diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/ConvertedAudioProcessor.h b/include/ffmpegcpp/ConvertedAudioProcessor.h similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/ConvertedAudioProcessor.h rename to include/ffmpegcpp/ConvertedAudioProcessor.h diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/Demuxing/AudioInputStream.h b/include/ffmpegcpp/Demuxing/AudioInputStream.h similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/Demuxing/AudioInputStream.h rename to include/ffmpegcpp/Demuxing/AudioInputStream.h diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/Demuxing/InputStream.h b/include/ffmpegcpp/Demuxing/InputStream.h similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/Demuxing/InputStream.h rename to include/ffmpegcpp/Demuxing/InputStream.h diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/Demuxing/VideoInputStream.h b/include/ffmpegcpp/Demuxing/VideoInputStream.h similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/Demuxing/VideoInputStream.h rename to include/ffmpegcpp/Demuxing/VideoInputStream.h diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/FFmpegException.h b/include/ffmpegcpp/FFmpegException.h similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/FFmpegException.h rename to include/ffmpegcpp/FFmpegException.h diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/Frame Sinks/AudioEncoder.h b/include/ffmpegcpp/FrameSinks/AudioEncoder.h similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/Frame Sinks/AudioEncoder.h rename to include/ffmpegcpp/FrameSinks/AudioEncoder.h diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/Frame Sinks/AudioFrameSink.h b/include/ffmpegcpp/FrameSinks/AudioFrameSink.h similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/Frame Sinks/AudioFrameSink.h rename to include/ffmpegcpp/FrameSinks/AudioFrameSink.h diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/Frame Sinks/FrameSink.h b/include/ffmpegcpp/FrameSinks/FrameSink.h similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/Frame Sinks/FrameSink.h rename to include/ffmpegcpp/FrameSinks/FrameSink.h diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/Frame Sinks/VideoEncoder.h b/include/ffmpegcpp/FrameSinks/VideoEncoder.h similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/Frame Sinks/VideoEncoder.h rename to include/ffmpegcpp/FrameSinks/VideoEncoder.h diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/Frame Sinks/VideoFilter.h b/include/ffmpegcpp/FrameSinks/VideoFilter.h similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/Frame Sinks/VideoFilter.h rename to include/ffmpegcpp/FrameSinks/VideoFilter.h diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/Frame Sinks/VideoFrameSink.h b/include/ffmpegcpp/FrameSinks/VideoFrameSink.h similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/Frame Sinks/VideoFrameSink.h rename to include/ffmpegcpp/FrameSinks/VideoFrameSink.h diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/Muxing/AudioOutputStream.h b/include/ffmpegcpp/Muxing/AudioOutputStream.h similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/Muxing/AudioOutputStream.h rename to include/ffmpegcpp/Muxing/AudioOutputStream.h diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/Muxing/Muxer.h b/include/ffmpegcpp/Muxing/Muxer.h similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/Muxing/Muxer.h rename to include/ffmpegcpp/Muxing/Muxer.h diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/Muxing/OutputStream.h b/include/ffmpegcpp/Muxing/OutputStream.h similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/Muxing/OutputStream.h rename to include/ffmpegcpp/Muxing/OutputStream.h diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/Muxing/VideoOutputStream.h b/include/ffmpegcpp/Muxing/VideoOutputStream.h similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/Muxing/VideoOutputStream.h rename to include/ffmpegcpp/Muxing/VideoOutputStream.h diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/OpenCodec.h b/include/ffmpegcpp/OpenCodec.h similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/OpenCodec.h rename to include/ffmpegcpp/OpenCodec.h diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/Sources/Demuxer.h b/include/ffmpegcpp/Sources/Demuxer.h similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/Sources/Demuxer.h rename to include/ffmpegcpp/Sources/Demuxer.h diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/Sources/EncodedFileSource.h b/include/ffmpegcpp/Sources/EncodedFileSource.h similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/Sources/EncodedFileSource.h rename to include/ffmpegcpp/Sources/EncodedFileSource.h diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/Sources/InputSource.h b/include/ffmpegcpp/Sources/InputSource.h similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/Sources/InputSource.h rename to include/ffmpegcpp/Sources/InputSource.h diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/Sources/RawAudioDataSource.h b/include/ffmpegcpp/Sources/RawAudioDataSource.h similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/Sources/RawAudioDataSource.h rename to include/ffmpegcpp/Sources/RawAudioDataSource.h diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/Sources/RawAudioFileSource.h b/include/ffmpegcpp/Sources/RawAudioFileSource.h similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/Sources/RawAudioFileSource.h rename to include/ffmpegcpp/Sources/RawAudioFileSource.h diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/Sources/RawVideoDataSource.h b/include/ffmpegcpp/Sources/RawVideoDataSource.h similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/Sources/RawVideoDataSource.h rename to include/ffmpegcpp/Sources/RawVideoDataSource.h diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/Sources/RawVideoFileSource.h b/include/ffmpegcpp/Sources/RawVideoFileSource.h similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/Sources/RawVideoFileSource.h rename to include/ffmpegcpp/Sources/RawVideoFileSource.h diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/VideoFormatConverter.h b/include/ffmpegcpp/VideoFormatConverter.h similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/VideoFormatConverter.h rename to include/ffmpegcpp/VideoFormatConverter.h diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/ffmpeg.h b/include/ffmpegcpp/ffmpeg.h similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/ffmpeg.h rename to include/ffmpegcpp/ffmpeg.h diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/ffmpegcpp.h b/include/ffmpegcpp/ffmpegcpp.h similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/ffmpegcpp.h rename to include/ffmpegcpp/ffmpegcpp.h diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/std.h b/include/ffmpegcpp/std.h similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/std.h rename to include/ffmpegcpp/std.h diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/AudioFormatConverter.cpp b/src/AudioFormatConverter.cpp similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/AudioFormatConverter.cpp rename to src/AudioFormatConverter.cpp diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/CodecDeducer.cpp b/src/CodecDeducer.cpp similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/CodecDeducer.cpp rename to src/CodecDeducer.cpp diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/Codecs/AudioCodec.cpp b/src/Codecs/AudioCodec.cpp similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/Codecs/AudioCodec.cpp rename to src/Codecs/AudioCodec.cpp diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/Codecs/Codec.cpp b/src/Codecs/Codec.cpp similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/Codecs/Codec.cpp rename to src/Codecs/Codec.cpp diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/codecs/H264NVEncCodec.cpp b/src/Codecs/H264NVEncCodec.cpp similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/codecs/H264NVEncCodec.cpp rename to src/Codecs/H264NVEncCodec.cpp diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/codecs/H265NVEncCodec.cpp b/src/Codecs/H265NVEncCodec.cpp similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/codecs/H265NVEncCodec.cpp rename to src/Codecs/H265NVEncCodec.cpp diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/Codecs/JPGCodec.cpp b/src/Codecs/JPGCodec.cpp similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/Codecs/JPGCodec.cpp rename to src/Codecs/JPGCodec.cpp diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/Codecs/PNGCodec.cpp b/src/Codecs/PNGCodec.cpp similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/Codecs/PNGCodec.cpp rename to src/Codecs/PNGCodec.cpp diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/Codecs/VP9Codec.cpp b/src/Codecs/VP9Codec.cpp similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/Codecs/VP9Codec.cpp rename to src/Codecs/VP9Codec.cpp diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/Codecs/VideoCodec.cpp b/src/Codecs/VideoCodec.cpp similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/Codecs/VideoCodec.cpp rename to src/Codecs/VideoCodec.cpp diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/Demuxing/AudioInputStream.cpp b/src/Demuxing/AudioInputStream.cpp similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/Demuxing/AudioInputStream.cpp rename to src/Demuxing/AudioInputStream.cpp diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/Demuxing/InputStream.cpp b/src/Demuxing/InputStream.cpp similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/Demuxing/InputStream.cpp rename to src/Demuxing/InputStream.cpp diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/Demuxing/VideoInputStream.cpp b/src/Demuxing/VideoInputStream.cpp similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/Demuxing/VideoInputStream.cpp rename to src/Demuxing/VideoInputStream.cpp diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/FFmpegException.cpp b/src/FFmpegException.cpp similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/FFmpegException.cpp rename to src/FFmpegException.cpp diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/Frame Sinks/AudioEncoder.cpp b/src/FrameSinks/AudioEncoder.cpp similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/Frame Sinks/AudioEncoder.cpp rename to src/FrameSinks/AudioEncoder.cpp diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/Frame Sinks/VideoEncoder.cpp b/src/FrameSinks/VideoEncoder.cpp similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/Frame Sinks/VideoEncoder.cpp rename to src/FrameSinks/VideoEncoder.cpp diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/Frame Sinks/VideoFilter.cpp b/src/FrameSinks/VideoFilter.cpp similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/Frame Sinks/VideoFilter.cpp rename to src/FrameSinks/VideoFilter.cpp diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/Muxing/AudioOutputStream.cpp b/src/Muxing/AudioOutputStream.cpp similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/Muxing/AudioOutputStream.cpp rename to src/Muxing/AudioOutputStream.cpp diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/Muxing/Muxer.cpp b/src/Muxing/Muxer.cpp similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/Muxing/Muxer.cpp rename to src/Muxing/Muxer.cpp diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/Muxing/OutputStream.cpp b/src/Muxing/OutputStream.cpp similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/Muxing/OutputStream.cpp rename to src/Muxing/OutputStream.cpp diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/Muxing/VideoOutputStream.cpp b/src/Muxing/VideoOutputStream.cpp similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/Muxing/VideoOutputStream.cpp rename to src/Muxing/VideoOutputStream.cpp diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/OpenCodec.cpp b/src/OpenCodec.cpp similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/OpenCodec.cpp rename to src/OpenCodec.cpp diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/Sources/Demuxer.cpp b/src/Sources/Demuxer.cpp similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/Sources/Demuxer.cpp rename to src/Sources/Demuxer.cpp diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/Sources/EncodedFileSource.cpp b/src/Sources/EncodedFileSource.cpp similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/Sources/EncodedFileSource.cpp rename to src/Sources/EncodedFileSource.cpp diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/Sources/RawAudioDataSource.cpp b/src/Sources/RawAudioDataSource.cpp similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/Sources/RawAudioDataSource.cpp rename to src/Sources/RawAudioDataSource.cpp diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/Sources/RawAudioFileSource.cpp b/src/Sources/RawAudioFileSource.cpp similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/Sources/RawAudioFileSource.cpp rename to src/Sources/RawAudioFileSource.cpp diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/Sources/RawVideoDataSource.cpp b/src/Sources/RawVideoDataSource.cpp similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/Sources/RawVideoDataSource.cpp rename to src/Sources/RawVideoDataSource.cpp diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/Sources/RawVideoFileSource.cpp b/src/Sources/RawVideoFileSource.cpp similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/Sources/RawVideoFileSource.cpp rename to src/Sources/RawVideoFileSource.cpp diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/VideoFormatConverter.cpp b/src/VideoFormatConverter.cpp similarity index 100% rename from source/ffmpeg-cpp/ffmpeg-cpp/VideoFormatConverter.cpp rename to src/VideoFormatConverter.cpp From 3c94fde76eb886d74077b91337482f2147d79ffe Mon Sep 17 00:00:00 2001 From: Wim van Aarle Date: Fri, 14 Dec 2018 10:44:40 +0100 Subject: [PATCH 02/31] moved example files to the common directory structure --- {source/ffmpeg-cpp => examples}/decode_audio/decode_audio.cpp | 0 {source/ffmpeg-cpp => examples}/decode_video/decode_video.cpp | 0 {source/ffmpeg-cpp => examples}/demo/GeneratedAudioSource.cpp | 0 {source/ffmpeg-cpp => examples}/demo/GeneratedAudioSource.h | 0 {source/ffmpeg-cpp => examples}/demo/GeneratedVideoSource.cpp | 0 {source/ffmpeg-cpp => examples}/demo/GeneratedVideoSource.h | 0 {source/ffmpeg-cpp => examples}/demo/demo.cpp | 0 {source/ffmpeg-cpp => examples}/encode_audio/encode_audio.cpp | 0 {source/ffmpeg-cpp => examples}/encode_video/encode_video.cpp | 0 .../ffmpeg-cpp => examples}/filtering_video/filtering_video.cpp | 0 {source/ffmpeg-cpp => examples}/remuxing/remuxing.cpp | 0 11 files changed, 0 insertions(+), 0 deletions(-) rename {source/ffmpeg-cpp => examples}/decode_audio/decode_audio.cpp (100%) rename {source/ffmpeg-cpp => examples}/decode_video/decode_video.cpp (100%) rename {source/ffmpeg-cpp => examples}/demo/GeneratedAudioSource.cpp (100%) rename {source/ffmpeg-cpp => examples}/demo/GeneratedAudioSource.h (100%) rename {source/ffmpeg-cpp => examples}/demo/GeneratedVideoSource.cpp (100%) rename {source/ffmpeg-cpp => examples}/demo/GeneratedVideoSource.h (100%) rename {source/ffmpeg-cpp => examples}/demo/demo.cpp (100%) rename {source/ffmpeg-cpp => examples}/encode_audio/encode_audio.cpp (100%) rename {source/ffmpeg-cpp => examples}/encode_video/encode_video.cpp (100%) rename {source/ffmpeg-cpp => examples}/filtering_video/filtering_video.cpp (100%) rename {source/ffmpeg-cpp => examples}/remuxing/remuxing.cpp (100%) diff --git a/source/ffmpeg-cpp/decode_audio/decode_audio.cpp b/examples/decode_audio/decode_audio.cpp similarity index 100% rename from source/ffmpeg-cpp/decode_audio/decode_audio.cpp rename to examples/decode_audio/decode_audio.cpp diff --git a/source/ffmpeg-cpp/decode_video/decode_video.cpp b/examples/decode_video/decode_video.cpp similarity index 100% rename from source/ffmpeg-cpp/decode_video/decode_video.cpp rename to examples/decode_video/decode_video.cpp diff --git a/source/ffmpeg-cpp/demo/GeneratedAudioSource.cpp b/examples/demo/GeneratedAudioSource.cpp similarity index 100% rename from source/ffmpeg-cpp/demo/GeneratedAudioSource.cpp rename to examples/demo/GeneratedAudioSource.cpp diff --git a/source/ffmpeg-cpp/demo/GeneratedAudioSource.h b/examples/demo/GeneratedAudioSource.h similarity index 100% rename from source/ffmpeg-cpp/demo/GeneratedAudioSource.h rename to examples/demo/GeneratedAudioSource.h diff --git a/source/ffmpeg-cpp/demo/GeneratedVideoSource.cpp b/examples/demo/GeneratedVideoSource.cpp similarity index 100% rename from source/ffmpeg-cpp/demo/GeneratedVideoSource.cpp rename to examples/demo/GeneratedVideoSource.cpp diff --git a/source/ffmpeg-cpp/demo/GeneratedVideoSource.h b/examples/demo/GeneratedVideoSource.h similarity index 100% rename from source/ffmpeg-cpp/demo/GeneratedVideoSource.h rename to examples/demo/GeneratedVideoSource.h diff --git a/source/ffmpeg-cpp/demo/demo.cpp b/examples/demo/demo.cpp similarity index 100% rename from source/ffmpeg-cpp/demo/demo.cpp rename to examples/demo/demo.cpp diff --git a/source/ffmpeg-cpp/encode_audio/encode_audio.cpp b/examples/encode_audio/encode_audio.cpp similarity index 100% rename from source/ffmpeg-cpp/encode_audio/encode_audio.cpp rename to examples/encode_audio/encode_audio.cpp diff --git a/source/ffmpeg-cpp/encode_video/encode_video.cpp b/examples/encode_video/encode_video.cpp similarity index 100% rename from source/ffmpeg-cpp/encode_video/encode_video.cpp rename to examples/encode_video/encode_video.cpp diff --git a/source/ffmpeg-cpp/filtering_video/filtering_video.cpp b/examples/filtering_video/filtering_video.cpp similarity index 100% rename from source/ffmpeg-cpp/filtering_video/filtering_video.cpp rename to examples/filtering_video/filtering_video.cpp diff --git a/source/ffmpeg-cpp/remuxing/remuxing.cpp b/examples/remuxing/remuxing.cpp similarity index 100% rename from source/ffmpeg-cpp/remuxing/remuxing.cpp rename to examples/remuxing/remuxing.cpp From 465a07601b3ed9115c07e0a2f2a4ea0676060ea6 Mon Sep 17 00:00:00 2001 From: Wim van Aarle Date: Fri, 14 Dec 2018 10:47:51 +0100 Subject: [PATCH 03/31] removed all visual studio project files --- .../FFmpegLibraryLocationProperty.props | 20 -- .../decode_audio/decode_audio.vcxproj | 199 ------------- .../decode_audio/decode_audio.vcxproj.filters | 18 -- .../decode_audio/decode_audio.vcxproj.user | 19 -- .../decode_video/decode_video.vcxproj | 200 ------------- .../decode_video/decode_video.vcxproj.filters | 18 -- .../decode_video/decode_video.vcxproj.user | 19 -- source/ffmpeg-cpp/demo/demo.vcxproj | 207 ------------- source/ffmpeg-cpp/demo/demo.vcxproj.filters | 36 --- source/ffmpeg-cpp/demo/demo.vcxproj.user | 19 -- .../encode_audio/encode_audio.vcxproj | 201 ------------- .../encode_audio/encode_audio.vcxproj.filters | 18 -- .../encode_audio/encode_audio.vcxproj.user | 19 -- .../encode_video/encode_video.vcxproj | 200 ------------- .../encode_video/encode_video.vcxproj.filters | 18 -- .../encode_video/encode_video.vcxproj.user | 19 -- source/ffmpeg-cpp/ffmpeg-cpp.sln | 281 ------------------ .../ffmpeg-cpp/ffmpeg-cpp/ffmpeg-cpp.vcxproj | 267 ----------------- .../ffmpeg-cpp/ffmpeg-cpp.vcxproj.filters | 219 -------------- .../ffmpeg-cpp/ffmpeg-cpp.vcxproj.user | 6 - .../filtering_video/filtering_video.vcxproj | 200 ------------- .../filtering_video.vcxproj.filters | 18 -- .../filtering_video.vcxproj.user | 19 -- source/ffmpeg-cpp/remuxing/remuxing.vcxproj | 200 ------------- .../remuxing/remuxing.vcxproj.filters | 18 -- .../ffmpeg-cpp/remuxing/remuxing.vcxproj.user | 4 - 26 files changed, 2462 deletions(-) delete mode 100644 source/ffmpeg-cpp/FFmpegLibraryLocationProperty.props delete mode 100644 source/ffmpeg-cpp/decode_audio/decode_audio.vcxproj delete mode 100644 source/ffmpeg-cpp/decode_audio/decode_audio.vcxproj.filters delete mode 100644 source/ffmpeg-cpp/decode_audio/decode_audio.vcxproj.user delete mode 100644 source/ffmpeg-cpp/decode_video/decode_video.vcxproj delete mode 100644 source/ffmpeg-cpp/decode_video/decode_video.vcxproj.filters delete mode 100644 source/ffmpeg-cpp/decode_video/decode_video.vcxproj.user delete mode 100644 source/ffmpeg-cpp/demo/demo.vcxproj delete mode 100644 source/ffmpeg-cpp/demo/demo.vcxproj.filters delete mode 100644 source/ffmpeg-cpp/demo/demo.vcxproj.user delete mode 100644 source/ffmpeg-cpp/encode_audio/encode_audio.vcxproj delete mode 100644 source/ffmpeg-cpp/encode_audio/encode_audio.vcxproj.filters delete mode 100644 source/ffmpeg-cpp/encode_audio/encode_audio.vcxproj.user delete mode 100644 source/ffmpeg-cpp/encode_video/encode_video.vcxproj delete mode 100644 source/ffmpeg-cpp/encode_video/encode_video.vcxproj.filters delete mode 100644 source/ffmpeg-cpp/encode_video/encode_video.vcxproj.user delete mode 100644 source/ffmpeg-cpp/ffmpeg-cpp.sln delete mode 100644 source/ffmpeg-cpp/ffmpeg-cpp/ffmpeg-cpp.vcxproj delete mode 100644 source/ffmpeg-cpp/ffmpeg-cpp/ffmpeg-cpp.vcxproj.filters delete mode 100644 source/ffmpeg-cpp/ffmpeg-cpp/ffmpeg-cpp.vcxproj.user delete mode 100644 source/ffmpeg-cpp/filtering_video/filtering_video.vcxproj delete mode 100644 source/ffmpeg-cpp/filtering_video/filtering_video.vcxproj.filters delete mode 100644 source/ffmpeg-cpp/filtering_video/filtering_video.vcxproj.user delete mode 100644 source/ffmpeg-cpp/remuxing/remuxing.vcxproj delete mode 100644 source/ffmpeg-cpp/remuxing/remuxing.vcxproj.filters delete mode 100644 source/ffmpeg-cpp/remuxing/remuxing.vcxproj.user diff --git a/source/ffmpeg-cpp/FFmpegLibraryLocationProperty.props b/source/ffmpeg-cpp/FFmpegLibraryLocationProperty.props deleted file mode 100644 index b2dffa9..0000000 --- a/source/ffmpeg-cpp/FFmpegLibraryLocationProperty.props +++ /dev/null @@ -1,20 +0,0 @@ - - - - - $(ProjectDir)..\..\..\ffmpeg\ - $(ProjectDir)..\..\..\samples - - - - - - $(FFmpegLibraryDir) - true - - - $(SamplesDir) - true - - - \ No newline at end of file diff --git a/source/ffmpeg-cpp/decode_audio/decode_audio.vcxproj b/source/ffmpeg-cpp/decode_audio/decode_audio.vcxproj deleted file mode 100644 index e0fb0d2..0000000 --- a/source/ffmpeg-cpp/decode_audio/decode_audio.vcxproj +++ /dev/null @@ -1,199 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 15.0 - {C6101E18-D73B-430C-A79C-084E1236EA94} - Win32Proj - decodeaudio - 10.0.17763.0 - - - - Application - true - v141 - Unicode - - - Application - false - v141 - true - Unicode - - - Application - true - v141 - Unicode - - - Application - false - v141 - true - Unicode - - - - - - - - - - - - - - - - - - - - - - - - true - $(ProjectDir)..\..\..\bin\$(Platform)\$(Configuration)\ - obj\$(Platform)\$(Configuration)\ - - - true - $(ProjectDir)..\..\..\bin\$(Platform)\$(Configuration)\ - obj\$(Platform)\$(Configuration)\ - - - false - $(ProjectDir)..\..\..\bin\$(Platform)\$(Configuration)\ - obj\$(Platform)\$(Configuration)\ - - - false - $(ProjectDir)..\..\..\bin\$(Platform)\$(Configuration)\ - obj\$(Platform)\$(Configuration)\ - - - - NotUsing - Level3 - Disabled - false - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - pch.h - $(FFmpegLibraryDir)include;..\ffmpeg-cpp;%(AdditionalIncludeDirectories) - - - Console - true - $(FFmpegLibraryDir)lib\avcodec.lib;$(FFmpegLibraryDir)lib\avfilter.lib;$(FFmpegLibraryDir)lib\avformat.lib;$(FFmpegLibraryDir)lib\avutil.lib;$(FFmpegLibraryDir)lib\swresample.lib;$(FFmpegLibraryDir)lib\swscale.lib;%(AdditionalDependencies) - - - xcopy $(SamplesDir) $(OutDir)samples /s /y /i -xcopy $(FFmpegLibraryDir)bin $(OutDir) /s /y /i - - - - - NotUsing - Level3 - Disabled - true - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - pch.h - $(FFmpegLibraryDir)include;..\ffmpeg-cpp;%(AdditionalIncludeDirectories) - - - Console - true - $(FFmpegLibraryDir)lib\avcodec.lib;$(FFmpegLibraryDir)lib\avfilter.lib;$(FFmpegLibraryDir)lib\avformat.lib;$(FFmpegLibraryDir)lib\avutil.lib;$(FFmpegLibraryDir)lib\swresample.lib;$(FFmpegLibraryDir)lib\swscale.lib;%(AdditionalDependencies) - - - xcopy $(SamplesDir) $(OutDir)samples /s /y /i -xcopy $(FFmpegLibraryDir)bin $(OutDir) /s /y /i - - - - - NotUsing - Level3 - MaxSpeed - true - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - pch.h - $(FFmpegLibraryDir)include;..\ffmpeg-cpp;%(AdditionalIncludeDirectories) - - - Console - true - true - true - $(FFmpegLibraryDir)lib\avcodec.lib;$(FFmpegLibraryDir)lib\avfilter.lib;$(FFmpegLibraryDir)lib\avformat.lib;$(FFmpegLibraryDir)lib\avutil.lib;$(FFmpegLibraryDir)lib\swresample.lib;$(FFmpegLibraryDir)lib\swscale.lib;%(AdditionalDependencies) - - - xcopy $(SamplesDir) $(OutDir)samples /s /y /i -xcopy $(FFmpegLibraryDir)bin $(OutDir) /s /y /i - - - - - NotUsing - Level3 - MaxSpeed - true - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - pch.h - $(FFmpegLibraryDir)include;..\ffmpeg-cpp;%(AdditionalIncludeDirectories) - - - Console - true - true - true - $(FFmpegLibraryDir)lib\avcodec.lib;$(FFmpegLibraryDir)lib\avfilter.lib;$(FFmpegLibraryDir)lib\avformat.lib;$(FFmpegLibraryDir)lib\avutil.lib;$(FFmpegLibraryDir)lib\swresample.lib;$(FFmpegLibraryDir)lib\swscale.lib;%(AdditionalDependencies) - - - xcopy $(SamplesDir) $(OutDir)samples /s /y /i -xcopy $(FFmpegLibraryDir)bin $(OutDir) /s /y /i - - - - - - - - {babfd64d-9bf1-4328-b977-24bf81800620} - - - - - - \ No newline at end of file diff --git a/source/ffmpeg-cpp/decode_audio/decode_audio.vcxproj.filters b/source/ffmpeg-cpp/decode_audio/decode_audio.vcxproj.filters deleted file mode 100644 index 88e5ec5..0000000 --- a/source/ffmpeg-cpp/decode_audio/decode_audio.vcxproj.filters +++ /dev/null @@ -1,18 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Source Files - - - \ No newline at end of file diff --git a/source/ffmpeg-cpp/decode_audio/decode_audio.vcxproj.user b/source/ffmpeg-cpp/decode_audio/decode_audio.vcxproj.user deleted file mode 100644 index 6c84d89..0000000 --- a/source/ffmpeg-cpp/decode_audio/decode_audio.vcxproj.user +++ /dev/null @@ -1,19 +0,0 @@ - - - - $(OutDir) - WindowsLocalDebugger - - - $(OutDir) - WindowsLocalDebugger - - - $(OutDir) - WindowsLocalDebugger - - - $(OutDir) - WindowsLocalDebugger - - \ No newline at end of file diff --git a/source/ffmpeg-cpp/decode_video/decode_video.vcxproj b/source/ffmpeg-cpp/decode_video/decode_video.vcxproj deleted file mode 100644 index fccf89e..0000000 --- a/source/ffmpeg-cpp/decode_video/decode_video.vcxproj +++ /dev/null @@ -1,200 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 15.0 - {AAD3AB93-F831-4339-8AAD-DC956B9B9233} - Win32Proj - decodeaudio - 10.0.17763.0 - - - - Application - true - v141 - Unicode - - - Application - false - v141 - true - Unicode - - - Application - true - v141 - Unicode - - - Application - false - v141 - true - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - true - $(ProjectDir)..\..\..\bin\$(Platform)\$(Configuration)\ - obj\$(Platform)\$(Configuration)\ - - - true - $(ProjectDir)..\..\..\bin\$(Platform)\$(Configuration)\ - obj\$(Platform)\$(Configuration)\ - - - false - $(ProjectDir)..\..\..\bin\$(Platform)\$(Configuration)\ - obj\$(Platform)\$(Configuration)\ - - - false - $(ProjectDir)..\..\..\bin\$(Platform)\$(Configuration)\ - obj\$(Platform)\$(Configuration)\ - - - - NotUsing - Level3 - Disabled - false - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - pch.h - $(FFmpegLibraryDir)include;..\ffmpeg-cpp;%(AdditionalIncludeDirectories) - - - Console - true - %(AdditionalDependencies) - - - xcopy $(SamplesDir) $(OutDir)samples /s /y /i -xcopy $(FFmpegLibraryDir)bin $(OutDir) /s /y /i - - - - - NotUsing - Level3 - Disabled - true - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - pch.h - $(FFmpegLibraryDir)include;..\ffmpeg-cpp;%(AdditionalIncludeDirectories) - - - Console - true - %(AdditionalDependencies) - - - xcopy $(SamplesDir) $(OutDir)samples /s /y /i -xcopy $(FFmpegLibraryDir)bin $(OutDir) /s /y /i - - - - - NotUsing - Level3 - MaxSpeed - true - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - pch.h - $(FFmpegLibraryDir)include;..\ffmpeg-cpp;%(AdditionalIncludeDirectories) - - - Console - true - true - true - %(AdditionalDependencies) - - - xcopy $(SamplesDir) $(OutDir)samples /s /y /i -xcopy $(FFmpegLibraryDir)bin $(OutDir) /s /y /i - - - - - NotUsing - Level3 - MaxSpeed - true - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - pch.h - $(FFmpegLibraryDir)include;..\ffmpeg-cpp;%(AdditionalIncludeDirectories) - - - Console - true - true - true - %(AdditionalDependencies) - - - xcopy $(SamplesDir) $(OutDir)samples /s /y /i -xcopy $(FFmpegLibraryDir)bin $(OutDir) /s /y /i - - - - - - - - {babfd64d-9bf1-4328-b977-24bf81800620} - - - - - - \ No newline at end of file diff --git a/source/ffmpeg-cpp/decode_video/decode_video.vcxproj.filters b/source/ffmpeg-cpp/decode_video/decode_video.vcxproj.filters deleted file mode 100644 index dbaf137..0000000 --- a/source/ffmpeg-cpp/decode_video/decode_video.vcxproj.filters +++ /dev/null @@ -1,18 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Source Files - - - \ No newline at end of file diff --git a/source/ffmpeg-cpp/decode_video/decode_video.vcxproj.user b/source/ffmpeg-cpp/decode_video/decode_video.vcxproj.user deleted file mode 100644 index 6c84d89..0000000 --- a/source/ffmpeg-cpp/decode_video/decode_video.vcxproj.user +++ /dev/null @@ -1,19 +0,0 @@ - - - - $(OutDir) - WindowsLocalDebugger - - - $(OutDir) - WindowsLocalDebugger - - - $(OutDir) - WindowsLocalDebugger - - - $(OutDir) - WindowsLocalDebugger - - \ No newline at end of file diff --git a/source/ffmpeg-cpp/demo/demo.vcxproj b/source/ffmpeg-cpp/demo/demo.vcxproj deleted file mode 100644 index 35e0da7..0000000 --- a/source/ffmpeg-cpp/demo/demo.vcxproj +++ /dev/null @@ -1,207 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 15.0 - {D8377B20-EEFC-4ABC-95F0-24BC86B7E3F2} - Win32Proj - demo - 10.0.17763.0 - - - - Application - true - v141 - Unicode - - - Application - false - v141 - true - Unicode - - - Application - true - v141 - Unicode - false - - - Application - false - v141 - true - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - true - obj\$(Platform)\$(Configuration)\ - $(ProjectDir)..\..\..\bin\$(Platform)\$(Configuration)\ - - - true - $(ProjectDir)..\..\..\bin\$(Platform)\$(Configuration)\ - obj\$(Platform)\$(Configuration)\ - - - false - obj\$(Platform)\$(Configuration)\ - $(ProjectDir)..\..\..\bin\$(Platform)\$(Configuration)\ - - - false - obj\$(Platform)\$(Configuration)\ - $(ProjectDir)..\..\..\bin\$(Platform)\$(Configuration)\ - - - - NotUsing - Level3 - Disabled - true - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - pch.h - $(FFmpegLibraryDir)include;..\ffmpeg-cpp;%(AdditionalIncludeDirectories) - - - Console - true - %(AdditionalDependencies) - - - xcopy $(SamplesDir) $(OutDir)samples /s /y /i -xcopy $(FFmpegLibraryDir)bin $(OutDir) /s /y /i - - - - - NotUsing - Level3 - Disabled - false - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - pch.h - $(FFmpegLibraryDir)include;..\ffmpeg-cpp;%(AdditionalIncludeDirectories) - - - Console - true - %(AdditionalDependencies) - - - xcopy $(SamplesDir) $(OutDir)samples /s /y /i -xcopy $(FFmpegLibraryDir)bin $(OutDir) /s /y /i - - - - - NotUsing - Level3 - MaxSpeed - true - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - pch.h - $(FFmpegLibraryDir)include;..\ffmpeg-cpp;%(AdditionalIncludeDirectories) - - - Console - true - true - true - %(AdditionalDependencies) - - - xcopy $(SamplesDir) $(OutDir)samples /s /y /i -xcopy $(FFmpegLibraryDir)bin $(OutDir) /s /y /i - - - - - NotUsing - Level3 - MaxSpeed - true - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - pch.h - $(FFmpegLibraryDir)include;..\ffmpeg-cpp;%(AdditionalIncludeDirectories) - - - Console - true - true - true - %(AdditionalDependencies) - - - xcopy $(SamplesDir) $(OutDir)samples /s /y /i -xcopy $(FFmpegLibraryDir)bin $(OutDir) /s /y /i - - - - - - - - - - {babfd64d-9bf1-4328-b977-24bf81800620} - - - - - - - - - - \ No newline at end of file diff --git a/source/ffmpeg-cpp/demo/demo.vcxproj.filters b/source/ffmpeg-cpp/demo/demo.vcxproj.filters deleted file mode 100644 index ff353b2..0000000 --- a/source/ffmpeg-cpp/demo/demo.vcxproj.filters +++ /dev/null @@ -1,36 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;ipp;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - \ No newline at end of file diff --git a/source/ffmpeg-cpp/demo/demo.vcxproj.user b/source/ffmpeg-cpp/demo/demo.vcxproj.user deleted file mode 100644 index 6c84d89..0000000 --- a/source/ffmpeg-cpp/demo/demo.vcxproj.user +++ /dev/null @@ -1,19 +0,0 @@ - - - - $(OutDir) - WindowsLocalDebugger - - - $(OutDir) - WindowsLocalDebugger - - - $(OutDir) - WindowsLocalDebugger - - - $(OutDir) - WindowsLocalDebugger - - \ No newline at end of file diff --git a/source/ffmpeg-cpp/encode_audio/encode_audio.vcxproj b/source/ffmpeg-cpp/encode_audio/encode_audio.vcxproj deleted file mode 100644 index 434460a..0000000 --- a/source/ffmpeg-cpp/encode_audio/encode_audio.vcxproj +++ /dev/null @@ -1,201 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 15.0 - {9D936BE4-46AA-489F-82E7-D2CFEB157FB6} - Win32Proj - decodeaudio - 10.0.17763.0 - - - - Application - true - v141 - Unicode - - - Application - false - v141 - true - Unicode - - - Application - true - v141 - Unicode - - - Application - false - v141 - true - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - true - $(ProjectDir)..\..\..\bin\$(Platform)\$(Configuration)\ - obj\$(Platform)\$(Configuration)\ - - - true - $(ProjectDir)..\..\..\bin\$(Platform)\$(Configuration)\ - obj\$(Platform)\$(Configuration)\ - - - false - $(ProjectDir)..\..\..\bin\$(Platform)\$(Configuration)\ - obj\$(Platform)\$(Configuration)\ - - - false - $(ProjectDir)..\..\..\bin\$(Platform)\$(Configuration)\ - obj\$(Platform)\$(Configuration)\ - - - - NotUsing - Level3 - Disabled - false - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - pch.h - $(FFmpegLibraryDir)include;..\ffmpeg-cpp;%(AdditionalIncludeDirectories) - - - Console - true - %(AdditionalDependencies) - - - xcopy $(SamplesDir) $(OutDir)samples /s /y /i -xcopy $(FFmpegLibraryDir)bin $(OutDir) /s /y /i - - - - - NotUsing - Level3 - Disabled - true - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - pch.h - $(FFmpegLibraryDir)include;..\ffmpeg-cpp;%(AdditionalIncludeDirectories) - - - Console - true - %(AdditionalDependencies) - - - xcopy $(SamplesDir) $(OutDir)samples /s /y /i -xcopy $(FFmpegLibraryDir)bin $(OutDir) /s /y /i - - - - - NotUsing - Level3 - MaxSpeed - true - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - pch.h - $(FFmpegLibraryDir)include;..\ffmpeg-cpp;%(AdditionalIncludeDirectories) - - - Console - true - true - true - %(AdditionalDependencies) - - - xcopy $(SamplesDir) $(OutDir)samples /s /y /i -xcopy $(FFmpegLibraryDir)bin $(OutDir) /s /y /i - - - - - NotUsing - Level3 - MaxSpeed - true - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - pch.h - $(FFmpegLibraryDir)include;..\ffmpeg-cpp;%(AdditionalIncludeDirectories) - - - Console - true - true - true - %(AdditionalDependencies) - - - xcopy $(SamplesDir) $(OutDir)samples /s /y /i -xcopy $(FFmpegLibraryDir)bin $(OutDir) /s /y /i - - - - - - - - {babfd64d-9bf1-4328-b977-24bf81800620} - - - - - - \ No newline at end of file diff --git a/source/ffmpeg-cpp/encode_audio/encode_audio.vcxproj.filters b/source/ffmpeg-cpp/encode_audio/encode_audio.vcxproj.filters deleted file mode 100644 index ae624bc..0000000 --- a/source/ffmpeg-cpp/encode_audio/encode_audio.vcxproj.filters +++ /dev/null @@ -1,18 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Source Files - - - \ No newline at end of file diff --git a/source/ffmpeg-cpp/encode_audio/encode_audio.vcxproj.user b/source/ffmpeg-cpp/encode_audio/encode_audio.vcxproj.user deleted file mode 100644 index 6c84d89..0000000 --- a/source/ffmpeg-cpp/encode_audio/encode_audio.vcxproj.user +++ /dev/null @@ -1,19 +0,0 @@ - - - - $(OutDir) - WindowsLocalDebugger - - - $(OutDir) - WindowsLocalDebugger - - - $(OutDir) - WindowsLocalDebugger - - - $(OutDir) - WindowsLocalDebugger - - \ No newline at end of file diff --git a/source/ffmpeg-cpp/encode_video/encode_video.vcxproj b/source/ffmpeg-cpp/encode_video/encode_video.vcxproj deleted file mode 100644 index e9c6d00..0000000 --- a/source/ffmpeg-cpp/encode_video/encode_video.vcxproj +++ /dev/null @@ -1,200 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 15.0 - {597D5EF8-04DB-48F9-A8F3-4B593B81C7C3} - Win32Proj - decodeaudio - 10.0.17763.0 - - - - Application - true - v141 - Unicode - - - Application - false - v141 - true - Unicode - - - Application - true - v141 - Unicode - - - Application - false - v141 - true - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - true - $(ProjectDir)..\..\..\bin\$(Platform)\$(Configuration)\ - obj\$(Platform)\$(Configuration)\ - - - true - $(ProjectDir)..\..\..\bin\$(Platform)\$(Configuration)\ - obj\$(Platform)\$(Configuration)\ - - - false - $(ProjectDir)..\..\..\bin\$(Platform)\$(Configuration)\ - obj\$(Platform)\$(Configuration)\ - - - false - $(ProjectDir)..\..\..\bin\$(Platform)\$(Configuration)\ - obj\$(Platform)\$(Configuration)\ - - - - NotUsing - Level3 - Disabled - false - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - pch.h - $(FFmpegLibraryDir)include;..\ffmpeg-cpp;%(AdditionalIncludeDirectories) - - - Console - true - %(AdditionalDependencies) - - - xcopy $(SamplesDir) $(OutDir)samples /s /y /i -xcopy $(FFmpegLibraryDir)bin $(OutDir) /s /y /i - - - - - NotUsing - Level3 - Disabled - true - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - pch.h - $(FFmpegLibraryDir)include;..\ffmpeg-cpp;%(AdditionalIncludeDirectories) - - - Console - true - %(AdditionalDependencies) - - - xcopy $(SamplesDir) $(OutDir)samples /s /y /i -xcopy $(FFmpegLibraryDir)bin $(OutDir) /s /y /i - - - - - NotUsing - Level3 - MaxSpeed - true - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - pch.h - $(FFmpegLibraryDir)include;..\ffmpeg-cpp;%(AdditionalIncludeDirectories) - - - Console - true - true - true - %(AdditionalDependencies) - - - xcopy $(SamplesDir) $(OutDir)samples /s /y /i -xcopy $(FFmpegLibraryDir)bin $(OutDir) /s /y /i - - - - - NotUsing - Level3 - MaxSpeed - true - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - pch.h - $(FFmpegLibraryDir)include;..\ffmpeg-cpp;%(AdditionalIncludeDirectories) - - - Console - true - true - true - %(AdditionalDependencies) - - - xcopy $(SamplesDir) $(OutDir)samples /s /y /i -xcopy $(FFmpegLibraryDir)bin $(OutDir) /s /y /i - - - - - {babfd64d-9bf1-4328-b977-24bf81800620} - - - - - - - - - \ No newline at end of file diff --git a/source/ffmpeg-cpp/encode_video/encode_video.vcxproj.filters b/source/ffmpeg-cpp/encode_video/encode_video.vcxproj.filters deleted file mode 100644 index c863a03..0000000 --- a/source/ffmpeg-cpp/encode_video/encode_video.vcxproj.filters +++ /dev/null @@ -1,18 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Source Files - - - \ No newline at end of file diff --git a/source/ffmpeg-cpp/encode_video/encode_video.vcxproj.user b/source/ffmpeg-cpp/encode_video/encode_video.vcxproj.user deleted file mode 100644 index 6c84d89..0000000 --- a/source/ffmpeg-cpp/encode_video/encode_video.vcxproj.user +++ /dev/null @@ -1,19 +0,0 @@ - - - - $(OutDir) - WindowsLocalDebugger - - - $(OutDir) - WindowsLocalDebugger - - - $(OutDir) - WindowsLocalDebugger - - - $(OutDir) - WindowsLocalDebugger - - \ No newline at end of file diff --git a/source/ffmpeg-cpp/ffmpeg-cpp.sln b/source/ffmpeg-cpp/ffmpeg-cpp.sln deleted file mode 100644 index 99292a3..0000000 --- a/source/ffmpeg-cpp/ffmpeg-cpp.sln +++ /dev/null @@ -1,281 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.28307.106 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "demo", "demo\demo.vcxproj", "{D8377B20-EEFC-4ABC-95F0-24BC86B7E3F2}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ffmpeg-cpp", "ffmpeg-cpp\ffmpeg-cpp.vcxproj", "{BABFD64D-9BF1-4328-B977-24BF81800620}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Examples", "Examples", "{3B1FE419-D7D2-4406-9C24-5A6F6ED63E73}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "decode_audio", "decode_audio\decode_audio.vcxproj", "{C6101E18-D73B-430C-A79C-084E1236EA94}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "decode_video", "decode_video\decode_video.vcxproj", "{AAD3AB93-F831-4339-8AAD-DC956B9B9233}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "encode_audio", "encode_audio\encode_audio.vcxproj", "{9D936BE4-46AA-489F-82E7-D2CFEB157FB6}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "encode_video", "encode_video\encode_video.vcxproj", "{597D5EF8-04DB-48F9-A8F3-4B593B81C7C3}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "remuxing", "remuxing\remuxing.vcxproj", "{B337D322-355B-4348-A2A8-270471BE2C95}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "filtering_video", "filtering_video\filtering_video.vcxproj", "{80579A29-8073-46A0-B328-661155E0887B}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - DebugDLL|x64 = DebugDLL|x64 - DebugDLL|x86 = DebugDLL|x86 - DebugDLLStaticDeps|x64 = DebugDLLStaticDeps|x64 - DebugDLLStaticDeps|x86 = DebugDLLStaticDeps|x86 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - ReleaseDLL|x64 = ReleaseDLL|x64 - ReleaseDLL|x86 = ReleaseDLL|x86 - ReleaseDLLStaticDeps|x64 = ReleaseDLLStaticDeps|x64 - ReleaseDLLStaticDeps|x86 = ReleaseDLLStaticDeps|x86 - ReleaseLTO|x64 = ReleaseLTO|x64 - ReleaseLTO|x86 = ReleaseLTO|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {D8377B20-EEFC-4ABC-95F0-24BC86B7E3F2}.Debug|x64.ActiveCfg = Debug|x64 - {D8377B20-EEFC-4ABC-95F0-24BC86B7E3F2}.Debug|x64.Build.0 = Debug|x64 - {D8377B20-EEFC-4ABC-95F0-24BC86B7E3F2}.Debug|x86.ActiveCfg = Debug|Win32 - {D8377B20-EEFC-4ABC-95F0-24BC86B7E3F2}.Debug|x86.Build.0 = Debug|Win32 - {D8377B20-EEFC-4ABC-95F0-24BC86B7E3F2}.DebugDLL|x64.ActiveCfg = Debug|x64 - {D8377B20-EEFC-4ABC-95F0-24BC86B7E3F2}.DebugDLL|x64.Build.0 = Debug|x64 - {D8377B20-EEFC-4ABC-95F0-24BC86B7E3F2}.DebugDLL|x86.ActiveCfg = Debug|Win32 - {D8377B20-EEFC-4ABC-95F0-24BC86B7E3F2}.DebugDLL|x86.Build.0 = Debug|Win32 - {D8377B20-EEFC-4ABC-95F0-24BC86B7E3F2}.DebugDLLStaticDeps|x64.ActiveCfg = Debug|x64 - {D8377B20-EEFC-4ABC-95F0-24BC86B7E3F2}.DebugDLLStaticDeps|x64.Build.0 = Debug|x64 - {D8377B20-EEFC-4ABC-95F0-24BC86B7E3F2}.DebugDLLStaticDeps|x86.ActiveCfg = Debug|Win32 - {D8377B20-EEFC-4ABC-95F0-24BC86B7E3F2}.DebugDLLStaticDeps|x86.Build.0 = Debug|Win32 - {D8377B20-EEFC-4ABC-95F0-24BC86B7E3F2}.Release|x64.ActiveCfg = Release|x64 - {D8377B20-EEFC-4ABC-95F0-24BC86B7E3F2}.Release|x64.Build.0 = Release|x64 - {D8377B20-EEFC-4ABC-95F0-24BC86B7E3F2}.Release|x86.ActiveCfg = Release|Win32 - {D8377B20-EEFC-4ABC-95F0-24BC86B7E3F2}.Release|x86.Build.0 = Release|Win32 - {D8377B20-EEFC-4ABC-95F0-24BC86B7E3F2}.ReleaseDLL|x64.ActiveCfg = Release|x64 - {D8377B20-EEFC-4ABC-95F0-24BC86B7E3F2}.ReleaseDLL|x64.Build.0 = Release|x64 - {D8377B20-EEFC-4ABC-95F0-24BC86B7E3F2}.ReleaseDLL|x86.ActiveCfg = Release|Win32 - {D8377B20-EEFC-4ABC-95F0-24BC86B7E3F2}.ReleaseDLL|x86.Build.0 = Release|Win32 - {D8377B20-EEFC-4ABC-95F0-24BC86B7E3F2}.ReleaseDLLStaticDeps|x64.ActiveCfg = Release|x64 - {D8377B20-EEFC-4ABC-95F0-24BC86B7E3F2}.ReleaseDLLStaticDeps|x64.Build.0 = Release|x64 - {D8377B20-EEFC-4ABC-95F0-24BC86B7E3F2}.ReleaseDLLStaticDeps|x86.ActiveCfg = Release|Win32 - {D8377B20-EEFC-4ABC-95F0-24BC86B7E3F2}.ReleaseDLLStaticDeps|x86.Build.0 = Release|Win32 - {D8377B20-EEFC-4ABC-95F0-24BC86B7E3F2}.ReleaseLTO|x64.ActiveCfg = Release|x64 - {D8377B20-EEFC-4ABC-95F0-24BC86B7E3F2}.ReleaseLTO|x64.Build.0 = Release|x64 - {D8377B20-EEFC-4ABC-95F0-24BC86B7E3F2}.ReleaseLTO|x86.ActiveCfg = Release|Win32 - {D8377B20-EEFC-4ABC-95F0-24BC86B7E3F2}.ReleaseLTO|x86.Build.0 = Release|Win32 - {BABFD64D-9BF1-4328-B977-24BF81800620}.Debug|x64.ActiveCfg = Debug|x64 - {BABFD64D-9BF1-4328-B977-24BF81800620}.Debug|x64.Build.0 = Debug|x64 - {BABFD64D-9BF1-4328-B977-24BF81800620}.Debug|x86.ActiveCfg = Debug|Win32 - {BABFD64D-9BF1-4328-B977-24BF81800620}.Debug|x86.Build.0 = Debug|Win32 - {BABFD64D-9BF1-4328-B977-24BF81800620}.DebugDLL|x64.ActiveCfg = Debug|x64 - {BABFD64D-9BF1-4328-B977-24BF81800620}.DebugDLL|x64.Build.0 = Debug|x64 - {BABFD64D-9BF1-4328-B977-24BF81800620}.DebugDLL|x86.ActiveCfg = Debug|Win32 - {BABFD64D-9BF1-4328-B977-24BF81800620}.DebugDLL|x86.Build.0 = Debug|Win32 - {BABFD64D-9BF1-4328-B977-24BF81800620}.DebugDLLStaticDeps|x64.ActiveCfg = Debug|x64 - {BABFD64D-9BF1-4328-B977-24BF81800620}.DebugDLLStaticDeps|x64.Build.0 = Debug|x64 - {BABFD64D-9BF1-4328-B977-24BF81800620}.DebugDLLStaticDeps|x86.ActiveCfg = Debug|Win32 - {BABFD64D-9BF1-4328-B977-24BF81800620}.DebugDLLStaticDeps|x86.Build.0 = Debug|Win32 - {BABFD64D-9BF1-4328-B977-24BF81800620}.Release|x64.ActiveCfg = Release|x64 - {BABFD64D-9BF1-4328-B977-24BF81800620}.Release|x64.Build.0 = Release|x64 - {BABFD64D-9BF1-4328-B977-24BF81800620}.Release|x86.ActiveCfg = Release|Win32 - {BABFD64D-9BF1-4328-B977-24BF81800620}.Release|x86.Build.0 = Release|Win32 - {BABFD64D-9BF1-4328-B977-24BF81800620}.ReleaseDLL|x64.ActiveCfg = Release|x64 - {BABFD64D-9BF1-4328-B977-24BF81800620}.ReleaseDLL|x64.Build.0 = Release|x64 - {BABFD64D-9BF1-4328-B977-24BF81800620}.ReleaseDLL|x86.ActiveCfg = Release|Win32 - {BABFD64D-9BF1-4328-B977-24BF81800620}.ReleaseDLL|x86.Build.0 = Release|Win32 - {BABFD64D-9BF1-4328-B977-24BF81800620}.ReleaseDLLStaticDeps|x64.ActiveCfg = Release|x64 - {BABFD64D-9BF1-4328-B977-24BF81800620}.ReleaseDLLStaticDeps|x64.Build.0 = Release|x64 - {BABFD64D-9BF1-4328-B977-24BF81800620}.ReleaseDLLStaticDeps|x86.ActiveCfg = Release|Win32 - {BABFD64D-9BF1-4328-B977-24BF81800620}.ReleaseDLLStaticDeps|x86.Build.0 = Release|Win32 - {BABFD64D-9BF1-4328-B977-24BF81800620}.ReleaseLTO|x64.ActiveCfg = Release|x64 - {BABFD64D-9BF1-4328-B977-24BF81800620}.ReleaseLTO|x64.Build.0 = Release|x64 - {BABFD64D-9BF1-4328-B977-24BF81800620}.ReleaseLTO|x86.ActiveCfg = Release|Win32 - {BABFD64D-9BF1-4328-B977-24BF81800620}.ReleaseLTO|x86.Build.0 = Release|Win32 - {C6101E18-D73B-430C-A79C-084E1236EA94}.Debug|x64.ActiveCfg = Debug|x64 - {C6101E18-D73B-430C-A79C-084E1236EA94}.Debug|x64.Build.0 = Debug|x64 - {C6101E18-D73B-430C-A79C-084E1236EA94}.Debug|x86.ActiveCfg = Debug|Win32 - {C6101E18-D73B-430C-A79C-084E1236EA94}.Debug|x86.Build.0 = Debug|Win32 - {C6101E18-D73B-430C-A79C-084E1236EA94}.DebugDLL|x64.ActiveCfg = Debug|x64 - {C6101E18-D73B-430C-A79C-084E1236EA94}.DebugDLL|x64.Build.0 = Debug|x64 - {C6101E18-D73B-430C-A79C-084E1236EA94}.DebugDLL|x86.ActiveCfg = Debug|Win32 - {C6101E18-D73B-430C-A79C-084E1236EA94}.DebugDLL|x86.Build.0 = Debug|Win32 - {C6101E18-D73B-430C-A79C-084E1236EA94}.DebugDLLStaticDeps|x64.ActiveCfg = Debug|x64 - {C6101E18-D73B-430C-A79C-084E1236EA94}.DebugDLLStaticDeps|x64.Build.0 = Debug|x64 - {C6101E18-D73B-430C-A79C-084E1236EA94}.DebugDLLStaticDeps|x86.ActiveCfg = Debug|Win32 - {C6101E18-D73B-430C-A79C-084E1236EA94}.DebugDLLStaticDeps|x86.Build.0 = Debug|Win32 - {C6101E18-D73B-430C-A79C-084E1236EA94}.Release|x64.ActiveCfg = Release|x64 - {C6101E18-D73B-430C-A79C-084E1236EA94}.Release|x64.Build.0 = Release|x64 - {C6101E18-D73B-430C-A79C-084E1236EA94}.Release|x86.ActiveCfg = Release|Win32 - {C6101E18-D73B-430C-A79C-084E1236EA94}.Release|x86.Build.0 = Release|Win32 - {C6101E18-D73B-430C-A79C-084E1236EA94}.ReleaseDLL|x64.ActiveCfg = Release|x64 - {C6101E18-D73B-430C-A79C-084E1236EA94}.ReleaseDLL|x64.Build.0 = Release|x64 - {C6101E18-D73B-430C-A79C-084E1236EA94}.ReleaseDLL|x86.ActiveCfg = Release|Win32 - {C6101E18-D73B-430C-A79C-084E1236EA94}.ReleaseDLL|x86.Build.0 = Release|Win32 - {C6101E18-D73B-430C-A79C-084E1236EA94}.ReleaseDLLStaticDeps|x64.ActiveCfg = Release|x64 - {C6101E18-D73B-430C-A79C-084E1236EA94}.ReleaseDLLStaticDeps|x64.Build.0 = Release|x64 - {C6101E18-D73B-430C-A79C-084E1236EA94}.ReleaseDLLStaticDeps|x86.ActiveCfg = Release|Win32 - {C6101E18-D73B-430C-A79C-084E1236EA94}.ReleaseDLLStaticDeps|x86.Build.0 = Release|Win32 - {C6101E18-D73B-430C-A79C-084E1236EA94}.ReleaseLTO|x64.ActiveCfg = Release|x64 - {C6101E18-D73B-430C-A79C-084E1236EA94}.ReleaseLTO|x64.Build.0 = Release|x64 - {C6101E18-D73B-430C-A79C-084E1236EA94}.ReleaseLTO|x86.ActiveCfg = Release|Win32 - {C6101E18-D73B-430C-A79C-084E1236EA94}.ReleaseLTO|x86.Build.0 = Release|Win32 - {AAD3AB93-F831-4339-8AAD-DC956B9B9233}.Debug|x64.ActiveCfg = Debug|x64 - {AAD3AB93-F831-4339-8AAD-DC956B9B9233}.Debug|x64.Build.0 = Debug|x64 - {AAD3AB93-F831-4339-8AAD-DC956B9B9233}.Debug|x86.ActiveCfg = Debug|Win32 - {AAD3AB93-F831-4339-8AAD-DC956B9B9233}.Debug|x86.Build.0 = Debug|Win32 - {AAD3AB93-F831-4339-8AAD-DC956B9B9233}.DebugDLL|x64.ActiveCfg = Debug|x64 - {AAD3AB93-F831-4339-8AAD-DC956B9B9233}.DebugDLL|x64.Build.0 = Debug|x64 - {AAD3AB93-F831-4339-8AAD-DC956B9B9233}.DebugDLL|x86.ActiveCfg = Debug|Win32 - {AAD3AB93-F831-4339-8AAD-DC956B9B9233}.DebugDLL|x86.Build.0 = Debug|Win32 - {AAD3AB93-F831-4339-8AAD-DC956B9B9233}.DebugDLLStaticDeps|x64.ActiveCfg = Debug|x64 - {AAD3AB93-F831-4339-8AAD-DC956B9B9233}.DebugDLLStaticDeps|x64.Build.0 = Debug|x64 - {AAD3AB93-F831-4339-8AAD-DC956B9B9233}.DebugDLLStaticDeps|x86.ActiveCfg = Debug|Win32 - {AAD3AB93-F831-4339-8AAD-DC956B9B9233}.DebugDLLStaticDeps|x86.Build.0 = Debug|Win32 - {AAD3AB93-F831-4339-8AAD-DC956B9B9233}.Release|x64.ActiveCfg = Release|x64 - {AAD3AB93-F831-4339-8AAD-DC956B9B9233}.Release|x64.Build.0 = Release|x64 - {AAD3AB93-F831-4339-8AAD-DC956B9B9233}.Release|x86.ActiveCfg = Release|Win32 - {AAD3AB93-F831-4339-8AAD-DC956B9B9233}.Release|x86.Build.0 = Release|Win32 - {AAD3AB93-F831-4339-8AAD-DC956B9B9233}.ReleaseDLL|x64.ActiveCfg = Release|x64 - {AAD3AB93-F831-4339-8AAD-DC956B9B9233}.ReleaseDLL|x64.Build.0 = Release|x64 - {AAD3AB93-F831-4339-8AAD-DC956B9B9233}.ReleaseDLL|x86.ActiveCfg = Release|Win32 - {AAD3AB93-F831-4339-8AAD-DC956B9B9233}.ReleaseDLL|x86.Build.0 = Release|Win32 - {AAD3AB93-F831-4339-8AAD-DC956B9B9233}.ReleaseDLLStaticDeps|x64.ActiveCfg = Release|x64 - {AAD3AB93-F831-4339-8AAD-DC956B9B9233}.ReleaseDLLStaticDeps|x64.Build.0 = Release|x64 - {AAD3AB93-F831-4339-8AAD-DC956B9B9233}.ReleaseDLLStaticDeps|x86.ActiveCfg = Release|Win32 - {AAD3AB93-F831-4339-8AAD-DC956B9B9233}.ReleaseDLLStaticDeps|x86.Build.0 = Release|Win32 - {AAD3AB93-F831-4339-8AAD-DC956B9B9233}.ReleaseLTO|x64.ActiveCfg = Release|x64 - {AAD3AB93-F831-4339-8AAD-DC956B9B9233}.ReleaseLTO|x64.Build.0 = Release|x64 - {AAD3AB93-F831-4339-8AAD-DC956B9B9233}.ReleaseLTO|x86.ActiveCfg = Release|Win32 - {AAD3AB93-F831-4339-8AAD-DC956B9B9233}.ReleaseLTO|x86.Build.0 = Release|Win32 - {9D936BE4-46AA-489F-82E7-D2CFEB157FB6}.Debug|x64.ActiveCfg = Debug|x64 - {9D936BE4-46AA-489F-82E7-D2CFEB157FB6}.Debug|x64.Build.0 = Debug|x64 - {9D936BE4-46AA-489F-82E7-D2CFEB157FB6}.Debug|x86.ActiveCfg = Debug|Win32 - {9D936BE4-46AA-489F-82E7-D2CFEB157FB6}.Debug|x86.Build.0 = Debug|Win32 - {9D936BE4-46AA-489F-82E7-D2CFEB157FB6}.DebugDLL|x64.ActiveCfg = Debug|x64 - {9D936BE4-46AA-489F-82E7-D2CFEB157FB6}.DebugDLL|x64.Build.0 = Debug|x64 - {9D936BE4-46AA-489F-82E7-D2CFEB157FB6}.DebugDLL|x86.ActiveCfg = Debug|Win32 - {9D936BE4-46AA-489F-82E7-D2CFEB157FB6}.DebugDLL|x86.Build.0 = Debug|Win32 - {9D936BE4-46AA-489F-82E7-D2CFEB157FB6}.DebugDLLStaticDeps|x64.ActiveCfg = Debug|x64 - {9D936BE4-46AA-489F-82E7-D2CFEB157FB6}.DebugDLLStaticDeps|x64.Build.0 = Debug|x64 - {9D936BE4-46AA-489F-82E7-D2CFEB157FB6}.DebugDLLStaticDeps|x86.ActiveCfg = Debug|Win32 - {9D936BE4-46AA-489F-82E7-D2CFEB157FB6}.DebugDLLStaticDeps|x86.Build.0 = Debug|Win32 - {9D936BE4-46AA-489F-82E7-D2CFEB157FB6}.Release|x64.ActiveCfg = Release|x64 - {9D936BE4-46AA-489F-82E7-D2CFEB157FB6}.Release|x64.Build.0 = Release|x64 - {9D936BE4-46AA-489F-82E7-D2CFEB157FB6}.Release|x86.ActiveCfg = Release|Win32 - {9D936BE4-46AA-489F-82E7-D2CFEB157FB6}.Release|x86.Build.0 = Release|Win32 - {9D936BE4-46AA-489F-82E7-D2CFEB157FB6}.ReleaseDLL|x64.ActiveCfg = Release|x64 - {9D936BE4-46AA-489F-82E7-D2CFEB157FB6}.ReleaseDLL|x64.Build.0 = Release|x64 - {9D936BE4-46AA-489F-82E7-D2CFEB157FB6}.ReleaseDLL|x86.ActiveCfg = Release|Win32 - {9D936BE4-46AA-489F-82E7-D2CFEB157FB6}.ReleaseDLL|x86.Build.0 = Release|Win32 - {9D936BE4-46AA-489F-82E7-D2CFEB157FB6}.ReleaseDLLStaticDeps|x64.ActiveCfg = Release|x64 - {9D936BE4-46AA-489F-82E7-D2CFEB157FB6}.ReleaseDLLStaticDeps|x64.Build.0 = Release|x64 - {9D936BE4-46AA-489F-82E7-D2CFEB157FB6}.ReleaseDLLStaticDeps|x86.ActiveCfg = Release|Win32 - {9D936BE4-46AA-489F-82E7-D2CFEB157FB6}.ReleaseDLLStaticDeps|x86.Build.0 = Release|Win32 - {9D936BE4-46AA-489F-82E7-D2CFEB157FB6}.ReleaseLTO|x64.ActiveCfg = Release|x64 - {9D936BE4-46AA-489F-82E7-D2CFEB157FB6}.ReleaseLTO|x64.Build.0 = Release|x64 - {9D936BE4-46AA-489F-82E7-D2CFEB157FB6}.ReleaseLTO|x86.ActiveCfg = Release|Win32 - {9D936BE4-46AA-489F-82E7-D2CFEB157FB6}.ReleaseLTO|x86.Build.0 = Release|Win32 - {597D5EF8-04DB-48F9-A8F3-4B593B81C7C3}.Debug|x64.ActiveCfg = Debug|x64 - {597D5EF8-04DB-48F9-A8F3-4B593B81C7C3}.Debug|x64.Build.0 = Debug|x64 - {597D5EF8-04DB-48F9-A8F3-4B593B81C7C3}.Debug|x86.ActiveCfg = Debug|Win32 - {597D5EF8-04DB-48F9-A8F3-4B593B81C7C3}.Debug|x86.Build.0 = Debug|Win32 - {597D5EF8-04DB-48F9-A8F3-4B593B81C7C3}.DebugDLL|x64.ActiveCfg = Debug|x64 - {597D5EF8-04DB-48F9-A8F3-4B593B81C7C3}.DebugDLL|x64.Build.0 = Debug|x64 - {597D5EF8-04DB-48F9-A8F3-4B593B81C7C3}.DebugDLL|x86.ActiveCfg = Debug|Win32 - {597D5EF8-04DB-48F9-A8F3-4B593B81C7C3}.DebugDLL|x86.Build.0 = Debug|Win32 - {597D5EF8-04DB-48F9-A8F3-4B593B81C7C3}.DebugDLLStaticDeps|x64.ActiveCfg = Debug|x64 - {597D5EF8-04DB-48F9-A8F3-4B593B81C7C3}.DebugDLLStaticDeps|x64.Build.0 = Debug|x64 - {597D5EF8-04DB-48F9-A8F3-4B593B81C7C3}.DebugDLLStaticDeps|x86.ActiveCfg = Debug|Win32 - {597D5EF8-04DB-48F9-A8F3-4B593B81C7C3}.DebugDLLStaticDeps|x86.Build.0 = Debug|Win32 - {597D5EF8-04DB-48F9-A8F3-4B593B81C7C3}.Release|x64.ActiveCfg = Release|x64 - {597D5EF8-04DB-48F9-A8F3-4B593B81C7C3}.Release|x64.Build.0 = Release|x64 - {597D5EF8-04DB-48F9-A8F3-4B593B81C7C3}.Release|x86.ActiveCfg = Release|Win32 - {597D5EF8-04DB-48F9-A8F3-4B593B81C7C3}.Release|x86.Build.0 = Release|Win32 - {597D5EF8-04DB-48F9-A8F3-4B593B81C7C3}.ReleaseDLL|x64.ActiveCfg = Release|x64 - {597D5EF8-04DB-48F9-A8F3-4B593B81C7C3}.ReleaseDLL|x64.Build.0 = Release|x64 - {597D5EF8-04DB-48F9-A8F3-4B593B81C7C3}.ReleaseDLL|x86.ActiveCfg = Release|Win32 - {597D5EF8-04DB-48F9-A8F3-4B593B81C7C3}.ReleaseDLL|x86.Build.0 = Release|Win32 - {597D5EF8-04DB-48F9-A8F3-4B593B81C7C3}.ReleaseDLLStaticDeps|x64.ActiveCfg = Release|x64 - {597D5EF8-04DB-48F9-A8F3-4B593B81C7C3}.ReleaseDLLStaticDeps|x64.Build.0 = Release|x64 - {597D5EF8-04DB-48F9-A8F3-4B593B81C7C3}.ReleaseDLLStaticDeps|x86.ActiveCfg = Release|Win32 - {597D5EF8-04DB-48F9-A8F3-4B593B81C7C3}.ReleaseDLLStaticDeps|x86.Build.0 = Release|Win32 - {597D5EF8-04DB-48F9-A8F3-4B593B81C7C3}.ReleaseLTO|x64.ActiveCfg = Release|x64 - {597D5EF8-04DB-48F9-A8F3-4B593B81C7C3}.ReleaseLTO|x64.Build.0 = Release|x64 - {597D5EF8-04DB-48F9-A8F3-4B593B81C7C3}.ReleaseLTO|x86.ActiveCfg = Release|Win32 - {597D5EF8-04DB-48F9-A8F3-4B593B81C7C3}.ReleaseLTO|x86.Build.0 = Release|Win32 - {B337D322-355B-4348-A2A8-270471BE2C95}.Debug|x64.ActiveCfg = Debug|x64 - {B337D322-355B-4348-A2A8-270471BE2C95}.Debug|x64.Build.0 = Debug|x64 - {B337D322-355B-4348-A2A8-270471BE2C95}.Debug|x86.ActiveCfg = Debug|Win32 - {B337D322-355B-4348-A2A8-270471BE2C95}.Debug|x86.Build.0 = Debug|Win32 - {B337D322-355B-4348-A2A8-270471BE2C95}.DebugDLL|x64.ActiveCfg = Debug|x64 - {B337D322-355B-4348-A2A8-270471BE2C95}.DebugDLL|x64.Build.0 = Debug|x64 - {B337D322-355B-4348-A2A8-270471BE2C95}.DebugDLL|x86.ActiveCfg = Debug|Win32 - {B337D322-355B-4348-A2A8-270471BE2C95}.DebugDLL|x86.Build.0 = Debug|Win32 - {B337D322-355B-4348-A2A8-270471BE2C95}.DebugDLLStaticDeps|x64.ActiveCfg = Debug|x64 - {B337D322-355B-4348-A2A8-270471BE2C95}.DebugDLLStaticDeps|x64.Build.0 = Debug|x64 - {B337D322-355B-4348-A2A8-270471BE2C95}.DebugDLLStaticDeps|x86.ActiveCfg = Debug|Win32 - {B337D322-355B-4348-A2A8-270471BE2C95}.DebugDLLStaticDeps|x86.Build.0 = Debug|Win32 - {B337D322-355B-4348-A2A8-270471BE2C95}.Release|x64.ActiveCfg = Release|x64 - {B337D322-355B-4348-A2A8-270471BE2C95}.Release|x64.Build.0 = Release|x64 - {B337D322-355B-4348-A2A8-270471BE2C95}.Release|x86.ActiveCfg = Release|Win32 - {B337D322-355B-4348-A2A8-270471BE2C95}.Release|x86.Build.0 = Release|Win32 - {B337D322-355B-4348-A2A8-270471BE2C95}.ReleaseDLL|x64.ActiveCfg = Release|x64 - {B337D322-355B-4348-A2A8-270471BE2C95}.ReleaseDLL|x64.Build.0 = Release|x64 - {B337D322-355B-4348-A2A8-270471BE2C95}.ReleaseDLL|x86.ActiveCfg = Release|Win32 - {B337D322-355B-4348-A2A8-270471BE2C95}.ReleaseDLL|x86.Build.0 = Release|Win32 - {B337D322-355B-4348-A2A8-270471BE2C95}.ReleaseDLLStaticDeps|x64.ActiveCfg = Release|x64 - {B337D322-355B-4348-A2A8-270471BE2C95}.ReleaseDLLStaticDeps|x64.Build.0 = Release|x64 - {B337D322-355B-4348-A2A8-270471BE2C95}.ReleaseDLLStaticDeps|x86.ActiveCfg = Release|Win32 - {B337D322-355B-4348-A2A8-270471BE2C95}.ReleaseDLLStaticDeps|x86.Build.0 = Release|Win32 - {B337D322-355B-4348-A2A8-270471BE2C95}.ReleaseLTO|x64.ActiveCfg = Release|x64 - {B337D322-355B-4348-A2A8-270471BE2C95}.ReleaseLTO|x64.Build.0 = Release|x64 - {B337D322-355B-4348-A2A8-270471BE2C95}.ReleaseLTO|x86.ActiveCfg = Release|Win32 - {B337D322-355B-4348-A2A8-270471BE2C95}.ReleaseLTO|x86.Build.0 = Release|Win32 - {80579A29-8073-46A0-B328-661155E0887B}.Debug|x64.ActiveCfg = Debug|x64 - {80579A29-8073-46A0-B328-661155E0887B}.Debug|x64.Build.0 = Debug|x64 - {80579A29-8073-46A0-B328-661155E0887B}.Debug|x86.ActiveCfg = Debug|Win32 - {80579A29-8073-46A0-B328-661155E0887B}.Debug|x86.Build.0 = Debug|Win32 - {80579A29-8073-46A0-B328-661155E0887B}.DebugDLL|x64.ActiveCfg = Debug|x64 - {80579A29-8073-46A0-B328-661155E0887B}.DebugDLL|x64.Build.0 = Debug|x64 - {80579A29-8073-46A0-B328-661155E0887B}.DebugDLL|x86.ActiveCfg = Debug|Win32 - {80579A29-8073-46A0-B328-661155E0887B}.DebugDLL|x86.Build.0 = Debug|Win32 - {80579A29-8073-46A0-B328-661155E0887B}.DebugDLLStaticDeps|x64.ActiveCfg = Debug|x64 - {80579A29-8073-46A0-B328-661155E0887B}.DebugDLLStaticDeps|x64.Build.0 = Debug|x64 - {80579A29-8073-46A0-B328-661155E0887B}.DebugDLLStaticDeps|x86.ActiveCfg = Debug|Win32 - {80579A29-8073-46A0-B328-661155E0887B}.DebugDLLStaticDeps|x86.Build.0 = Debug|Win32 - {80579A29-8073-46A0-B328-661155E0887B}.Release|x64.ActiveCfg = Release|x64 - {80579A29-8073-46A0-B328-661155E0887B}.Release|x64.Build.0 = Release|x64 - {80579A29-8073-46A0-B328-661155E0887B}.Release|x86.ActiveCfg = Release|Win32 - {80579A29-8073-46A0-B328-661155E0887B}.Release|x86.Build.0 = Release|Win32 - {80579A29-8073-46A0-B328-661155E0887B}.ReleaseDLL|x64.ActiveCfg = Release|x64 - {80579A29-8073-46A0-B328-661155E0887B}.ReleaseDLL|x64.Build.0 = Release|x64 - {80579A29-8073-46A0-B328-661155E0887B}.ReleaseDLL|x86.ActiveCfg = Release|Win32 - {80579A29-8073-46A0-B328-661155E0887B}.ReleaseDLL|x86.Build.0 = Release|Win32 - {80579A29-8073-46A0-B328-661155E0887B}.ReleaseDLLStaticDeps|x64.ActiveCfg = Release|x64 - {80579A29-8073-46A0-B328-661155E0887B}.ReleaseDLLStaticDeps|x64.Build.0 = Release|x64 - {80579A29-8073-46A0-B328-661155E0887B}.ReleaseDLLStaticDeps|x86.ActiveCfg = Release|Win32 - {80579A29-8073-46A0-B328-661155E0887B}.ReleaseDLLStaticDeps|x86.Build.0 = Release|Win32 - {80579A29-8073-46A0-B328-661155E0887B}.ReleaseLTO|x64.ActiveCfg = Release|x64 - {80579A29-8073-46A0-B328-661155E0887B}.ReleaseLTO|x64.Build.0 = Release|x64 - {80579A29-8073-46A0-B328-661155E0887B}.ReleaseLTO|x86.ActiveCfg = Release|Win32 - {80579A29-8073-46A0-B328-661155E0887B}.ReleaseLTO|x86.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {C6101E18-D73B-430C-A79C-084E1236EA94} = {3B1FE419-D7D2-4406-9C24-5A6F6ED63E73} - {AAD3AB93-F831-4339-8AAD-DC956B9B9233} = {3B1FE419-D7D2-4406-9C24-5A6F6ED63E73} - {9D936BE4-46AA-489F-82E7-D2CFEB157FB6} = {3B1FE419-D7D2-4406-9C24-5A6F6ED63E73} - {597D5EF8-04DB-48F9-A8F3-4B593B81C7C3} = {3B1FE419-D7D2-4406-9C24-5A6F6ED63E73} - {B337D322-355B-4348-A2A8-270471BE2C95} = {3B1FE419-D7D2-4406-9C24-5A6F6ED63E73} - {80579A29-8073-46A0-B328-661155E0887B} = {3B1FE419-D7D2-4406-9C24-5A6F6ED63E73} - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {1838F09B-B929-4D1E-ABB6-FA2A94F4A4BE} - EndGlobalSection -EndGlobal diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/ffmpeg-cpp.vcxproj b/source/ffmpeg-cpp/ffmpeg-cpp/ffmpeg-cpp.vcxproj deleted file mode 100644 index fed6ac2..0000000 --- a/source/ffmpeg-cpp/ffmpeg-cpp/ffmpeg-cpp.vcxproj +++ /dev/null @@ -1,267 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 15.0 - {BABFD64D-9BF1-4328-B977-24BF81800620} - Win32Proj - ffmpegcpp - 10.0.17763.0 - - - - StaticLibrary - true - v141 - Unicode - - - StaticLibrary - false - v141 - true - Unicode - - - StaticLibrary - true - v141 - Unicode - false - - - StaticLibrary - false - v141 - true - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - true - $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(NETFXKitsDir)Lib\um\x64;$(FFmpegLibraryDir)lib - $(ProjectDir)..\..\..\lib\$(Platform)\$(Configuration)\ - obj\$(Platform)\$(Configuration)\ - - - true - $(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86;$(FFmpegLibraryDir)lib - $(ProjectDir)..\..\..\lib\$(Platform)\$(Configuration)\ - obj\$(Platform)\$(Configuration)\ - - - false - $(ProjectDir)..\..\..\lib\$(Platform)\$(Configuration)\ - obj\$(Platform)\$(Configuration)\ - - - false - $(ProjectDir)..\..\..\lib\$(Platform)\$(Configuration)\ - obj\$(Platform)\$(Configuration)\ - - - - NotUsing - Level3 - Disabled - false - _DEBUG;_LIB;%(PreprocessorDefinitions) - true - $(FFmpegLibraryDir)include;$(ProjectDir);%(AdditionalIncludeDirectories) - - - Windows - true - - - $(FFmpegLibraryDir)lib\avcodec.lib;$(FFmpegLibraryDir)lib\avfilter.lib;$(FFmpegLibraryDir)lib\avformat.lib;$(FFmpegLibraryDir)lib\avutil.lib;$(FFmpegLibraryDir)lib\swresample.lib;$(FFmpegLibraryDir)lib\swscale.lib - - - xcopy $(ProjectDir)*.h $(ProjectDir)..\..\..\include /y /s /i - - - - - NotUsing - Level3 - Disabled - true - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - $(FFmpegLibraryDir)include;$(ProjectDir);%(AdditionalIncludeDirectories) - - - Windows - true - - - $(FFmpegLibraryDir)lib\avcodec.lib;$(FFmpegLibraryDir)lib\avfilter.lib;$(FFmpegLibraryDir)lib\avformat.lib;$(FFmpegLibraryDir)lib\avutil.lib;$(FFmpegLibraryDir)lib\swresample.lib;$(FFmpegLibraryDir)lib\swscale.lib - - - xcopy $(ProjectDir)*.h $(ProjectDir)..\..\..\include /y /s - - - - - NotUsing - Level3 - MaxSpeed - true - true - true - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - $(FFmpegLibraryDir)include;$(ProjectDir);%(AdditionalIncludeDirectories) - - - Windows - true - true - true - - - $(FFmpegLibraryDir)lib\avcodec.lib;$(FFmpegLibraryDir)lib\avfilter.lib;$(FFmpegLibraryDir)lib\avformat.lib;$(FFmpegLibraryDir)lib\avutil.lib;$(FFmpegLibraryDir)lib\swresample.lib;$(FFmpegLibraryDir)lib\swscale.lib - - - xcopy $(ProjectDir)*.h $(ProjectDir)..\..\..\include /y /s - - - - - NotUsing - Level3 - MaxSpeed - true - true - true - NDEBUG;_LIB;%(PreprocessorDefinitions) - true - $(FFmpegLibraryDir)include;$(ProjectDir);%(AdditionalIncludeDirectories) - - - Windows - true - true - true - - - $(FFmpegLibraryDir)lib\avcodec.lib;$(FFmpegLibraryDir)lib\avfilter.lib;$(FFmpegLibraryDir)lib\avformat.lib;$(FFmpegLibraryDir)lib\avutil.lib;$(FFmpegLibraryDir)lib\swresample.lib;$(FFmpegLibraryDir)lib\swscale.lib - - - xcopy $(ProjectDir)*.h $(ProjectDir)..\..\..\include /y /s - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/ffmpeg-cpp.vcxproj.filters b/source/ffmpeg-cpp/ffmpeg-cpp/ffmpeg-cpp.vcxproj.filters deleted file mode 100644 index e88632f..0000000 --- a/source/ffmpeg-cpp/ffmpeg-cpp/ffmpeg-cpp.vcxproj.filters +++ /dev/null @@ -1,219 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;ipp;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - \ No newline at end of file diff --git a/source/ffmpeg-cpp/ffmpeg-cpp/ffmpeg-cpp.vcxproj.user b/source/ffmpeg-cpp/ffmpeg-cpp/ffmpeg-cpp.vcxproj.user deleted file mode 100644 index 0b0f24d..0000000 --- a/source/ffmpeg-cpp/ffmpeg-cpp/ffmpeg-cpp.vcxproj.user +++ /dev/null @@ -1,6 +0,0 @@ - - - - true - - \ No newline at end of file diff --git a/source/ffmpeg-cpp/filtering_video/filtering_video.vcxproj b/source/ffmpeg-cpp/filtering_video/filtering_video.vcxproj deleted file mode 100644 index 4362b9a..0000000 --- a/source/ffmpeg-cpp/filtering_video/filtering_video.vcxproj +++ /dev/null @@ -1,200 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 15.0 - {80579A29-8073-46A0-B328-661155E0887B} - Win32Proj - decodeaudio - 10.0.17763.0 - - - - Application - true - v141 - Unicode - - - Application - false - v141 - true - Unicode - - - Application - true - v141 - Unicode - - - Application - false - v141 - true - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - true - $(ProjectDir)..\..\..\bin\$(Platform)\$(Configuration)\ - obj\$(Platform)\$(Configuration)\ - - - true - $(ProjectDir)..\..\..\bin\$(Platform)\$(Configuration)\ - obj\$(Platform)\$(Configuration)\ - - - false - $(ProjectDir)..\..\..\bin\$(Platform)\$(Configuration)\ - obj\$(Platform)\$(Configuration)\ - - - false - $(ProjectDir)..\..\..\bin\$(Platform)\$(Configuration)\ - obj\$(Platform)\$(Configuration)\ - - - - NotUsing - Level3 - Disabled - false - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - pch.h - $(FFmpegLibraryDir)include;..\ffmpeg-cpp;%(AdditionalIncludeDirectories) - - - Console - true - %(AdditionalDependencies) - - - xcopy $(SamplesDir) $(OutDir)samples /s /y /i -xcopy $(FFmpegLibraryDir)bin $(OutDir) /s /y /i - - - - - NotUsing - Level3 - Disabled - true - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - pch.h - $(FFmpegLibraryDir)include;..\ffmpeg-cpp;%(AdditionalIncludeDirectories) - - - Console - true - %(AdditionalDependencies) - - - xcopy $(SamplesDir) $(OutDir)samples /s /y /i -xcopy $(FFmpegLibraryDir)bin $(OutDir) /s /y /i - - - - - NotUsing - Level3 - MaxSpeed - true - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - pch.h - $(FFmpegLibraryDir)include;..\ffmpeg-cpp;%(AdditionalIncludeDirectories) - - - Console - true - true - true - %(AdditionalDependencies) - - - xcopy $(SamplesDir) $(OutDir)samples /s /y /i -xcopy $(FFmpegLibraryDir)bin $(OutDir) /s /y /i - - - - - NotUsing - Level3 - MaxSpeed - true - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - pch.h - $(FFmpegLibraryDir)include;..\ffmpeg-cpp;%(AdditionalIncludeDirectories) - - - Console - true - true - true - %(AdditionalDependencies) - - - xcopy $(SamplesDir) $(OutDir)samples /s /y /i -xcopy $(FFmpegLibraryDir)bin $(OutDir) /s /y /i - - - - - {babfd64d-9bf1-4328-b977-24bf81800620} - - - - - - - - - \ No newline at end of file diff --git a/source/ffmpeg-cpp/filtering_video/filtering_video.vcxproj.filters b/source/ffmpeg-cpp/filtering_video/filtering_video.vcxproj.filters deleted file mode 100644 index b1ed7c9..0000000 --- a/source/ffmpeg-cpp/filtering_video/filtering_video.vcxproj.filters +++ /dev/null @@ -1,18 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Source Files - - - \ No newline at end of file diff --git a/source/ffmpeg-cpp/filtering_video/filtering_video.vcxproj.user b/source/ffmpeg-cpp/filtering_video/filtering_video.vcxproj.user deleted file mode 100644 index 6c84d89..0000000 --- a/source/ffmpeg-cpp/filtering_video/filtering_video.vcxproj.user +++ /dev/null @@ -1,19 +0,0 @@ - - - - $(OutDir) - WindowsLocalDebugger - - - $(OutDir) - WindowsLocalDebugger - - - $(OutDir) - WindowsLocalDebugger - - - $(OutDir) - WindowsLocalDebugger - - \ No newline at end of file diff --git a/source/ffmpeg-cpp/remuxing/remuxing.vcxproj b/source/ffmpeg-cpp/remuxing/remuxing.vcxproj deleted file mode 100644 index c45c067..0000000 --- a/source/ffmpeg-cpp/remuxing/remuxing.vcxproj +++ /dev/null @@ -1,200 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 15.0 - {B337D322-355B-4348-A2A8-270471BE2C95} - Win32Proj - decodeaudio - 10.0.17763.0 - - - - Application - true - v141 - Unicode - - - Application - false - v141 - true - Unicode - - - Application - true - v141 - Unicode - - - Application - false - v141 - true - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - true - $(ProjectDir)..\..\..\bin\$(Platform)\$(Configuration)\ - obj\$(Platform)\$(Configuration)\ - - - true - $(ProjectDir)..\..\..\bin\$(Platform)\$(Configuration)\ - obj\$(Platform)\$(Configuration)\ - - - false - $(ProjectDir)..\..\..\bin\$(Platform)\$(Configuration)\ - obj\$(Platform)\$(Configuration)\ - - - false - $(ProjectDir)..\..\..\bin\$(Platform)\$(Configuration)\ - obj\$(Platform)\$(Configuration)\ - - - - NotUsing - Level3 - Disabled - false - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - pch.h - $(FFmpegLibraryDir)include;..\ffmpeg-cpp;%(AdditionalIncludeDirectories) - - - Console - true - %(AdditionalDependencies) - - - xcopy $(SamplesDir) $(OutDir)samples /s /y /i -xcopy $(FFmpegLibraryDir)bin $(OutDir) /s /y /i - - - - - NotUsing - Level3 - Disabled - true - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - pch.h - $(FFmpegLibraryDir)include;..\ffmpeg-cpp;%(AdditionalIncludeDirectories) - - - Console - true - %(AdditionalDependencies) - - - xcopy $(SamplesDir) $(OutDir)samples /s /y /i -xcopy $(FFmpegLibraryDir)bin $(OutDir) /s /y /i - - - - - NotUsing - Level3 - MaxSpeed - true - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - pch.h - $(FFmpegLibraryDir)include;..\ffmpeg-cpp;%(AdditionalIncludeDirectories) - - - Console - true - true - true - %(AdditionalDependencies) - - - xcopy $(SamplesDir) $(OutDir)samples /s /y /i -xcopy $(FFmpegLibraryDir)bin $(OutDir) /s /y /i - - - - - NotUsing - Level3 - MaxSpeed - true - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - pch.h - $(FFmpegLibraryDir)include;..\ffmpeg-cpp;%(AdditionalIncludeDirectories) - - - Console - true - true - true - %(AdditionalDependencies) - - - xcopy $(SamplesDir) $(OutDir)samples /s /y /i -xcopy $(FFmpegLibraryDir)bin $(OutDir) /s /y /i - - - - - {babfd64d-9bf1-4328-b977-24bf81800620} - - - - - - - - - \ No newline at end of file diff --git a/source/ffmpeg-cpp/remuxing/remuxing.vcxproj.filters b/source/ffmpeg-cpp/remuxing/remuxing.vcxproj.filters deleted file mode 100644 index de7d8a5..0000000 --- a/source/ffmpeg-cpp/remuxing/remuxing.vcxproj.filters +++ /dev/null @@ -1,18 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Source Files - - - \ No newline at end of file diff --git a/source/ffmpeg-cpp/remuxing/remuxing.vcxproj.user b/source/ffmpeg-cpp/remuxing/remuxing.vcxproj.user deleted file mode 100644 index be25078..0000000 --- a/source/ffmpeg-cpp/remuxing/remuxing.vcxproj.user +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file From de143d4724a0b4edf5ecbdc0a557963e73ce8a08 Mon Sep 17 00:00:00 2001 From: Wim van Aarle Date: Fri, 14 Dec 2018 10:49:56 +0100 Subject: [PATCH 04/31] update gitignore file --- .gitignore | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/.gitignore b/.gitignore index 6466313..ca32786 100644 --- a/.gitignore +++ b/.gitignore @@ -1,24 +1,7 @@ -################################################################################ -# This .gitignore file was automatically created by Microsoft(R) Visual Studio. -################################################################################ - -/source/ffmpeg-cpp/.vs/ffmpeg-cpp/v15 -/source/ffmpeg-cpp/ffmpeg-cpp/obj -/source/ffmpeg-cpp/demo/obj -/source/ffmpeg-cpp/x64/Debug -/source/ffmpeg-cpp/obj/Debug -/source/ffmpeg-cpp/demo/samples/out.mp4 -/ffmpeg/include +/ffmpeg/include /ffmpeg/lib /ffmpeg/bin /bin /lib - -/source/ffmpeg-cpp/decode_audio/obj -/source/ffmpeg-cpp/encode_audio/obj -/source/ffmpeg-cpp/encode_video/obj -/source/ffmpeg-cpp/decode_video/obj -/source/ffmpeg-cpp/filtering_video/obj -/include - -/source/ffmpeg-cpp/remuxing/obj +/.vs +/.vscode From d76cc3e8068e120286337d941c503dd16a3732ea Mon Sep 17 00:00:00 2001 From: Wim van Aarle Date: Fri, 14 Dec 2018 20:59:03 +0100 Subject: [PATCH 05/31] Fixed include paths --- include/ffmpegcpp/Codecs/AudioCodec.h | 2 +- include/ffmpegcpp/Demuxing/AudioInputStream.h | 4 ++-- include/ffmpegcpp/Demuxing/InputStream.h | 2 +- include/ffmpegcpp/Demuxing/VideoInputStream.h | 4 ++-- include/ffmpegcpp/FrameSinks/AudioEncoder.h | 2 +- include/ffmpegcpp/FrameSinks/AudioFrameSink.h | 2 +- include/ffmpegcpp/FrameSinks/VideoEncoder.h | 2 +- include/ffmpegcpp/FrameSinks/VideoFilter.h | 2 +- include/ffmpegcpp/FrameSinks/VideoFrameSink.h | 2 +- include/ffmpegcpp/Muxing/AudioOutputStream.h | 4 ++-- include/ffmpegcpp/Muxing/OutputStream.h | 2 +- include/ffmpegcpp/Muxing/VideoOutputStream.h | 4 ++-- include/ffmpegcpp/Sources/EncodedFileSource.h | 4 ++-- include/ffmpegcpp/Sources/RawAudioDataSource.h | 2 +- include/ffmpegcpp/Sources/RawAudioFileSource.h | 4 ++-- include/ffmpegcpp/Sources/RawVideoDataSource.h | 2 +- include/ffmpegcpp/Sources/RawVideoFileSource.h | 4 ++-- include/ffmpegcpp/ffmpegcpp.h | 6 +++--- src/Codecs/AudioCodec.cpp | 2 +- src/Codecs/Codec.cpp | 2 +- src/Codecs/H264NVEncCodec.cpp | 2 +- src/Codecs/H265NVEncCodec.cpp | 2 +- src/Codecs/JPGCodec.cpp | 2 +- src/Codecs/PNGCodec.cpp | 2 +- src/Codecs/VP9Codec.cpp | 2 +- src/Codecs/VideoCodec.cpp | 2 +- src/Demuxing/AudioInputStream.cpp | 2 +- src/Demuxing/InputStream.cpp | 2 +- src/Demuxing/VideoInputStream.cpp | 2 +- src/FrameSinks/AudioEncoder.cpp | 2 +- src/FrameSinks/VideoEncoder.cpp | 2 +- src/FrameSinks/VideoFilter.cpp | 2 +- src/Muxing/AudioOutputStream.cpp | 2 +- src/Muxing/Muxer.cpp | 4 ++-- src/Muxing/OutputStream.cpp | 2 +- src/Muxing/VideoOutputStream.cpp | 2 +- src/Sources/Demuxer.cpp | 2 +- src/Sources/EncodedFileSource.cpp | 2 +- src/Sources/RawAudioDataSource.cpp | 2 +- src/Sources/RawAudioFileSource.cpp | 2 +- src/Sources/RawVideoDataSource.cpp | 2 +- src/Sources/RawVideoFileSource.cpp | 2 +- 42 files changed, 52 insertions(+), 52 deletions(-) diff --git a/include/ffmpegcpp/Codecs/AudioCodec.h b/include/ffmpegcpp/Codecs/AudioCodec.h index ec605cd..d56e84f 100644 --- a/include/ffmpegcpp/Codecs/AudioCodec.h +++ b/include/ffmpegcpp/Codecs/AudioCodec.h @@ -1,6 +1,6 @@ #pragma once -#include "Codec.h" +#include "Codecs/Codec.h" #include "OpenCodec.h" namespace ffmpegcpp diff --git a/include/ffmpegcpp/Demuxing/AudioInputStream.h b/include/ffmpegcpp/Demuxing/AudioInputStream.h index bfdee63..cab0d72 100644 --- a/include/ffmpegcpp/Demuxing/AudioInputStream.h +++ b/include/ffmpegcpp/Demuxing/AudioInputStream.h @@ -1,8 +1,8 @@ #pragma once #include "ffmpeg.h" -#include "InputStream.h" -#include "Frame Sinks/AudioFrameSink.h" +#include "Demuxing/InputStream.h" +#include "FrameSinks/AudioFrameSink.h" namespace ffmpegcpp { diff --git a/include/ffmpegcpp/Demuxing/InputStream.h b/include/ffmpegcpp/Demuxing/InputStream.h index f55fabc..a9c2404 100644 --- a/include/ffmpegcpp/Demuxing/InputStream.h +++ b/include/ffmpegcpp/Demuxing/InputStream.h @@ -2,7 +2,7 @@ #include "ffmpeg.h" #include "std.h" -#include "Frame Sinks/FrameSink.h" +#include "FrameSinks/FrameSink.h" namespace ffmpegcpp { diff --git a/include/ffmpegcpp/Demuxing/VideoInputStream.h b/include/ffmpegcpp/Demuxing/VideoInputStream.h index 1436f4f..2343dc4 100644 --- a/include/ffmpegcpp/Demuxing/VideoInputStream.h +++ b/include/ffmpegcpp/Demuxing/VideoInputStream.h @@ -1,8 +1,8 @@ #pragma once #include "ffmpeg.h" -#include "InputStream.h" -#include "Frame Sinks/VideoFrameSink.h" +#include "Demuxing/InputStream.h" +#include "FrameSinks/VideoFrameSink.h" namespace ffmpegcpp { diff --git a/include/ffmpegcpp/FrameSinks/AudioEncoder.h b/include/ffmpegcpp/FrameSinks/AudioEncoder.h index f60effa..0d15ba4 100644 --- a/include/ffmpegcpp/FrameSinks/AudioEncoder.h +++ b/include/ffmpegcpp/FrameSinks/AudioEncoder.h @@ -3,7 +3,7 @@ #include "ffmpeg.h" #include "std.h" -#include "Frame Sinks/AudioFrameSink.h" +#include "FrameSinks/AudioFrameSink.h" #include "Codecs/AudioCodec.h" #include "ConvertedAudioProcessor.h" #include "AudioFormatConverter.h" diff --git a/include/ffmpegcpp/FrameSinks/AudioFrameSink.h b/include/ffmpegcpp/FrameSinks/AudioFrameSink.h index 13d7fa7..d1c797f 100644 --- a/include/ffmpegcpp/FrameSinks/AudioFrameSink.h +++ b/include/ffmpegcpp/FrameSinks/AudioFrameSink.h @@ -1,6 +1,6 @@ #pragma once -#include "FrameSink.h" +#include "FrameSinks/FrameSink.h" namespace ffmpegcpp { diff --git a/include/ffmpegcpp/FrameSinks/VideoEncoder.h b/include/ffmpegcpp/FrameSinks/VideoEncoder.h index daec115..eda2600 100644 --- a/include/ffmpegcpp/FrameSinks/VideoEncoder.h +++ b/include/ffmpegcpp/FrameSinks/VideoEncoder.h @@ -2,7 +2,7 @@ #include "ffmpeg.h" -#include "Frame Sinks/VideoFrameSink.h" +#include "FrameSinks/VideoFrameSink.h" #include "Codecs/VideoCodec.h" #include "VideoFormatConverter.h" #include "Muxing/Muxer.h" diff --git a/include/ffmpegcpp/FrameSinks/VideoFilter.h b/include/ffmpegcpp/FrameSinks/VideoFilter.h index 1afe66e..6c893b4 100644 --- a/include/ffmpegcpp/FrameSinks/VideoFilter.h +++ b/include/ffmpegcpp/FrameSinks/VideoFilter.h @@ -2,7 +2,7 @@ #include "ffmpeg.h" -#include "VideoFrameSink.h" +#include "FrameSinks/VideoFrameSink.h" namespace ffmpegcpp { diff --git a/include/ffmpegcpp/FrameSinks/VideoFrameSink.h b/include/ffmpegcpp/FrameSinks/VideoFrameSink.h index ece64aa..72a45ff 100644 --- a/include/ffmpegcpp/FrameSinks/VideoFrameSink.h +++ b/include/ffmpegcpp/FrameSinks/VideoFrameSink.h @@ -1,6 +1,6 @@ #pragma once -#include "FrameSink.h" +#include "FrameSinks/FrameSink.h" namespace ffmpegcpp { diff --git a/include/ffmpegcpp/Muxing/AudioOutputStream.h b/include/ffmpegcpp/Muxing/AudioOutputStream.h index 0181295..688b549 100644 --- a/include/ffmpegcpp/Muxing/AudioOutputStream.h +++ b/include/ffmpegcpp/Muxing/AudioOutputStream.h @@ -2,8 +2,8 @@ #include "ffmpeg.h" #include "Codecs/Codec.h" -#include "OutputStream.h" -#include "Muxer.h" +#include "Muxing/OutputStream.h" +#include "Muxing/Muxer.h" namespace ffmpegcpp { diff --git a/include/ffmpegcpp/Muxing/OutputStream.h b/include/ffmpegcpp/Muxing/OutputStream.h index 9164497..26088cd 100644 --- a/include/ffmpegcpp/Muxing/OutputStream.h +++ b/include/ffmpegcpp/Muxing/OutputStream.h @@ -2,7 +2,7 @@ #include "ffmpeg.h" #include "Codecs/Codec.h" -#include "Muxer.h" +#include "Muxing/Muxer.h" namespace ffmpegcpp { diff --git a/include/ffmpegcpp/Muxing/VideoOutputStream.h b/include/ffmpegcpp/Muxing/VideoOutputStream.h index fe4fc6d..c9be26d 100644 --- a/include/ffmpegcpp/Muxing/VideoOutputStream.h +++ b/include/ffmpegcpp/Muxing/VideoOutputStream.h @@ -2,8 +2,8 @@ #include "ffmpeg.h" #include "Codecs/Codec.h" -#include "OutputStream.h" -#include "Muxer.h" +#include "Muxing/OutputStream.h" +#include "Muxing/Muxer.h" namespace ffmpegcpp { diff --git a/include/ffmpegcpp/Sources/EncodedFileSource.h b/include/ffmpegcpp/Sources/EncodedFileSource.h index 8637d03..d663cd2 100644 --- a/include/ffmpegcpp/Sources/EncodedFileSource.h +++ b/include/ffmpegcpp/Sources/EncodedFileSource.h @@ -1,8 +1,8 @@ #pragma once #include "ffmpeg.h" -#include "Frame Sinks/FrameSink.h" -#include "InputSource.h" +#include "FrameSinks/FrameSink.h" +#include "Sources/InputSource.h" namespace ffmpegcpp { diff --git a/include/ffmpegcpp/Sources/RawAudioDataSource.h b/include/ffmpegcpp/Sources/RawAudioDataSource.h index 418f032..e144a8e 100644 --- a/include/ffmpegcpp/Sources/RawAudioDataSource.h +++ b/include/ffmpegcpp/Sources/RawAudioDataSource.h @@ -1,7 +1,7 @@ #pragma once #include "ffmpeg.h" -#include "Frame Sinks/AudioFrameSink.h" +#include "FrameSinks/AudioFrameSink.h" namespace ffmpegcpp { diff --git a/include/ffmpegcpp/Sources/RawAudioFileSource.h b/include/ffmpegcpp/Sources/RawAudioFileSource.h index 23270a5..19a90e8 100644 --- a/include/ffmpegcpp/Sources/RawAudioFileSource.h +++ b/include/ffmpegcpp/Sources/RawAudioFileSource.h @@ -2,8 +2,8 @@ #include "ffmpeg.h" -#include "InputSource.h" -#include "Demuxer.h" +#include "Sources/InputSource.h" +#include "Sources/Demuxer.h" namespace ffmpegcpp diff --git a/include/ffmpegcpp/Sources/RawVideoDataSource.h b/include/ffmpegcpp/Sources/RawVideoDataSource.h index d131b05..b62a154 100644 --- a/include/ffmpegcpp/Sources/RawVideoDataSource.h +++ b/include/ffmpegcpp/Sources/RawVideoDataSource.h @@ -1,7 +1,7 @@ #pragma once #include "ffmpeg.h" -#include "Frame Sinks/VideoFrameSink.h" +#include "FrameSinks/VideoFrameSink.h" namespace ffmpegcpp { diff --git a/include/ffmpegcpp/Sources/RawVideoFileSource.h b/include/ffmpegcpp/Sources/RawVideoFileSource.h index 4d45222..781074b 100644 --- a/include/ffmpegcpp/Sources/RawVideoFileSource.h +++ b/include/ffmpegcpp/Sources/RawVideoFileSource.h @@ -2,8 +2,8 @@ #include "ffmpeg.h" -#include "InputSource.h" -#include "Demuxer.h" +#include "Sources/InputSource.h" +#include "Sources/Demuxer.h" namespace ffmpegcpp diff --git a/include/ffmpegcpp/ffmpegcpp.h b/include/ffmpegcpp/ffmpegcpp.h index 6b1f519..8890a08 100644 --- a/include/ffmpegcpp/ffmpegcpp.h +++ b/include/ffmpegcpp/ffmpegcpp.h @@ -11,9 +11,9 @@ #include "Sources/RawVideoDataSource.h" #include "Sources/EncodedFileSource.h" -#include "Frame Sinks/VideoEncoder.h" -#include "Frame Sinks/AudioEncoder.h" -#include "Frame Sinks/VideoFilter.h" +#include "FrameSinks/VideoEncoder.h" +#include "FrameSinks/AudioEncoder.h" +#include "FrameSinks/VideoFilter.h" #include "Codecs/AudioCodec.h" diff --git a/src/Codecs/AudioCodec.cpp b/src/Codecs/AudioCodec.cpp index 3d18e0c..8e931a6 100644 --- a/src/Codecs/AudioCodec.cpp +++ b/src/Codecs/AudioCodec.cpp @@ -1,4 +1,4 @@ -#include "AudioCodec.h" +#include "Codecs/AudioCodec.h" #include "FFmpegException.h" using namespace std; diff --git a/src/Codecs/Codec.cpp b/src/Codecs/Codec.cpp index 8b44c97..6488b75 100644 --- a/src/Codecs/Codec.cpp +++ b/src/Codecs/Codec.cpp @@ -1,4 +1,4 @@ -#include "Codec.h" +#include "Codecs/Codec.h" #include "FFmpegException.h" #include "CodecDeducer.h" diff --git a/src/Codecs/H264NVEncCodec.cpp b/src/Codecs/H264NVEncCodec.cpp index 424c6b1..fb86719 100644 --- a/src/Codecs/H264NVEncCodec.cpp +++ b/src/Codecs/H264NVEncCodec.cpp @@ -1,4 +1,4 @@ -#include "H264NVEncCodec.h" +#include "Codecs/H264NVEncCodec.h" namespace ffmpegcpp { diff --git a/src/Codecs/H265NVEncCodec.cpp b/src/Codecs/H265NVEncCodec.cpp index 31c55f2..bfc3470 100644 --- a/src/Codecs/H265NVEncCodec.cpp +++ b/src/Codecs/H265NVEncCodec.cpp @@ -1,4 +1,4 @@ -#include "H265NVEncCodec.h" +#include "Codecs/H265NVEncCodec.h" namespace ffmpegcpp { diff --git a/src/Codecs/JPGCodec.cpp b/src/Codecs/JPGCodec.cpp index 6431dd5..f695dc1 100644 --- a/src/Codecs/JPGCodec.cpp +++ b/src/Codecs/JPGCodec.cpp @@ -1,4 +1,4 @@ -#include "JPGCodec.h" +#include "Codecs/JPGCodec.h" namespace ffmpegcpp { diff --git a/src/Codecs/PNGCodec.cpp b/src/Codecs/PNGCodec.cpp index ff0f522..173c2e1 100644 --- a/src/Codecs/PNGCodec.cpp +++ b/src/Codecs/PNGCodec.cpp @@ -1,4 +1,4 @@ -#include "PNGCodec.h" +#include "Codecs/PNGCodec.h" namespace ffmpegcpp { diff --git a/src/Codecs/VP9Codec.cpp b/src/Codecs/VP9Codec.cpp index 1497525..a4e10c9 100644 --- a/src/Codecs/VP9Codec.cpp +++ b/src/Codecs/VP9Codec.cpp @@ -1,4 +1,4 @@ -#include "VP9Codec.h" +#include "Codecs/VP9Codec.h" namespace ffmpegcpp { diff --git a/src/Codecs/VideoCodec.cpp b/src/Codecs/VideoCodec.cpp index c166957..7499261 100644 --- a/src/Codecs/VideoCodec.cpp +++ b/src/Codecs/VideoCodec.cpp @@ -1,4 +1,4 @@ -#include "VideoCodec.h" +#include "Codecs/VideoCodec.h" #include "FFmpegException.h" using namespace std; diff --git a/src/Demuxing/AudioInputStream.cpp b/src/Demuxing/AudioInputStream.cpp index 0674174..037bc99 100644 --- a/src/Demuxing/AudioInputStream.cpp +++ b/src/Demuxing/AudioInputStream.cpp @@ -1,4 +1,4 @@ -#include "AudioInputStream.h" +#include "Demuxing/AudioInputStream.h" namespace ffmpegcpp { diff --git a/src/Demuxing/InputStream.cpp b/src/Demuxing/InputStream.cpp index 6fbe39c..91c9d7f 100644 --- a/src/Demuxing/InputStream.cpp +++ b/src/Demuxing/InputStream.cpp @@ -1,4 +1,4 @@ -#include "InputStream.h" +#include "Demuxing/InputStream.h" #include "CodecDeducer.h" #include "FFmpegException.h" diff --git a/src/Demuxing/VideoInputStream.cpp b/src/Demuxing/VideoInputStream.cpp index d1facae..241d04a 100644 --- a/src/Demuxing/VideoInputStream.cpp +++ b/src/Demuxing/VideoInputStream.cpp @@ -1,4 +1,4 @@ -#include "VideoInputStream.h" +#include "Demuxing/VideoInputStream.h" namespace ffmpegcpp { diff --git a/src/FrameSinks/AudioEncoder.cpp b/src/FrameSinks/AudioEncoder.cpp index 4220afb..e5d69aa 100644 --- a/src/FrameSinks/AudioEncoder.cpp +++ b/src/FrameSinks/AudioEncoder.cpp @@ -1,4 +1,4 @@ -#include "AudioEncoder.h" +#include "FrameSinks/AudioEncoder.h" #include "Muxing/AudioOutputStream.h" #include "FFmpegException.h" diff --git a/src/FrameSinks/VideoEncoder.cpp b/src/FrameSinks/VideoEncoder.cpp index 9d52254..d66a0b0 100644 --- a/src/FrameSinks/VideoEncoder.cpp +++ b/src/FrameSinks/VideoEncoder.cpp @@ -1,4 +1,4 @@ -#include "VideoEncoder.h" +#include "FrameSinks/VideoEncoder.h" #include "FFmpegException.h" #include "Muxing/VideoOutputStream.h" diff --git a/src/FrameSinks/VideoFilter.cpp b/src/FrameSinks/VideoFilter.cpp index 2a599c8..6562aa5 100644 --- a/src/FrameSinks/VideoFilter.cpp +++ b/src/FrameSinks/VideoFilter.cpp @@ -1,4 +1,4 @@ -#include "VideoFilter.h" +#include "FrameSinks/VideoFilter.h" #include "FFmpegException.h" namespace ffmpegcpp diff --git a/src/Muxing/AudioOutputStream.cpp b/src/Muxing/AudioOutputStream.cpp index b79c564..cdb5e20 100644 --- a/src/Muxing/AudioOutputStream.cpp +++ b/src/Muxing/AudioOutputStream.cpp @@ -1,4 +1,4 @@ -#include "AudioOutputStream.h" +#include "Muxing/AudioOutputStream.h" #include "FFmpegException.h" using namespace std; diff --git a/src/Muxing/Muxer.cpp b/src/Muxing/Muxer.cpp index 2135608..2db072a 100644 --- a/src/Muxing/Muxer.cpp +++ b/src/Muxing/Muxer.cpp @@ -1,6 +1,6 @@ -#include "Muxer.h" +#include "Muxing/Muxer.h" #include "FFmpegException.h" -#include "OutputStream.h" +#include "Muxing/OutputStream.h" #include diff --git a/src/Muxing/OutputStream.cpp b/src/Muxing/OutputStream.cpp index 8e1bfa9..373fdaf 100644 --- a/src/Muxing/OutputStream.cpp +++ b/src/Muxing/OutputStream.cpp @@ -1,4 +1,4 @@ -#include "OutputStream.h" +#include "Muxing/OutputStream.h" #include "FFmpegException.h" using namespace std; diff --git a/src/Muxing/VideoOutputStream.cpp b/src/Muxing/VideoOutputStream.cpp index 5a555a4..ae86a5b 100644 --- a/src/Muxing/VideoOutputStream.cpp +++ b/src/Muxing/VideoOutputStream.cpp @@ -1,4 +1,4 @@ -#include "VideoOutputStream.h" +#include "Muxing/VideoOutputStream.h" #include "FFmpegException.h" using namespace std; diff --git a/src/Sources/Demuxer.cpp b/src/Sources/Demuxer.cpp index 8f157eb..d489a1d 100644 --- a/src/Sources/Demuxer.cpp +++ b/src/Sources/Demuxer.cpp @@ -1,4 +1,4 @@ -#include "Demuxer.h" +#include "Sources/Demuxer.h" #include "FFmpegException.h" #include "CodecDeducer.h" diff --git a/src/Sources/EncodedFileSource.cpp b/src/Sources/EncodedFileSource.cpp index 88ccd43..3f5aba1 100644 --- a/src/Sources/EncodedFileSource.cpp +++ b/src/Sources/EncodedFileSource.cpp @@ -1,4 +1,4 @@ -#include "EncodedFileSource.h" +#include "Sources/EncodedFileSource.h" #include "FFmpegException.h" #include "CodecDeducer.h" diff --git a/src/Sources/RawAudioDataSource.cpp b/src/Sources/RawAudioDataSource.cpp index 3354795..512a718 100644 --- a/src/Sources/RawAudioDataSource.cpp +++ b/src/Sources/RawAudioDataSource.cpp @@ -1,4 +1,4 @@ -#include "RawAudioDataSource.h" +#include "Sources/RawAudioDataSource.h" #include "FFmpegException.h" namespace ffmpegcpp diff --git a/src/Sources/RawAudioFileSource.cpp b/src/Sources/RawAudioFileSource.cpp index 6b55509..71a5a6a 100644 --- a/src/Sources/RawAudioFileSource.cpp +++ b/src/Sources/RawAudioFileSource.cpp @@ -1,4 +1,4 @@ -#include "RawAudioFileSource.h" +#include "Sources/RawAudioFileSource.h" #include "FFmpegException.h" #include "std.h" diff --git a/src/Sources/RawVideoDataSource.cpp b/src/Sources/RawVideoDataSource.cpp index ee199b6..15e127e 100644 --- a/src/Sources/RawVideoDataSource.cpp +++ b/src/Sources/RawVideoDataSource.cpp @@ -1,4 +1,4 @@ -#include "RawVideoDataSource.h" +#include "Sources/RawVideoDataSource.h" #include "FFmpegException.h" namespace ffmpegcpp diff --git a/src/Sources/RawVideoFileSource.cpp b/src/Sources/RawVideoFileSource.cpp index 28c0d95..4b56f96 100644 --- a/src/Sources/RawVideoFileSource.cpp +++ b/src/Sources/RawVideoFileSource.cpp @@ -1,4 +1,4 @@ -#include "RawVideoFileSource.h" +#include "Sources/RawVideoFileSource.h" #include "FFmpegException.h" #include "std.h" From add307f51ef764aa72abda4a0694a070def4657f Mon Sep 17 00:00:00 2001 From: Wim van Aarle Date: Mon, 17 Dec 2018 09:25:11 +0100 Subject: [PATCH 06/31] added cmake files --- CMakeLists.txt | 50 +++++++++++++++++++++++++ examples/CMakeLists.txt | 7 ++++ examples/decode_audio/CMakeLists.txt | 17 +++++++++ examples/decode_video/CMakeLists.txt | 17 +++++++++ examples/demo/CMakeLists.txt | 19 ++++++++++ examples/encode_audio/CMakeLists.txt | 17 +++++++++ examples/encode_video/CMakeLists.txt | 17 +++++++++ examples/filtering_video/CMakeLists.txt | 17 +++++++++ examples/remuxing/CMakeLists.txt | 17 +++++++++ 9 files changed, 178 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 examples/CMakeLists.txt create mode 100644 examples/decode_audio/CMakeLists.txt create mode 100644 examples/decode_video/CMakeLists.txt create mode 100644 examples/demo/CMakeLists.txt create mode 100644 examples/encode_audio/CMakeLists.txt create mode 100644 examples/encode_video/CMakeLists.txt create mode 100644 examples/filtering_video/CMakeLists.txt create mode 100644 examples/remuxing/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..77be6f6 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,50 @@ +cmake_minimum_required(VERSION 3.5) + +project(ffmpegcpp VERSION 1.0.0) + +set_property(GLOBAL PROPERTY USE_FOLDERS ON) + +file(GLOB_RECURSE ffmpegcpp_files "include/ffmpegcpp/*.h" "src/*.cpp") +file(GLOB_RECURSE header_files "include/ffmpegcpp/*.h") + +source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}" FILES ${ffmpegcpp_files}) + +add_library(ffmpegcpp STATIC ${ffmpegcpp_files}) + +set_target_properties(ffmpegcpp PROPERTIES + VERSION ${PROJECT_VERSION} + PUBLIC_HEADER ${header_files} + CXX_STANDARD 17 +) + +set_target_properties(ffmpegcpp PROPERTIES + ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib +) + +target_include_directories(ffmpegcpp PRIVATE + include/ffmpegcpp + ffmpeg/include +) + +target_link_libraries(ffmpegcpp + ${PROJECT_SOURCE_DIR}/ffmpeg/lib/avcodec.lib + ${PROJECT_SOURCE_DIR}/ffmpeg/lib/avdevice.lib + ${PROJECT_SOURCE_DIR}/ffmpeg/lib/avfilter.lib + ${PROJECT_SOURCE_DIR}/ffmpeg/lib/avformat.lib + ${PROJECT_SOURCE_DIR}/ffmpeg/lib/avutil.lib + ${PROJECT_SOURCE_DIR}/ffmpeg/lib/postproc.lib + ${PROJECT_SOURCE_DIR}/ffmpeg/lib/swresample.lib + ${PROJECT_SOURCE_DIR}/ffmpeg/lib/swscale.lib +) + +install(TARGETS ffmpegcpp + ARCHIVE DESTINATION ${CMAKE_BINARY_DIR}/lib + LIBRARY DESTINATION ${CMAKE_BINARY_DIR}/lib + PUBLIC_HEADER DESTINATION ${CMAKE_BINARY_DIR}/lib/include +) + +install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/ffmpeg/bin/ DESTINATION ${CMAKE_BINARY_DIR}/bin/Release FILES_MATCHING PATTERN "*.dll") +install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/samples/ DESTINATION ${CMAKE_BINARY_DIR}/bin/Release/samples) + +add_subdirectory(examples) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt new file mode 100644 index 0000000..738c5c3 --- /dev/null +++ b/examples/CMakeLists.txt @@ -0,0 +1,7 @@ +add_subdirectory(decode_audio) +add_subdirectory(decode_video) +add_subdirectory(demo) +add_subdirectory(encode_audio) +add_subdirectory(encode_video) +add_subdirectory(filtering_video) +add_subdirectory(remuxing) diff --git a/examples/decode_audio/CMakeLists.txt b/examples/decode_audio/CMakeLists.txt new file mode 100644 index 0000000..45606a9 --- /dev/null +++ b/examples/decode_audio/CMakeLists.txt @@ -0,0 +1,17 @@ + +add_executable(decode_audio + decode_audio.cpp +) + +set_target_properties(decode_audio PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin +) + +target_include_directories(decode_audio PUBLIC + ${PROJECT_SOURCE_DIR}/include/ffmpegcpp + ${PROJECT_SOURCE_DIR}/ffmpeg/include +) + +target_link_libraries(decode_audio ffmpegcpp) + +set_target_properties(decode_audio PROPERTIES FOLDER examples) diff --git a/examples/decode_video/CMakeLists.txt b/examples/decode_video/CMakeLists.txt new file mode 100644 index 0000000..9e57c11 --- /dev/null +++ b/examples/decode_video/CMakeLists.txt @@ -0,0 +1,17 @@ + +add_executable(decode_video + decode_video.cpp +) + +set_target_properties(decode_video PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin +) + +target_include_directories(decode_video PUBLIC + ${PROJECT_SOURCE_DIR}/include/ffmpegcpp + ${PROJECT_SOURCE_DIR}/ffmpeg/include +) + +target_link_libraries(decode_video ffmpegcpp) + +set_target_properties(decode_video PROPERTIES FOLDER examples) diff --git a/examples/demo/CMakeLists.txt b/examples/demo/CMakeLists.txt new file mode 100644 index 0000000..68ab5f3 --- /dev/null +++ b/examples/demo/CMakeLists.txt @@ -0,0 +1,19 @@ + +add_executable(demo + demo.cpp + GeneratedAudioSource.cpp + GeneratedVideoSource.cpp +) + +set_target_properties(demo PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin +) + +target_include_directories(demo PUBLIC + ${PROJECT_SOURCE_DIR}/include/ffmpegcpp + ${PROJECT_SOURCE_DIR}/ffmpeg/include +) + +target_link_libraries(demo ffmpegcpp) + +set_target_properties(demo PROPERTIES FOLDER examples) diff --git a/examples/encode_audio/CMakeLists.txt b/examples/encode_audio/CMakeLists.txt new file mode 100644 index 0000000..5caddf5 --- /dev/null +++ b/examples/encode_audio/CMakeLists.txt @@ -0,0 +1,17 @@ + +add_executable(encode_audio + encode_audio.cpp +) + +set_target_properties(encode_audio PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin +) + +target_include_directories(encode_audio PUBLIC + ${PROJECT_SOURCE_DIR}/include/ffmpegcpp + ${PROJECT_SOURCE_DIR}/ffmpeg/include +) + +target_link_libraries(encode_audio ffmpegcpp) + +set_target_properties(encode_audio PROPERTIES FOLDER examples) diff --git a/examples/encode_video/CMakeLists.txt b/examples/encode_video/CMakeLists.txt new file mode 100644 index 0000000..f58f7e0 --- /dev/null +++ b/examples/encode_video/CMakeLists.txt @@ -0,0 +1,17 @@ + +add_executable(encode_video + encode_video.cpp +) + +set_target_properties(encode_video PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin +) + +target_include_directories(encode_video PUBLIC + ${PROJECT_SOURCE_DIR}/include/ffmpegcpp + ${PROJECT_SOURCE_DIR}/ffmpeg/include +) + +target_link_libraries(encode_video ffmpegcpp) + +set_target_properties(encode_video PROPERTIES FOLDER examples) diff --git a/examples/filtering_video/CMakeLists.txt b/examples/filtering_video/CMakeLists.txt new file mode 100644 index 0000000..ab86583 --- /dev/null +++ b/examples/filtering_video/CMakeLists.txt @@ -0,0 +1,17 @@ + +add_executable(filtering_video + filtering_video.cpp +) + +set_target_properties(filtering_video PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin +) + +target_include_directories(filtering_video PUBLIC + ${PROJECT_SOURCE_DIR}/include/ffmpegcpp + ${PROJECT_SOURCE_DIR}/ffmpeg/include +) + +target_link_libraries(filtering_video ffmpegcpp) + +set_target_properties(filtering_video PROPERTIES FOLDER examples) diff --git a/examples/remuxing/CMakeLists.txt b/examples/remuxing/CMakeLists.txt new file mode 100644 index 0000000..3f0f4d6 --- /dev/null +++ b/examples/remuxing/CMakeLists.txt @@ -0,0 +1,17 @@ + +add_executable(remuxing + remuxing.cpp +) + +set_target_properties(remuxing PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin +) + +target_include_directories(remuxing PUBLIC + ${PROJECT_SOURCE_DIR}/include/ffmpegcpp + ${PROJECT_SOURCE_DIR}/ffmpeg/include +) + +target_link_libraries(remuxing ffmpegcpp) + +set_target_properties(remuxing PROPERTIES FOLDER examples) From 0534884251bb2e9e739b5f3939105f32ee276e84 Mon Sep 17 00:00:00 2001 From: Wim van Aarle Date: Mon, 17 Dec 2018 09:54:33 +0100 Subject: [PATCH 07/31] use nullptr instead of NULL or 0 (clang-tidy: modernize-use-nullptr) --- examples/demo/GeneratedVideoSource.h | 2 +- examples/demo/demo.cpp | 4 ++-- src/AudioFormatConverter.cpp | 4 ++-- src/Codecs/Codec.cpp | 2 +- src/Demuxing/InputStream.cpp | 2 +- src/FrameSinks/AudioEncoder.cpp | 4 ++-- src/FrameSinks/VideoEncoder.cpp | 2 +- src/FrameSinks/VideoFilter.cpp | 14 +++++++------- src/Muxing/Muxer.cpp | 8 ++++---- src/Sources/Demuxer.cpp | 12 ++++++------ src/Sources/EncodedFileSource.cpp | 4 ++-- src/Sources/RawAudioDataSource.cpp | 2 +- src/Sources/RawAudioFileSource.cpp | 2 +- src/Sources/RawVideoDataSource.cpp | 2 +- src/Sources/RawVideoFileSource.cpp | 2 +- src/VideoFormatConverter.cpp | 2 +- 16 files changed, 34 insertions(+), 34 deletions(-) diff --git a/examples/demo/GeneratedVideoSource.h b/examples/demo/GeneratedVideoSource.h index 2c9e5b0..8a12325 100644 --- a/examples/demo/GeneratedVideoSource.h +++ b/examples/demo/GeneratedVideoSource.h @@ -21,6 +21,6 @@ class GeneratedVideoSource : public InputSource int frameNumber = 0; - uint8_t *rgb = NULL; + uint8_t *rgb = nullptr; }; diff --git a/examples/demo/demo.cpp b/examples/demo/demo.cpp index 2d652c6..3e1f770 100644 --- a/examples/demo/demo.cpp +++ b/examples/demo/demo.cpp @@ -41,7 +41,7 @@ void PlayDemo(int argc, char** argv) // set the filter to NULL to disable filtering. // See https://trac.ffmpeg.org/wiki/FilteringGuide for more info // This example rotates the entire video and then puts a vignette on top of it. - const char* videoFilterConfig = NULL;//"transpose=cclock[middle];[middle]vignette" + const char* videoFilterConfig = nullptr;//"transpose=cclock[middle];[middle]vignette" // if command line is specified, we overwrite our hard-coded settings if (argc >= 6) @@ -179,7 +179,7 @@ void PlayDemo(int argc, char** argv) // Instead of feeding the video source directly to the encoder, we feed it to // the video filter instead, which will pass it on to the encoder. VideoFilter* videoFilter = nullptr; - if (videoFilterConfig != NULL && videoEncoder != nullptr) + if (videoFilterConfig != nullptr && videoEncoder != nullptr) { printf("Applying filter %s to video...\n", videoFilterConfig); videoFilter = new VideoFilter(videoFilterConfig, videoEncoder); diff --git a/src/AudioFormatConverter.cpp b/src/AudioFormatConverter.cpp index 61e43db..f25cbdb 100644 --- a/src/AudioFormatConverter.cpp +++ b/src/AudioFormatConverter.cpp @@ -135,7 +135,7 @@ namespace ffmpegcpp while (tmp_frame->nb_samples > 0) { AddToFifo(tmp_frame); - ret = swr_convert_frame(swr_ctx, tmp_frame, NULL); + ret = swr_convert_frame(swr_ctx, tmp_frame, nullptr); if (ret < 0) { throw FFmpegException("Error while converting audio frame to destination format", ret); @@ -145,7 +145,7 @@ namespace ffmpegcpp /* If we have enough samples for the encoder, we encode them. * At the end of the file, we pass the remaining samples to * the encoder. */ - bool finished = (frame == NULL); + bool finished = (frame == nullptr); int fifoSize = av_audio_fifo_size(fifo); while (fifoSize >= converted_frame->nb_samples || (finished && fifoSize > 0)) diff --git a/src/Codecs/Codec.cpp b/src/Codecs/Codec.cpp index 6488b75..bd9435d 100644 --- a/src/Codecs/Codec.cpp +++ b/src/Codecs/Codec.cpp @@ -65,7 +65,7 @@ namespace ffmpegcpp throw FFmpegException("You can only open a codec once"); } - int ret = avcodec_open2(codecContext, codecContext->codec, NULL); + int ret = avcodec_open2(codecContext, codecContext->codec, nullptr); if (ret < 0) { throw FFmpegException("Could not open codecContext for codec", ret); diff --git a/src/Demuxing/InputStream.cpp b/src/Demuxing/InputStream.cpp index 91c9d7f..a3177c8 100644 --- a/src/Demuxing/InputStream.cpp +++ b/src/Demuxing/InputStream.cpp @@ -54,7 +54,7 @@ namespace ffmpegcpp ConfigureCodecContext(); // Init the decoders - if ((ret = avcodec_open2(codecContext, codec, NULL)) < 0) + if ((ret = avcodec_open2(codecContext, codec, nullptr)) < 0) { throw FFmpegException("Failed to open codec " + string(codec->name), ret); } diff --git a/src/FrameSinks/AudioEncoder.cpp b/src/FrameSinks/AudioEncoder.cpp index e5d69aa..6677869 100644 --- a/src/FrameSinks/AudioEncoder.cpp +++ b/src/FrameSinks/AudioEncoder.cpp @@ -116,10 +116,10 @@ namespace ffmpegcpp if (codec == nullptr) return; // can't close if we were never opened // First flush the converter and the FIFO queue in it - formatConverter->ProcessFrame(NULL); + formatConverter->ProcessFrame(nullptr); // then flush our encoder - WriteConvertedFrame(NULL); + WriteConvertedFrame(nullptr); } void AudioEncoder::PollCodecForPackets() diff --git a/src/FrameSinks/VideoEncoder.cpp b/src/FrameSinks/VideoEncoder.cpp index d66a0b0..479e578 100644 --- a/src/FrameSinks/VideoEncoder.cpp +++ b/src/FrameSinks/VideoEncoder.cpp @@ -140,7 +140,7 @@ namespace ffmpegcpp { if (codec == nullptr) return; // can't close if we were never opened - int ret = avcodec_send_frame(codec->GetContext(), NULL); + int ret = avcodec_send_frame(codec->GetContext(), nullptr); if (ret < 0) { throw FFmpegException("Error flushing codec after encoding", ret); diff --git a/src/FrameSinks/VideoFilter.cpp b/src/FrameSinks/VideoFilter.cpp index 6562aa5..b9fd96e 100644 --- a/src/FrameSinks/VideoFilter.cpp +++ b/src/FrameSinks/VideoFilter.cpp @@ -67,7 +67,7 @@ namespace ffmpegcpp //codec->codecContext->sample_aspect_ratio.num, codec->codecContext->sample_aspect_ratio.den); ret = avfilter_graph_create_filter(&buffersrc_ctx, buffersrc, "in", - args, NULL, filter_graph); + args, nullptr, filter_graph); if (ret < 0) { throw FFmpegException("Cannot create buffer source", ret); @@ -75,7 +75,7 @@ namespace ffmpegcpp /* buffer video sink: to terminate the filter chain. */ ret = avfilter_graph_create_filter(&buffersink_ctx, buffersink, "out", - NULL, NULL, filter_graph); + nullptr, nullptr, filter_graph); if (ret < 0) { throw FFmpegException("Cannot create buffer sink", ret); @@ -102,7 +102,7 @@ namespace ffmpegcpp outputs->name = av_strdup("in"); outputs->filter_ctx = buffersrc_ctx; outputs->pad_idx = 0; - outputs->next = NULL; + outputs->next = nullptr; /* * The buffer sink input must be connected to the output pad of @@ -113,15 +113,15 @@ namespace ffmpegcpp inputs->name = av_strdup("out"); inputs->filter_ctx = buffersink_ctx; inputs->pad_idx = 0; - inputs->next = NULL; + inputs->next = nullptr; if ((ret = avfilter_graph_parse_ptr(filter_graph, filterString, - &inputs, &outputs, NULL)) < 0) + &inputs, &outputs, nullptr)) < 0) { throw FFmpegException("Failed to parse and generate filters", ret); } - if ((ret = avfilter_graph_config(filter_graph, NULL)) < 0) + if ((ret = avfilter_graph_config(filter_graph, nullptr)) < 0) { throw FFmpegException("Failed to configure filter graph", ret); } @@ -158,7 +158,7 @@ namespace ffmpegcpp { if (!initialized) return; // can't close if we were never opened - int ret = av_buffersrc_add_frame_flags(buffersrc_ctx, NULL, AV_BUFFERSRC_FLAG_KEEP_REF); + int ret = av_buffersrc_add_frame_flags(buffersrc_ctx, nullptr, AV_BUFFERSRC_FLAG_KEEP_REF); PollFilterGraphForFrames(); // close our target as well diff --git a/src/Muxing/Muxer.cpp b/src/Muxing/Muxer.cpp index 2db072a..c1a7ea1 100644 --- a/src/Muxing/Muxer.cpp +++ b/src/Muxing/Muxer.cpp @@ -14,11 +14,11 @@ namespace ffmpegcpp this->fileName = fileName; /* allocate the output media context */ - avformat_alloc_output_context2(&containerContext, NULL, NULL, fileName); + avformat_alloc_output_context2(&containerContext, nullptr, nullptr, fileName); if (!containerContext) { printf("WARNING: Could not deduce output format from file extension: using MP4. as default\n"); - avformat_alloc_output_context2(&containerContext, NULL, "mp4", fileName); + avformat_alloc_output_context2(&containerContext, nullptr, "mp4", fileName); } if (!containerContext) { @@ -73,7 +73,7 @@ namespace ffmpegcpp if (opened) throw FFmpegException("You cannot open a new stream after something was written to the muxer"); // create an internal stream and pass it on - AVStream* stream = avformat_new_stream(containerContext, NULL); + AVStream* stream = avformat_new_stream(containerContext, nullptr); if (!stream) { throw FFmpegException("Could not allocate stream for container " + string(containerContext->oformat->name)); @@ -192,7 +192,7 @@ namespace ffmpegcpp } // Write the stream header, if any. - int ret = avformat_write_header(containerContext, NULL); + int ret = avformat_write_header(containerContext, nullptr); if (ret < 0) { throw FFmpegException("Error when writing header to output file " + fileName, ret); diff --git a/src/Sources/Demuxer.cpp b/src/Sources/Demuxer.cpp index d489a1d..ed0dc53 100644 --- a/src/Sources/Demuxer.cpp +++ b/src/Sources/Demuxer.cpp @@ -10,7 +10,7 @@ namespace ffmpegcpp { Demuxer::Demuxer(const char* fileName) - : Demuxer(fileName, NULL, NULL) + : Demuxer(fileName, nullptr, nullptr) { } @@ -27,7 +27,7 @@ namespace ffmpegcpp } // retrieve stream information - if (ret = (avformat_find_stream_info(containerContext, NULL)) < 0) + if (ret = (avformat_find_stream_info(containerContext, nullptr)) < 0) { CleanUp(); throw FFmpegException("Failed to read streams from " + string(fileName), ret); @@ -47,7 +47,7 @@ namespace ffmpegcpp throw FFmpegException("Failed to create packet for input stream"); } av_init_packet(pkt); - pkt->data = NULL; + pkt->data = nullptr; pkt->size = 0; } @@ -125,7 +125,7 @@ namespace ffmpegcpp void Demuxer::DecodeBestAudioStream(AudioFrameSink* frameSink) { - int ret = av_find_best_stream(containerContext, AVMEDIA_TYPE_AUDIO, -1, -1, NULL, 0); + int ret = av_find_best_stream(containerContext, AVMEDIA_TYPE_AUDIO, -1, -1, nullptr, 0); if (ret < 0) { throw FFmpegException("Could not find " + string(av_get_media_type_string(AVMEDIA_TYPE_AUDIO)) + " stream in input file " + fileName, ret); @@ -136,7 +136,7 @@ namespace ffmpegcpp void Demuxer::DecodeBestVideoStream(VideoFrameSink* frameSink) { - int ret = av_find_best_stream(containerContext, AVMEDIA_TYPE_VIDEO, -1, -1, NULL, 0); + int ret = av_find_best_stream(containerContext, AVMEDIA_TYPE_VIDEO, -1, -1, nullptr, 0); if (ret < 0) { throw FFmpegException("Could not find " + string(av_get_media_type_string(AVMEDIA_TYPE_VIDEO)) + " stream in input file " + fileName, ret); @@ -213,7 +213,7 @@ namespace ffmpegcpp // EOF if (ret == AVERROR_EOF) { - pkt->data = NULL; + pkt->data = nullptr; pkt->size = 0; for (int i = 0; i < containerContext->nb_streams; ++i) { diff --git a/src/Sources/EncodedFileSource.cpp b/src/Sources/EncodedFileSource.cpp index 3f5aba1..69ef3e1 100644 --- a/src/Sources/EncodedFileSource.cpp +++ b/src/Sources/EncodedFileSource.cpp @@ -88,7 +88,7 @@ namespace ffmpegcpp } /* open it */ - if (int ret = avcodec_open2(codecContext, codec, NULL) < 0) + if (int ret = avcodec_open2(codecContext, codec, nullptr) < 0) { throw FFmpegException("Failed to open context for codec " + string(codec->name), ret); } @@ -183,7 +183,7 @@ namespace ffmpegcpp { /* flush the decoder */ - pkt->data = NULL; + pkt->data = nullptr; pkt->size = 0; Decode(pkt, decoded_frame); diff --git a/src/Sources/RawAudioDataSource.cpp b/src/Sources/RawAudioDataSource.cpp index 512a718..01156c3 100644 --- a/src/Sources/RawAudioDataSource.cpp +++ b/src/Sources/RawAudioDataSource.cpp @@ -70,7 +70,7 @@ namespace ffmpegcpp // pass on to the sink // we don't have a time_base so we pass NULL and hope that it gets handled later... - output->WriteFrame(frame, NULL); + output->WriteFrame(frame, nullptr); } void RawAudioDataSource::Close() diff --git a/src/Sources/RawAudioFileSource.cpp b/src/Sources/RawAudioFileSource.cpp index 71a5a6a..672eccf 100644 --- a/src/Sources/RawAudioFileSource.cpp +++ b/src/Sources/RawAudioFileSource.cpp @@ -17,7 +17,7 @@ namespace ffmpegcpp throw FFmpegException("Unknown input format: " + string(inputFormat)); } - AVDictionary* format_opts = NULL; + AVDictionary* format_opts = nullptr; av_dict_set_int(&format_opts, "sample_rate", sampleRate, 0); av_dict_set_int(&format_opts, "channels", channels, 0); diff --git a/src/Sources/RawVideoDataSource.cpp b/src/Sources/RawVideoDataSource.cpp index 15e127e..4170371 100644 --- a/src/Sources/RawVideoDataSource.cpp +++ b/src/Sources/RawVideoDataSource.cpp @@ -82,7 +82,7 @@ namespace ffmpegcpp swsContext = sws_getCachedContext(swsContext, frame->width, frame->height, sourcePixelFormat, frame->width, frame->height, (AVPixelFormat)frame->format, - 0, 0, 0, 0); + 0, nullptr, nullptr, nullptr); sws_scale(swsContext, (const uint8_t * const *)&data, in_linesize, 0, frame->height, frame->data, frame->linesize); diff --git a/src/Sources/RawVideoFileSource.cpp b/src/Sources/RawVideoFileSource.cpp index 4b56f96..258d2c2 100644 --- a/src/Sources/RawVideoFileSource.cpp +++ b/src/Sources/RawVideoFileSource.cpp @@ -12,7 +12,7 @@ namespace ffmpegcpp // create the demuxer - it can handle figuring out the video type on its own apparently try { - demuxer = new Demuxer(fileName, NULL, NULL); + demuxer = new Demuxer(fileName, nullptr, nullptr); demuxer->DecodeBestVideoStream(frameSink); } catch (FFmpegException e) diff --git a/src/VideoFormatConverter.cpp b/src/VideoFormatConverter.cpp index 1b2b2c9..345edd0 100644 --- a/src/VideoFormatConverter.cpp +++ b/src/VideoFormatConverter.cpp @@ -54,7 +54,7 @@ namespace ffmpegcpp swsContext = sws_getCachedContext(swsContext, frame->width, frame->height, (AVPixelFormat)frame->format, converted_frame->width, converted_frame->height, (AVPixelFormat)converted_frame->format, - 0, 0, 0, 0); + 0, nullptr, nullptr, nullptr); } From 498ad8ff6a9628dfadf77f1da58ee8dfd6ad71b9 Mon Sep 17 00:00:00 2001 From: Wim van Aarle Date: Mon, 17 Dec 2018 09:57:41 +0100 Subject: [PATCH 08/31] use the override keyword on overridden functions (clang-tidy: modernize-use-override) --- examples/decode_audio/decode_audio.cpp | 6 +++--- examples/decode_video/decode_video.cpp | 6 +++--- examples/demo/GeneratedAudioSource.h | 8 ++++---- examples/demo/GeneratedVideoSource.h | 8 ++++---- include/ffmpegcpp/Demuxing/AudioInputStream.h | 2 +- include/ffmpegcpp/Demuxing/VideoInputStream.h | 2 +- include/ffmpegcpp/FrameSinks/AudioEncoder.h | 8 ++++---- include/ffmpegcpp/FrameSinks/AudioFrameSink.h | 2 -- include/ffmpegcpp/FrameSinks/VideoEncoder.h | 6 +++--- include/ffmpegcpp/FrameSinks/VideoFilter.h | 6 +++--- include/ffmpegcpp/FrameSinks/VideoFrameSink.h | 2 -- include/ffmpegcpp/Muxing/AudioOutputStream.h | 8 ++++---- include/ffmpegcpp/Muxing/VideoOutputStream.h | 8 ++++---- include/ffmpegcpp/Sources/Demuxer.h | 6 +++--- include/ffmpegcpp/Sources/EncodedFileSource.h | 6 +++--- include/ffmpegcpp/Sources/RawAudioFileSource.h | 6 +++--- include/ffmpegcpp/Sources/RawVideoFileSource.h | 6 +++--- 17 files changed, 46 insertions(+), 50 deletions(-) diff --git a/examples/decode_audio/decode_audio.cpp b/examples/decode_audio/decode_audio.cpp index fc11027..c20320c 100644 --- a/examples/decode_audio/decode_audio.cpp +++ b/examples/decode_audio/decode_audio.cpp @@ -15,7 +15,7 @@ class RawAudioFileSink : public AudioFrameSink file = fopen(fileName, "wb"); } - virtual void WriteFrame(AVFrame* frame, AVRational* timeBase) + void WriteFrame(AVFrame* frame, AVRational* timeBase) override { // Just write out the samples channel by channel to a file. int data_size = av_get_bytes_per_sample((AVSampleFormat)frame->format); @@ -28,12 +28,12 @@ class RawAudioFileSink : public AudioFrameSink } } - virtual void Close() + void Close() override { fclose(file); } - virtual bool IsPrimed() + bool IsPrimed() override { // Return whether we have all information we need to start writing out data. // Since we don't really need any data in this use case, we are always ready. diff --git a/examples/decode_video/decode_video.cpp b/examples/decode_video/decode_video.cpp index 03e45af..4ac509d 100644 --- a/examples/decode_video/decode_video.cpp +++ b/examples/decode_video/decode_video.cpp @@ -14,7 +14,7 @@ class PGMFileSink : public VideoFrameSink { } - virtual void WriteFrame(AVFrame* frame, AVRational* timeBase) + void WriteFrame(AVFrame* frame, AVRational* timeBase) override { ++frameNumber; printf("saving frame %3d\n", frameNumber); @@ -41,12 +41,12 @@ class PGMFileSink : public VideoFrameSink fclose(f); } - virtual void Close() + void Close() override { // nothing to do here. } - virtual bool IsPrimed() + bool IsPrimed() override { // Return whether we have all information we need to start writing out data. // Since we don't really need any data in this use case, we are always ready. diff --git a/examples/demo/GeneratedAudioSource.h b/examples/demo/GeneratedAudioSource.h index b8acdb6..f74e723 100644 --- a/examples/demo/GeneratedAudioSource.h +++ b/examples/demo/GeneratedAudioSource.h @@ -9,11 +9,11 @@ class GeneratedAudioSource : public InputSource public: GeneratedAudioSource(AudioFrameSink* frameSink); - ~GeneratedAudioSource(); + ~GeneratedAudioSource() override; - virtual void PreparePipeline(); - virtual bool IsDone(); - virtual void Step(); + void PreparePipeline() override; + bool IsDone() override; + void Step() override; private: diff --git a/examples/demo/GeneratedVideoSource.h b/examples/demo/GeneratedVideoSource.h index 8a12325..5faaddf 100644 --- a/examples/demo/GeneratedVideoSource.h +++ b/examples/demo/GeneratedVideoSource.h @@ -9,11 +9,11 @@ class GeneratedVideoSource : public InputSource public: GeneratedVideoSource(int width, int height, VideoFrameSink* frameSink); - ~GeneratedVideoSource(); + ~GeneratedVideoSource() override; - virtual void PreparePipeline(); - virtual bool IsDone(); - virtual void Step(); + void PreparePipeline() override; + bool IsDone() override; + void Step() override; private: diff --git a/include/ffmpegcpp/Demuxing/AudioInputStream.h b/include/ffmpegcpp/Demuxing/AudioInputStream.h index cab0d72..c3e79ca 100644 --- a/include/ffmpegcpp/Demuxing/AudioInputStream.h +++ b/include/ffmpegcpp/Demuxing/AudioInputStream.h @@ -16,6 +16,6 @@ namespace ffmpegcpp protected: - virtual void ConfigureCodecContext(); + void ConfigureCodecContext() override; }; } diff --git a/include/ffmpegcpp/Demuxing/VideoInputStream.h b/include/ffmpegcpp/Demuxing/VideoInputStream.h index 2343dc4..8793f44 100644 --- a/include/ffmpegcpp/Demuxing/VideoInputStream.h +++ b/include/ffmpegcpp/Demuxing/VideoInputStream.h @@ -16,7 +16,7 @@ namespace ffmpegcpp protected: - virtual void ConfigureCodecContext(); + void ConfigureCodecContext() override; }; } diff --git a/include/ffmpegcpp/FrameSinks/AudioEncoder.h b/include/ffmpegcpp/FrameSinks/AudioEncoder.h index 0d15ba4..ad1930d 100644 --- a/include/ffmpegcpp/FrameSinks/AudioEncoder.h +++ b/include/ffmpegcpp/FrameSinks/AudioEncoder.h @@ -19,12 +19,12 @@ namespace ffmpegcpp AudioEncoder(AudioCodec* codec, Muxer* muxer, int bitRate); virtual ~AudioEncoder(); - void WriteFrame(AVFrame* frame, AVRational* timeBase); - void Close(); + void WriteFrame(AVFrame* frame, AVRational* timeBase) override; + void Close() override; - virtual void WriteConvertedFrame(AVFrame* frame); + void WriteConvertedFrame(AVFrame* frame) override; - bool IsPrimed(); + bool IsPrimed() override; private: diff --git a/include/ffmpegcpp/FrameSinks/AudioFrameSink.h b/include/ffmpegcpp/FrameSinks/AudioFrameSink.h index d1c797f..5de043c 100644 --- a/include/ffmpegcpp/FrameSinks/AudioFrameSink.h +++ b/include/ffmpegcpp/FrameSinks/AudioFrameSink.h @@ -8,8 +8,6 @@ namespace ffmpegcpp { public: - virtual void WriteFrame(AVFrame* frame, AVRational* timeBase) = 0; - virtual ~AudioFrameSink() {} }; } diff --git a/include/ffmpegcpp/FrameSinks/VideoEncoder.h b/include/ffmpegcpp/FrameSinks/VideoEncoder.h index eda2600..d9939b0 100644 --- a/include/ffmpegcpp/FrameSinks/VideoEncoder.h +++ b/include/ffmpegcpp/FrameSinks/VideoEncoder.h @@ -18,10 +18,10 @@ namespace ffmpegcpp VideoEncoder(VideoCodec* codec, Muxer* muxer, AVRational frameRate, AVPixelFormat format); virtual ~VideoEncoder(); - void WriteFrame(AVFrame* frame, AVRational* timeBase); - void Close(); + void WriteFrame(AVFrame* frame, AVRational* timeBase) override; + void Close() override; - bool IsPrimed(); + bool IsPrimed() override; private: diff --git a/include/ffmpegcpp/FrameSinks/VideoFilter.h b/include/ffmpegcpp/FrameSinks/VideoFilter.h index 6c893b4..980c74b 100644 --- a/include/ffmpegcpp/FrameSinks/VideoFilter.h +++ b/include/ffmpegcpp/FrameSinks/VideoFilter.h @@ -14,10 +14,10 @@ namespace ffmpegcpp VideoFilter(const char* filterString, VideoFrameSink* target); virtual ~VideoFilter(); - void WriteFrame(AVFrame* frame, AVRational* timeBase); - void Close(); + void WriteFrame(AVFrame* frame, AVRational* timeBase) override; + void Close() override; - bool IsPrimed(); + bool IsPrimed() override; private: diff --git a/include/ffmpegcpp/FrameSinks/VideoFrameSink.h b/include/ffmpegcpp/FrameSinks/VideoFrameSink.h index 72a45ff..6ce74c1 100644 --- a/include/ffmpegcpp/FrameSinks/VideoFrameSink.h +++ b/include/ffmpegcpp/FrameSinks/VideoFrameSink.h @@ -8,8 +8,6 @@ namespace ffmpegcpp { public: - virtual void WriteFrame(AVFrame* frame, AVRational* timeBase) = 0; - virtual ~VideoFrameSink() {} }; } diff --git a/include/ffmpegcpp/Muxing/AudioOutputStream.h b/include/ffmpegcpp/Muxing/AudioOutputStream.h index 688b549..02f3b3c 100644 --- a/include/ffmpegcpp/Muxing/AudioOutputStream.h +++ b/include/ffmpegcpp/Muxing/AudioOutputStream.h @@ -13,15 +13,15 @@ namespace ffmpegcpp AudioOutputStream(Muxer* muxer, Codec* codec); - virtual void OpenStream(AVStream* stream, int containerFlags); + void OpenStream(AVStream* stream, int containerFlags) override; - virtual void WritePacket(AVPacket* pkt, OpenCodec* openCodec); + void WritePacket(AVPacket* pkt, OpenCodec* openCodec) override; - virtual bool IsPrimed(); + bool IsPrimed() override; protected: - virtual void PreparePacketForMuxer(AVPacket* pkt); + void PreparePacketForMuxer(AVPacket* pkt) override; private: diff --git a/include/ffmpegcpp/Muxing/VideoOutputStream.h b/include/ffmpegcpp/Muxing/VideoOutputStream.h index c9be26d..163436c 100644 --- a/include/ffmpegcpp/Muxing/VideoOutputStream.h +++ b/include/ffmpegcpp/Muxing/VideoOutputStream.h @@ -13,15 +13,15 @@ namespace ffmpegcpp VideoOutputStream(Muxer* muxer, Codec* codec); - virtual void OpenStream(AVStream* stream, int containerFlags); + void OpenStream(AVStream* stream, int containerFlags) override; - virtual void WritePacket(AVPacket* pkt, OpenCodec* openCodec); + void WritePacket(AVPacket* pkt, OpenCodec* openCodec) override; - virtual bool IsPrimed(); + bool IsPrimed() override; protected: - virtual void PreparePacketForMuxer(AVPacket* pkt); + void PreparePacketForMuxer(AVPacket* pkt) override; private: diff --git a/include/ffmpegcpp/Sources/Demuxer.h b/include/ffmpegcpp/Sources/Demuxer.h index 7af3531..3daa648 100644 --- a/include/ffmpegcpp/Sources/Demuxer.h +++ b/include/ffmpegcpp/Sources/Demuxer.h @@ -34,9 +34,9 @@ namespace ffmpegcpp std::vector GetAudioStreamInfo(); std::vector GetVideoStreamInfo(); - virtual void PreparePipeline(); - virtual bool IsDone(); - virtual void Step(); + void PreparePipeline() override; + bool IsDone() override; + void Step() override; private: diff --git a/include/ffmpegcpp/Sources/EncodedFileSource.h b/include/ffmpegcpp/Sources/EncodedFileSource.h index d663cd2..29653d9 100644 --- a/include/ffmpegcpp/Sources/EncodedFileSource.h +++ b/include/ffmpegcpp/Sources/EncodedFileSource.h @@ -16,9 +16,9 @@ namespace ffmpegcpp EncodedFileSource(const char* inFileName, const char* codecName, FrameSink* output); virtual ~EncodedFileSource(); - virtual void PreparePipeline(); - virtual bool IsDone(); - virtual void Step(); + void PreparePipeline() override; + bool IsDone() override; + void Step() override; private: diff --git a/include/ffmpegcpp/Sources/RawAudioFileSource.h b/include/ffmpegcpp/Sources/RawAudioFileSource.h index 19a90e8..333ed84 100644 --- a/include/ffmpegcpp/Sources/RawAudioFileSource.h +++ b/include/ffmpegcpp/Sources/RawAudioFileSource.h @@ -15,9 +15,9 @@ namespace ffmpegcpp RawAudioFileSource(const char* fileName, const char* inputFormat, int sampleRate, int channels, AudioFrameSink* frameSink); virtual ~RawAudioFileSource(); - virtual void PreparePipeline(); - virtual bool IsDone(); - virtual void Step(); + void PreparePipeline() override; + bool IsDone() override; + void Step() override; private: diff --git a/include/ffmpegcpp/Sources/RawVideoFileSource.h b/include/ffmpegcpp/Sources/RawVideoFileSource.h index 781074b..ebf9d62 100644 --- a/include/ffmpegcpp/Sources/RawVideoFileSource.h +++ b/include/ffmpegcpp/Sources/RawVideoFileSource.h @@ -19,9 +19,9 @@ namespace ffmpegcpp //RawVideoFileSource(const char* fileName, int width, int height, const char* frameRate, AVPixelFormat format, VideoFrameSink* frameSink); virtual ~RawVideoFileSource(); - virtual void PreparePipeline(); - virtual bool IsDone(); - virtual void Step(); + void PreparePipeline() override; + bool IsDone() override; + void Step() override; private: From 25fc7daf5321e8b74ab73657f49b3d882c5a5623 Mon Sep 17 00:00:00 2001 From: Wim van Aarle Date: Mon, 17 Dec 2018 13:57:44 +0100 Subject: [PATCH 09/31] replaced std::endl with '\n' --- examples/decode_audio/decode_audio.cpp | 8 ++++---- examples/decode_video/decode_video.cpp | 8 ++++---- examples/demo/demo.cpp | 6 +++--- examples/encode_audio/encode_audio.cpp | 8 ++++---- examples/encode_video/encode_video.cpp | 8 ++++---- examples/filtering_video/filtering_video.cpp | 8 ++++---- examples/remuxing/remuxing.cpp | 8 ++++---- 7 files changed, 27 insertions(+), 27 deletions(-) diff --git a/examples/decode_audio/decode_audio.cpp b/examples/decode_audio/decode_audio.cpp index c20320c..0d9cb6c 100644 --- a/examples/decode_audio/decode_audio.cpp +++ b/examples/decode_audio/decode_audio.cpp @@ -75,13 +75,13 @@ int main() } catch (FFmpegException e) { - cerr << "Exception caught!" << endl; - cerr << e.what() << endl; + cerr << "Exception caught!" << '\n'; + cerr << e.what() << '\n'; throw e; } - cout << "Decoding complete!" << endl; - cout << "Press any key to continue..." << endl; + cout << "Decoding complete!" << '\n'; + cout << "Press any key to continue..." << '\n'; getchar(); } diff --git a/examples/decode_video/decode_video.cpp b/examples/decode_video/decode_video.cpp index 4ac509d..3031b41 100644 --- a/examples/decode_video/decode_video.cpp +++ b/examples/decode_video/decode_video.cpp @@ -90,13 +90,13 @@ int main() } catch (FFmpegException e) { - cerr << "Exception caught!" << endl; - cerr << e.what() << endl; + cerr << "Exception caught!" << '\n'; + cerr << e.what() << '\n'; throw e; } - cout << "Decoding complete!" << endl; - cout << "Press any key to continue..." << endl; + cout << "Decoding complete!" << '\n'; + cout << "Press any key to continue..." << '\n'; getchar(); } diff --git a/examples/demo/demo.cpp b/examples/demo/demo.cpp index 3e1f770..3175655 100644 --- a/examples/demo/demo.cpp +++ b/examples/demo/demo.cpp @@ -277,7 +277,7 @@ void PlayDemo(int argc, char** argv) } catch (FFmpegException e) { - cerr << e.what() << endl; + cerr << e.what() << '\n'; throw e; } } @@ -286,8 +286,8 @@ int main(int argc, char **argv) { PlayDemo(argc, argv); - cout << "Encoding complete!" << endl; - cout << "Press any key to continue..." << endl; + cout << "Encoding complete!" << '\n'; + cout << "Press any key to continue..." << '\n'; getchar(); diff --git a/examples/encode_audio/encode_audio.cpp b/examples/encode_audio/encode_audio.cpp index 13652e2..2be6375 100644 --- a/examples/encode_audio/encode_audio.cpp +++ b/examples/encode_audio/encode_audio.cpp @@ -42,13 +42,13 @@ int main() } catch (FFmpegException e) { - cerr << "Exception caught!" << endl; - cerr << e.what() << endl; + cerr << "Exception caught!" << '\n'; + cerr << e.what() << '\n'; throw e; } - cout << "Encoding complete!" << endl; - cout << "Press any key to continue..." << endl; + cout << "Encoding complete!" << '\n'; + cout << "Press any key to continue..." << '\n'; getchar(); } diff --git a/examples/encode_video/encode_video.cpp b/examples/encode_video/encode_video.cpp index 1fc4e98..856f472 100644 --- a/examples/encode_video/encode_video.cpp +++ b/examples/encode_video/encode_video.cpp @@ -45,13 +45,13 @@ int main() } catch (FFmpegException e) { - cerr << "Exception caught!" << endl; - cerr << e.what() << endl; + cerr << "Exception caught!" << '\n'; + cerr << e.what() << '\n'; throw e; } - cout << "Encoding complete!" << endl; - cout << "Press any key to continue..." << endl; + cout << "Encoding complete!" << '\n'; + cout << "Press any key to continue..." << '\n'; getchar(); } diff --git a/examples/filtering_video/filtering_video.cpp b/examples/filtering_video/filtering_video.cpp index 07936b9..06ab0f3 100644 --- a/examples/filtering_video/filtering_video.cpp +++ b/examples/filtering_video/filtering_video.cpp @@ -46,13 +46,13 @@ int main() } catch (FFmpegException e) { - cerr << "Exception caught!" << endl; - cerr << e.what() << endl; + cerr << "Exception caught!" << '\n'; + cerr << e.what() << '\n'; throw e; } - cout << "Encoding complete!" << endl; - cout << "Press any key to continue..." << endl; + cout << "Encoding complete!" << '\n'; + cout << "Press any key to continue..." << '\n'; getchar(); } diff --git a/examples/remuxing/remuxing.cpp b/examples/remuxing/remuxing.cpp index 668c556..dc6c94d 100644 --- a/examples/remuxing/remuxing.cpp +++ b/examples/remuxing/remuxing.cpp @@ -58,13 +58,13 @@ int main() } catch (FFmpegException e) { - cerr << "Exception caught!" << endl; - cerr << e.what() << endl; + cerr << "Exception caught!" << '\n'; + cerr << e.what() << '\n'; throw e; } - cout << "Encoding complete!" << endl; - cout << "Press any key to continue..." << endl; + cout << "Encoding complete!" << '\n'; + cout << "Press any key to continue..." << '\n'; getchar(); } From 145c709799bbb87966110f33c256833e035b3644 Mon Sep 17 00:00:00 2001 From: Wim van Aarle Date: Mon, 17 Dec 2018 14:26:40 +0100 Subject: [PATCH 10/31] examples: use smart pointers instead of raw pointers This solves a bunch of memory leaks where objects didn't get deleted when an exception was thrown. --- examples/decode_audio/decode_audio.cpp | 16 ++-- examples/decode_video/decode_video.cpp | 17 ++-- examples/demo/GeneratedAudioSource.cpp | 3 +- examples/demo/GeneratedAudioSource.h | 4 +- examples/demo/GeneratedVideoSource.cpp | 3 +- examples/demo/GeneratedVideoSource.h | 4 +- examples/demo/demo.cpp | 91 +++++++------------- examples/encode_audio/encode_audio.cpp | 9 +- examples/encode_video/encode_video.cpp | 9 +- examples/filtering_video/filtering_video.cpp | 13 +-- examples/remuxing/remuxing.cpp | 19 ++-- 11 files changed, 81 insertions(+), 107 deletions(-) diff --git a/examples/decode_audio/decode_audio.cpp b/examples/decode_audio/decode_audio.cpp index 0d9cb6c..3ae7f34 100644 --- a/examples/decode_audio/decode_audio.cpp +++ b/examples/decode_audio/decode_audio.cpp @@ -1,5 +1,6 @@ #include +#include #include "ffmpegcpp.h" @@ -52,26 +53,23 @@ int main() try { // Load this container file so we can extract audio from it. - Demuxer* demuxer = new Demuxer("samples/big_buck_bunny.mp4"); + Demuxer demuxer("samples/big_buck_bunny.mp4"); // Create a file sink that will just output the raw audio data. - RawAudioFileSink* fileSink = new RawAudioFileSink("rawaudio"); + auto fileSink = std::make_unique("rawaudio"); // tie the file sink to the best audio stream in the input container. - demuxer->DecodeBestAudioStream(fileSink); + demuxer.DecodeBestAudioStream(fileSink.get()); // Prepare the output pipeline. This will push a small amount of frames to the file sink until it IsPrimed returns true. - demuxer->PreparePipeline(); + demuxer.PreparePipeline(); // Push all the remaining frames through. - while (!demuxer->IsDone()) + while (!demuxer.IsDone()) { - demuxer->Step(); + demuxer.Step(); } - // done - delete demuxer; - delete fileSink; } catch (FFmpegException e) { diff --git a/examples/decode_video/decode_video.cpp b/examples/decode_video/decode_video.cpp index 3031b41..2727f84 100644 --- a/examples/decode_video/decode_video.cpp +++ b/examples/decode_video/decode_video.cpp @@ -1,5 +1,6 @@ #include +#include #include "ffmpegcpp.h" @@ -67,26 +68,22 @@ int main() try { // Load this container file so we can extract video from it. - Demuxer* demuxer = new Demuxer("samples/big_buck_bunny.mp4"); + Demuxer demuxer("samples/big_buck_bunny.mp4"); // Create a file sink that will just output the raw frame data in one PGM file per frame. - PGMFileSink* fileSink = new PGMFileSink(); + auto fileSink = std::make_unique(); // tie the file sink to the best video stream in the input container. - demuxer->DecodeBestVideoStream(fileSink); + demuxer.DecodeBestVideoStream(fileSink.get()); // Prepare the output pipeline. This will push a small amount of frames to the file sink until it IsPrimed returns true. - demuxer->PreparePipeline(); + demuxer.PreparePipeline(); // Push all the remaining frames through. - while (!demuxer->IsDone()) + while (!demuxer.IsDone()) { - demuxer->Step(); + demuxer.Step(); } - - // done - delete demuxer; - delete fileSink; } catch (FFmpegException e) { diff --git a/examples/demo/GeneratedAudioSource.cpp b/examples/demo/GeneratedAudioSource.cpp index b1e04df..5fcd875 100644 --- a/examples/demo/GeneratedAudioSource.cpp +++ b/examples/demo/GeneratedAudioSource.cpp @@ -8,7 +8,7 @@ GeneratedAudioSource::GeneratedAudioSource(AudioFrameSink* frameSink) // generate a raw video source that will convert the raw format to any other format and pass it on to the encoder // or any other sink (might be a filter as well). - output = new RawAudioDataSource(format, this->sampleRate, this->channels, frameSink); + output = std::make_unique(format, this->sampleRate, this->channels, frameSink); samples = new uint16_t[channels * 2 * sampleCount]; @@ -16,7 +16,6 @@ GeneratedAudioSource::GeneratedAudioSource(AudioFrameSink* frameSink) GeneratedAudioSource::~GeneratedAudioSource() { - delete output; delete samples; } diff --git a/examples/demo/GeneratedAudioSource.h b/examples/demo/GeneratedAudioSource.h index f74e723..48989d8 100644 --- a/examples/demo/GeneratedAudioSource.h +++ b/examples/demo/GeneratedAudioSource.h @@ -1,5 +1,7 @@ #pragma once +#include + #include "ffmpegcpp.h" using namespace ffmpegcpp; @@ -21,7 +23,7 @@ class GeneratedAudioSource : public InputSource int channels; AVSampleFormat format; - RawAudioDataSource* output; + std::unique_ptr output; int sampleCount = 735; diff --git a/examples/demo/GeneratedVideoSource.cpp b/examples/demo/GeneratedVideoSource.cpp index 54cb44a..95142eb 100644 --- a/examples/demo/GeneratedVideoSource.cpp +++ b/examples/demo/GeneratedVideoSource.cpp @@ -4,12 +4,11 @@ GeneratedVideoSource::GeneratedVideoSource(int width, int height, VideoFrameSink { // generate a raw video source that will convert the raw format to any other format and pass it on to the encoder // or any other sink (might be a filter as well). - output = new RawVideoDataSource(width, height, AV_PIX_FMT_RGBA, AV_PIX_FMT_RGBA, 30, frameSink); + output = std::make_unique(width, height, AV_PIX_FMT_RGBA, AV_PIX_FMT_RGBA, 30, frameSink); } GeneratedVideoSource::~GeneratedVideoSource() { - delete output; delete rgb; } diff --git a/examples/demo/GeneratedVideoSource.h b/examples/demo/GeneratedVideoSource.h index 5faaddf..e40e2e3 100644 --- a/examples/demo/GeneratedVideoSource.h +++ b/examples/demo/GeneratedVideoSource.h @@ -1,5 +1,7 @@ #pragma once +#include + #include "ffmpegcpp.h" using namespace ffmpegcpp; @@ -17,7 +19,7 @@ class GeneratedVideoSource : public InputSource private: - RawVideoDataSource* output; + std::unique_ptr output; int frameNumber = 0; diff --git a/examples/demo/demo.cpp b/examples/demo/demo.cpp index 3175655..38b01b8 100644 --- a/examples/demo/demo.cpp +++ b/examples/demo/demo.cpp @@ -1,5 +1,6 @@ #include +#include #include "GeneratedVideoSource.h" #include "GeneratedAudioSource.h" @@ -63,24 +64,24 @@ void PlayDemo(int argc, char** argv) */ // create the output muxer - we'll be adding encoders to it later - Muxer* muxer = new Muxer(outputContainerName.c_str()); + auto muxer = std::make_unique(outputContainerName.c_str()); /** * CONFIGURE AUDIO OUTPUT */ // create the output encoder based on our setting above - AudioCodec* audioCodec = nullptr; + std::unique_ptr audioCodec; if (outputAudioCodec == "MP2") { printf("Encoding audio as MP2...\n"); - audioCodec = new AudioCodec(AV_CODEC_ID_MP2); + audioCodec = std::make_unique(AV_CODEC_ID_MP2); } else if (outputAudioCodec == "AAC") { printf("Encoding audio as AAC...\n"); - audioCodec = new AudioCodec(AV_CODEC_ID_AAC); + audioCodec = std::make_unique(AV_CODEC_ID_AAC); } else if (outputAudioCodec == "NONE") @@ -90,10 +91,10 @@ void PlayDemo(int argc, char** argv) // create an encoder - this encoder will receive raw data from any source (filter, file, container, memory, etc), // encode it and send it to the muxer (the output container). - AudioEncoder* audioEncoder = nullptr; + std::unique_ptr audioEncoder; if (audioCodec != nullptr) { - audioEncoder = new AudioEncoder(audioCodec, muxer); + audioEncoder = std::make_unique(audioCodec.get(), muxer.get()); } /** @@ -101,27 +102,27 @@ void PlayDemo(int argc, char** argv) */ // create the output encoder based on our setting above - VideoCodec* videoCodec = nullptr; + std::unique_ptr videoCodec; if (outputVideoCodec == "H264") { printf("Encoding video as H264 on Nvidia GPU...\n"); - H264NVEncCodec* h264Codec = new H264NVEncCodec(); + auto h264Codec = std::make_unique(); h264Codec->SetPreset("hq"); - videoCodec = h264Codec; + videoCodec = std::move(h264Codec); } else if (outputVideoCodec == "H265") { printf("Encoding video as H265 on Nvidia GPU...\n"); - H265NVEncCodec* h265Codec = new H265NVEncCodec(); + auto h265Codec = std::make_unique(); h265Codec->SetPreset("hq"); - videoCodec = h265Codec; + videoCodec = std::move(h265Codec); } else if (outputVideoCodec == "VP9") { printf("Encoding video as VP9...\n"); - VP9Codec* vp9Codec = new VP9Codec(); + auto vp9Codec = std::make_unique(); vp9Codec->SetLossless(true); - videoCodec = vp9Codec; + videoCodec = std::move(vp9Codec); } else if (outputVideoCodec == "NONE") { @@ -130,10 +131,10 @@ void PlayDemo(int argc, char** argv) // create an encoder for the codec and tie it to the muxer // this encoder will receive data from an input source (file, raw, filter, etc), encode it and send it to the output container (muxer) - VideoEncoder* videoEncoder = nullptr; + std::unique_ptr videoEncoder; if (videoCodec != nullptr) { - videoEncoder = new VideoEncoder(videoCodec, muxer); + videoEncoder = std::make_unique(videoCodec.get(), muxer.get()); } /** @@ -141,31 +142,31 @@ void PlayDemo(int argc, char** argv) */ // only do this when there is an output - otherwise there is no point in reading audio - InputSource* audioInputSource = nullptr; + std::unique_ptr audioInputSource; if (audioEncoder != nullptr) { if (inputAudioSource == "RAW") { printf("Pulling audio from %s...\n", rawAudioFile); - audioInputSource = new RawAudioFileSource(rawAudioFile, rawAudioFormat, rawAudioSampleRate, rawAudioChannels, audioEncoder); + audioInputSource = std::make_unique(rawAudioFile, rawAudioFormat, rawAudioSampleRate, rawAudioChannels, audioEncoder.get()); } else if (inputAudioSource == "ENCODED") { printf("Pulling audio from %s...\n", encodedAudioFile); - audioInputSource = new EncodedFileSource(encodedAudioFile, AV_CODEC_ID_MP3, audioEncoder); + audioInputSource = std::make_unique(encodedAudioFile, AV_CODEC_ID_MP3, audioEncoder.get()); } else if (inputAudioSource == "CONTAINER") { // if the input comes from a container, we use the demuxer class - it is just an input source like any other printf("Pulling audio from %s...\n", containerWithAudioFile); - Demuxer* demuxer = new Demuxer(containerWithAudioFile); - demuxer->DecodeBestAudioStream(audioEncoder); - audioInputSource = demuxer; + auto demuxer = std::make_unique(containerWithAudioFile); + demuxer->DecodeBestAudioStream(audioEncoder.get()); + audioInputSource = std::move(demuxer); } else if (inputAudioSource == "GENERATED") { printf("Generating 440Hz audio tone...\n"); - audioInputSource = new GeneratedAudioSource(audioEncoder); + audioInputSource = std::make_unique(audioEncoder.get()); } } @@ -173,17 +174,14 @@ void PlayDemo(int argc, char** argv) * CONFIGURE VIDEO FILTER IF IT IS USED */ - VideoFrameSink* videoFrameSink = videoEncoder; - // If a video filter was specified, we inject it into the pipeline here. // Instead of feeding the video source directly to the encoder, we feed it to // the video filter instead, which will pass it on to the encoder. - VideoFilter* videoFilter = nullptr; + std::unique_ptr videoFilter; if (videoFilterConfig != nullptr && videoEncoder != nullptr) { printf("Applying filter %s to video...\n", videoFilterConfig); - videoFilter = new VideoFilter(videoFilterConfig, videoEncoder); - videoFrameSink = videoFilter; // used to feed the source below + videoFilter = std::make_unique(videoFilterConfig, videoEncoder.get()); } /** @@ -191,30 +189,30 @@ void PlayDemo(int argc, char** argv) */ // only do this when there is video output - InputSource* videoInputSource = nullptr; + std::unique_ptr videoInputSource; if (videoEncoder != nullptr) { if (inputVideoSource == "RAW") { printf("Pulling video from %s...\n", rawVideoFile); - videoInputSource = new RawVideoFileSource(rawVideoFile, videoFrameSink); + videoInputSource = std::make_unique(rawVideoFile, videoFilter.get()); } else if (inputVideoSource == "ENCODED") { printf("Pulling video from %s...\n", encodedVideoFile); - videoInputSource = new RawVideoFileSource(encodedVideoFile, videoFrameSink); + videoInputSource = std::make_unique(encodedVideoFile, videoFilter.get()); } else if (inputVideoSource == "CONTAINER") { printf("Pulling video from %s...\n", containerWithVideoAndAudioFile); - Demuxer* demuxer = new Demuxer(containerWithVideoAndAudioFile); - demuxer->DecodeBestVideoStream(videoFrameSink); - videoInputSource = demuxer; + auto demuxer = std::make_unique(containerWithVideoAndAudioFile); + demuxer->DecodeBestVideoStream(videoFilter.get()); + videoInputSource = std::move(demuxer); } else if (inputVideoSource == "GENERATED") { printf("Generating checkerboard video pattern...\n"); - videoInputSource = new GeneratedVideoSource(640, 480, videoFrameSink); + videoInputSource = std::make_unique(640, 480, videoFilter.get()); } } @@ -249,31 +247,6 @@ void PlayDemo(int argc, char** argv) // close the muxer and save the file to disk muxer->Close(); - // all done - if (audioCodec != nullptr) - { - delete audioCodec; - delete audioEncoder; - } - if (videoCodec != nullptr) - { - delete videoCodec; - delete videoEncoder; - if (videoFilter != nullptr) delete videoFilter; - } - - if (audioInputSource != nullptr) - { - delete audioInputSource; - } - - if (videoInputSource != nullptr) - { - delete videoInputSource; - } - - - delete muxer; } catch (FFmpegException e) { diff --git a/examples/encode_audio/encode_audio.cpp b/examples/encode_audio/encode_audio.cpp index 2be6375..601495c 100644 --- a/examples/encode_audio/encode_audio.cpp +++ b/examples/encode_audio/encode_audio.cpp @@ -1,5 +1,6 @@ #include +#include #include "ffmpegcpp.h" @@ -12,21 +13,21 @@ int main() try { // Create a muxer that will output as MP3. - Muxer* muxer = new Muxer("output.mp3"); + auto muxer = std::make_unique("output.mp3"); // Create a MP3 codec that will encode the raw data. - AudioCodec* codec = new AudioCodec(AV_CODEC_ID_MP3); + auto codec = std::make_unique(AV_CODEC_ID_MP3); // Create an encoder that will encode the raw audio data as MP3. // Tie it to the muxer so it will be written to the file. - AudioEncoder* encoder = new AudioEncoder(codec, muxer); + auto encoder = std::make_unique(codec.get(), muxer.get()); // Load the raw audio file so we can process it. // We need to provide some info because we can't derive it from the raw format. // Hand it the encoder so it will pass on its raw data to the encoder, which will in turn pass it on to the muxer. const char* rawAudioFile = "samples/Vivaldi_s16le_2_channels_samplerate_11025.dat"; const char* rawAudioFormat = "s16le"; int rawAudioSampleRate = 11025; int rawAudioChannels = 2; - RawAudioFileSource* audioFile = new RawAudioFileSource(rawAudioFile, rawAudioFormat, rawAudioSampleRate, rawAudioChannels, encoder); + auto audioFile = std::make_unique(rawAudioFile, rawAudioFormat, rawAudioSampleRate, rawAudioChannels, encoder.get()); // Prepare the output pipeline. This will push a small amount of frames to the file sink until it IsPrimed returns true. audioFile->PreparePipeline(); diff --git a/examples/encode_video/encode_video.cpp b/examples/encode_video/encode_video.cpp index 856f472..050e301 100644 --- a/examples/encode_video/encode_video.cpp +++ b/examples/encode_video/encode_video.cpp @@ -1,5 +1,6 @@ #include +#include #include "ffmpegcpp.h" @@ -12,10 +13,10 @@ int main() try { // Create a muxer that will output the video as MKV. - Muxer* muxer = new Muxer("output.mpg"); + auto muxer = std::make_unique("output.mpg"); // Create a MPEG2 codec that will encode the raw data. - VideoCodec* codec = new VideoCodec("mpeg2video"); + auto codec = std::make_unique("mpeg2video"); // Set the global quality of the video encoding. This maps to the command line // parameter -qscale and must be within range [0,31]. @@ -23,13 +24,13 @@ int main() // Create an encoder that will encode the raw audio data as MP3. // Tie it to the muxer so it will be written to the file. - VideoEncoder* encoder = new VideoEncoder(codec, muxer); + auto encoder = std::make_unique(codec.get(), muxer.get()); // Load the raw video file so we can process it. // FFmpeg is very good at deducing the file format, even from raw video files, // but if we have something weird, we can specify the properties of the format // in the constructor as commented out below. - RawVideoFileSource* videoFile = new RawVideoFileSource("samples/carphone_qcif.y4m", encoder); + auto videoFile = std::make_unique("samples/carphone_qcif.y4m", encoder.get()); // Prepare the output pipeline. This will push a small amount of frames to the file sink until it IsPrimed returns true. videoFile->PreparePipeline(); diff --git a/examples/filtering_video/filtering_video.cpp b/examples/filtering_video/filtering_video.cpp index 06ab0f3..40d3a43 100644 --- a/examples/filtering_video/filtering_video.cpp +++ b/examples/filtering_video/filtering_video.cpp @@ -1,5 +1,6 @@ #include +#include #include "ffmpegcpp.h" @@ -12,10 +13,10 @@ int main() try { // Create a muxer that will output the video as MKV. - Muxer* muxer = new Muxer("filtered_video.mp4"); + auto muxer = std::make_unique("filtered_video.mp4"); // Create a MPEG2 codec that will encode the raw data. - VideoCodec* codec = new VideoCodec(AV_CODEC_ID_MPEG2VIDEO); + auto codec = std::make_unique(AV_CODEC_ID_MPEG2VIDEO); // Set the global quality of the video encoding. This maps to the command line // parameter -qscale and must be within range [0,31]. @@ -23,14 +24,14 @@ int main() // Create an encoder that will encode the raw audio data as MP3. // Tie it to the muxer so it will be written to the file. - VideoEncoder* encoder = new VideoEncoder(codec, muxer); + auto encoder = std::make_unique(codec.get(), muxer.get()); // Create a video filter and do some funny stuff with the video data. - VideoFilter* filter = new VideoFilter("scale=640:150,transpose=cclock,vignette", encoder); + auto filter = std::make_unique("scale=640:150,transpose=cclock,vignette", encoder.get()); // Load a video from a container and send it to the filter first. - Demuxer* demuxer = new Demuxer("samples/big_buck_bunny.mp4"); - demuxer->DecodeBestVideoStream(filter); + auto demuxer = std::make_unique("samples/big_buck_bunny.mp4"); + demuxer->DecodeBestVideoStream(filter.get()); // Prepare the output pipeline. This will push a small amount of frames to the file sink until it IsPrimed returns true. demuxer->PreparePipeline(); diff --git a/examples/remuxing/remuxing.cpp b/examples/remuxing/remuxing.cpp index dc6c94d..76b81e0 100644 --- a/examples/remuxing/remuxing.cpp +++ b/examples/remuxing/remuxing.cpp @@ -1,5 +1,6 @@ #include +#include #include "ffmpegcpp.h" @@ -13,10 +14,10 @@ int main() try { // Create a muxer that will output the video as MKV. - Muxer* muxer = new Muxer("output.mkv"); + auto muxer = std::make_unique("output.mkv"); // Create a codec that will encode video as VP9 - VP9Codec* videoCodec = new VP9Codec(); + auto videoCodec = std::make_unique(); // Configure the codec to not do compression, to use multiple CPU's and to go as fast as possible. videoCodec->SetLossless(true); @@ -24,19 +25,19 @@ int main() videoCodec->SetDeadline("realtime"); // Create a codec that will encode audio as AAC - AudioCodec* audioCodec = new AudioCodec(AV_CODEC_ID_AAC); + auto audioCodec = std::make_unique(AV_CODEC_ID_AAC); // Create encoders for both - VideoEncoder* videoEncoder = new VideoEncoder(videoCodec, muxer); - AudioEncoder* audioEncoder = new AudioEncoder(audioCodec, muxer); + auto videoEncoder = std::make_unique(videoCodec.get(), muxer.get()); + auto audioEncoder = std::make_unique(audioCodec.get(), muxer.get()); // Load both audio and video from a container - Demuxer* videoContainer = new Demuxer("samples/big_buck_bunny.mp4"); - Demuxer* audioContainer = new Demuxer("samples/DesiJourney.wav"); + auto videoContainer = std::make_unique("samples/big_buck_bunny.mp4"); + auto audioContainer = std::make_unique("samples/DesiJourney.wav"); // Tie the best stream from each container to the output - videoContainer->DecodeBestVideoStream(videoEncoder); - audioContainer->DecodeBestAudioStream(audioEncoder); + videoContainer->DecodeBestVideoStream(videoEncoder.get()); + audioContainer->DecodeBestAudioStream(audioEncoder.get()); // Prepare the pipeline. We want to call this before the rest of the loop // to ensure that the muxer will be fully ready to receive data from From 5d5b477bb71f6a6fdfaed54dcbbb1ec2271ce3e1 Mon Sep 17 00:00:00 2001 From: Wim van Aarle Date: Mon, 17 Dec 2018 14:30:51 +0100 Subject: [PATCH 11/31] examples: removed using namespace std --- examples/decode_audio/decode_audio.cpp | 9 ++++--- examples/decode_video/decode_video.cpp | 9 ++++--- examples/demo/demo.cpp | 25 ++++++++++---------- examples/encode_audio/encode_audio.cpp | 9 ++++--- examples/encode_video/encode_video.cpp | 9 ++++--- examples/filtering_video/filtering_video.cpp | 9 ++++--- examples/remuxing/remuxing.cpp | 9 ++++--- 7 files changed, 36 insertions(+), 43 deletions(-) diff --git a/examples/decode_audio/decode_audio.cpp b/examples/decode_audio/decode_audio.cpp index 3ae7f34..03e2876 100644 --- a/examples/decode_audio/decode_audio.cpp +++ b/examples/decode_audio/decode_audio.cpp @@ -4,7 +4,6 @@ #include "ffmpegcpp.h" -using namespace std; using namespace ffmpegcpp; class RawAudioFileSink : public AudioFrameSink @@ -73,13 +72,13 @@ int main() } catch (FFmpegException e) { - cerr << "Exception caught!" << '\n'; - cerr << e.what() << '\n'; + std::cerr << "Exception caught!" << '\n'; + std::cerr << e.what() << '\n'; throw e; } - cout << "Decoding complete!" << '\n'; - cout << "Press any key to continue..." << '\n'; + std::cout << "Decoding complete!" << '\n'; + std::cout << "Press any key to continue..." << '\n'; getchar(); } diff --git a/examples/decode_video/decode_video.cpp b/examples/decode_video/decode_video.cpp index 2727f84..96deeec 100644 --- a/examples/decode_video/decode_video.cpp +++ b/examples/decode_video/decode_video.cpp @@ -4,7 +4,6 @@ #include "ffmpegcpp.h" -using namespace std; using namespace ffmpegcpp; class PGMFileSink : public VideoFrameSink @@ -87,13 +86,13 @@ int main() } catch (FFmpegException e) { - cerr << "Exception caught!" << '\n'; - cerr << e.what() << '\n'; + std::cerr << "Exception caught!" << '\n'; + std::cerr << e.what() << '\n'; throw e; } - cout << "Decoding complete!" << '\n'; - cout << "Press any key to continue..." << '\n'; + std::cout << "Decoding complete!" << '\n'; + std::cout << "Press any key to continue..." << '\n'; getchar(); } diff --git a/examples/demo/demo.cpp b/examples/demo/demo.cpp index 38b01b8..d8c3235 100644 --- a/examples/demo/demo.cpp +++ b/examples/demo/demo.cpp @@ -8,7 +8,6 @@ #include using namespace ffmpegcpp; -using namespace std; // This example demonstrates different combinations and usages for ffmpeg-cpp. // Configure it by changing the values below. @@ -32,11 +31,11 @@ void PlayDemo(int argc, char** argv) const char* containerWithAudioFile = "samples/DesiJourney.wav"; // hard-code the settings here, but let them be overridden by the arguments - string inputAudioSource = "CONTAINER"; // options are RAW, ENCODED, CONTAINER, GENERATED - string inputVideoSource = "ENCODED"; // options are RAW, ENCODED, CONTAINER, GENERATED - string outputAudioCodec = "AAC"; // options are MP2, AAC, NONE - string outputVideoCodec = "H264"; // options are H264, H265, VP9, NONE (H264 and H265 only work on Nvidia hardware) - string outputContainerName = "out.mp4"; // container format is deduced from extension so use a known one + std::string inputAudioSource = "CONTAINER"; // options are RAW, ENCODED, CONTAINER, GENERATED + std::string inputVideoSource = "ENCODED"; // options are RAW, ENCODED, CONTAINER, GENERATED + std::string outputAudioCodec = "AAC"; // options are MP2, AAC, NONE + std::string outputVideoCodec = "H264"; // options are H264, H265, VP9, NONE (H264 and H265 only work on Nvidia hardware) + std::string outputContainerName = "out.mp4"; // container format is deduced from extension so use a known one // you can use any filter string that you can use in the ffmpeg command-line here // set the filter to NULL to disable filtering. @@ -47,10 +46,10 @@ void PlayDemo(int argc, char** argv) // if command line is specified, we overwrite our hard-coded settings if (argc >= 6) { - inputAudioSource = string(argv[1]); - inputVideoSource = string(argv[2]); - outputAudioCodec = string(argv[3]); - outputVideoCodec = string(argv[4]); + inputAudioSource = std::string(argv[1]); + inputVideoSource = std::string(argv[2]); + outputAudioCodec = std::string(argv[3]); + outputVideoCodec = std::string(argv[4]); videoFilterConfig = argv[5]; } @@ -250,7 +249,7 @@ void PlayDemo(int argc, char** argv) } catch (FFmpegException e) { - cerr << e.what() << '\n'; + std::cerr << e.what() << '\n'; throw e; } } @@ -259,8 +258,8 @@ int main(int argc, char **argv) { PlayDemo(argc, argv); - cout << "Encoding complete!" << '\n'; - cout << "Press any key to continue..." << '\n'; + std::cout << "Encoding complete!" << '\n'; + std::cout << "Press any key to continue..." << '\n'; getchar(); diff --git a/examples/encode_audio/encode_audio.cpp b/examples/encode_audio/encode_audio.cpp index 601495c..2138c0f 100644 --- a/examples/encode_audio/encode_audio.cpp +++ b/examples/encode_audio/encode_audio.cpp @@ -4,7 +4,6 @@ #include "ffmpegcpp.h" -using namespace std; using namespace ffmpegcpp; int main() @@ -43,13 +42,13 @@ int main() } catch (FFmpegException e) { - cerr << "Exception caught!" << '\n'; - cerr << e.what() << '\n'; + std::cerr << "Exception caught!" << '\n'; + std::cerr << e.what() << '\n'; throw e; } - cout << "Encoding complete!" << '\n'; - cout << "Press any key to continue..." << '\n'; + std::cout << "Encoding complete!" << '\n'; + std::cout << "Press any key to continue..." << '\n'; getchar(); } diff --git a/examples/encode_video/encode_video.cpp b/examples/encode_video/encode_video.cpp index 050e301..1bd54b6 100644 --- a/examples/encode_video/encode_video.cpp +++ b/examples/encode_video/encode_video.cpp @@ -4,7 +4,6 @@ #include "ffmpegcpp.h" -using namespace std; using namespace ffmpegcpp; int main() @@ -46,13 +45,13 @@ int main() } catch (FFmpegException e) { - cerr << "Exception caught!" << '\n'; - cerr << e.what() << '\n'; + std::cerr << "Exception caught!" << '\n'; + std::cerr << e.what() << '\n'; throw e; } - cout << "Encoding complete!" << '\n'; - cout << "Press any key to continue..." << '\n'; + std::cout << "Encoding complete!" << '\n'; + std::cout << "Press any key to continue..." << '\n'; getchar(); } diff --git a/examples/filtering_video/filtering_video.cpp b/examples/filtering_video/filtering_video.cpp index 40d3a43..dc5135f 100644 --- a/examples/filtering_video/filtering_video.cpp +++ b/examples/filtering_video/filtering_video.cpp @@ -4,7 +4,6 @@ #include "ffmpegcpp.h" -using namespace std; using namespace ffmpegcpp; int main() @@ -47,13 +46,13 @@ int main() } catch (FFmpegException e) { - cerr << "Exception caught!" << '\n'; - cerr << e.what() << '\n'; + std::cerr << "Exception caught!" << '\n'; + std::cerr << e.what() << '\n'; throw e; } - cout << "Encoding complete!" << '\n'; - cout << "Press any key to continue..." << '\n'; + std::cout << "Encoding complete!" << '\n'; + std::cout << "Press any key to continue..." << '\n'; getchar(); } diff --git a/examples/remuxing/remuxing.cpp b/examples/remuxing/remuxing.cpp index 76b81e0..5ee0d7b 100644 --- a/examples/remuxing/remuxing.cpp +++ b/examples/remuxing/remuxing.cpp @@ -4,7 +4,6 @@ #include "ffmpegcpp.h" -using namespace std; using namespace ffmpegcpp; @@ -59,13 +58,13 @@ int main() } catch (FFmpegException e) { - cerr << "Exception caught!" << '\n'; - cerr << e.what() << '\n'; + std::cerr << "Exception caught!" << '\n'; + std::cerr << e.what() << '\n'; throw e; } - cout << "Encoding complete!" << '\n'; - cout << "Press any key to continue..." << '\n'; + std::cout << "Encoding complete!" << '\n'; + std::cout << "Press any key to continue..." << '\n'; getchar(); } From 785c64d48b235f5434a3e4495be8c9c35c6439b2 Mon Sep 17 00:00:00 2001 From: Wim van Aarle Date: Mon, 17 Dec 2018 14:36:40 +0100 Subject: [PATCH 12/31] examples: removed using namespace ffmpegcpp --- examples/decode_audio/decode_audio.cpp | 8 ++-- examples/decode_video/decode_video.cpp | 8 ++-- examples/demo/GeneratedAudioSource.cpp | 4 +- examples/demo/GeneratedAudioSource.h | 8 ++-- examples/demo/GeneratedVideoSource.cpp | 4 +- examples/demo/GeneratedVideoSource.h | 8 ++-- examples/demo/demo.cpp | 48 ++++++++++---------- examples/encode_audio/encode_audio.cpp | 12 ++--- examples/encode_video/encode_video.cpp | 12 ++--- examples/filtering_video/filtering_video.cpp | 14 +++--- examples/remuxing/remuxing.cpp | 19 ++++---- 11 files changed, 63 insertions(+), 82 deletions(-) diff --git a/examples/decode_audio/decode_audio.cpp b/examples/decode_audio/decode_audio.cpp index 03e2876..d7fe5da 100644 --- a/examples/decode_audio/decode_audio.cpp +++ b/examples/decode_audio/decode_audio.cpp @@ -4,9 +4,7 @@ #include "ffmpegcpp.h" -using namespace ffmpegcpp; - -class RawAudioFileSink : public AudioFrameSink +class RawAudioFileSink : public ffmpegcpp::AudioFrameSink { public: @@ -52,7 +50,7 @@ int main() try { // Load this container file so we can extract audio from it. - Demuxer demuxer("samples/big_buck_bunny.mp4"); + ffmpegcpp::Demuxer demuxer("samples/big_buck_bunny.mp4"); // Create a file sink that will just output the raw audio data. auto fileSink = std::make_unique("rawaudio"); @@ -70,7 +68,7 @@ int main() } } - catch (FFmpegException e) + catch (ffmpegcpp::FFmpegException e) { std::cerr << "Exception caught!" << '\n'; std::cerr << e.what() << '\n'; diff --git a/examples/decode_video/decode_video.cpp b/examples/decode_video/decode_video.cpp index 96deeec..1f22279 100644 --- a/examples/decode_video/decode_video.cpp +++ b/examples/decode_video/decode_video.cpp @@ -4,9 +4,7 @@ #include "ffmpegcpp.h" -using namespace ffmpegcpp; - -class PGMFileSink : public VideoFrameSink +class PGMFileSink : public ffmpegcpp::VideoFrameSink { public: @@ -67,7 +65,7 @@ int main() try { // Load this container file so we can extract video from it. - Demuxer demuxer("samples/big_buck_bunny.mp4"); + ffmpegcpp::Demuxer demuxer("samples/big_buck_bunny.mp4"); // Create a file sink that will just output the raw frame data in one PGM file per frame. auto fileSink = std::make_unique(); @@ -84,7 +82,7 @@ int main() demuxer.Step(); } } - catch (FFmpegException e) + catch (ffmpegcpp::FFmpegException e) { std::cerr << "Exception caught!" << '\n'; std::cerr << e.what() << '\n'; diff --git a/examples/demo/GeneratedAudioSource.cpp b/examples/demo/GeneratedAudioSource.cpp index 5fcd875..95af79e 100644 --- a/examples/demo/GeneratedAudioSource.cpp +++ b/examples/demo/GeneratedAudioSource.cpp @@ -1,6 +1,6 @@ #include "GeneratedAudioSource.h" -GeneratedAudioSource::GeneratedAudioSource(AudioFrameSink* frameSink) +GeneratedAudioSource::GeneratedAudioSource(ffmpegcpp::AudioFrameSink* frameSink) { this->sampleRate = 44100; this->channels = 2; @@ -8,7 +8,7 @@ GeneratedAudioSource::GeneratedAudioSource(AudioFrameSink* frameSink) // generate a raw video source that will convert the raw format to any other format and pass it on to the encoder // or any other sink (might be a filter as well). - output = std::make_unique(format, this->sampleRate, this->channels, frameSink); + output = std::make_unique(format, this->sampleRate, this->channels, frameSink); samples = new uint16_t[channels * 2 * sampleCount]; diff --git a/examples/demo/GeneratedAudioSource.h b/examples/demo/GeneratedAudioSource.h index 48989d8..3fe0092 100644 --- a/examples/demo/GeneratedAudioSource.h +++ b/examples/demo/GeneratedAudioSource.h @@ -4,13 +4,11 @@ #include "ffmpegcpp.h" -using namespace ffmpegcpp; - -class GeneratedAudioSource : public InputSource +class GeneratedAudioSource : public ffmpegcpp::InputSource { public: - GeneratedAudioSource(AudioFrameSink* frameSink); + GeneratedAudioSource(ffmpegcpp::AudioFrameSink* frameSink); ~GeneratedAudioSource() override; void PreparePipeline() override; @@ -23,7 +21,7 @@ class GeneratedAudioSource : public InputSource int channels; AVSampleFormat format; - std::unique_ptr output; + std::unique_ptr output; int sampleCount = 735; diff --git a/examples/demo/GeneratedVideoSource.cpp b/examples/demo/GeneratedVideoSource.cpp index 95142eb..763f358 100644 --- a/examples/demo/GeneratedVideoSource.cpp +++ b/examples/demo/GeneratedVideoSource.cpp @@ -1,10 +1,10 @@ #include "GeneratedVideoSource.h" -GeneratedVideoSource::GeneratedVideoSource(int width, int height, VideoFrameSink* frameSink) +GeneratedVideoSource::GeneratedVideoSource(int width, int height, ffmpegcpp::VideoFrameSink* frameSink) { // generate a raw video source that will convert the raw format to any other format and pass it on to the encoder // or any other sink (might be a filter as well). - output = std::make_unique(width, height, AV_PIX_FMT_RGBA, AV_PIX_FMT_RGBA, 30, frameSink); + output = std::make_unique(width, height, AV_PIX_FMT_RGBA, AV_PIX_FMT_RGBA, 30, frameSink); } GeneratedVideoSource::~GeneratedVideoSource() diff --git a/examples/demo/GeneratedVideoSource.h b/examples/demo/GeneratedVideoSource.h index e40e2e3..9ad82d5 100644 --- a/examples/demo/GeneratedVideoSource.h +++ b/examples/demo/GeneratedVideoSource.h @@ -4,13 +4,11 @@ #include "ffmpegcpp.h" -using namespace ffmpegcpp; - -class GeneratedVideoSource : public InputSource +class GeneratedVideoSource : public ffmpegcpp::InputSource { public: - GeneratedVideoSource(int width, int height, VideoFrameSink* frameSink); + GeneratedVideoSource(int width, int height, ffmpegcpp::VideoFrameSink* frameSink); ~GeneratedVideoSource() override; void PreparePipeline() override; @@ -19,7 +17,7 @@ class GeneratedVideoSource : public InputSource private: - std::unique_ptr output; + std::unique_ptr output; int frameNumber = 0; diff --git a/examples/demo/demo.cpp b/examples/demo/demo.cpp index d8c3235..94b711b 100644 --- a/examples/demo/demo.cpp +++ b/examples/demo/demo.cpp @@ -7,8 +7,6 @@ #include -using namespace ffmpegcpp; - // This example demonstrates different combinations and usages for ffmpeg-cpp. // Configure it by changing the values below. // The list of supported codecs is not limited to the ones mentioned below, @@ -63,24 +61,24 @@ void PlayDemo(int argc, char** argv) */ // create the output muxer - we'll be adding encoders to it later - auto muxer = std::make_unique(outputContainerName.c_str()); + auto muxer = std::make_unique(outputContainerName.c_str()); /** * CONFIGURE AUDIO OUTPUT */ // create the output encoder based on our setting above - std::unique_ptr audioCodec; + std::unique_ptr audioCodec; if (outputAudioCodec == "MP2") { printf("Encoding audio as MP2...\n"); - audioCodec = std::make_unique(AV_CODEC_ID_MP2); + audioCodec = std::make_unique(AV_CODEC_ID_MP2); } else if (outputAudioCodec == "AAC") { printf("Encoding audio as AAC...\n"); - audioCodec = std::make_unique(AV_CODEC_ID_AAC); + audioCodec = std::make_unique(AV_CODEC_ID_AAC); } else if (outputAudioCodec == "NONE") @@ -90,10 +88,10 @@ void PlayDemo(int argc, char** argv) // create an encoder - this encoder will receive raw data from any source (filter, file, container, memory, etc), // encode it and send it to the muxer (the output container). - std::unique_ptr audioEncoder; + std::unique_ptr audioEncoder; if (audioCodec != nullptr) { - audioEncoder = std::make_unique(audioCodec.get(), muxer.get()); + audioEncoder = std::make_unique(audioCodec.get(), muxer.get()); } /** @@ -101,25 +99,25 @@ void PlayDemo(int argc, char** argv) */ // create the output encoder based on our setting above - std::unique_ptr videoCodec; + std::unique_ptr videoCodec; if (outputVideoCodec == "H264") { printf("Encoding video as H264 on Nvidia GPU...\n"); - auto h264Codec = std::make_unique(); + auto h264Codec = std::make_unique(); h264Codec->SetPreset("hq"); videoCodec = std::move(h264Codec); } else if (outputVideoCodec == "H265") { printf("Encoding video as H265 on Nvidia GPU...\n"); - auto h265Codec = std::make_unique(); + auto h265Codec = std::make_unique(); h265Codec->SetPreset("hq"); videoCodec = std::move(h265Codec); } else if (outputVideoCodec == "VP9") { printf("Encoding video as VP9...\n"); - auto vp9Codec = std::make_unique(); + auto vp9Codec = std::make_unique(); vp9Codec->SetLossless(true); videoCodec = std::move(vp9Codec); } @@ -130,10 +128,10 @@ void PlayDemo(int argc, char** argv) // create an encoder for the codec and tie it to the muxer // this encoder will receive data from an input source (file, raw, filter, etc), encode it and send it to the output container (muxer) - std::unique_ptr videoEncoder; + std::unique_ptr videoEncoder; if (videoCodec != nullptr) { - videoEncoder = std::make_unique(videoCodec.get(), muxer.get()); + videoEncoder = std::make_unique(videoCodec.get(), muxer.get()); } /** @@ -141,24 +139,24 @@ void PlayDemo(int argc, char** argv) */ // only do this when there is an output - otherwise there is no point in reading audio - std::unique_ptr audioInputSource; + std::unique_ptr audioInputSource; if (audioEncoder != nullptr) { if (inputAudioSource == "RAW") { printf("Pulling audio from %s...\n", rawAudioFile); - audioInputSource = std::make_unique(rawAudioFile, rawAudioFormat, rawAudioSampleRate, rawAudioChannels, audioEncoder.get()); + audioInputSource = std::make_unique(rawAudioFile, rawAudioFormat, rawAudioSampleRate, rawAudioChannels, audioEncoder.get()); } else if (inputAudioSource == "ENCODED") { printf("Pulling audio from %s...\n", encodedAudioFile); - audioInputSource = std::make_unique(encodedAudioFile, AV_CODEC_ID_MP3, audioEncoder.get()); + audioInputSource = std::make_unique(encodedAudioFile, AV_CODEC_ID_MP3, audioEncoder.get()); } else if (inputAudioSource == "CONTAINER") { // if the input comes from a container, we use the demuxer class - it is just an input source like any other printf("Pulling audio from %s...\n", containerWithAudioFile); - auto demuxer = std::make_unique(containerWithAudioFile); + auto demuxer = std::make_unique(containerWithAudioFile); demuxer->DecodeBestAudioStream(audioEncoder.get()); audioInputSource = std::move(demuxer); } @@ -176,11 +174,11 @@ void PlayDemo(int argc, char** argv) // If a video filter was specified, we inject it into the pipeline here. // Instead of feeding the video source directly to the encoder, we feed it to // the video filter instead, which will pass it on to the encoder. - std::unique_ptr videoFilter; + std::unique_ptr videoFilter; if (videoFilterConfig != nullptr && videoEncoder != nullptr) { printf("Applying filter %s to video...\n", videoFilterConfig); - videoFilter = std::make_unique(videoFilterConfig, videoEncoder.get()); + videoFilter = std::make_unique(videoFilterConfig, videoEncoder.get()); } /** @@ -188,23 +186,23 @@ void PlayDemo(int argc, char** argv) */ // only do this when there is video output - std::unique_ptr videoInputSource; + std::unique_ptr videoInputSource; if (videoEncoder != nullptr) { if (inputVideoSource == "RAW") { printf("Pulling video from %s...\n", rawVideoFile); - videoInputSource = std::make_unique(rawVideoFile, videoFilter.get()); + videoInputSource = std::make_unique(rawVideoFile, videoFilter.get()); } else if (inputVideoSource == "ENCODED") { printf("Pulling video from %s...\n", encodedVideoFile); - videoInputSource = std::make_unique(encodedVideoFile, videoFilter.get()); + videoInputSource = std::make_unique(encodedVideoFile, videoFilter.get()); } else if (inputVideoSource == "CONTAINER") { printf("Pulling video from %s...\n", containerWithVideoAndAudioFile); - auto demuxer = std::make_unique(containerWithVideoAndAudioFile); + auto demuxer = std::make_unique(containerWithVideoAndAudioFile); demuxer->DecodeBestVideoStream(videoFilter.get()); videoInputSource = std::move(demuxer); } @@ -247,7 +245,7 @@ void PlayDemo(int argc, char** argv) muxer->Close(); } - catch (FFmpegException e) + catch (ffmpegcpp::FFmpegException e) { std::cerr << e.what() << '\n'; throw e; diff --git a/examples/encode_audio/encode_audio.cpp b/examples/encode_audio/encode_audio.cpp index 2138c0f..8471e87 100644 --- a/examples/encode_audio/encode_audio.cpp +++ b/examples/encode_audio/encode_audio.cpp @@ -4,29 +4,27 @@ #include "ffmpegcpp.h" -using namespace ffmpegcpp; - int main() { // This example will take a raw audio file and encode it into as MP3. try { // Create a muxer that will output as MP3. - auto muxer = std::make_unique("output.mp3"); + auto muxer = std::make_unique("output.mp3"); // Create a MP3 codec that will encode the raw data. - auto codec = std::make_unique(AV_CODEC_ID_MP3); + auto codec = std::make_unique(AV_CODEC_ID_MP3); // Create an encoder that will encode the raw audio data as MP3. // Tie it to the muxer so it will be written to the file. - auto encoder = std::make_unique(codec.get(), muxer.get()); + auto encoder = std::make_unique(codec.get(), muxer.get()); // Load the raw audio file so we can process it. // We need to provide some info because we can't derive it from the raw format. // Hand it the encoder so it will pass on its raw data to the encoder, which will in turn pass it on to the muxer. const char* rawAudioFile = "samples/Vivaldi_s16le_2_channels_samplerate_11025.dat"; const char* rawAudioFormat = "s16le"; int rawAudioSampleRate = 11025; int rawAudioChannels = 2; - auto audioFile = std::make_unique(rawAudioFile, rawAudioFormat, rawAudioSampleRate, rawAudioChannels, encoder.get()); + auto audioFile = std::make_unique(rawAudioFile, rawAudioFormat, rawAudioSampleRate, rawAudioChannels, encoder.get()); // Prepare the output pipeline. This will push a small amount of frames to the file sink until it IsPrimed returns true. audioFile->PreparePipeline(); @@ -40,7 +38,7 @@ int main() // Save everything to disk by closing the muxer. muxer->Close(); } - catch (FFmpegException e) + catch (ffmpegcpp::FFmpegException e) { std::cerr << "Exception caught!" << '\n'; std::cerr << e.what() << '\n'; diff --git a/examples/encode_video/encode_video.cpp b/examples/encode_video/encode_video.cpp index 1bd54b6..3a6529b 100644 --- a/examples/encode_video/encode_video.cpp +++ b/examples/encode_video/encode_video.cpp @@ -4,18 +4,16 @@ #include "ffmpegcpp.h" -using namespace ffmpegcpp; - int main() { // This example will take a raw audio file and encode it into as MP3. try { // Create a muxer that will output the video as MKV. - auto muxer = std::make_unique("output.mpg"); + auto muxer = std::make_unique("output.mpg"); // Create a MPEG2 codec that will encode the raw data. - auto codec = std::make_unique("mpeg2video"); + auto codec = std::make_unique("mpeg2video"); // Set the global quality of the video encoding. This maps to the command line // parameter -qscale and must be within range [0,31]. @@ -23,13 +21,13 @@ int main() // Create an encoder that will encode the raw audio data as MP3. // Tie it to the muxer so it will be written to the file. - auto encoder = std::make_unique(codec.get(), muxer.get()); + auto encoder = std::make_unique(codec.get(), muxer.get()); // Load the raw video file so we can process it. // FFmpeg is very good at deducing the file format, even from raw video files, // but if we have something weird, we can specify the properties of the format // in the constructor as commented out below. - auto videoFile = std::make_unique("samples/carphone_qcif.y4m", encoder.get()); + auto videoFile = std::make_unique("samples/carphone_qcif.y4m", encoder.get()); // Prepare the output pipeline. This will push a small amount of frames to the file sink until it IsPrimed returns true. videoFile->PreparePipeline(); @@ -43,7 +41,7 @@ int main() // Save everything to disk by closing the muxer. muxer->Close(); } - catch (FFmpegException e) + catch (ffmpegcpp::FFmpegException e) { std::cerr << "Exception caught!" << '\n'; std::cerr << e.what() << '\n'; diff --git a/examples/filtering_video/filtering_video.cpp b/examples/filtering_video/filtering_video.cpp index dc5135f..aa3f1d6 100644 --- a/examples/filtering_video/filtering_video.cpp +++ b/examples/filtering_video/filtering_video.cpp @@ -4,18 +4,16 @@ #include "ffmpegcpp.h" -using namespace ffmpegcpp; - int main() { // This example will apply some filters to a video and write it back. try { // Create a muxer that will output the video as MKV. - auto muxer = std::make_unique("filtered_video.mp4"); + auto muxer = std::make_unique("filtered_video.mp4"); // Create a MPEG2 codec that will encode the raw data. - auto codec = std::make_unique(AV_CODEC_ID_MPEG2VIDEO); + auto codec = std::make_unique(AV_CODEC_ID_MPEG2VIDEO); // Set the global quality of the video encoding. This maps to the command line // parameter -qscale and must be within range [0,31]. @@ -23,13 +21,13 @@ int main() // Create an encoder that will encode the raw audio data as MP3. // Tie it to the muxer so it will be written to the file. - auto encoder = std::make_unique(codec.get(), muxer.get()); + auto encoder = std::make_unique(codec.get(), muxer.get()); // Create a video filter and do some funny stuff with the video data. - auto filter = std::make_unique("scale=640:150,transpose=cclock,vignette", encoder.get()); + auto filter = std::make_unique("scale=640:150,transpose=cclock,vignette", encoder.get()); // Load a video from a container and send it to the filter first. - auto demuxer = std::make_unique("samples/big_buck_bunny.mp4"); + auto demuxer = std::make_unique("samples/big_buck_bunny.mp4"); demuxer->DecodeBestVideoStream(filter.get()); // Prepare the output pipeline. This will push a small amount of frames to the file sink until it IsPrimed returns true. @@ -44,7 +42,7 @@ int main() // Save everything to disk by closing the muxer. muxer->Close(); } - catch (FFmpegException e) + catch (ffmpegcpp::FFmpegException e) { std::cerr << "Exception caught!" << '\n'; std::cerr << e.what() << '\n'; diff --git a/examples/remuxing/remuxing.cpp b/examples/remuxing/remuxing.cpp index 5ee0d7b..73b8c84 100644 --- a/examples/remuxing/remuxing.cpp +++ b/examples/remuxing/remuxing.cpp @@ -4,19 +4,16 @@ #include "ffmpegcpp.h" -using namespace ffmpegcpp; - - int main() { // This example will take a raw audio file and encode it into as MP3. try { // Create a muxer that will output the video as MKV. - auto muxer = std::make_unique("output.mkv"); + auto muxer = std::make_unique("output.mkv"); // Create a codec that will encode video as VP9 - auto videoCodec = std::make_unique(); + auto videoCodec = std::make_unique(); // Configure the codec to not do compression, to use multiple CPU's and to go as fast as possible. videoCodec->SetLossless(true); @@ -24,15 +21,15 @@ int main() videoCodec->SetDeadline("realtime"); // Create a codec that will encode audio as AAC - auto audioCodec = std::make_unique(AV_CODEC_ID_AAC); + auto audioCodec = std::make_unique(AV_CODEC_ID_AAC); // Create encoders for both - auto videoEncoder = std::make_unique(videoCodec.get(), muxer.get()); - auto audioEncoder = std::make_unique(audioCodec.get(), muxer.get()); + auto videoEncoder = std::make_unique(videoCodec.get(), muxer.get()); + auto audioEncoder = std::make_unique(audioCodec.get(), muxer.get()); // Load both audio and video from a container - auto videoContainer = std::make_unique("samples/big_buck_bunny.mp4"); - auto audioContainer = std::make_unique("samples/DesiJourney.wav"); + auto videoContainer = std::make_unique("samples/big_buck_bunny.mp4"); + auto audioContainer = std::make_unique("samples/DesiJourney.wav"); // Tie the best stream from each container to the output videoContainer->DecodeBestVideoStream(videoEncoder.get()); @@ -56,7 +53,7 @@ int main() // Save everything to disk by closing the muxer. muxer->Close(); } - catch (FFmpegException e) + catch (ffmpegcpp::FFmpegException e) { std::cerr << "Exception caught!" << '\n'; std::cerr << e.what() << '\n'; From dace7886de56680a4c7db6d341ac9886454a38a7 Mon Sep 17 00:00:00 2001 From: Wim van Aarle Date: Tue, 18 Dec 2018 13:30:52 +0100 Subject: [PATCH 13/31] smart pointerify all uses of AVCodecContext* --- include/ffmpegcpp/Codecs/Codec.h | 8 +-- include/ffmpegcpp/Demuxing/InputStream.h | 3 +- include/ffmpegcpp/FFmpegResource.h | 30 +++++++++++ include/ffmpegcpp/Sources/EncodedFileSource.h | 4 +- include/ffmpegcpp/ffmpegcpp.h | 1 + src/Codecs/Codec.cpp | 50 ++++++++----------- src/Demuxing/InputStream.cpp | 15 ++---- src/Sources/EncodedFileSource.cpp | 16 ++---- 8 files changed, 67 insertions(+), 60 deletions(-) create mode 100644 include/ffmpegcpp/FFmpegResource.h diff --git a/include/ffmpegcpp/Codecs/Codec.h b/include/ffmpegcpp/Codecs/Codec.h index 8d4d717..74ba5b6 100644 --- a/include/ffmpegcpp/Codecs/Codec.h +++ b/include/ffmpegcpp/Codecs/Codec.h @@ -4,6 +4,7 @@ #include "std.h" #include "OpenCodec.h" +#include "FFmpegResource.h" namespace ffmpegcpp { @@ -14,7 +15,6 @@ namespace ffmpegcpp Codec(const char* codecName); Codec(AVCodecID codecId); - virtual ~Codec(); void SetOption(const char* name, const char* value); void SetOption(const char* name, int value); @@ -24,16 +24,12 @@ namespace ffmpegcpp protected: - AVCodecContext* codecContext = nullptr; + FFmpegResource codecContext; OpenCodec* Open(); private: - void CleanUp(); - - AVCodecContext* LoadContext(AVCodec* codec); - bool opened = false; }; } diff --git a/include/ffmpegcpp/Demuxing/InputStream.h b/include/ffmpegcpp/Demuxing/InputStream.h index a9c2404..25ba1d6 100644 --- a/include/ffmpegcpp/Demuxing/InputStream.h +++ b/include/ffmpegcpp/Demuxing/InputStream.h @@ -3,6 +3,7 @@ #include "ffmpeg.h" #include "std.h" #include "FrameSinks/FrameSink.h" +#include "FFmpegResource.h" namespace ffmpegcpp { @@ -23,7 +24,7 @@ namespace ffmpegcpp protected: - AVCodecContext* codecContext = nullptr; + FFmpegResource codecContext; void SetFrameSink(FrameSink* frameSink); diff --git a/include/ffmpegcpp/FFmpegResource.h b/include/ffmpegcpp/FFmpegResource.h new file mode 100644 index 0000000..2b68f67 --- /dev/null +++ b/include/ffmpegcpp/FFmpegResource.h @@ -0,0 +1,30 @@ +#pragma once + +#include + +#include "ffmpeg.h" + +namespace ffmpegcpp +{ + + template struct Deleter {}; + + template <> + struct Deleter { + void operator()(AVCodecContext * ptr) { avcodec_free_context(&ptr); } + }; + + template + class FFmpegResource : public std::unique_ptr> + { + public: + FFmpegResource() : std::unique_ptr>() {} + FFmpegResource(value_type * ptr) : std::unique_ptr>(ptr) {} + }; + + template + FFmpegResource MakeFFmpegResource(value_type * ptr) + { + return FFmpegResource(ptr); + } +} diff --git a/include/ffmpegcpp/Sources/EncodedFileSource.h b/include/ffmpegcpp/Sources/EncodedFileSource.h index 29653d9..b1c3f1f 100644 --- a/include/ffmpegcpp/Sources/EncodedFileSource.h +++ b/include/ffmpegcpp/Sources/EncodedFileSource.h @@ -3,6 +3,7 @@ #include "ffmpeg.h" #include "FrameSinks/FrameSink.h" #include "Sources/InputSource.h" +#include "FFmpegResource.h" namespace ffmpegcpp { @@ -30,8 +31,7 @@ namespace ffmpegcpp AVCodecParserContext* parser = nullptr; - AVCodec* codec; - AVCodecContext* codecContext = nullptr; + FFmpegResource codecContext; int bufferSize; diff --git a/include/ffmpegcpp/ffmpegcpp.h b/include/ffmpegcpp/ffmpegcpp.h index 8890a08..5cc3fb3 100644 --- a/include/ffmpegcpp/ffmpegcpp.h +++ b/include/ffmpegcpp/ffmpegcpp.h @@ -26,3 +26,4 @@ #include "FFmpegException.h" +#include "FFmpegResource.h" diff --git a/src/Codecs/Codec.cpp b/src/Codecs/Codec.cpp index bd9435d..47bd020 100644 --- a/src/Codecs/Codec.cpp +++ b/src/Codecs/Codec.cpp @@ -4,6 +4,24 @@ using namespace std; +namespace +{ + ffmpegcpp::FFmpegResource LoadContext(AVCodec* codec) + { + auto codecContext = ffmpegcpp::MakeFFmpegResource(avcodec_alloc_context3(codec)); + if (!codecContext) + { + throw ffmpegcpp::FFmpegException("Could not allocate video codec context for codec " + string(codec->name)); + } + + // copy the type + codecContext->codec_type = codec->type; + + return codecContext; + } + +} + namespace ffmpegcpp { Codec::Codec(const char* codecName) @@ -35,29 +53,6 @@ namespace ffmpegcpp av_opt_set_double(codecContext->priv_data, name, value, 0); } - AVCodecContext* Codec::LoadContext(AVCodec* codec) - { - AVCodecContext* codecContext = avcodec_alloc_context3(codec); - if (!codecContext) - { - CleanUp(); - throw FFmpegException("Could not allocate video codec context for codec " + string(codec->name)); - } - - // copy the type - codecContext->codec_type = codec->type; - - return codecContext; - } - - void Codec::CleanUp() - { - if (codecContext != nullptr && !opened) - { - avcodec_free_context(&codecContext); - } - } - OpenCodec* Codec::Open() { if (opened) @@ -65,7 +60,7 @@ namespace ffmpegcpp throw FFmpegException("You can only open a codec once"); } - int ret = avcodec_open2(codecContext, codecContext->codec, nullptr); + int ret = avcodec_open2(codecContext.get(), codecContext->codec, nullptr); if (ret < 0) { throw FFmpegException("Could not open codecContext for codec", ret); @@ -73,12 +68,7 @@ namespace ffmpegcpp opened = true; - return new OpenCodec(codecContext); - } - - Codec::~Codec() - { - CleanUp(); + return new OpenCodec(codecContext.get()); } void Codec::SetGlobalContainerHeader() diff --git a/src/Demuxing/InputStream.cpp b/src/Demuxing/InputStream.cpp index a3177c8..045c1eb 100644 --- a/src/Demuxing/InputStream.cpp +++ b/src/Demuxing/InputStream.cpp @@ -19,7 +19,7 @@ namespace ffmpegcpp } // Allocate a codec context for the decoder - codecContext = avcodec_alloc_context3(codec); + codecContext = MakeFFmpegResource(avcodec_alloc_context3(codec)); if (!codecContext) { CleanUp(); @@ -45,7 +45,7 @@ namespace ffmpegcpp // Copy codec parameters from input stream to output codec context int ret; - if ((ret = avcodec_parameters_to_context(codecContext, stream->codecpar)) < 0) + if ((ret = avcodec_parameters_to_context(codecContext.get(), stream->codecpar)) < 0) { throw FFmpegException("Failed to copy " + string(codec->name) + " codec parameters to decoder context", ret); } @@ -54,7 +54,7 @@ namespace ffmpegcpp ConfigureCodecContext(); // Init the decoders - if ((ret = avcodec_open2(codecContext, codec, nullptr)) < 0) + if ((ret = avcodec_open2(codecContext.get(), codec, nullptr)) < 0) { throw FFmpegException("Failed to open codec " + string(codec->name), ret); } @@ -75,11 +75,6 @@ namespace ffmpegcpp void InputStream::CleanUp() { - if (codecContext != nullptr) - { - avcodec_free_context(&codecContext); - codecContext = nullptr; - } if (frame != nullptr) { av_frame_free(&frame); @@ -99,7 +94,7 @@ namespace ffmpegcpp int ret; /* send the packet with the compressed data to the decoder */ - ret = avcodec_send_packet(codecContext, pkt); + ret = avcodec_send_packet(codecContext.get(), pkt); if (ret < 0) { throw FFmpegException("Error submitting the packet to the decoder", ret); @@ -108,7 +103,7 @@ namespace ffmpegcpp /* read all the output frames (in general there may be any number of them */ while (ret >= 0) { - ret = avcodec_receive_frame(codecContext, frame); + ret = avcodec_receive_frame(codecContext.get(), frame); if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) return; else if (ret < 0) diff --git a/src/Sources/EncodedFileSource.cpp b/src/Sources/EncodedFileSource.cpp index 69ef3e1..97f9ddf 100644 --- a/src/Sources/EncodedFileSource.cpp +++ b/src/Sources/EncodedFileSource.cpp @@ -56,11 +56,6 @@ namespace ffmpegcpp delete buffer; buffer = nullptr; } - if (codecContext != nullptr) - { - avcodec_free_context(&codecContext); - codecContext = nullptr; - } if (parser != nullptr) { av_parser_close(parser); @@ -73,7 +68,6 @@ namespace ffmpegcpp void EncodedFileSource::Init(const char* inFileName, AVCodec* codec, FrameSink* output) { this->output = output; - this->codec = codec; parser = av_parser_init(codec->id); if (!parser) @@ -81,14 +75,14 @@ namespace ffmpegcpp throw FFmpegException("Parser for codec not found " + string(codec->name)); } - codecContext = avcodec_alloc_context3(codec); + codecContext = MakeFFmpegResource(avcodec_alloc_context3(codec)); if (!codecContext) { throw FFmpegException("Failed to allocate context for codec " + string(codec->name)); } /* open it */ - if (int ret = avcodec_open2(codecContext, codec, nullptr) < 0) + if (int ret = avcodec_open2(codecContext.get(), codec, nullptr) < 0) { throw FFmpegException("Failed to open context for codec " + string(codec->name), ret); } @@ -163,7 +157,7 @@ namespace ffmpegcpp data = buffer; while (data_size > 0) { - ret = av_parser_parse2(parser, codecContext, &pkt->data, &pkt->size, + ret = av_parser_parse2(parser, codecContext.get(), &pkt->data, &pkt->size, data, data_size, AV_NOPTS_VALUE, AV_NOPTS_VALUE, 0); if (ret < 0) { @@ -198,7 +192,7 @@ namespace ffmpegcpp int ret; /* send the packet with the compressed data to the decoder */ - ret = avcodec_send_packet(codecContext, pkt); + ret = avcodec_send_packet(codecContext.get(), pkt); if (ret < 0) { throw FFmpegException("Error submitting the packet to the decoder", ret); @@ -207,7 +201,7 @@ namespace ffmpegcpp /* read all the output frames (in general there may be any number of them */ while (ret >= 0) { - ret = avcodec_receive_frame(codecContext, frame); + ret = avcodec_receive_frame(codecContext.get(), frame); if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) return; else if (ret < 0) From 01872f60cd20af20306b0994ae70231b32fd7a10 Mon Sep 17 00:00:00 2001 From: Wim van Aarle Date: Tue, 18 Dec 2018 13:54:11 +0100 Subject: [PATCH 14/31] smart pointerify all uses of AVPacket* --- include/ffmpegcpp/FFmpegResource.h | 5 +++++ include/ffmpegcpp/FrameSinks/AudioEncoder.h | 3 ++- include/ffmpegcpp/FrameSinks/VideoEncoder.h | 3 ++- include/ffmpegcpp/Muxing/Muxer.h | 4 ++-- include/ffmpegcpp/Muxing/OutputStream.h | 4 ++-- include/ffmpegcpp/Sources/Demuxer.h | 3 ++- include/ffmpegcpp/Sources/EncodedFileSource.h | 2 +- src/FrameSinks/AudioEncoder.cpp | 12 ++++------- src/FrameSinks/VideoEncoder.cpp | 12 ++++------- src/Muxing/Muxer.cpp | 20 ++++++------------- src/Muxing/OutputStream.cpp | 16 +++++++-------- src/Sources/Demuxer.cpp | 15 +++++--------- src/Sources/EncodedFileSource.cpp | 11 +++------- 13 files changed, 45 insertions(+), 65 deletions(-) diff --git a/include/ffmpegcpp/FFmpegResource.h b/include/ffmpegcpp/FFmpegResource.h index 2b68f67..72611b6 100644 --- a/include/ffmpegcpp/FFmpegResource.h +++ b/include/ffmpegcpp/FFmpegResource.h @@ -14,6 +14,11 @@ namespace ffmpegcpp void operator()(AVCodecContext * ptr) { avcodec_free_context(&ptr); } }; + template <> + struct Deleter { + void operator()(AVPacket * ptr) { av_packet_free(&ptr); } + }; + template class FFmpegResource : public std::unique_ptr> { diff --git a/include/ffmpegcpp/FrameSinks/AudioEncoder.h b/include/ffmpegcpp/FrameSinks/AudioEncoder.h index ad1930d..48e595d 100644 --- a/include/ffmpegcpp/FrameSinks/AudioEncoder.h +++ b/include/ffmpegcpp/FrameSinks/AudioEncoder.h @@ -9,6 +9,7 @@ #include "AudioFormatConverter.h" #include "Muxing/Muxer.h" #include "Muxing/OutputStream.h" +#include "FFmpegResource.h" namespace ffmpegcpp { @@ -40,7 +41,7 @@ namespace ffmpegcpp AudioFormatConverter *formatConverter = nullptr; OpenCodec* codec = nullptr; - AVPacket* pkt = nullptr; + FFmpegResource pkt; int frameNumber = 0; diff --git a/include/ffmpegcpp/FrameSinks/VideoEncoder.h b/include/ffmpegcpp/FrameSinks/VideoEncoder.h index d9939b0..075529f 100644 --- a/include/ffmpegcpp/FrameSinks/VideoEncoder.h +++ b/include/ffmpegcpp/FrameSinks/VideoEncoder.h @@ -6,6 +6,7 @@ #include "Codecs/VideoCodec.h" #include "VideoFormatConverter.h" #include "Muxing/Muxer.h" +#include "FFmpegResource.h" namespace ffmpegcpp { @@ -33,7 +34,7 @@ namespace ffmpegcpp VideoFormatConverter* formatConverter = nullptr; OpenCodec* codec = nullptr; - AVPacket* pkt = nullptr; + FFmpegResource pkt; int frameNumber = 0; diff --git a/include/ffmpegcpp/Muxing/Muxer.h b/include/ffmpegcpp/Muxing/Muxer.h index 46b29f6..1d61891 100644 --- a/include/ffmpegcpp/Muxing/Muxer.h +++ b/include/ffmpegcpp/Muxing/Muxer.h @@ -2,7 +2,7 @@ #include "ffmpeg.h" #include "std.h" - +#include "FFmpegResource.h" namespace ffmpegcpp { @@ -29,7 +29,7 @@ namespace ffmpegcpp { void Open(); std::vector outputStreams; - std::vector packetQueue; + std::vector> packetQueue; AVOutputFormat* containerFormat; diff --git a/include/ffmpegcpp/Muxing/OutputStream.h b/include/ffmpegcpp/Muxing/OutputStream.h index 26088cd..4d4aa84 100644 --- a/include/ffmpegcpp/Muxing/OutputStream.h +++ b/include/ffmpegcpp/Muxing/OutputStream.h @@ -3,6 +3,7 @@ #include "ffmpeg.h" #include "Codecs/Codec.h" #include "Muxing/Muxer.h" +#include "FFmpegResource.h" namespace ffmpegcpp { @@ -26,10 +27,9 @@ namespace ffmpegcpp void SendPacketToMuxer(AVPacket* packet); - Codec* codec; - std::vector packetQueue; + std::vector> packetQueue; private: diff --git a/include/ffmpegcpp/Sources/Demuxer.h b/include/ffmpegcpp/Sources/Demuxer.h index 3daa648..ed5e63f 100644 --- a/include/ffmpegcpp/Sources/Demuxer.h +++ b/include/ffmpegcpp/Sources/Demuxer.h @@ -7,6 +7,7 @@ #include "Demuxing/VideoInputStream.h" #include "Demuxing/InputStream.h" #include "Sources/InputSource.h" +#include "FFmpegResource.h" namespace ffmpegcpp { @@ -50,7 +51,7 @@ namespace ffmpegcpp InputStream** inputStreams = nullptr; AVFormatContext* containerContext = nullptr; - AVPacket* pkt = nullptr; + FFmpegResource pkt; void DecodePacket(); diff --git a/include/ffmpegcpp/Sources/EncodedFileSource.h b/include/ffmpegcpp/Sources/EncodedFileSource.h index b1c3f1f..4246a62 100644 --- a/include/ffmpegcpp/Sources/EncodedFileSource.h +++ b/include/ffmpegcpp/Sources/EncodedFileSource.h @@ -36,7 +36,7 @@ namespace ffmpegcpp int bufferSize; AVFrame* decoded_frame = nullptr; - AVPacket* pkt = nullptr; + FFmpegResource pkt; uint8_t* buffer = nullptr; FILE* file; diff --git a/src/FrameSinks/AudioEncoder.cpp b/src/FrameSinks/AudioEncoder.cpp index 6677869..1169339 100644 --- a/src/FrameSinks/AudioEncoder.cpp +++ b/src/FrameSinks/AudioEncoder.cpp @@ -33,7 +33,7 @@ namespace ffmpegcpp codec = closedCodec->Open(bitRate, format, sampleRate); - pkt = av_packet_alloc(); + pkt = MakeFFmpegResource(av_packet_alloc()); if (!pkt) { CleanUp(); @@ -58,10 +58,6 @@ namespace ffmpegcpp void AudioEncoder::CleanUp() { - if (pkt != nullptr) - { - av_packet_free(&pkt); - } if (formatConverter != nullptr) { delete formatConverter; @@ -127,7 +123,7 @@ namespace ffmpegcpp int ret = 0; while (ret >= 0) { - ret = avcodec_receive_packet(codec->GetContext(), pkt); + ret = avcodec_receive_packet(codec->GetContext(), pkt.get()); if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) { return; @@ -139,9 +135,9 @@ namespace ffmpegcpp //printf("Write packet %3 (size=%5d)\n", data->pkt->pts, data->pkt->size); //fwrite(data->pkt->data, 1, data->pkt->size, data->f); - output->WritePacket(pkt, codec); + output->WritePacket(pkt.get(), codec); - av_packet_unref(pkt); + av_packet_unref(pkt.get()); } } diff --git a/src/FrameSinks/VideoEncoder.cpp b/src/FrameSinks/VideoEncoder.cpp index 479e578..20c629e 100644 --- a/src/FrameSinks/VideoEncoder.cpp +++ b/src/FrameSinks/VideoEncoder.cpp @@ -45,10 +45,6 @@ namespace ffmpegcpp void VideoEncoder::CleanUp() { - if (pkt != nullptr) - { - av_packet_free(&pkt); - } if (codec != nullptr) { delete codec; @@ -89,7 +85,7 @@ namespace ffmpegcpp codec = closedCodec->Open(width, height, &frameRate, format); // allocate the packet we'll be using - pkt = av_packet_alloc(); + pkt = MakeFFmpegResource(av_packet_alloc()); if (!pkt) { CleanUp(); @@ -154,7 +150,7 @@ namespace ffmpegcpp int ret = 0; while (ret >= 0) { - ret = avcodec_receive_packet(codec->GetContext(), pkt); + ret = avcodec_receive_packet(codec->GetContext(), pkt.get()); if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) { return; @@ -166,9 +162,9 @@ namespace ffmpegcpp //printf("Write packet %3 (size=%5d)\n", data->pkt->pts, data->pkt->size); //fwrite(data->pkt->data, 1, data->pkt->size, data->f); - output->WritePacket(pkt, codec); + output->WritePacket(pkt.get(), codec); - av_packet_unref(pkt); + av_packet_unref(pkt.get()); } } diff --git a/src/Muxing/Muxer.cpp b/src/Muxing/Muxer.cpp index c1a7ea1..17aaf16 100644 --- a/src/Muxing/Muxer.cpp +++ b/src/Muxing/Muxer.cpp @@ -59,13 +59,6 @@ namespace ffmpegcpp avformat_free_context(containerContext); containerContext = nullptr; } - - // clean up the queue - for (int i = 0; i < packetQueue.size(); ++i) - { - AVPacket* tmp_pkt = packetQueue[i]; - av_packet_free(&tmp_pkt); - } } void Muxer::AddOutputStream(OutputStream* outputStream) @@ -139,17 +132,16 @@ namespace ffmpegcpp // flush the queue for (int i = 0; i < packetQueue.size(); ++i) { - AVPacket* tmp_pkt = packetQueue[i]; + const auto & tmp_pkt = packetQueue[i]; // Write the compressed frame to the media file. - int ret = av_interleaved_write_frame(containerContext, tmp_pkt); + int ret = av_interleaved_write_frame(containerContext, tmp_pkt.get()); if (ret < 0) { throw FFmpegException("Error while writing frame to output container", ret); } - av_packet_unref(tmp_pkt); - av_packet_free(&tmp_pkt); + av_packet_unref(tmp_pkt.get()); } packetQueue.clear(); } @@ -157,13 +149,13 @@ namespace ffmpegcpp // not ready - buffer the packet else { - AVPacket* tmp_pkt = av_packet_alloc(); + auto tmp_pkt = MakeFFmpegResource(av_packet_alloc()); if (!tmp_pkt) { throw FFmpegException("Failed to allocate packet"); } - av_packet_ref(tmp_pkt, pkt); - packetQueue.push_back(tmp_pkt); + av_packet_ref(tmp_pkt.get(), pkt); + packetQueue.emplace_back(std::move(tmp_pkt)); } } diff --git a/src/Muxing/OutputStream.cpp b/src/Muxing/OutputStream.cpp index 373fdaf..062142e 100644 --- a/src/Muxing/OutputStream.cpp +++ b/src/Muxing/OutputStream.cpp @@ -27,13 +27,13 @@ namespace ffmpegcpp // otherwise, we queue the packet else { - AVPacket* tmp_pkt = av_packet_alloc(); + auto tmp_pkt = MakeFFmpegResource(av_packet_alloc()); if (!tmp_pkt) { throw FFmpegException("Failed to allocate packet"); } - av_packet_ref(tmp_pkt, pkt); - packetQueue.push_back(tmp_pkt); + av_packet_ref(tmp_pkt.get(), pkt); + packetQueue.emplace_back(std::move(tmp_pkt)); } } @@ -42,17 +42,15 @@ namespace ffmpegcpp if (packetQueue.size() > 0) printf("Drain %d packets from the packet queue...", packetQueue.size()); for (int i = 0; i < packetQueue.size(); ++i) { - AVPacket* tmp_pkt = packetQueue[i]; + const auto & tmp_pkt = packetQueue[i]; // Write the compressed frame to the media file - PreparePacketForMuxer(tmp_pkt); - muxer->WritePacket(tmp_pkt); + PreparePacketForMuxer(tmp_pkt.get()); + muxer->WritePacket(tmp_pkt.get()); // Release the packet - av_packet_unref(tmp_pkt); - av_packet_free(&tmp_pkt); + av_packet_unref(tmp_pkt.get()); } - packetQueue.clear(); } } diff --git a/src/Sources/Demuxer.cpp b/src/Sources/Demuxer.cpp index ed0dc53..1d537b1 100644 --- a/src/Sources/Demuxer.cpp +++ b/src/Sources/Demuxer.cpp @@ -40,13 +40,13 @@ namespace ffmpegcpp } // initialize packet, set data to NULL, let the demuxer fill it - pkt = av_packet_alloc(); + pkt = MakeFFmpegResource(av_packet_alloc()); if (!pkt) { CleanUp(); throw FFmpegException("Failed to create packet for input stream"); } - av_init_packet(pkt); + av_init_packet(pkt.get()); pkt->data = nullptr; pkt->size = 0; } @@ -75,11 +75,6 @@ namespace ffmpegcpp avformat_close_input(&containerContext); containerContext = nullptr; } - if (pkt != nullptr) - { - av_packet_free(&pkt); - pkt = nullptr; - } } vector Demuxer::GetAudioStreamInfo() @@ -208,7 +203,7 @@ namespace ffmpegcpp void Demuxer::Step() { // read frames from the file - int ret = av_read_frame(containerContext, pkt); + int ret = av_read_frame(containerContext, pkt.get()); // EOF if (ret == AVERROR_EOF) @@ -250,11 +245,11 @@ namespace ffmpegcpp if (inputStream != nullptr) { - inputStream->DecodePacket(pkt); + inputStream->DecodePacket(pkt.get()); } // We need to unref the packet here because packets might pass by here // that don't have a stream attached to them. We want to dismiss them! - av_packet_unref(pkt); + av_packet_unref(pkt.get()); } } \ No newline at end of file diff --git a/src/Sources/EncodedFileSource.cpp b/src/Sources/EncodedFileSource.cpp index 97f9ddf..7521935 100644 --- a/src/Sources/EncodedFileSource.cpp +++ b/src/Sources/EncodedFileSource.cpp @@ -46,11 +46,6 @@ namespace ffmpegcpp av_frame_free(&decoded_frame); decoded_frame = nullptr; } - if (pkt != nullptr) - { - av_packet_free(&pkt); - pkt = nullptr; - } if (buffer != nullptr) { delete buffer; @@ -99,7 +94,7 @@ namespace ffmpegcpp throw FFmpegException("Could not allocate video frame"); } - pkt = av_packet_alloc(); + pkt = MakeFFmpegResource(av_packet_alloc()); if (!pkt) { throw FFmpegException("Failed to allocate packet"); @@ -168,7 +163,7 @@ namespace ffmpegcpp if (pkt->size) { - Decode(pkt, decoded_frame); + Decode(pkt.get(), decoded_frame); } } @@ -179,7 +174,7 @@ namespace ffmpegcpp /* flush the decoder */ pkt->data = nullptr; pkt->size = 0; - Decode(pkt, decoded_frame); + Decode(pkt.get(), decoded_frame); output->Close(); From 165c80ea603a4ec209d2cb6be436d726203c5688 Mon Sep 17 00:00:00 2001 From: Wim van Aarle Date: Tue, 18 Dec 2018 14:13:03 +0100 Subject: [PATCH 15/31] smart pointerify all uses of AVFrame* --- include/ffmpegcpp/AudioFormatConverter.h | 5 ++-- include/ffmpegcpp/Demuxing/InputStream.h | 5 +--- include/ffmpegcpp/FFmpegResource.h | 5 ++++ include/ffmpegcpp/FrameSinks/VideoFilter.h | 3 ++- include/ffmpegcpp/Sources/EncodedFileSource.h | 2 +- .../ffmpegcpp/Sources/RawAudioDataSource.h | 6 ++--- .../ffmpegcpp/Sources/RawVideoDataSource.h | 3 ++- include/ffmpegcpp/VideoFormatConverter.h | 3 ++- src/AudioFormatConverter.cpp | 26 ++++++------------- src/Demuxing/InputStream.cpp | 22 +++------------- src/FrameSinks/VideoFilter.cpp | 9 +++---- src/Sources/EncodedFileSource.cpp | 11 +++----- src/Sources/RawAudioDataSource.cpp | 24 +++-------------- src/Sources/RawVideoDataSource.cpp | 13 +++------- src/VideoFormatConverter.cpp | 13 +++------- 15 files changed, 48 insertions(+), 102 deletions(-) diff --git a/include/ffmpegcpp/AudioFormatConverter.h b/include/ffmpegcpp/AudioFormatConverter.h index 8891b53..686666d 100644 --- a/include/ffmpegcpp/AudioFormatConverter.h +++ b/include/ffmpegcpp/AudioFormatConverter.h @@ -2,6 +2,7 @@ #include "ffmpeg.h" #include "ConvertedAudioProcessor.h" +#include "FFmpegResource.h" namespace ffmpegcpp { @@ -34,8 +35,8 @@ namespace ffmpegcpp bool initialized = false; AVAudioFifo* fifo = nullptr; - AVFrame* tmp_frame = nullptr; - AVFrame* converted_frame = nullptr; + FFmpegResource tmp_frame; + FFmpegResource converted_frame; struct SwrContext* swr_ctx = nullptr; int in_sample_rate, out_sample_rate; diff --git a/include/ffmpegcpp/Demuxing/InputStream.h b/include/ffmpegcpp/Demuxing/InputStream.h index 25ba1d6..9634596 100644 --- a/include/ffmpegcpp/Demuxing/InputStream.h +++ b/include/ffmpegcpp/Demuxing/InputStream.h @@ -13,7 +13,6 @@ namespace ffmpegcpp public: InputStream(AVStream* stream); - ~InputStream(); void Open(); @@ -38,9 +37,7 @@ namespace ffmpegcpp FrameSink* output; - AVFrame* frame; - - void CleanUp(); + FFmpegResource frame; }; diff --git a/include/ffmpegcpp/FFmpegResource.h b/include/ffmpegcpp/FFmpegResource.h index 72611b6..33d3e10 100644 --- a/include/ffmpegcpp/FFmpegResource.h +++ b/include/ffmpegcpp/FFmpegResource.h @@ -19,6 +19,11 @@ namespace ffmpegcpp void operator()(AVPacket * ptr) { av_packet_free(&ptr); } }; + template <> + struct Deleter { + void operator()(AVFrame * ptr) { av_frame_free(&ptr); } + }; + template class FFmpegResource : public std::unique_ptr> { diff --git a/include/ffmpegcpp/FrameSinks/VideoFilter.h b/include/ffmpegcpp/FrameSinks/VideoFilter.h index 980c74b..e94b51b 100644 --- a/include/ffmpegcpp/FrameSinks/VideoFilter.h +++ b/include/ffmpegcpp/FrameSinks/VideoFilter.h @@ -3,6 +3,7 @@ #include "ffmpeg.h" #include "FrameSinks/VideoFrameSink.h" +#include "FFmpegResource.h" namespace ffmpegcpp { @@ -32,7 +33,7 @@ namespace ffmpegcpp AVFilterGraph *filter_graph = nullptr; AVFilterContext *buffersink_ctx = nullptr; AVFilterContext *buffersrc_ctx = nullptr; - AVFrame* filt_frame = nullptr; + FFmpegResource filt_frame; bool initialized = false; diff --git a/include/ffmpegcpp/Sources/EncodedFileSource.h b/include/ffmpegcpp/Sources/EncodedFileSource.h index 4246a62..e8453b6 100644 --- a/include/ffmpegcpp/Sources/EncodedFileSource.h +++ b/include/ffmpegcpp/Sources/EncodedFileSource.h @@ -35,7 +35,7 @@ namespace ffmpegcpp int bufferSize; - AVFrame* decoded_frame = nullptr; + FFmpegResource decoded_frame; FFmpegResource pkt; uint8_t* buffer = nullptr; diff --git a/include/ffmpegcpp/Sources/RawAudioDataSource.h b/include/ffmpegcpp/Sources/RawAudioDataSource.h index e144a8e..01aa3fe 100644 --- a/include/ffmpegcpp/Sources/RawAudioDataSource.h +++ b/include/ffmpegcpp/Sources/RawAudioDataSource.h @@ -2,6 +2,7 @@ #include "ffmpeg.h" #include "FrameSinks/AudioFrameSink.h" +#include "FFmpegResource.h" namespace ffmpegcpp { @@ -14,7 +15,6 @@ namespace ffmpegcpp RawAudioDataSource(AVSampleFormat sampleFormat, int sampleRate, int channels, AudioFrameSink* output); RawAudioDataSource(AVSampleFormat sampleFormat, int sampleRate, int channels, int64_t channelLayout, AudioFrameSink* output); - virtual ~RawAudioDataSource(); void WriteData(void* data, int sampleCount); void Close(); @@ -23,10 +23,8 @@ namespace ffmpegcpp private: - void CleanUp(); - AudioFrameSink* output; - AVFrame* frame = nullptr; + FFmpegResource frame; }; } diff --git a/include/ffmpegcpp/Sources/RawVideoDataSource.h b/include/ffmpegcpp/Sources/RawVideoDataSource.h index b62a154..e372bd0 100644 --- a/include/ffmpegcpp/Sources/RawVideoDataSource.h +++ b/include/ffmpegcpp/Sources/RawVideoDataSource.h @@ -2,6 +2,7 @@ #include "ffmpeg.h" #include "FrameSinks/VideoFrameSink.h" +#include "FFmpegResource.h" namespace ffmpegcpp { @@ -34,7 +35,7 @@ namespace ffmpegcpp VideoFrameSink* output; - AVFrame* frame = nullptr; + FFmpegResource frame; struct SwsContext* swsContext = nullptr; }; } diff --git a/include/ffmpegcpp/VideoFormatConverter.h b/include/ffmpegcpp/VideoFormatConverter.h index 6d252e4..75dc314 100644 --- a/include/ffmpegcpp/VideoFormatConverter.h +++ b/include/ffmpegcpp/VideoFormatConverter.h @@ -2,6 +2,7 @@ #include "ffmpeg.h" #include "ConvertedAudioProcessor.h" +#include "FFmpegResource.h" namespace ffmpegcpp { @@ -27,7 +28,7 @@ namespace ffmpegcpp bool initialized = false; - AVFrame* converted_frame = nullptr; + FFmpegResource converted_frame; struct SwsContext* swsContext = nullptr; }; diff --git a/src/AudioFormatConverter.cpp b/src/AudioFormatConverter.cpp index f25cbdb..4840caa 100644 --- a/src/AudioFormatConverter.cpp +++ b/src/AudioFormatConverter.cpp @@ -8,7 +8,7 @@ namespace ffmpegcpp this->output = writer; this->codecContext = codecContext; - converted_frame = av_frame_alloc(); + converted_frame = MakeFFmpegResource(av_frame_alloc()); int ret; if (!converted_frame) { @@ -30,7 +30,7 @@ namespace ffmpegcpp converted_frame->nb_samples = nb_samples; if (nb_samples) { - ret = av_frame_get_buffer(converted_frame, 0); + ret = av_frame_get_buffer(converted_frame.get(), 0); if (ret < 0) { CleanUp(); @@ -40,7 +40,7 @@ namespace ffmpegcpp // create the temporary frame that will hold parts of the converted data // this data will later be assembled in a complete converted_frame. - tmp_frame = av_frame_alloc(); + tmp_frame = MakeFFmpegResource(av_frame_alloc()); if (!tmp_frame) { CleanUp(); @@ -67,16 +67,6 @@ namespace ffmpegcpp void AudioFormatConverter::CleanUp() { - if (converted_frame != nullptr) - { - av_frame_free(&converted_frame); - converted_frame = nullptr; - } - if (tmp_frame != nullptr) - { - av_frame_free(&tmp_frame); - tmp_frame = nullptr; - } if (swr_ctx != nullptr) { swr_free(&swr_ctx); @@ -126,7 +116,7 @@ namespace ffmpegcpp } int ret; - ret = swr_convert_frame(swr_ctx, tmp_frame, frame); + ret = swr_convert_frame(swr_ctx, tmp_frame.get(), frame); if (ret < 0) { throw FFmpegException("Error while converting audio frame to destination format", ret); @@ -134,8 +124,8 @@ namespace ffmpegcpp while (tmp_frame->nb_samples > 0) { - AddToFifo(tmp_frame); - ret = swr_convert_frame(swr_ctx, tmp_frame, nullptr); + AddToFifo(tmp_frame.get()); + ret = swr_convert_frame(swr_ctx, tmp_frame.get(), nullptr); if (ret < 0) { throw FFmpegException("Error while converting audio frame to destination format", ret); @@ -203,10 +193,10 @@ namespace ffmpegcpp converted_frame->pts = av_rescale_q(samples_count, inv_sample_rate, codecContext->time_base); samples_count += converted_frame->nb_samples; - output->WriteConvertedFrame(converted_frame); + output->WriteConvertedFrame(converted_frame.get()); samplesInCurrentFrame = 0; - int ret = av_frame_make_writable(converted_frame); + int ret = av_frame_make_writable(converted_frame.get()); if (ret < 0) { throw FFmpegException("Failed to make audio frame writable", ret); diff --git a/src/Demuxing/InputStream.cpp b/src/Demuxing/InputStream.cpp index 045c1eb..fe44e86 100644 --- a/src/Demuxing/InputStream.cpp +++ b/src/Demuxing/InputStream.cpp @@ -14,7 +14,6 @@ namespace ffmpegcpp AVCodec* codec = CodecDeducer::DeduceDecoder(stream->codecpar->codec_id); if (!codec) { - CleanUp(); throw FFmpegException("Failed to find codec for stream " + to_string(stream->index)); } @@ -22,18 +21,12 @@ namespace ffmpegcpp codecContext = MakeFFmpegResource(avcodec_alloc_context3(codec)); if (!codecContext) { - CleanUp(); throw FFmpegException("Failed to allocate the codec context for " + string(codec->name)); } codecContext->framerate = stream->avg_frame_rate; } - InputStream::~InputStream() - { - CleanUp(); - } - void InputStream::ConfigureCodecContext() { // does nothing by default @@ -66,22 +59,13 @@ namespace ffmpegcpp timeBaseCorrectedByTicksPerFrame.num *= codecContext->ticks_per_frame; // assign the frame that will be read from the container - frame = av_frame_alloc(); + frame = MakeFFmpegResource(av_frame_alloc()); if (!frame) { throw FFmpegException("Could not allocate frame"); } } - void InputStream::CleanUp() - { - if (frame != nullptr) - { - av_frame_free(&frame); - frame = nullptr; - } - } - void InputStream::SetFrameSink(FrameSink* frameSink) { output = frameSink; @@ -103,7 +87,7 @@ namespace ffmpegcpp /* read all the output frames (in general there may be any number of them */ while (ret >= 0) { - ret = avcodec_receive_frame(codecContext.get(), frame); + ret = avcodec_receive_frame(codecContext.get(), frame.get()); if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) return; else if (ret < 0) @@ -126,7 +110,7 @@ namespace ffmpegcpp // push the frame to the next stage. // The time_base is filled in in the codecContext after the first frame is decoded // so we can fetch it from there. - output->WriteFrame(frame, time_base); + output->WriteFrame(frame.get(), time_base); } } diff --git a/src/FrameSinks/VideoFilter.cpp b/src/FrameSinks/VideoFilter.cpp index b9fd96e..13c3525 100644 --- a/src/FrameSinks/VideoFilter.cpp +++ b/src/FrameSinks/VideoFilter.cpp @@ -18,7 +18,6 @@ namespace ffmpegcpp void VideoFilter::CleanUp() { avfilter_graph_free(&filter_graph); - av_frame_free(&filt_frame); } void VideoFilter::InitDelayed(AVFrame* frame, AVRational* timeBase) @@ -35,7 +34,7 @@ namespace ffmpegcpp const AVFilter *buffersrc = avfilter_get_by_name("buffer"); const AVFilter *buffersink = avfilter_get_by_name("buffersink"); - filt_frame = av_frame_alloc(); + filt_frame = MakeFFmpegResource(av_frame_alloc()); if (!filt_frame) { throw FFmpegException("Could not allocate intermediate video frame for filter"); @@ -171,7 +170,7 @@ namespace ffmpegcpp int ret = 0; while (ret >= 0) { - ret = av_buffersink_get_frame(buffersink_ctx, filt_frame); + ret = av_buffersink_get_frame(buffersink_ctx, filt_frame.get()); if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) { return; @@ -181,9 +180,9 @@ namespace ffmpegcpp throw FFmpegException("Erorr during filtering", ret); } - target->WriteFrame(filt_frame, timeBase); + target->WriteFrame(filt_frame.get(), timeBase); - av_frame_unref(filt_frame); + av_frame_unref(filt_frame.get()); } } diff --git a/src/Sources/EncodedFileSource.cpp b/src/Sources/EncodedFileSource.cpp index 7521935..92c4ce5 100644 --- a/src/Sources/EncodedFileSource.cpp +++ b/src/Sources/EncodedFileSource.cpp @@ -41,11 +41,6 @@ namespace ffmpegcpp void EncodedFileSource::CleanUp() { - if (decoded_frame != nullptr) - { - av_frame_free(&decoded_frame); - decoded_frame = nullptr; - } if (buffer != nullptr) { delete buffer; @@ -88,7 +83,7 @@ namespace ffmpegcpp throw FFmpegException("Could not open file " + string(inFileName)); } - decoded_frame = av_frame_alloc(); + decoded_frame = MakeFFmpegResource(av_frame_alloc()); if (!decoded_frame) { throw FFmpegException("Could not allocate video frame"); @@ -163,7 +158,7 @@ namespace ffmpegcpp if (pkt->size) { - Decode(pkt.get(), decoded_frame); + Decode(pkt.get(), decoded_frame.get()); } } @@ -174,7 +169,7 @@ namespace ffmpegcpp /* flush the decoder */ pkt->data = nullptr; pkt->size = 0; - Decode(pkt.get(), decoded_frame); + Decode(pkt.get(), decoded_frame.get()); output->Close(); diff --git a/src/Sources/RawAudioDataSource.cpp b/src/Sources/RawAudioDataSource.cpp index 01156c3..84d2500 100644 --- a/src/Sources/RawAudioDataSource.cpp +++ b/src/Sources/RawAudioDataSource.cpp @@ -16,10 +16,9 @@ namespace ffmpegcpp // create the frame int ret; - frame = av_frame_alloc(); + frame = MakeFFmpegResource(av_frame_alloc()); if (!frame) { - CleanUp(); throw FFmpegException("Could not allocate video frame"); } @@ -30,35 +29,20 @@ namespace ffmpegcpp frame->nb_samples = 735; // allocate the buffers for the frame data - ret = av_frame_get_buffer(frame, 0); + ret = av_frame_get_buffer(frame.get(), 0); if (ret < 0) { - CleanUp(); throw FFmpegException("Could not allocate the video frame data", ret); } } - RawAudioDataSource::~RawAudioDataSource() - { - CleanUp(); - } - - void RawAudioDataSource::CleanUp() - { - if (frame != nullptr) - { - av_frame_free(&frame); - frame = nullptr; - } - } - void RawAudioDataSource::WriteData(void* data, int sampleCount) { // resize the frame to the input frame->nb_samples = sampleCount; - int ret = av_frame_make_writable(frame); + int ret = av_frame_make_writable(frame.get()); if (ret < 0) { throw FFmpegException("Failed to make audio frame writable", ret); @@ -70,7 +54,7 @@ namespace ffmpegcpp // pass on to the sink // we don't have a time_base so we pass NULL and hope that it gets handled later... - output->WriteFrame(frame, nullptr); + output->WriteFrame(frame.get(), nullptr); } void RawAudioDataSource::Close() diff --git a/src/Sources/RawVideoDataSource.cpp b/src/Sources/RawVideoDataSource.cpp index 4170371..9c6a46b 100644 --- a/src/Sources/RawVideoDataSource.cpp +++ b/src/Sources/RawVideoDataSource.cpp @@ -27,7 +27,7 @@ namespace ffmpegcpp // create the frame int ret; - frame = av_frame_alloc(); + frame = MakeFFmpegResource(av_frame_alloc()); if (!frame) { CleanUp(); @@ -39,7 +39,7 @@ namespace ffmpegcpp frame->height = height; /* allocate the buffers for the frame data */ - ret = av_frame_get_buffer(frame, 32); + ret = av_frame_get_buffer(frame.get(), 32); if (ret < 0) { CleanUp(); @@ -54,11 +54,6 @@ namespace ffmpegcpp void RawVideoDataSource::CleanUp() { - if (frame != nullptr) - { - av_frame_free(&frame); - frame = nullptr; - } if (swsContext != nullptr) { sws_freeContext(swsContext); @@ -69,7 +64,7 @@ namespace ffmpegcpp void RawVideoDataSource::WriteFrame(void* data, int bytesPerRow) { // make sure the frame data is writable - int ret = av_frame_make_writable(frame); + int ret = av_frame_make_writable(frame.get()); if (ret < 0) { throw FFmpegException("Error making frame writable", ret); @@ -87,7 +82,7 @@ namespace ffmpegcpp frame->height, frame->data, frame->linesize); // send to the output - output->WriteFrame(frame, &this->timeBase); + output->WriteFrame(frame.get(), &this->timeBase); } void RawVideoDataSource::Close() diff --git a/src/VideoFormatConverter.cpp b/src/VideoFormatConverter.cpp index 345edd0..1b058ab 100644 --- a/src/VideoFormatConverter.cpp +++ b/src/VideoFormatConverter.cpp @@ -7,7 +7,7 @@ namespace ffmpegcpp { this->codecContext = codecContext; - converted_frame = av_frame_alloc(); + converted_frame = MakeFFmpegResource(av_frame_alloc()); int ret; if (!converted_frame) { @@ -21,7 +21,7 @@ namespace ffmpegcpp converted_frame->height = codecContext->height; /* allocate the buffers for the frame data */ - ret = av_frame_get_buffer(converted_frame, 32); + ret = av_frame_get_buffer(converted_frame.get(), 32); if (ret < 0) { CleanUp(); @@ -36,11 +36,6 @@ namespace ffmpegcpp void VideoFormatConverter::CleanUp() { - if (converted_frame != nullptr) - { - av_frame_free(&converted_frame); - converted_frame = nullptr; - } if (swsContext != nullptr) { sws_freeContext(swsContext); @@ -71,9 +66,9 @@ namespace ffmpegcpp sws_scale(swsContext, frame->data, frame->linesize, 0, frame->height, converted_frame->data, converted_frame->linesize); - av_frame_copy_props(converted_frame, frame); // remember all the other data + av_frame_copy_props(converted_frame.get(), frame); // remember all the other data - return converted_frame; + return converted_frame.get(); } } From 0edf8db7fbd124902ca077fe9b9887405cc2a647 Mon Sep 17 00:00:00 2001 From: Wim van Aarle Date: Tue, 18 Dec 2018 14:19:49 +0100 Subject: [PATCH 16/31] smart pointerify all uses of AVFilterGraph* --- include/ffmpegcpp/FFmpegResource.h | 7 +++++++ include/ffmpegcpp/FrameSinks/VideoFilter.h | 5 +---- src/FrameSinks/VideoFilter.cpp | 20 +++++--------------- 3 files changed, 13 insertions(+), 19 deletions(-) diff --git a/include/ffmpegcpp/FFmpegResource.h b/include/ffmpegcpp/FFmpegResource.h index 33d3e10..c352fe5 100644 --- a/include/ffmpegcpp/FFmpegResource.h +++ b/include/ffmpegcpp/FFmpegResource.h @@ -24,6 +24,13 @@ namespace ffmpegcpp void operator()(AVFrame * ptr) { av_frame_free(&ptr); } }; + + template <> + struct Deleter { + void operator()(AVFilterGraph * ptr) { avfilter_graph_free(&ptr); } + }; + + template class FFmpegResource : public std::unique_ptr> { diff --git a/include/ffmpegcpp/FrameSinks/VideoFilter.h b/include/ffmpegcpp/FrameSinks/VideoFilter.h index e94b51b..9a4aef4 100644 --- a/include/ffmpegcpp/FrameSinks/VideoFilter.h +++ b/include/ffmpegcpp/FrameSinks/VideoFilter.h @@ -13,7 +13,6 @@ namespace ffmpegcpp public: VideoFilter(const char* filterString, VideoFrameSink* target); - virtual ~VideoFilter(); void WriteFrame(AVFrame* frame, AVRational* timeBase) override; void Close() override; @@ -30,7 +29,7 @@ namespace ffmpegcpp const char* filterString; AVPixelFormat outputFormat; - AVFilterGraph *filter_graph = nullptr; + FFmpegResource filter_graph; AVFilterContext *buffersink_ctx = nullptr; AVFilterContext *buffersrc_ctx = nullptr; FFmpegResource filt_frame; @@ -38,8 +37,6 @@ namespace ffmpegcpp bool initialized = false; AVRational* timeBase; - - void CleanUp(); }; diff --git a/src/FrameSinks/VideoFilter.cpp b/src/FrameSinks/VideoFilter.cpp index 13c3525..166db0e 100644 --- a/src/FrameSinks/VideoFilter.cpp +++ b/src/FrameSinks/VideoFilter.cpp @@ -10,16 +10,6 @@ namespace ffmpegcpp this->filterString = filterString; } - VideoFilter::~VideoFilter() - { - CleanUp(); - } - - void VideoFilter::CleanUp() - { - avfilter_graph_free(&filter_graph); - } - void VideoFilter::InitDelayed(AVFrame* frame, AVRational* timeBase) { outputFormat = (AVPixelFormat)frame->format; @@ -50,7 +40,7 @@ namespace ffmpegcpp enum AVPixelFormat out_pix_fmts[] = { outputFormat, AV_PIX_FMT_NONE }; - filter_graph = avfilter_graph_alloc(); + filter_graph = MakeFFmpegResource(avfilter_graph_alloc()); if (!outputs || !inputs || !filter_graph) { throw FFmpegException("Failed to allocate filter graph"); @@ -66,7 +56,7 @@ namespace ffmpegcpp //codec->codecContext->sample_aspect_ratio.num, codec->codecContext->sample_aspect_ratio.den); ret = avfilter_graph_create_filter(&buffersrc_ctx, buffersrc, "in", - args, nullptr, filter_graph); + args, nullptr, filter_graph.get()); if (ret < 0) { throw FFmpegException("Cannot create buffer source", ret); @@ -74,7 +64,7 @@ namespace ffmpegcpp /* buffer video sink: to terminate the filter chain. */ ret = avfilter_graph_create_filter(&buffersink_ctx, buffersink, "out", - nullptr, nullptr, filter_graph); + nullptr, nullptr, filter_graph.get()); if (ret < 0) { throw FFmpegException("Cannot create buffer sink", ret); @@ -114,13 +104,13 @@ namespace ffmpegcpp inputs->pad_idx = 0; inputs->next = nullptr; - if ((ret = avfilter_graph_parse_ptr(filter_graph, filterString, + if ((ret = avfilter_graph_parse_ptr(filter_graph.get(), filterString, &inputs, &outputs, nullptr)) < 0) { throw FFmpegException("Failed to parse and generate filters", ret); } - if ((ret = avfilter_graph_config(filter_graph, nullptr)) < 0) + if ((ret = avfilter_graph_config(filter_graph.get(), nullptr)) < 0) { throw FFmpegException("Failed to configure filter graph", ret); } From 09288a880bcf87f94f4b37bb2cc3a262321ded30 Mon Sep 17 00:00:00 2001 From: Wim van Aarle Date: Tue, 18 Dec 2018 14:25:18 +0100 Subject: [PATCH 17/31] smart pointerify all uses of AVAudioFifo* --- include/ffmpegcpp/AudioFormatConverter.h | 2 +- include/ffmpegcpp/FFmpegResource.h | 5 ++++- src/AudioFormatConverter.cpp | 19 +++++++------------ 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/include/ffmpegcpp/AudioFormatConverter.h b/include/ffmpegcpp/AudioFormatConverter.h index 686666d..02e7cc0 100644 --- a/include/ffmpegcpp/AudioFormatConverter.h +++ b/include/ffmpegcpp/AudioFormatConverter.h @@ -34,7 +34,7 @@ namespace ffmpegcpp bool initialized = false; - AVAudioFifo* fifo = nullptr; + FFmpegResource fifo; FFmpegResource tmp_frame; FFmpegResource converted_frame; struct SwrContext* swr_ctx = nullptr; diff --git a/include/ffmpegcpp/FFmpegResource.h b/include/ffmpegcpp/FFmpegResource.h index c352fe5..d66ae54 100644 --- a/include/ffmpegcpp/FFmpegResource.h +++ b/include/ffmpegcpp/FFmpegResource.h @@ -24,12 +24,15 @@ namespace ffmpegcpp void operator()(AVFrame * ptr) { av_frame_free(&ptr); } }; - template <> struct Deleter { void operator()(AVFilterGraph * ptr) { avfilter_graph_free(&ptr); } }; + template <> + struct Deleter { + void operator()(AVAudioFifo * ptr) { av_audio_fifo_free(ptr); } + }; template class FFmpegResource : public std::unique_ptr> diff --git a/src/AudioFormatConverter.cpp b/src/AudioFormatConverter.cpp index 4840caa..8b132ed 100644 --- a/src/AudioFormatConverter.cpp +++ b/src/AudioFormatConverter.cpp @@ -52,7 +52,7 @@ namespace ffmpegcpp tmp_frame->nb_samples = 0; // Create the FIFO buffer based on the specified output sample format - fifo = av_audio_fifo_alloc(codecContext->sample_fmt, codecContext->channels, nb_samples); + fifo = MakeFFmpegResource(av_audio_fifo_alloc(codecContext->sample_fmt, codecContext->channels, nb_samples)); if (!fifo) { CleanUp(); @@ -72,11 +72,6 @@ namespace ffmpegcpp swr_free(&swr_ctx); swr_ctx = nullptr; } - if (fifo != nullptr) - { - av_audio_fifo_free(fifo); - fifo = nullptr; - } } void AudioFormatConverter::InitDelayed(AVFrame* frame) @@ -136,14 +131,14 @@ namespace ffmpegcpp * At the end of the file, we pass the remaining samples to * the encoder. */ bool finished = (frame == nullptr); - int fifoSize = av_audio_fifo_size(fifo); + int fifoSize = av_audio_fifo_size(fifo.get()); while (fifoSize >= converted_frame->nb_samples || (finished && fifoSize > 0)) { // Take one frame worth of audio samples from the FIFO buffer, // encode it and write it to the output file. PullConvertedFrameFromFifo(); - fifoSize = av_audio_fifo_size(fifo); + fifoSize = av_audio_fifo_size(fifo.get()); } } @@ -151,13 +146,13 @@ namespace ffmpegcpp { // Make the FIFO as large as it needs to be to hold both, the old and the new samples. int ret; - if ((ret = av_audio_fifo_realloc(fifo, av_audio_fifo_size(fifo) + frame->nb_samples)) < 0) + if ((ret = av_audio_fifo_realloc(fifo.get(), av_audio_fifo_size(fifo.get()) + frame->nb_samples)) < 0) { throw FFmpegException("Could not reallocate FIFO", ret); } /* Store the new samples in the FIFO buffer. */ - if (av_audio_fifo_write(fifo, (void **)frame->extended_data, frame->nb_samples) < frame->nb_samples) + if (av_audio_fifo_write(fifo.get(), (void **)frame->extended_data, frame->nb_samples) < frame->nb_samples) { throw FFmpegException("Could not write data to FIFO"); } @@ -168,14 +163,14 @@ namespace ffmpegcpp /* Use the maximum number of possible samples per frame. * If there is less than the maximum possible frame size in the FIFO * buffer use this number. Otherwise, use the maximum possible frame size. */ - const int frame_size = FFMIN(av_audio_fifo_size(fifo), converted_frame->nb_samples); + const int frame_size = FFMIN(av_audio_fifo_size(fifo.get()), converted_frame->nb_samples); int data_written; converted_frame->nb_samples = frame_size; /* Read as many samples from the FIFO buffer as required to fill the frame. * The samples are stored in the frame temporarily. */ int ret; - if ((ret = av_audio_fifo_read(fifo, (void **)converted_frame->data, frame_size)) < frame_size) + if ((ret = av_audio_fifo_read(fifo.get(), (void **)converted_frame->data, frame_size)) < frame_size) { throw FFmpegException("Could not read data from FIFO", ret); } From 203808a4b43f0f9e67c64218e3986d2c27e96be5 Mon Sep 17 00:00:00 2001 From: Wim van Aarle Date: Tue, 18 Dec 2018 14:33:16 +0100 Subject: [PATCH 18/31] smart pointerify all uses of SwsContext* --- include/ffmpegcpp/FFmpegResource.h | 5 +++++ .../ffmpegcpp/Sources/RawVideoDataSource.h | 4 +--- include/ffmpegcpp/VideoFormatConverter.h | 9 +-------- src/Sources/RawVideoDataSource.cpp | 20 ++----------------- src/VideoFormatConverter.cpp | 20 ++----------------- 5 files changed, 11 insertions(+), 47 deletions(-) diff --git a/include/ffmpegcpp/FFmpegResource.h b/include/ffmpegcpp/FFmpegResource.h index d66ae54..5ecb54b 100644 --- a/include/ffmpegcpp/FFmpegResource.h +++ b/include/ffmpegcpp/FFmpegResource.h @@ -34,6 +34,11 @@ namespace ffmpegcpp void operator()(AVAudioFifo * ptr) { av_audio_fifo_free(ptr); } }; + template <> + struct Deleter { + void operator()(struct SwsContext * ptr) { sws_freeContext(ptr); } + }; + template class FFmpegResource : public std::unique_ptr> { diff --git a/include/ffmpegcpp/Sources/RawVideoDataSource.h b/include/ffmpegcpp/Sources/RawVideoDataSource.h index e372bd0..172958f 100644 --- a/include/ffmpegcpp/Sources/RawVideoDataSource.h +++ b/include/ffmpegcpp/Sources/RawVideoDataSource.h @@ -15,7 +15,6 @@ namespace ffmpegcpp RawVideoDataSource(int width, int height, AVPixelFormat pixelFormat, int framesPerSecond, VideoFrameSink* output); RawVideoDataSource(int width, int height, AVPixelFormat sourcePixelFormat, AVPixelFormat targetPixelFormat, int framesPerSecond, VideoFrameSink* output); - virtual ~RawVideoDataSource(); void WriteFrame(void* data, int bytesPerRow); void Close(); @@ -28,7 +27,6 @@ namespace ffmpegcpp private: void Init(int width, int height, AVPixelFormat sourcePixelFormat, AVPixelFormat targetPixelFormat, int framesPerSecond, VideoFrameSink* output); - void CleanUp(); AVPixelFormat sourcePixelFormat; AVRational timeBase; @@ -36,6 +34,6 @@ namespace ffmpegcpp VideoFrameSink* output; FFmpegResource frame; - struct SwsContext* swsContext = nullptr; + FFmpegResource swsContext; }; } diff --git a/include/ffmpegcpp/VideoFormatConverter.h b/include/ffmpegcpp/VideoFormatConverter.h index 75dc314..92b366d 100644 --- a/include/ffmpegcpp/VideoFormatConverter.h +++ b/include/ffmpegcpp/VideoFormatConverter.h @@ -11,26 +11,19 @@ namespace ffmpegcpp public: VideoFormatConverter(AVCodecContext* codecContext); - ~VideoFormatConverter(); AVFrame* ConvertFrame(AVFrame* frame); - - private: - void CleanUp(); - void InitDelayed(AVFrame* frame); - AVCodecContext* codecContext; bool initialized = false; FFmpegResource converted_frame; - struct SwsContext* swsContext = nullptr; + FFmpegResource swsContext; }; - } diff --git a/src/Sources/RawVideoDataSource.cpp b/src/Sources/RawVideoDataSource.cpp index 9c6a46b..0e34c6d 100644 --- a/src/Sources/RawVideoDataSource.cpp +++ b/src/Sources/RawVideoDataSource.cpp @@ -30,7 +30,6 @@ namespace ffmpegcpp frame = MakeFFmpegResource(av_frame_alloc()); if (!frame) { - CleanUp(); throw FFmpegException("Could not allocate video frame"); } @@ -42,25 +41,10 @@ namespace ffmpegcpp ret = av_frame_get_buffer(frame.get(), 32); if (ret < 0) { - CleanUp(); throw FFmpegException("Could not allocate the video frame data", ret); } } - RawVideoDataSource::~RawVideoDataSource() - { - CleanUp(); - } - - void RawVideoDataSource::CleanUp() - { - if (swsContext != nullptr) - { - sws_freeContext(swsContext); - swsContext = nullptr; - } - } - void RawVideoDataSource::WriteFrame(void* data, int bytesPerRow) { // make sure the frame data is writable @@ -74,11 +58,11 @@ namespace ffmpegcpp // if the source and target pixel format are the same, we don't do any conversions, we just copy // but we use sws_scale anyway because we need to convert to the internal line_size format of frame - swsContext = sws_getCachedContext(swsContext, + swsContext = sws_getCachedContext(swsContext.get(), frame->width, frame->height, sourcePixelFormat, frame->width, frame->height, (AVPixelFormat)frame->format, 0, nullptr, nullptr, nullptr); - sws_scale(swsContext, (const uint8_t * const *)&data, in_linesize, 0, + sws_scale(swsContext.get(), (const uint8_t * const *)&data, in_linesize, 0, frame->height, frame->data, frame->linesize); // send to the output diff --git a/src/VideoFormatConverter.cpp b/src/VideoFormatConverter.cpp index 1b058ab..2aec4cd 100644 --- a/src/VideoFormatConverter.cpp +++ b/src/VideoFormatConverter.cpp @@ -11,7 +11,6 @@ namespace ffmpegcpp int ret; if (!converted_frame) { - CleanUp(); throw FFmpegException("Error allocating a video frame"); } @@ -24,29 +23,14 @@ namespace ffmpegcpp ret = av_frame_get_buffer(converted_frame.get(), 32); if (ret < 0) { - CleanUp(); throw FFmpegException("Failed to allocate buffer for frame", ret); } } - VideoFormatConverter::~VideoFormatConverter() - { - CleanUp(); - } - - void VideoFormatConverter::CleanUp() - { - if (swsContext != nullptr) - { - sws_freeContext(swsContext); - swsContext = nullptr; - } - } - void VideoFormatConverter::InitDelayed(AVFrame* frame) { // configure the conversion context based in the source and target data - swsContext = sws_getCachedContext(swsContext, + swsContext = sws_getCachedContext(swsContext.get(), frame->width, frame->height, (AVPixelFormat)frame->format, converted_frame->width, converted_frame->height, (AVPixelFormat)converted_frame->format, 0, nullptr, nullptr, nullptr); @@ -63,7 +47,7 @@ namespace ffmpegcpp } // convert the frame - sws_scale(swsContext, frame->data, frame->linesize, 0, + sws_scale(swsContext.get(), frame->data, frame->linesize, 0, frame->height, converted_frame->data, converted_frame->linesize); av_frame_copy_props(converted_frame.get(), frame); // remember all the other data From edc754931953349eca2c7f441415105d3517afb7 Mon Sep 17 00:00:00 2001 From: Wim van Aarle Date: Tue, 18 Dec 2018 14:36:17 +0100 Subject: [PATCH 19/31] smart pointerify all uses of SwrContext* --- include/ffmpegcpp/AudioFormatConverter.h | 7 +---- include/ffmpegcpp/FFmpegResource.h | 5 ++++ src/AudioFormatConverter.cpp | 36 ++++++------------------ 3 files changed, 15 insertions(+), 33 deletions(-) diff --git a/include/ffmpegcpp/AudioFormatConverter.h b/include/ffmpegcpp/AudioFormatConverter.h index 02e7cc0..f0830e3 100644 --- a/include/ffmpegcpp/AudioFormatConverter.h +++ b/include/ffmpegcpp/AudioFormatConverter.h @@ -11,16 +11,11 @@ namespace ffmpegcpp public: AudioFormatConverter(ConvertedAudioProcessor* output, AVCodecContext* codecContext); - ~AudioFormatConverter(); void ProcessFrame(AVFrame* frame); - - private: - void CleanUp(); - void InitDelayed(AVFrame* frame); void AddToFifo(AVFrame* frame); @@ -37,7 +32,7 @@ namespace ffmpegcpp FFmpegResource fifo; FFmpegResource tmp_frame; FFmpegResource converted_frame; - struct SwrContext* swr_ctx = nullptr; + FFmpegResource swr_ctx; int in_sample_rate, out_sample_rate; diff --git a/include/ffmpegcpp/FFmpegResource.h b/include/ffmpegcpp/FFmpegResource.h index 5ecb54b..1f860da 100644 --- a/include/ffmpegcpp/FFmpegResource.h +++ b/include/ffmpegcpp/FFmpegResource.h @@ -39,6 +39,11 @@ namespace ffmpegcpp void operator()(struct SwsContext * ptr) { sws_freeContext(ptr); } }; + template <> + struct Deleter { + void operator()(struct SwrContext * ptr) { swr_free(&ptr); } + }; + template class FFmpegResource : public std::unique_ptr> { diff --git a/src/AudioFormatConverter.cpp b/src/AudioFormatConverter.cpp index 8b132ed..45b3a5e 100644 --- a/src/AudioFormatConverter.cpp +++ b/src/AudioFormatConverter.cpp @@ -12,7 +12,6 @@ namespace ffmpegcpp int ret; if (!converted_frame) { - CleanUp(); throw FFmpegException("Error allocating an audio frame"); } @@ -33,7 +32,6 @@ namespace ffmpegcpp ret = av_frame_get_buffer(converted_frame.get(), 0); if (ret < 0) { - CleanUp(); throw FFmpegException("Error allocating an audio buffer", ret); } } @@ -43,7 +41,6 @@ namespace ffmpegcpp tmp_frame = MakeFFmpegResource(av_frame_alloc()); if (!tmp_frame) { - CleanUp(); throw FFmpegException("Error allocating an audio frame"); } tmp_frame->format = codecContext->sample_fmt; @@ -55,25 +52,10 @@ namespace ffmpegcpp fifo = MakeFFmpegResource(av_audio_fifo_alloc(codecContext->sample_fmt, codecContext->channels, nb_samples)); if (!fifo) { - CleanUp(); throw FFmpegException("Failed to create FIFO queue for audio format converter"); } } - AudioFormatConverter::~AudioFormatConverter() - { - CleanUp(); - } - - void AudioFormatConverter::CleanUp() - { - if (swr_ctx != nullptr) - { - swr_free(&swr_ctx); - swr_ctx = nullptr; - } - } - void AudioFormatConverter::InitDelayed(AVFrame* frame) { swr_ctx = swr_alloc(); @@ -85,16 +67,16 @@ namespace ffmpegcpp // set options in_sample_rate = frame->sample_rate; out_sample_rate = codecContext->sample_rate; - av_opt_set_int(swr_ctx, "in_channel_count", frame->channels, 0); - av_opt_set_int(swr_ctx, "in_sample_rate", frame->sample_rate, 0); - av_opt_set_sample_fmt(swr_ctx, "in_sample_fmt", (AVSampleFormat)frame->format, 0); - av_opt_set_int(swr_ctx, "out_channel_count", codecContext->channels, 0); - av_opt_set_int(swr_ctx, "out_sample_rate", codecContext->sample_rate, 0); - av_opt_set_sample_fmt(swr_ctx, "out_sample_fmt", codecContext->sample_fmt, 0); + av_opt_set_int(swr_ctx.get(), "in_channel_count", frame->channels, 0); + av_opt_set_int(swr_ctx.get(), "in_sample_rate", frame->sample_rate, 0); + av_opt_set_sample_fmt(swr_ctx.get(), "in_sample_fmt", (AVSampleFormat)frame->format, 0); + av_opt_set_int(swr_ctx.get(), "out_channel_count", codecContext->channels, 0); + av_opt_set_int(swr_ctx.get(), "out_sample_rate", codecContext->sample_rate, 0); + av_opt_set_sample_fmt(swr_ctx.get(), "out_sample_fmt", codecContext->sample_fmt, 0); // initialize the resampling context int ret; - if ((ret = swr_init(swr_ctx)) < 0) + if ((ret = swr_init(swr_ctx.get())) < 0) { throw FFmpegException("Failed to initialize the resampling context", ret); } @@ -111,7 +93,7 @@ namespace ffmpegcpp } int ret; - ret = swr_convert_frame(swr_ctx, tmp_frame.get(), frame); + ret = swr_convert_frame(swr_ctx.get(), tmp_frame.get(), frame); if (ret < 0) { throw FFmpegException("Error while converting audio frame to destination format", ret); @@ -120,7 +102,7 @@ namespace ffmpegcpp while (tmp_frame->nb_samples > 0) { AddToFifo(tmp_frame.get()); - ret = swr_convert_frame(swr_ctx, tmp_frame.get(), nullptr); + ret = swr_convert_frame(swr_ctx.get(), tmp_frame.get(), nullptr); if (ret < 0) { throw FFmpegException("Error while converting audio frame to destination format", ret); From 1117ca47d2607b19848604806f73e26587d88e72 Mon Sep 17 00:00:00 2001 From: Wim van Aarle Date: Tue, 18 Dec 2018 14:47:07 +0100 Subject: [PATCH 20/31] smart pointerify all uses of AVCodecParserContext* --- include/ffmpegcpp/FFmpegResource.h | 5 +++++ include/ffmpegcpp/Sources/EncodedFileSource.h | 2 +- src/Sources/EncodedFileSource.cpp | 7 +------ 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/ffmpegcpp/FFmpegResource.h b/include/ffmpegcpp/FFmpegResource.h index 1f860da..8cb58cd 100644 --- a/include/ffmpegcpp/FFmpegResource.h +++ b/include/ffmpegcpp/FFmpegResource.h @@ -34,6 +34,11 @@ namespace ffmpegcpp void operator()(AVAudioFifo * ptr) { av_audio_fifo_free(ptr); } }; + template <> + struct Deleter { + void operator()(AVCodecParserContext * ptr) { av_parser_close(ptr); } + }; + template <> struct Deleter { void operator()(struct SwsContext * ptr) { sws_freeContext(ptr); } diff --git a/include/ffmpegcpp/Sources/EncodedFileSource.h b/include/ffmpegcpp/Sources/EncodedFileSource.h index e8453b6..5343549 100644 --- a/include/ffmpegcpp/Sources/EncodedFileSource.h +++ b/include/ffmpegcpp/Sources/EncodedFileSource.h @@ -29,7 +29,7 @@ namespace ffmpegcpp FrameSink* output; - AVCodecParserContext* parser = nullptr; + FFmpegResource parser; FFmpegResource codecContext; diff --git a/src/Sources/EncodedFileSource.cpp b/src/Sources/EncodedFileSource.cpp index 92c4ce5..e69c1bb 100644 --- a/src/Sources/EncodedFileSource.cpp +++ b/src/Sources/EncodedFileSource.cpp @@ -46,11 +46,6 @@ namespace ffmpegcpp delete buffer; buffer = nullptr; } - if (parser != nullptr) - { - av_parser_close(parser); - parser = nullptr; - } fclose(file); } @@ -147,7 +142,7 @@ namespace ffmpegcpp data = buffer; while (data_size > 0) { - ret = av_parser_parse2(parser, codecContext.get(), &pkt->data, &pkt->size, + ret = av_parser_parse2(parser.get(), codecContext.get(), &pkt->data, &pkt->size, data, data_size, AV_NOPTS_VALUE, AV_NOPTS_VALUE, 0); if (ret < 0) { From 09172b856bec64053d36e174d9d618aa676fe297 Mon Sep 17 00:00:00 2001 From: Wim van Aarle Date: Tue, 18 Dec 2018 14:48:23 +0100 Subject: [PATCH 21/31] smart pointerify all uses of AVFormatContext* --- include/ffmpegcpp/FFmpegResource.h | 5 +++++ include/ffmpegcpp/Sources/Demuxer.h | 2 +- src/Sources/Demuxer.cpp | 16 ++++++---------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/include/ffmpegcpp/FFmpegResource.h b/include/ffmpegcpp/FFmpegResource.h index 8cb58cd..841263f 100644 --- a/include/ffmpegcpp/FFmpegResource.h +++ b/include/ffmpegcpp/FFmpegResource.h @@ -39,6 +39,11 @@ namespace ffmpegcpp void operator()(AVCodecParserContext * ptr) { av_parser_close(ptr); } }; + template <> + struct Deleter { + void operator()(AVFormatContext * ptr) { avformat_close_input(&ptr); } + }; + template <> struct Deleter { void operator()(struct SwsContext * ptr) { sws_freeContext(ptr); } diff --git a/include/ffmpegcpp/Sources/Demuxer.h b/include/ffmpegcpp/Sources/Demuxer.h index ed5e63f..46823f2 100644 --- a/include/ffmpegcpp/Sources/Demuxer.h +++ b/include/ffmpegcpp/Sources/Demuxer.h @@ -50,7 +50,7 @@ namespace ffmpegcpp InputStream** inputStreams = nullptr; - AVFormatContext* containerContext = nullptr; + FFmpegResource containerContext; FFmpegResource pkt; void DecodePacket(); diff --git a/src/Sources/Demuxer.cpp b/src/Sources/Demuxer.cpp index 1d537b1..6838c53 100644 --- a/src/Sources/Demuxer.cpp +++ b/src/Sources/Demuxer.cpp @@ -20,14 +20,15 @@ namespace ffmpegcpp // open input file, and allocate format context int ret; - if ((ret = avformat_open_input(&containerContext, fileName, inputFormat, &format_opts)) < 0) + auto container_ctx = containerContext.get(); + if ((ret = avformat_open_input(&container_ctx, fileName, inputFormat, &format_opts)) < 0) { CleanUp(); throw FFmpegException("Failed to open input container " + string(fileName), ret); } // retrieve stream information - if (ret = (avformat_find_stream_info(containerContext, nullptr)) < 0) + if (ret = (avformat_find_stream_info(containerContext.get(), nullptr)) < 0) { CleanUp(); throw FFmpegException("Failed to read streams from " + string(fileName), ret); @@ -70,11 +71,6 @@ namespace ffmpegcpp delete inputStreams; inputStreams = nullptr; } - if (containerContext != nullptr) - { - avformat_close_input(&containerContext); - containerContext = nullptr; - } } vector Demuxer::GetAudioStreamInfo() @@ -120,7 +116,7 @@ namespace ffmpegcpp void Demuxer::DecodeBestAudioStream(AudioFrameSink* frameSink) { - int ret = av_find_best_stream(containerContext, AVMEDIA_TYPE_AUDIO, -1, -1, nullptr, 0); + int ret = av_find_best_stream(containerContext.get(), AVMEDIA_TYPE_AUDIO, -1, -1, nullptr, 0); if (ret < 0) { throw FFmpegException("Could not find " + string(av_get_media_type_string(AVMEDIA_TYPE_AUDIO)) + " stream in input file " + fileName, ret); @@ -131,7 +127,7 @@ namespace ffmpegcpp void Demuxer::DecodeBestVideoStream(VideoFrameSink* frameSink) { - int ret = av_find_best_stream(containerContext, AVMEDIA_TYPE_VIDEO, -1, -1, nullptr, 0); + int ret = av_find_best_stream(containerContext.get(), AVMEDIA_TYPE_VIDEO, -1, -1, nullptr, 0); if (ret < 0) { throw FFmpegException("Could not find " + string(av_get_media_type_string(AVMEDIA_TYPE_VIDEO)) + " stream in input file " + fileName, ret); @@ -203,7 +199,7 @@ namespace ffmpegcpp void Demuxer::Step() { // read frames from the file - int ret = av_read_frame(containerContext, pkt.get()); + int ret = av_read_frame(containerContext.get(), pkt.get()); // EOF if (ret == AVERROR_EOF) From efed9f805030b6a425995f9d8734445ce386d308 Mon Sep 17 00:00:00 2001 From: Wim van Aarle Date: Tue, 18 Dec 2018 15:09:30 +0100 Subject: [PATCH 22/31] removed more cleanup() functions by managing member variables with smart pointers --- include/ffmpegcpp/FrameSinks/AudioEncoder.h | 11 +++--- include/ffmpegcpp/FrameSinks/VideoEncoder.h | 11 +++--- .../ffmpegcpp/Sources/RawAudioFileSource.h | 6 +-- .../ffmpegcpp/Sources/RawVideoFileSource.h | 6 +-- src/FrameSinks/AudioEncoder.cpp | 36 +++-------------- src/FrameSinks/VideoEncoder.cpp | 39 ++++--------------- src/Sources/RawAudioFileSource.cpp | 19 +-------- src/Sources/RawVideoFileSource.cpp | 18 +-------- 8 files changed, 28 insertions(+), 118 deletions(-) diff --git a/include/ffmpegcpp/FrameSinks/AudioEncoder.h b/include/ffmpegcpp/FrameSinks/AudioEncoder.h index 48e595d..fa2f904 100644 --- a/include/ffmpegcpp/FrameSinks/AudioEncoder.h +++ b/include/ffmpegcpp/FrameSinks/AudioEncoder.h @@ -11,6 +11,8 @@ #include "Muxing/OutputStream.h" #include "FFmpegResource.h" +#include + namespace ffmpegcpp { class AudioEncoder : public AudioFrameSink, public ConvertedAudioProcessor @@ -18,7 +20,6 @@ namespace ffmpegcpp public: AudioEncoder(AudioCodec* codec, Muxer* muxer); AudioEncoder(AudioCodec* codec, Muxer* muxer, int bitRate); - virtual ~AudioEncoder(); void WriteFrame(AVFrame* frame, AVRational* timeBase) override; void Close() override; @@ -31,16 +32,14 @@ namespace ffmpegcpp void OpenLazily(AVFrame* frame, AVRational* timeBase); - void CleanUp(); - void PollCodecForPackets(); - OutputStream* output; + std::unique_ptr output; AudioCodec* closedCodec; - AudioFormatConverter *formatConverter = nullptr; - OpenCodec* codec = nullptr; + std::unique_ptr formatConverter; + std::unique_ptr codec; FFmpegResource pkt; int frameNumber = 0; diff --git a/include/ffmpegcpp/FrameSinks/VideoEncoder.h b/include/ffmpegcpp/FrameSinks/VideoEncoder.h index 075529f..5cc5996 100644 --- a/include/ffmpegcpp/FrameSinks/VideoEncoder.h +++ b/include/ffmpegcpp/FrameSinks/VideoEncoder.h @@ -8,6 +8,8 @@ #include "Muxing/Muxer.h" #include "FFmpegResource.h" +#include + namespace ffmpegcpp { class VideoEncoder : public VideoFrameSink @@ -17,7 +19,6 @@ namespace ffmpegcpp VideoEncoder(VideoCodec* codec, Muxer* muxer, AVPixelFormat format); VideoEncoder(VideoCodec* codec, Muxer* muxer, AVRational frameRate); VideoEncoder(VideoCodec* codec, Muxer* muxer, AVRational frameRate, AVPixelFormat format); - virtual ~VideoEncoder(); void WriteFrame(AVFrame* frame, AVRational* timeBase) override; void Close() override; @@ -30,16 +31,14 @@ namespace ffmpegcpp void PollCodecForPackets(); VideoCodec* closedCodec; - OutputStream* output; + std::unique_ptr output; - VideoFormatConverter* formatConverter = nullptr; - OpenCodec* codec = nullptr; + std::unique_ptr formatConverter; + std::unique_ptr codec; FFmpegResource pkt; int frameNumber = 0; - void CleanUp(); - AVPixelFormat finalPixelFormat = AV_PIX_FMT_NONE; AVRational finalFrameRate; diff --git a/include/ffmpegcpp/Sources/RawAudioFileSource.h b/include/ffmpegcpp/Sources/RawAudioFileSource.h index 333ed84..5efd751 100644 --- a/include/ffmpegcpp/Sources/RawAudioFileSource.h +++ b/include/ffmpegcpp/Sources/RawAudioFileSource.h @@ -5,6 +5,7 @@ #include "Sources/InputSource.h" #include "Sources/Demuxer.h" +#include namespace ffmpegcpp { @@ -13,7 +14,6 @@ namespace ffmpegcpp public: RawAudioFileSource(const char* fileName, const char* inputFormat, int sampleRate, int channels, AudioFrameSink* frameSink); - virtual ~RawAudioFileSource(); void PreparePipeline() override; bool IsDone() override; @@ -21,9 +21,7 @@ namespace ffmpegcpp private: - void CleanUp(); - - Demuxer* demuxer = nullptr; + std::unique_ptr demuxer; }; diff --git a/include/ffmpegcpp/Sources/RawVideoFileSource.h b/include/ffmpegcpp/Sources/RawVideoFileSource.h index ebf9d62..7c5cd7b 100644 --- a/include/ffmpegcpp/Sources/RawVideoFileSource.h +++ b/include/ffmpegcpp/Sources/RawVideoFileSource.h @@ -5,6 +5,7 @@ #include "Sources/InputSource.h" #include "Sources/Demuxer.h" +#include namespace ffmpegcpp { @@ -17,7 +18,6 @@ namespace ffmpegcpp // I couldn't get this to work. The thing is that it also crashes weirdly when I run ffmpeg directly, // so I think it's more an issue of ffmpeg than one of my library. //RawVideoFileSource(const char* fileName, int width, int height, const char* frameRate, AVPixelFormat format, VideoFrameSink* frameSink); - virtual ~RawVideoFileSource(); void PreparePipeline() override; bool IsDone() override; @@ -25,9 +25,7 @@ namespace ffmpegcpp private: - void CleanUp(); - - Demuxer* demuxer = nullptr; + std::unique_ptr demuxer; }; diff --git a/src/FrameSinks/AudioEncoder.cpp b/src/FrameSinks/AudioEncoder.cpp index 1169339..b496161 100644 --- a/src/FrameSinks/AudioEncoder.cpp +++ b/src/FrameSinks/AudioEncoder.cpp @@ -13,8 +13,8 @@ namespace ffmpegcpp this->closedCodec = codec; // create an output stream - output = new AudioOutputStream(muxer, codec); - muxer->AddOutputStream(output); + output = std::make_unique(muxer, codec); + muxer->AddOutputStream(output.get()); } AudioEncoder::AudioEncoder(AudioCodec* codec, Muxer* muxer, int bitRate) @@ -31,50 +31,24 @@ namespace ffmpegcpp int sampleRate = closedCodec->GetDefaultSampleRate(); AVSampleFormat format = closedCodec->GetDefaultSampleFormat(); - codec = closedCodec->Open(bitRate, format, sampleRate); + codec = std::unique_ptr(closedCodec->Open(bitRate, format, sampleRate)); pkt = MakeFFmpegResource(av_packet_alloc()); if (!pkt) { - CleanUp(); throw FFmpegException("Failed to allocate packet"); } try { - formatConverter = new AudioFormatConverter(this, codec->GetContext()); + formatConverter = std::make_unique(this, codec->GetContext()); } catch (FFmpegException e) { - CleanUp(); throw e; } } - AudioEncoder::~AudioEncoder() - { - CleanUp(); - } - - void AudioEncoder::CleanUp() - { - if (formatConverter != nullptr) - { - delete formatConverter; - formatConverter = nullptr; - } - if (codec != nullptr) - { - delete codec; - codec = nullptr; - } - if (output != nullptr) - { - delete output; - output = nullptr; - } - } - void AudioEncoder::WriteFrame(AVFrame* frame, AVRational* timeBase) { // if we haven't opened the codec yet, we do it now! @@ -135,7 +109,7 @@ namespace ffmpegcpp //printf("Write packet %3 (size=%5d)\n", data->pkt->pts, data->pkt->size); //fwrite(data->pkt->data, 1, data->pkt->size, data->f); - output->WritePacket(pkt.get(), codec); + output->WritePacket(pkt.get(), codec.get()); av_packet_unref(pkt.get()); } diff --git a/src/FrameSinks/VideoEncoder.cpp b/src/FrameSinks/VideoEncoder.cpp index 20c629e..c218de0 100644 --- a/src/FrameSinks/VideoEncoder.cpp +++ b/src/FrameSinks/VideoEncoder.cpp @@ -13,8 +13,8 @@ namespace ffmpegcpp this->closedCodec = codec; // create an output stream - this->output = new VideoOutputStream(muxer, codec); - muxer->AddOutputStream(output); + this->output = std::make_unique(muxer, codec); + muxer->AddOutputStream(output.get()); } VideoEncoder::VideoEncoder(VideoCodec* codec, Muxer* muxer, AVPixelFormat format) @@ -38,30 +38,6 @@ namespace ffmpegcpp finalFrameRateSet = true; } - VideoEncoder::~VideoEncoder() - { - CleanUp(); - } - - void VideoEncoder::CleanUp() - { - if (codec != nullptr) - { - delete codec; - codec = nullptr; - } - if (formatConverter != nullptr) - { - delete formatConverter; - formatConverter = nullptr; - } - if (output != nullptr) - { - delete output; - output = nullptr; - } - } - void VideoEncoder::OpenLazily(AVFrame* frame, AVRational* timeBase) { // configure the parameters for the codec based on the frame and our preferences @@ -82,24 +58,23 @@ namespace ffmpegcpp if (finalFrameRateSet) frameRate = finalFrameRate; // open the codec - codec = closedCodec->Open(width, height, &frameRate, format); - + codec = std::unique_ptr(closedCodec->Open(width, height, &frameRate, format)); + // ToDo: make the Open() function return unique_ptr + // allocate the packet we'll be using pkt = MakeFFmpegResource(av_packet_alloc()); if (!pkt) { - CleanUp(); throw FFmpegException("Failed to allocate packet"); } // set up the format converter try { - formatConverter = new VideoFormatConverter(codec->GetContext()); + formatConverter = std::make_unique(codec->GetContext()); } catch (FFmpegException e) { - CleanUp(); throw e; } } @@ -162,7 +137,7 @@ namespace ffmpegcpp //printf("Write packet %3 (size=%5d)\n", data->pkt->pts, data->pkt->size); //fwrite(data->pkt->data, 1, data->pkt->size, data->f); - output->WritePacket(pkt.get(), codec); + output->WritePacket(pkt.get(), codec.get()); av_packet_unref(pkt.get()); } diff --git a/src/Sources/RawAudioFileSource.cpp b/src/Sources/RawAudioFileSource.cpp index 672eccf..790cf75 100644 --- a/src/Sources/RawAudioFileSource.cpp +++ b/src/Sources/RawAudioFileSource.cpp @@ -13,7 +13,6 @@ namespace ffmpegcpp AVInputFormat *file_iformat; if (!(file_iformat = av_find_input_format(inputFormat))) { - CleanUp(); throw FFmpegException("Unknown input format: " + string(inputFormat)); } @@ -25,31 +24,15 @@ namespace ffmpegcpp // create the demuxer try { - demuxer = new Demuxer(fileName, file_iformat, format_opts); + demuxer = std::make_unique(fileName, file_iformat, format_opts); demuxer->DecodeBestAudioStream(frameSink); } catch (FFmpegException e) { - CleanUp(); throw e; } } - - RawAudioFileSource::~RawAudioFileSource() - { - CleanUp(); - } - - void RawAudioFileSource::CleanUp() - { - if (demuxer != nullptr) - { - delete demuxer; - demuxer = nullptr; - } - } - void RawAudioFileSource::PreparePipeline() { demuxer->PreparePipeline(); diff --git a/src/Sources/RawVideoFileSource.cpp b/src/Sources/RawVideoFileSource.cpp index 258d2c2..54d72ce 100644 --- a/src/Sources/RawVideoFileSource.cpp +++ b/src/Sources/RawVideoFileSource.cpp @@ -12,12 +12,11 @@ namespace ffmpegcpp // create the demuxer - it can handle figuring out the video type on its own apparently try { - demuxer = new Demuxer(fileName, nullptr, nullptr); + demuxer = std::make_unique(fileName, nullptr, nullptr); demuxer->DecodeBestVideoStream(frameSink); } catch (FFmpegException e) { - CleanUp(); throw e; } } @@ -60,21 +59,6 @@ namespace ffmpegcpp } }*/ - - RawVideoFileSource::~RawVideoFileSource() - { - CleanUp(); - } - - void RawVideoFileSource::CleanUp() - { - if (demuxer != nullptr) - { - delete demuxer; - demuxer = nullptr; - } - } - void RawVideoFileSource::PreparePipeline() { demuxer->PreparePipeline(); From cee50cc4204d947a2747b958b56ac908d17a3d6c Mon Sep 17 00:00:00 2001 From: Wim van Aarle Date: Wed, 19 Dec 2018 12:18:35 +0100 Subject: [PATCH 23/31] use smart pointer for OpenCodec --- include/ffmpegcpp/Codecs/AudioCodec.h | 2 +- include/ffmpegcpp/Codecs/Codec.h | 5 +++-- include/ffmpegcpp/Codecs/VideoCodec.h | 2 +- src/Codecs/AudioCodec.cpp | 2 +- src/Codecs/Codec.cpp | 4 ++-- src/Codecs/VideoCodec.cpp | 2 +- src/FrameSinks/AudioEncoder.cpp | 2 +- src/FrameSinks/VideoEncoder.cpp | 3 +-- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/ffmpegcpp/Codecs/AudioCodec.h b/include/ffmpegcpp/Codecs/AudioCodec.h index d56e84f..5ce1801 100644 --- a/include/ffmpegcpp/Codecs/AudioCodec.h +++ b/include/ffmpegcpp/Codecs/AudioCodec.h @@ -14,7 +14,7 @@ namespace ffmpegcpp AudioCodec(AVCodecID codecId); virtual ~AudioCodec(); - OpenCodec* Open(int bitRate, AVSampleFormat format, int sampleRate); + std::unique_ptr Open(int bitRate, AVSampleFormat format, int sampleRate); bool IsFormatSupported(AVSampleFormat format); bool IsChannelsSupported(int channels); diff --git a/include/ffmpegcpp/Codecs/Codec.h b/include/ffmpegcpp/Codecs/Codec.h index 74ba5b6..d12a699 100644 --- a/include/ffmpegcpp/Codecs/Codec.h +++ b/include/ffmpegcpp/Codecs/Codec.h @@ -1,11 +1,12 @@ #pragma once #include "ffmpeg.h" -#include "std.h" #include "OpenCodec.h" #include "FFmpegResource.h" +#include + namespace ffmpegcpp { @@ -26,7 +27,7 @@ namespace ffmpegcpp FFmpegResource codecContext; - OpenCodec* Open(); + std::unique_ptr Open(); private: diff --git a/include/ffmpegcpp/Codecs/VideoCodec.h b/include/ffmpegcpp/Codecs/VideoCodec.h index e67be18..bc37fd0 100644 --- a/include/ffmpegcpp/Codecs/VideoCodec.h +++ b/include/ffmpegcpp/Codecs/VideoCodec.h @@ -14,7 +14,7 @@ namespace ffmpegcpp VideoCodec(AVCodecID codecId); virtual ~VideoCodec(); - OpenCodec* Open(int width, int height, AVRational* frameRate, AVPixelFormat format); + std::unique_ptr Open(int width, int height, AVRational* frameRate, AVPixelFormat format); // This maps to the qscale parameter so should be in the range [0,31]. void SetQualityScale(int qscale); diff --git a/src/Codecs/AudioCodec.cpp b/src/Codecs/AudioCodec.cpp index 8e931a6..824e4d6 100644 --- a/src/Codecs/AudioCodec.cpp +++ b/src/Codecs/AudioCodec.cpp @@ -125,7 +125,7 @@ namespace ffmpegcpp return select_sample_rate(codecContext->codec); } - OpenCodec* AudioCodec::Open(int bitRate, AVSampleFormat format, int sampleRate) + std::unique_ptr AudioCodec::Open(int bitRate, AVSampleFormat format, int sampleRate) { // do some sanity checks diff --git a/src/Codecs/Codec.cpp b/src/Codecs/Codec.cpp index 47bd020..2588b43 100644 --- a/src/Codecs/Codec.cpp +++ b/src/Codecs/Codec.cpp @@ -53,7 +53,7 @@ namespace ffmpegcpp av_opt_set_double(codecContext->priv_data, name, value, 0); } - OpenCodec* Codec::Open() + std::unique_ptr Codec::Open() { if (opened) { @@ -68,7 +68,7 @@ namespace ffmpegcpp opened = true; - return new OpenCodec(codecContext.get()); + return std::make_unique(codecContext.get()); } void Codec::SetGlobalContainerHeader() diff --git a/src/Codecs/VideoCodec.cpp b/src/Codecs/VideoCodec.cpp index 7499261..0ee28bc 100644 --- a/src/Codecs/VideoCodec.cpp +++ b/src/Codecs/VideoCodec.cpp @@ -50,7 +50,7 @@ namespace ffmpegcpp return false; } - OpenCodec* VideoCodec::Open(int width, int height, AVRational* frameRate, AVPixelFormat format) + std::unique_ptr VideoCodec::Open(int width, int height, AVRational* frameRate, AVPixelFormat format) { // sanity checks diff --git a/src/FrameSinks/AudioEncoder.cpp b/src/FrameSinks/AudioEncoder.cpp index b496161..c960ae8 100644 --- a/src/FrameSinks/AudioEncoder.cpp +++ b/src/FrameSinks/AudioEncoder.cpp @@ -31,7 +31,7 @@ namespace ffmpegcpp int sampleRate = closedCodec->GetDefaultSampleRate(); AVSampleFormat format = closedCodec->GetDefaultSampleFormat(); - codec = std::unique_ptr(closedCodec->Open(bitRate, format, sampleRate)); + codec = closedCodec->Open(bitRate, format, sampleRate); pkt = MakeFFmpegResource(av_packet_alloc()); if (!pkt) diff --git a/src/FrameSinks/VideoEncoder.cpp b/src/FrameSinks/VideoEncoder.cpp index c218de0..0c99b1c 100644 --- a/src/FrameSinks/VideoEncoder.cpp +++ b/src/FrameSinks/VideoEncoder.cpp @@ -58,8 +58,7 @@ namespace ffmpegcpp if (finalFrameRateSet) frameRate = finalFrameRate; // open the codec - codec = std::unique_ptr(closedCodec->Open(width, height, &frameRate, format)); - // ToDo: make the Open() function return unique_ptr + codec = closedCodec->Open(width, height, &frameRate, format); // allocate the packet we'll be using pkt = MakeFFmpegResource(av_packet_alloc()); From d5b3e5660f71f013d4bb8b8616bb390bba034c58 Mon Sep 17 00:00:00 2001 From: Wim van Aarle Date: Wed, 19 Dec 2018 13:03:17 +0100 Subject: [PATCH 24/31] forward declare as much as possible --- include/ffmpegcpp/AudioFormatConverter.h | 9 +++++++-- include/ffmpegcpp/CodecDeducer.h | 3 ++- include/ffmpegcpp/Codecs/AudioCodec.h | 5 ++++- include/ffmpegcpp/Codecs/Codec.h | 7 ++++--- include/ffmpegcpp/Codecs/VideoCodec.h | 6 +++++- include/ffmpegcpp/Demuxing/AudioInputStream.h | 6 ++++-- include/ffmpegcpp/Demuxing/InputStream.h | 11 +++++++--- include/ffmpegcpp/Demuxing/VideoInputStream.h | 6 ++++-- include/ffmpegcpp/FrameSinks/AudioEncoder.h | 19 ++++++++++-------- include/ffmpegcpp/FrameSinks/VideoEncoder.h | 19 ++++++++++++------ include/ffmpegcpp/FrameSinks/VideoFilter.h | 8 ++++++-- include/ffmpegcpp/Muxing/AudioOutputStream.h | 11 +++++++--- include/ffmpegcpp/Muxing/Muxer.h | 9 +++++++-- include/ffmpegcpp/Muxing/OutputStream.h | 12 ++++++++--- include/ffmpegcpp/Muxing/VideoOutputStream.h | 10 +++++++--- include/ffmpegcpp/OpenCodec.h | 2 +- include/ffmpegcpp/Sources/Demuxer.h | 20 +++++++++++++------ include/ffmpegcpp/Sources/EncodedFileSource.h | 12 +++++++++-- .../ffmpegcpp/Sources/RawAudioDataSource.h | 7 +++++-- .../ffmpegcpp/Sources/RawAudioFileSource.h | 6 +++--- .../ffmpegcpp/Sources/RawVideoDataSource.h | 8 ++++++-- .../ffmpegcpp/Sources/RawVideoFileSource.h | 6 +++--- include/ffmpegcpp/VideoFormatConverter.h | 5 +++-- src/AudioFormatConverter.cpp | 3 +++ src/CodecDeducer.cpp | 2 ++ src/Codecs/AudioCodec.cpp | 2 ++ src/Codecs/Codec.cpp | 5 ++++- src/Codecs/VideoCodec.cpp | 2 ++ src/Demuxing/AudioInputStream.cpp | 3 +++ src/Demuxing/InputStream.cpp | 3 +++ src/Demuxing/VideoInputStream.cpp | 3 +++ src/FrameSinks/AudioEncoder.cpp | 9 ++++++++- src/FrameSinks/VideoEncoder.cpp | 6 ++++++ src/FrameSinks/VideoFilter.cpp | 2 ++ src/Muxing/AudioOutputStream.cpp | 5 +++++ src/Muxing/Muxer.cpp | 5 +++-- src/Muxing/OutputStream.cpp | 4 ++++ src/Muxing/VideoOutputStream.cpp | 5 +++++ src/OpenCodec.cpp | 4 ++-- src/Sources/Demuxer.cpp | 8 +++++++- src/Sources/EncodedFileSource.cpp | 5 ++++- src/Sources/RawAudioDataSource.cpp | 3 +++ src/Sources/RawAudioFileSource.cpp | 3 +++ src/Sources/RawVideoDataSource.cpp | 3 +++ src/Sources/RawVideoFileSource.cpp | 3 +++ src/VideoFormatConverter.cpp | 3 +++ 46 files changed, 227 insertions(+), 71 deletions(-) diff --git a/include/ffmpegcpp/AudioFormatConverter.h b/include/ffmpegcpp/AudioFormatConverter.h index f0830e3..78946dc 100644 --- a/include/ffmpegcpp/AudioFormatConverter.h +++ b/include/ffmpegcpp/AudioFormatConverter.h @@ -1,11 +1,16 @@ #pragma once -#include "ffmpeg.h" -#include "ConvertedAudioProcessor.h" + #include "FFmpegResource.h" +struct AVCodecContext; +struct AVFrame; +struct AVAudioFifo; + namespace ffmpegcpp { + class ConvertedAudioProcessor; + class AudioFormatConverter { public: diff --git a/include/ffmpegcpp/CodecDeducer.h b/include/ffmpegcpp/CodecDeducer.h index c3cc536..04b9221 100644 --- a/include/ffmpegcpp/CodecDeducer.h +++ b/include/ffmpegcpp/CodecDeducer.h @@ -1,6 +1,7 @@ #pragma once -#include "ffmpeg.h" +enum AVCodecID; +struct AVCodec; namespace ffmpegcpp { diff --git a/include/ffmpegcpp/Codecs/AudioCodec.h b/include/ffmpegcpp/Codecs/AudioCodec.h index 5ce1801..8decac6 100644 --- a/include/ffmpegcpp/Codecs/AudioCodec.h +++ b/include/ffmpegcpp/Codecs/AudioCodec.h @@ -1,10 +1,13 @@ #pragma once #include "Codecs/Codec.h" -#include "OpenCodec.h" + +enum AVCodecID; +enum AVSampleFormat; namespace ffmpegcpp { + class OpenCodec; class AudioCodec : public Codec { diff --git a/include/ffmpegcpp/Codecs/Codec.h b/include/ffmpegcpp/Codecs/Codec.h index d12a699..866e548 100644 --- a/include/ffmpegcpp/Codecs/Codec.h +++ b/include/ffmpegcpp/Codecs/Codec.h @@ -1,14 +1,15 @@ #pragma once -#include "ffmpeg.h" - -#include "OpenCodec.h" #include "FFmpegResource.h" #include +enum AVCodecID; +struct AVCodecContext; + namespace ffmpegcpp { + class OpenCodec; class Codec { diff --git a/include/ffmpegcpp/Codecs/VideoCodec.h b/include/ffmpegcpp/Codecs/VideoCodec.h index bc37fd0..4c51ddf 100644 --- a/include/ffmpegcpp/Codecs/VideoCodec.h +++ b/include/ffmpegcpp/Codecs/VideoCodec.h @@ -1,10 +1,14 @@ #pragma once #include "Codec.h" -#include "OpenCodec.h" + +enum AVCodecID; +enum AVSampleFormat; +struct AVRational; namespace ffmpegcpp { + class OpenCodec; class VideoCodec : public Codec { diff --git a/include/ffmpegcpp/Demuxing/AudioInputStream.h b/include/ffmpegcpp/Demuxing/AudioInputStream.h index c3e79ca..374d9c5 100644 --- a/include/ffmpegcpp/Demuxing/AudioInputStream.h +++ b/include/ffmpegcpp/Demuxing/AudioInputStream.h @@ -1,11 +1,13 @@ #pragma once -#include "ffmpeg.h" #include "Demuxing/InputStream.h" -#include "FrameSinks/AudioFrameSink.h" + +struct AVStream; namespace ffmpegcpp { + class AudioFrameSink; + class AudioInputStream : public InputStream { diff --git a/include/ffmpegcpp/Demuxing/InputStream.h b/include/ffmpegcpp/Demuxing/InputStream.h index 9634596..c64dca0 100644 --- a/include/ffmpegcpp/Demuxing/InputStream.h +++ b/include/ffmpegcpp/Demuxing/InputStream.h @@ -1,12 +1,17 @@ #pragma once -#include "ffmpeg.h" -#include "std.h" -#include "FrameSinks/FrameSink.h" #include "FFmpegResource.h" +struct AVCodecContext; +struct AVFrame; +struct AVPacket; +struct AVRational; +struct AVStream; + namespace ffmpegcpp { + class FrameSink; + class InputStream { diff --git a/include/ffmpegcpp/Demuxing/VideoInputStream.h b/include/ffmpegcpp/Demuxing/VideoInputStream.h index 8793f44..b2737af 100644 --- a/include/ffmpegcpp/Demuxing/VideoInputStream.h +++ b/include/ffmpegcpp/Demuxing/VideoInputStream.h @@ -1,11 +1,13 @@ #pragma once -#include "ffmpeg.h" #include "Demuxing/InputStream.h" -#include "FrameSinks/VideoFrameSink.h" + +struct AVStream; namespace ffmpegcpp { + class VideoFrameSink; + class VideoInputStream : public InputStream { diff --git a/include/ffmpegcpp/FrameSinks/AudioEncoder.h b/include/ffmpegcpp/FrameSinks/AudioEncoder.h index fa2f904..f4f0779 100644 --- a/include/ffmpegcpp/FrameSinks/AudioEncoder.h +++ b/include/ffmpegcpp/FrameSinks/AudioEncoder.h @@ -1,20 +1,23 @@ #pragma once -#include "ffmpeg.h" -#include "std.h" - +#include "FFmpegResource.h" #include "FrameSinks/AudioFrameSink.h" -#include "Codecs/AudioCodec.h" #include "ConvertedAudioProcessor.h" -#include "AudioFormatConverter.h" -#include "Muxing/Muxer.h" -#include "Muxing/OutputStream.h" -#include "FFmpegResource.h" #include +struct AVFrame; +struct AVPacket; +struct AVRational; + namespace ffmpegcpp { + class AudioCodec; + class AudioFormatConverter; + class Muxer; + class OpenCodec; + class OutputStream; + class AudioEncoder : public AudioFrameSink, public ConvertedAudioProcessor { public: diff --git a/include/ffmpegcpp/FrameSinks/VideoEncoder.h b/include/ffmpegcpp/FrameSinks/VideoEncoder.h index 5cc5996..37632dc 100644 --- a/include/ffmpegcpp/FrameSinks/VideoEncoder.h +++ b/include/ffmpegcpp/FrameSinks/VideoEncoder.h @@ -1,17 +1,24 @@ #pragma once -#include "ffmpeg.h" - -#include "FrameSinks/VideoFrameSink.h" -#include "Codecs/VideoCodec.h" -#include "VideoFormatConverter.h" -#include "Muxing/Muxer.h" #include "FFmpegResource.h" +#include "FrameSinks/VideoFrameSink.h" #include +enum AVPixelFormat; +struct AVRational; +struct AVFrame; +struct AVPacket; + namespace ffmpegcpp { + class VideoCodec; + class Muxer; + class OutputStream; + class VideoFormatConverter; + class OpenCodec; + + class VideoEncoder : public VideoFrameSink { public: diff --git a/include/ffmpegcpp/FrameSinks/VideoFilter.h b/include/ffmpegcpp/FrameSinks/VideoFilter.h index 9a4aef4..62bd18e 100644 --- a/include/ffmpegcpp/FrameSinks/VideoFilter.h +++ b/include/ffmpegcpp/FrameSinks/VideoFilter.h @@ -1,10 +1,14 @@ #pragma once -#include "ffmpeg.h" - #include "FrameSinks/VideoFrameSink.h" #include "FFmpegResource.h" +struct AVFilterContext; +struct AVFilterGraph; +struct AVFrame; +struct AVFrame; +struct AVRational; + namespace ffmpegcpp { class VideoFilter : public VideoFrameSink diff --git a/include/ffmpegcpp/Muxing/AudioOutputStream.h b/include/ffmpegcpp/Muxing/AudioOutputStream.h index 02f3b3c..a752b36 100644 --- a/include/ffmpegcpp/Muxing/AudioOutputStream.h +++ b/include/ffmpegcpp/Muxing/AudioOutputStream.h @@ -1,12 +1,17 @@ #pragma once -#include "ffmpeg.h" -#include "Codecs/Codec.h" #include "Muxing/OutputStream.h" -#include "Muxing/Muxer.h" + +struct AVPacket; +struct AVRational; +struct AVStream; namespace ffmpegcpp { + class Codec; + class Muxer; + class OpenCodec; + class AudioOutputStream : public OutputStream { public: diff --git a/include/ffmpegcpp/Muxing/Muxer.h b/include/ffmpegcpp/Muxing/Muxer.h index 1d61891..a0f4d3b 100644 --- a/include/ffmpegcpp/Muxing/Muxer.h +++ b/include/ffmpegcpp/Muxing/Muxer.h @@ -1,9 +1,14 @@ #pragma once -#include "ffmpeg.h" -#include "std.h" #include "FFmpegResource.h" +#include +#include + +struct AVFormatContext; +struct AVOutputFormat; +struct AVPacket; + namespace ffmpegcpp { class OutputStream; diff --git a/include/ffmpegcpp/Muxing/OutputStream.h b/include/ffmpegcpp/Muxing/OutputStream.h index 4d4aa84..d0ab665 100644 --- a/include/ffmpegcpp/Muxing/OutputStream.h +++ b/include/ffmpegcpp/Muxing/OutputStream.h @@ -1,12 +1,18 @@ #pragma once -#include "ffmpeg.h" -#include "Codecs/Codec.h" -#include "Muxing/Muxer.h" #include "FFmpegResource.h" +#include + +struct AVPacket; +struct AVStream; + namespace ffmpegcpp { + class Codec; + class Muxer; + class OpenCodec; + class OutputStream { public: diff --git a/include/ffmpegcpp/Muxing/VideoOutputStream.h b/include/ffmpegcpp/Muxing/VideoOutputStream.h index 163436c..0cc49e8 100644 --- a/include/ffmpegcpp/Muxing/VideoOutputStream.h +++ b/include/ffmpegcpp/Muxing/VideoOutputStream.h @@ -1,12 +1,16 @@ #pragma once -#include "ffmpeg.h" -#include "Codecs/Codec.h" #include "Muxing/OutputStream.h" -#include "Muxing/Muxer.h" + +struct AVPacket; +struct AVStream; namespace ffmpegcpp { + class Codec; + class Muxer; + class OpenCodec; + class VideoOutputStream : public OutputStream { public: diff --git a/include/ffmpegcpp/OpenCodec.h b/include/ffmpegcpp/OpenCodec.h index dbe9301..68b1da9 100644 --- a/include/ffmpegcpp/OpenCodec.h +++ b/include/ffmpegcpp/OpenCodec.h @@ -1,6 +1,6 @@ #pragma once -#include "ffmpeg.h" +struct AVCodecContext; namespace ffmpegcpp { diff --git a/include/ffmpegcpp/Sources/Demuxer.h b/include/ffmpegcpp/Sources/Demuxer.h index 46823f2..48e1c28 100644 --- a/include/ffmpegcpp/Sources/Demuxer.h +++ b/include/ffmpegcpp/Sources/Demuxer.h @@ -1,16 +1,24 @@ #pragma once -#include "ffmpeg.h" -#include "std.h" - -#include "Demuxing/AudioInputStream.h" -#include "Demuxing/VideoInputStream.h" -#include "Demuxing/InputStream.h" #include "Sources/InputSource.h" #include "FFmpegResource.h" +#include + +enum AVMediaType; +struct AVCodec; +struct AVDictionary; +struct AVFormatContext; +struct AVInputFormat; +struct AVPacket; +struct AVStream; + namespace ffmpegcpp { + class AudioFrameSink; + class InputStream; + class VideoFrameSink; + struct StreamInfo { int streamId; diff --git a/include/ffmpegcpp/Sources/EncodedFileSource.h b/include/ffmpegcpp/Sources/EncodedFileSource.h index 5343549..54cd535 100644 --- a/include/ffmpegcpp/Sources/EncodedFileSource.h +++ b/include/ffmpegcpp/Sources/EncodedFileSource.h @@ -1,12 +1,20 @@ #pragma once -#include "ffmpeg.h" -#include "FrameSinks/FrameSink.h" #include "Sources/InputSource.h" #include "FFmpegResource.h" +enum AVCodecID; +struct AVCodec; +struct AVCodecContext; +struct AVCodecParserContext; +struct AVFrame; +struct AVPacket; +struct AVRational; + namespace ffmpegcpp { + class FrameSink; + // EncodedFileSource takes a file that is already encoded but not in a container (ie .mp3, .h264) // and feeds it to the system. class EncodedFileSource : public InputSource diff --git a/include/ffmpegcpp/Sources/RawAudioDataSource.h b/include/ffmpegcpp/Sources/RawAudioDataSource.h index 01aa3fe..f80ffcd 100644 --- a/include/ffmpegcpp/Sources/RawAudioDataSource.h +++ b/include/ffmpegcpp/Sources/RawAudioDataSource.h @@ -1,11 +1,14 @@ #pragma once -#include "ffmpeg.h" -#include "FrameSinks/AudioFrameSink.h" #include "FFmpegResource.h" +enum AVSampleFormat; +struct AVFrame; + namespace ffmpegcpp { + class AudioFrameSink; + // RawVideoDataSource is used to feed raw memory to the system and process it. // You can use this if the video data comes from another source than the file system (ie rendering). class RawAudioDataSource diff --git a/include/ffmpegcpp/Sources/RawAudioFileSource.h b/include/ffmpegcpp/Sources/RawAudioFileSource.h index 5efd751..b25328d 100644 --- a/include/ffmpegcpp/Sources/RawAudioFileSource.h +++ b/include/ffmpegcpp/Sources/RawAudioFileSource.h @@ -1,14 +1,14 @@ #pragma once -#include "ffmpeg.h" - #include "Sources/InputSource.h" -#include "Sources/Demuxer.h" #include namespace ffmpegcpp { + class AudioFrameSink; + class Demuxer; + class RawAudioFileSource : public InputSource { public: diff --git a/include/ffmpegcpp/Sources/RawVideoDataSource.h b/include/ffmpegcpp/Sources/RawVideoDataSource.h index 172958f..9ee9a78 100644 --- a/include/ffmpegcpp/Sources/RawVideoDataSource.h +++ b/include/ffmpegcpp/Sources/RawVideoDataSource.h @@ -1,11 +1,15 @@ #pragma once -#include "ffmpeg.h" -#include "FrameSinks/VideoFrameSink.h" #include "FFmpegResource.h" +enum AVPixelFormat; +struct AVFrame; +struct AVRational; + namespace ffmpegcpp { + class VideoFrameSink; + // RawVideoDataSource is used to feed raw memory to the system and process it. // You can use this if the video data comes from another source than the file system (ie rendering). class RawVideoDataSource diff --git a/include/ffmpegcpp/Sources/RawVideoFileSource.h b/include/ffmpegcpp/Sources/RawVideoFileSource.h index 7c5cd7b..86a80ce 100644 --- a/include/ffmpegcpp/Sources/RawVideoFileSource.h +++ b/include/ffmpegcpp/Sources/RawVideoFileSource.h @@ -1,14 +1,14 @@ #pragma once -#include "ffmpeg.h" - #include "Sources/InputSource.h" -#include "Sources/Demuxer.h" #include namespace ffmpegcpp { + class Demuxer; + class VideoFrameSink; + class RawVideoFileSource : public InputSource { public: diff --git a/include/ffmpegcpp/VideoFormatConverter.h b/include/ffmpegcpp/VideoFormatConverter.h index 92b366d..d0b881c 100644 --- a/include/ffmpegcpp/VideoFormatConverter.h +++ b/include/ffmpegcpp/VideoFormatConverter.h @@ -1,9 +1,10 @@ #pragma once -#include "ffmpeg.h" -#include "ConvertedAudioProcessor.h" #include "FFmpegResource.h" +struct AVCodecContext; +struct AVFrame; + namespace ffmpegcpp { class VideoFormatConverter diff --git a/src/AudioFormatConverter.cpp b/src/AudioFormatConverter.cpp index 45b3a5e..fce0a54 100644 --- a/src/AudioFormatConverter.cpp +++ b/src/AudioFormatConverter.cpp @@ -1,4 +1,7 @@ #include "AudioFormatConverter.h" + +#include "ConvertedAudioProcessor.h" +#include "ffmpeg.h" #include "FFmpegException.h" namespace ffmpegcpp diff --git a/src/CodecDeducer.cpp b/src/CodecDeducer.cpp index ba61b88..07a0d2b 100644 --- a/src/CodecDeducer.cpp +++ b/src/CodecDeducer.cpp @@ -1,4 +1,6 @@ #include "CodecDeducer.h" + +#include "ffmpeg.h" #include "FFmpegException.h" using namespace std; diff --git a/src/Codecs/AudioCodec.cpp b/src/Codecs/AudioCodec.cpp index 824e4d6..7b3342f 100644 --- a/src/Codecs/AudioCodec.cpp +++ b/src/Codecs/AudioCodec.cpp @@ -1,5 +1,7 @@ #include "Codecs/AudioCodec.h" #include "FFmpegException.h" +#include "ffmpeg.h" +#include "OpenCodec.h" using namespace std; diff --git a/src/Codecs/Codec.cpp b/src/Codecs/Codec.cpp index 2588b43..42548b8 100644 --- a/src/Codecs/Codec.cpp +++ b/src/Codecs/Codec.cpp @@ -1,6 +1,9 @@ + +#include "CodecDeducer.h" #include "Codecs/Codec.h" +#include "ffmpeg.h" #include "FFmpegException.h" -#include "CodecDeducer.h" +#include "OpenCodec.h" using namespace std; diff --git a/src/Codecs/VideoCodec.cpp b/src/Codecs/VideoCodec.cpp index 0ee28bc..a8ac347 100644 --- a/src/Codecs/VideoCodec.cpp +++ b/src/Codecs/VideoCodec.cpp @@ -1,5 +1,7 @@ #include "Codecs/VideoCodec.h" #include "FFmpegException.h" +#include "ffmpeg.h" +#include "OpenCodec.h" using namespace std; diff --git a/src/Demuxing/AudioInputStream.cpp b/src/Demuxing/AudioInputStream.cpp index 037bc99..da32466 100644 --- a/src/Demuxing/AudioInputStream.cpp +++ b/src/Demuxing/AudioInputStream.cpp @@ -1,5 +1,8 @@ #include "Demuxing/AudioInputStream.h" +#include "ffmpeg.h" +#include "FrameSinks/AudioFrameSink.h" + namespace ffmpegcpp { AudioInputStream::AudioInputStream(AudioFrameSink* frameSink, AVStream* stream) diff --git a/src/Demuxing/InputStream.cpp b/src/Demuxing/InputStream.cpp index fe44e86..42fd62a 100644 --- a/src/Demuxing/InputStream.cpp +++ b/src/Demuxing/InputStream.cpp @@ -1,6 +1,9 @@ #include "Demuxing/InputStream.h" #include "CodecDeducer.h" +#include "ffmpeg.h" #include "FFmpegException.h" +#include "FrameSinks/FrameSink.h" +#include "std.h" using namespace std; diff --git a/src/Demuxing/VideoInputStream.cpp b/src/Demuxing/VideoInputStream.cpp index 241d04a..f162dae 100644 --- a/src/Demuxing/VideoInputStream.cpp +++ b/src/Demuxing/VideoInputStream.cpp @@ -1,5 +1,8 @@ #include "Demuxing/VideoInputStream.h" +#include "ffmpeg.h" +#include "FrameSinks/VideoFrameSink.h" + namespace ffmpegcpp { VideoInputStream::VideoInputStream(VideoFrameSink* frameSink, AVStream* stream) diff --git a/src/FrameSinks/AudioEncoder.cpp b/src/FrameSinks/AudioEncoder.cpp index c960ae8..ec2405c 100644 --- a/src/FrameSinks/AudioEncoder.cpp +++ b/src/FrameSinks/AudioEncoder.cpp @@ -1,7 +1,14 @@ #include "FrameSinks/AudioEncoder.h" -#include "Muxing/AudioOutputStream.h" +#include "AudioFormatConverter.h" +#include "Codecs/AudioCodec.h" +#include "ffmpeg.h" #include "FFmpegException.h" +#include "Muxing/AudioOutputStream.h" +#include "Muxing/Muxer.h" +#include "Muxing/OutputStream.h" +#include "OpenCodec.h" +#include "std.h" using namespace std; diff --git a/src/FrameSinks/VideoEncoder.cpp b/src/FrameSinks/VideoEncoder.cpp index 0c99b1c..8371c97 100644 --- a/src/FrameSinks/VideoEncoder.cpp +++ b/src/FrameSinks/VideoEncoder.cpp @@ -1,7 +1,13 @@ #include "FrameSinks/VideoEncoder.h" + +#include "Codecs/VideoCodec.h" +#include "ffmpeg.h" #include "FFmpegException.h" +#include "Muxing/Muxer.h" #include "Muxing/VideoOutputStream.h" +#include "VideoFormatConverter.h" +#include "OpenCodec.h" using namespace std; diff --git a/src/FrameSinks/VideoFilter.cpp b/src/FrameSinks/VideoFilter.cpp index 166db0e..d0f5643 100644 --- a/src/FrameSinks/VideoFilter.cpp +++ b/src/FrameSinks/VideoFilter.cpp @@ -1,4 +1,6 @@ #include "FrameSinks/VideoFilter.h" + +#include "ffmpeg.h" #include "FFmpegException.h" namespace ffmpegcpp diff --git a/src/Muxing/AudioOutputStream.cpp b/src/Muxing/AudioOutputStream.cpp index cdb5e20..c7c081f 100644 --- a/src/Muxing/AudioOutputStream.cpp +++ b/src/Muxing/AudioOutputStream.cpp @@ -1,5 +1,10 @@ #include "Muxing/AudioOutputStream.h" + +#include "Codecs/Codec.h" +#include "ffmpeg.h" #include "FFmpegException.h" +#include "Muxing/Muxer.h" +#include "OpenCodec.h" using namespace std; namespace ffmpegcpp diff --git a/src/Muxing/Muxer.cpp b/src/Muxing/Muxer.cpp index 17aaf16..ed88956 100644 --- a/src/Muxing/Muxer.cpp +++ b/src/Muxing/Muxer.cpp @@ -1,8 +1,9 @@ #include "Muxing/Muxer.h" + +#include "ffmpeg.h" #include "FFmpegException.h" #include "Muxing/OutputStream.h" - -#include +#include "std.h" using namespace std; diff --git a/src/Muxing/OutputStream.cpp b/src/Muxing/OutputStream.cpp index 062142e..37f84ac 100644 --- a/src/Muxing/OutputStream.cpp +++ b/src/Muxing/OutputStream.cpp @@ -1,5 +1,9 @@ #include "Muxing/OutputStream.h" + +#include "Codecs/Codec.h" +#include "ffmpeg.h" #include "FFmpegException.h" +#include "Muxing/Muxer.h" using namespace std; diff --git a/src/Muxing/VideoOutputStream.cpp b/src/Muxing/VideoOutputStream.cpp index ae86a5b..dbfdd15 100644 --- a/src/Muxing/VideoOutputStream.cpp +++ b/src/Muxing/VideoOutputStream.cpp @@ -1,5 +1,10 @@ #include "Muxing/VideoOutputStream.h" + +#include "Codecs/Codec.h" +#include "ffmpeg.h" #include "FFmpegException.h" +#include "Muxing/Muxer.h" +#include "OpenCodec.h" using namespace std; diff --git a/src/OpenCodec.cpp b/src/OpenCodec.cpp index b54c900..4228288 100644 --- a/src/OpenCodec.cpp +++ b/src/OpenCodec.cpp @@ -1,6 +1,6 @@ -#pragma once - #include "OpenCodec.h" + +#include "ffmpeg.h" #include "FFmpegException.h" using namespace std; diff --git a/src/Sources/Demuxer.cpp b/src/Sources/Demuxer.cpp index 6838c53..95de96a 100644 --- a/src/Sources/Demuxer.cpp +++ b/src/Sources/Demuxer.cpp @@ -1,6 +1,12 @@ #include "Sources/Demuxer.h" -#include "FFmpegException.h" + #include "CodecDeducer.h" +#include "Demuxing/AudioInputStream.h" +#include "Demuxing/InputStream.h" +#include "Demuxing/VideoInputStream.h" +#include "ffmpeg.h" +#include "FFmpegException.h" +#include "std.h" #include diff --git a/src/Sources/EncodedFileSource.cpp b/src/Sources/EncodedFileSource.cpp index e69c1bb..22f686b 100644 --- a/src/Sources/EncodedFileSource.cpp +++ b/src/Sources/EncodedFileSource.cpp @@ -1,6 +1,9 @@ #include "Sources/EncodedFileSource.h" -#include "FFmpegException.h" + #include "CodecDeducer.h" +#include "ffmpeg.h" +#include "FFmpegException.h" +#include "FrameSinks/FrameSink.h" using namespace std; diff --git a/src/Sources/RawAudioDataSource.cpp b/src/Sources/RawAudioDataSource.cpp index 84d2500..de9439e 100644 --- a/src/Sources/RawAudioDataSource.cpp +++ b/src/Sources/RawAudioDataSource.cpp @@ -1,5 +1,8 @@ #include "Sources/RawAudioDataSource.h" + +#include "ffmpeg.h" #include "FFmpegException.h" +#include "FrameSinks/AudioFrameSink.h" namespace ffmpegcpp { diff --git a/src/Sources/RawAudioFileSource.cpp b/src/Sources/RawAudioFileSource.cpp index 790cf75..b8164c1 100644 --- a/src/Sources/RawAudioFileSource.cpp +++ b/src/Sources/RawAudioFileSource.cpp @@ -1,5 +1,8 @@ #include "Sources/RawAudioFileSource.h" + +#include "ffmpeg.h" #include "FFmpegException.h" +#include "Sources/Demuxer.h" #include "std.h" using namespace std; diff --git a/src/Sources/RawVideoDataSource.cpp b/src/Sources/RawVideoDataSource.cpp index 0e34c6d..252c8bb 100644 --- a/src/Sources/RawVideoDataSource.cpp +++ b/src/Sources/RawVideoDataSource.cpp @@ -1,5 +1,8 @@ #include "Sources/RawVideoDataSource.h" + +#include "ffmpeg.h" #include "FFmpegException.h" +#include "FrameSinks/VideoFrameSink.h" namespace ffmpegcpp { diff --git a/src/Sources/RawVideoFileSource.cpp b/src/Sources/RawVideoFileSource.cpp index 54d72ce..dc9cd69 100644 --- a/src/Sources/RawVideoFileSource.cpp +++ b/src/Sources/RawVideoFileSource.cpp @@ -1,5 +1,8 @@ #include "Sources/RawVideoFileSource.h" + +#include "ffmpeg.h" #include "FFmpegException.h" +#include "Sources/Demuxer.h" #include "std.h" using namespace std; diff --git a/src/VideoFormatConverter.cpp b/src/VideoFormatConverter.cpp index 2aec4cd..aeb722d 100644 --- a/src/VideoFormatConverter.cpp +++ b/src/VideoFormatConverter.cpp @@ -1,4 +1,7 @@ #include "VideoFormatConverter.h" + +#include "ConvertedAudioProcessor.h" +#include "ffmpeg.h" #include "FFmpegException.h" namespace ffmpegcpp From 5b5bd80f1a9e667dc9dc407fe9f2483c3a59fbe8 Mon Sep 17 00:00:00 2001 From: Wim van Aarle Date: Wed, 19 Dec 2018 18:03:19 +0100 Subject: [PATCH 25/31] replaced InputStream** with vector --- include/ffmpegcpp/Sources/Demuxer.h | 5 +-- src/Sources/Demuxer.cpp | 47 +++++++---------------------- 2 files changed, 12 insertions(+), 40 deletions(-) diff --git a/include/ffmpegcpp/Sources/Demuxer.h b/include/ffmpegcpp/Sources/Demuxer.h index 48e1c28..41f27b2 100644 --- a/include/ffmpegcpp/Sources/Demuxer.h +++ b/include/ffmpegcpp/Sources/Demuxer.h @@ -32,7 +32,6 @@ namespace ffmpegcpp Demuxer(const char* fileName); Demuxer(const char* fileName, AVInputFormat* inputFormat, AVDictionary *inputFormatOptions); - ~Demuxer(); void DecodeBestAudioStream(AudioFrameSink* frameSink); void DecodeBestVideoStream(VideoFrameSink* frameSink); @@ -56,13 +55,11 @@ namespace ffmpegcpp std::vector GetStreamInfo(AVMediaType mediaType); StreamInfo CreateInfo(int streamIndex, AVStream* stream, AVCodec* codec); - InputStream** inputStreams = nullptr; + std::vector> inputStreams; FFmpegResource containerContext; FFmpegResource pkt; void DecodePacket(); - - void CleanUp(); }; } diff --git a/src/Sources/Demuxer.cpp b/src/Sources/Demuxer.cpp index 95de96a..6f23ebb 100644 --- a/src/Sources/Demuxer.cpp +++ b/src/Sources/Demuxer.cpp @@ -29,28 +29,24 @@ namespace ffmpegcpp auto container_ctx = containerContext.get(); if ((ret = avformat_open_input(&container_ctx, fileName, inputFormat, &format_opts)) < 0) { - CleanUp(); throw FFmpegException("Failed to open input container " + string(fileName), ret); } // retrieve stream information if (ret = (avformat_find_stream_info(containerContext.get(), nullptr)) < 0) { - CleanUp(); throw FFmpegException("Failed to read streams from " + string(fileName), ret); } - inputStreams = new InputStream*[containerContext->nb_streams]; - for (int i = 0; i < containerContext->nb_streams; ++i) - { - inputStreams[i] = nullptr; - } + for (int i = 0; i < containerContext->nb_streams; ++i) + { + inputStreams.emplace_back(nullptr); + } // initialize packet, set data to NULL, let the demuxer fill it pkt = MakeFFmpegResource(av_packet_alloc()); if (!pkt) { - CleanUp(); throw FFmpegException("Failed to create packet for input stream"); } av_init_packet(pkt.get()); @@ -58,27 +54,6 @@ namespace ffmpegcpp pkt->size = 0; } - Demuxer::~Demuxer() - { - CleanUp(); - } - - void Demuxer::CleanUp() - { - if (inputStreams != nullptr) - { - for (int i = 0; i < containerContext->nb_streams; ++i) - { - if (inputStreams[i] != nullptr) - { - delete inputStreams[i]; - } - } - delete inputStreams; - inputStreams = nullptr; - } - } - vector Demuxer::GetAudioStreamInfo() { return GetStreamInfo(AVMEDIA_TYPE_AUDIO); @@ -152,11 +127,11 @@ namespace ffmpegcpp // create the stream AVStream* stream = containerContext->streams[streamIndex]; - AudioInputStream* inputStream = new AudioInputStream(frameSink, stream); + auto inputStream = std::make_unique(frameSink, stream); inputStream->Open(); // remember and return - inputStreams[streamIndex] = inputStream; + inputStreams[streamIndex] = std::move(inputStream); } void Demuxer::DecodeVideoStream(int streamIndex, VideoFrameSink* frameSink) @@ -169,11 +144,11 @@ namespace ffmpegcpp // create the stream AVStream* stream = containerContext->streams[streamIndex]; - VideoInputStream* inputStream = new VideoInputStream(frameSink, stream); + auto inputStream = std::make_unique(frameSink, stream); inputStream->Open(); // remember and return - inputStreams[streamIndex] = inputStream; + inputStreams[streamIndex] = std::move(inputStream); } void Demuxer::PreparePipeline() @@ -187,7 +162,7 @@ namespace ffmpegcpp allPrimed = true; for (int i = 0; i < containerContext->nb_streams; ++i) { - InputStream* stream = inputStreams[i]; + const auto & stream = inputStreams[i]; if (stream != nullptr) { if (!stream->IsPrimed()) allPrimed = false; @@ -214,7 +189,7 @@ namespace ffmpegcpp pkt->size = 0; for (int i = 0; i < containerContext->nb_streams; ++i) { - InputStream* stream = inputStreams[i]; + const auto & stream = inputStreams[i]; if (stream != nullptr) { pkt->stream_index = i; @@ -243,7 +218,7 @@ namespace ffmpegcpp void Demuxer::DecodePacket() { int streamIndex = pkt->stream_index; - InputStream* inputStream = inputStreams[streamIndex]; + const auto & inputStream = inputStreams[streamIndex]; if (inputStream != nullptr) { From 0659b0721dcae0512dc290bc5e9026cdf4876bb5 Mon Sep 17 00:00:00 2001 From: Wim van Aarle Date: Wed, 19 Dec 2018 18:34:06 +0100 Subject: [PATCH 26/31] replaced for loops with algorithms where possible --- src/Muxing/Muxer.cpp | 24 +++++++++++------------- src/Muxing/OutputStream.cpp | 8 ++++---- src/Sources/Demuxer.cpp | 17 ++++++----------- 3 files changed, 21 insertions(+), 28 deletions(-) diff --git a/src/Muxing/Muxer.cpp b/src/Muxing/Muxer.cpp index ed88956..a237ee6 100644 --- a/src/Muxing/Muxer.cpp +++ b/src/Muxing/Muxer.cpp @@ -5,6 +5,8 @@ #include "Muxing/OutputStream.h" #include "std.h" +#include + using namespace std; namespace ffmpegcpp @@ -83,11 +85,10 @@ namespace ffmpegcpp bool Muxer::IsPrimed() { if (opened) return true; // we were already opened before - always primed from now on! - bool allPrimed = true; - for (int i = 0; i < outputStreams.size(); ++i) - { - if (!outputStreams[i]->IsPrimed()) allPrimed = false; - } + + bool allPrimed = std::all_of(cbegin(outputStreams), cend(outputStreams), [](const auto & stream){ + return stream->IsPrimed(); + }); // we are finally primed - open ourselves before we continue. if (allPrimed) @@ -131,10 +132,8 @@ namespace ffmpegcpp printf("After %d cached packets, we can finally open the container\n", packetQueue.size()); // flush the queue - for (int i = 0; i < packetQueue.size(); ++i) + std::for_each(begin(packetQueue), end(packetQueue), [this](const auto & tmp_pkt) { - const auto & tmp_pkt = packetQueue[i]; - // Write the compressed frame to the media file. int ret = av_interleaved_write_frame(containerContext, tmp_pkt.get()); if (ret < 0) @@ -143,7 +142,7 @@ namespace ffmpegcpp } av_packet_unref(tmp_pkt.get()); - } + }); packetQueue.clear(); } @@ -198,10 +197,9 @@ namespace ffmpegcpp // We must be sure to do this because in an extreme case, one entire stream // might be queueing all its packets before we are opened, so it might not // be draining them at all. - for (int i = 0; i < outputStreams.size(); ++i) - { - outputStreams[i]->DrainPacketQueue(); - } + std::for_each(begin(outputStreams), end(outputStreams), [](auto * stream){ + stream->DrainPacketQueue(); + }); // free the stream CleanUp(); diff --git a/src/Muxing/OutputStream.cpp b/src/Muxing/OutputStream.cpp index 37f84ac..b843891 100644 --- a/src/Muxing/OutputStream.cpp +++ b/src/Muxing/OutputStream.cpp @@ -5,6 +5,8 @@ #include "FFmpegException.h" #include "Muxing/Muxer.h" +#include + using namespace std; namespace ffmpegcpp @@ -44,17 +46,15 @@ namespace ffmpegcpp void OutputStream::DrainPacketQueue() { if (packetQueue.size() > 0) printf("Drain %d packets from the packet queue...", packetQueue.size()); - for (int i = 0; i < packetQueue.size(); ++i) + std::for_each(begin(packetQueue), end(packetQueue), [this](auto & tmp_pkt) { - const auto & tmp_pkt = packetQueue[i]; - // Write the compressed frame to the media file PreparePacketForMuxer(tmp_pkt.get()); muxer->WritePacket(tmp_pkt.get()); // Release the packet av_packet_unref(tmp_pkt.get()); - } + }); packetQueue.clear(); } } diff --git a/src/Sources/Demuxer.cpp b/src/Sources/Demuxer.cpp index 6f23ebb..a94e0a6 100644 --- a/src/Sources/Demuxer.cpp +++ b/src/Sources/Demuxer.cpp @@ -8,6 +8,7 @@ #include "FFmpegException.h" #include "std.h" +#include #include using namespace std; @@ -159,16 +160,10 @@ namespace ffmpegcpp Step(); // see if all input streams are primed - allPrimed = true; - for (int i = 0; i < containerContext->nb_streams; ++i) - { - const auto & stream = inputStreams[i]; - if (stream != nullptr) - { - if (!stream->IsPrimed()) allPrimed = false; - } - } - + allPrimed = std::all_of(cbegin(inputStreams), cend(inputStreams), [](const auto & stream){ + return stream->IsPrimed(); + }); + } while (!allPrimed && !IsDone()); } @@ -189,7 +184,7 @@ namespace ffmpegcpp pkt->size = 0; for (int i = 0; i < containerContext->nb_streams; ++i) { - const auto & stream = inputStreams[i]; + auto & stream = inputStreams[i]; if (stream != nullptr) { pkt->stream_index = i; From 95207841bf579fe890ce0dd6596a1030f28fcf18 Mon Sep 17 00:00:00 2001 From: Wim van Aarle Date: Wed, 19 Dec 2018 18:49:37 +0100 Subject: [PATCH 27/31] added const specifier to const member functions --- examples/decode_audio/decode_audio.cpp | 2 +- examples/decode_video/decode_video.cpp | 2 +- examples/demo/GeneratedAudioSource.cpp | 2 +- examples/demo/GeneratedAudioSource.h | 2 +- examples/demo/GeneratedVideoSource.cpp | 2 +- examples/demo/GeneratedVideoSource.h | 2 +- include/ffmpegcpp/Codecs/AudioCodec.h | 11 +++++------ include/ffmpegcpp/Codecs/VideoCodec.h | 8 ++++---- include/ffmpegcpp/Demuxing/InputStream.h | 2 +- include/ffmpegcpp/Demuxing/VideoInputStream.h | 1 - include/ffmpegcpp/FrameSinks/AudioEncoder.h | 2 +- include/ffmpegcpp/FrameSinks/FrameSink.h | 2 +- include/ffmpegcpp/FrameSinks/VideoEncoder.h | 2 +- include/ffmpegcpp/FrameSinks/VideoFilter.h | 2 +- include/ffmpegcpp/Muxing/AudioOutputStream.h | 2 +- include/ffmpegcpp/Muxing/Muxer.h | 2 +- include/ffmpegcpp/Muxing/OutputStream.h | 2 +- include/ffmpegcpp/Muxing/VideoOutputStream.h | 2 +- include/ffmpegcpp/OpenCodec.h | 2 +- include/ffmpegcpp/Sources/Demuxer.h | 11 ++++++----- include/ffmpegcpp/Sources/EncodedFileSource.h | 2 +- include/ffmpegcpp/Sources/InputSource.h | 2 +- include/ffmpegcpp/Sources/RawAudioDataSource.h | 2 +- include/ffmpegcpp/Sources/RawAudioFileSource.h | 2 +- include/ffmpegcpp/Sources/RawVideoDataSource.h | 6 +++--- include/ffmpegcpp/Sources/RawVideoFileSource.h | 2 +- include/ffmpegcpp/ffmpegcpp.h | 2 ++ src/Codecs/AudioCodec.cpp | 14 +++++--------- src/Codecs/VideoCodec.cpp | 8 ++++---- src/Demuxing/InputStream.cpp | 2 +- src/Demuxing/VideoInputStream.cpp | 4 ---- src/FrameSinks/AudioEncoder.cpp | 2 +- src/FrameSinks/VideoEncoder.cpp | 2 +- src/FrameSinks/VideoFilter.cpp | 2 +- src/Muxing/AudioOutputStream.cpp | 2 +- src/Muxing/VideoOutputStream.cpp | 2 +- src/OpenCodec.cpp | 2 +- src/Sources/Demuxer.cpp | 10 +++++----- src/Sources/EncodedFileSource.cpp | 2 +- src/Sources/RawAudioDataSource.cpp | 2 +- src/Sources/RawAudioFileSource.cpp | 2 +- src/Sources/RawVideoDataSource.cpp | 6 +++--- src/Sources/RawVideoFileSource.cpp | 2 +- 43 files changed, 69 insertions(+), 76 deletions(-) diff --git a/examples/decode_audio/decode_audio.cpp b/examples/decode_audio/decode_audio.cpp index d7fe5da..8376520 100644 --- a/examples/decode_audio/decode_audio.cpp +++ b/examples/decode_audio/decode_audio.cpp @@ -31,7 +31,7 @@ class RawAudioFileSink : public ffmpegcpp::AudioFrameSink fclose(file); } - bool IsPrimed() override + bool IsPrimed() const override { // Return whether we have all information we need to start writing out data. // Since we don't really need any data in this use case, we are always ready. diff --git a/examples/decode_video/decode_video.cpp b/examples/decode_video/decode_video.cpp index 1f22279..a63132b 100644 --- a/examples/decode_video/decode_video.cpp +++ b/examples/decode_video/decode_video.cpp @@ -44,7 +44,7 @@ class PGMFileSink : public ffmpegcpp::VideoFrameSink // nothing to do here. } - bool IsPrimed() override + bool IsPrimed() const override { // Return whether we have all information we need to start writing out data. // Since we don't really need any data in this use case, we are always ready. diff --git a/examples/demo/GeneratedAudioSource.cpp b/examples/demo/GeneratedAudioSource.cpp index 95af79e..5c33e14 100644 --- a/examples/demo/GeneratedAudioSource.cpp +++ b/examples/demo/GeneratedAudioSource.cpp @@ -27,7 +27,7 @@ void GeneratedAudioSource::PreparePipeline() } } -bool GeneratedAudioSource::IsDone() +bool GeneratedAudioSource::IsDone() const { return frameNumber >= 120; } diff --git a/examples/demo/GeneratedAudioSource.h b/examples/demo/GeneratedAudioSource.h index 3fe0092..779ae0f 100644 --- a/examples/demo/GeneratedAudioSource.h +++ b/examples/demo/GeneratedAudioSource.h @@ -12,7 +12,7 @@ class GeneratedAudioSource : public ffmpegcpp::InputSource ~GeneratedAudioSource() override; void PreparePipeline() override; - bool IsDone() override; + bool IsDone() const override; void Step() override; private: diff --git a/examples/demo/GeneratedVideoSource.cpp b/examples/demo/GeneratedVideoSource.cpp index 763f358..6b5036c 100644 --- a/examples/demo/GeneratedVideoSource.cpp +++ b/examples/demo/GeneratedVideoSource.cpp @@ -34,7 +34,7 @@ void GeneratedVideoSource::Step() } } -bool GeneratedVideoSource::IsDone() +bool GeneratedVideoSource::IsDone() const { return frameNumber >= 100; } diff --git a/examples/demo/GeneratedVideoSource.h b/examples/demo/GeneratedVideoSource.h index 9ad82d5..ac53339 100644 --- a/examples/demo/GeneratedVideoSource.h +++ b/examples/demo/GeneratedVideoSource.h @@ -12,7 +12,7 @@ class GeneratedVideoSource : public ffmpegcpp::InputSource ~GeneratedVideoSource() override; void PreparePipeline() override; - bool IsDone() override; + bool IsDone() const override; void Step() override; private: diff --git a/include/ffmpegcpp/Codecs/AudioCodec.h b/include/ffmpegcpp/Codecs/AudioCodec.h index 8decac6..4183513 100644 --- a/include/ffmpegcpp/Codecs/AudioCodec.h +++ b/include/ffmpegcpp/Codecs/AudioCodec.h @@ -15,16 +15,15 @@ namespace ffmpegcpp AudioCodec(const char* codecName); AudioCodec(AVCodecID codecId); - virtual ~AudioCodec(); std::unique_ptr Open(int bitRate, AVSampleFormat format, int sampleRate); - bool IsFormatSupported(AVSampleFormat format); - bool IsChannelsSupported(int channels); - bool IsSampleRateSupported(int sampleRate); + bool IsFormatSupported(AVSampleFormat format) const; + bool IsChannelsSupported(int channels) const; + bool IsSampleRateSupported(int sampleRate) const; - AVSampleFormat GetDefaultSampleFormat(); - int GetDefaultSampleRate(); + AVSampleFormat GetDefaultSampleFormat() const; + int GetDefaultSampleRate() const; }; diff --git a/include/ffmpegcpp/Codecs/VideoCodec.h b/include/ffmpegcpp/Codecs/VideoCodec.h index 4c51ddf..4e6b04d 100644 --- a/include/ffmpegcpp/Codecs/VideoCodec.h +++ b/include/ffmpegcpp/Codecs/VideoCodec.h @@ -23,11 +23,11 @@ namespace ffmpegcpp // This maps to the qscale parameter so should be in the range [0,31]. void SetQualityScale(int qscale); - bool IsPixelFormatSupported(AVPixelFormat format); - bool IsFrameRateSupported(AVRational* frameRate); + bool IsPixelFormatSupported(AVPixelFormat format) const; + bool IsFrameRateSupported(AVRational* frameRate) const; - AVPixelFormat GetDefaultPixelFormat(); - AVRational GetClosestSupportedFrameRate(AVRational frameRate); + AVPixelFormat GetDefaultPixelFormat() const; + AVRational GetClosestSupportedFrameRate(AVRational frameRate) const; }; diff --git a/include/ffmpegcpp/Demuxing/InputStream.h b/include/ffmpegcpp/Demuxing/InputStream.h index c64dca0..816bff2 100644 --- a/include/ffmpegcpp/Demuxing/InputStream.h +++ b/include/ffmpegcpp/Demuxing/InputStream.h @@ -24,7 +24,7 @@ namespace ffmpegcpp virtual void DecodePacket(AVPacket* pkt); void Close(); - bool IsPrimed(); + bool IsPrimed() const; protected: diff --git a/include/ffmpegcpp/Demuxing/VideoInputStream.h b/include/ffmpegcpp/Demuxing/VideoInputStream.h index b2737af..3c6fb25 100644 --- a/include/ffmpegcpp/Demuxing/VideoInputStream.h +++ b/include/ffmpegcpp/Demuxing/VideoInputStream.h @@ -14,7 +14,6 @@ namespace ffmpegcpp public: VideoInputStream(VideoFrameSink* frameSink, AVStream* stream); - ~VideoInputStream(); protected: diff --git a/include/ffmpegcpp/FrameSinks/AudioEncoder.h b/include/ffmpegcpp/FrameSinks/AudioEncoder.h index f4f0779..a99bf35 100644 --- a/include/ffmpegcpp/FrameSinks/AudioEncoder.h +++ b/include/ffmpegcpp/FrameSinks/AudioEncoder.h @@ -29,7 +29,7 @@ namespace ffmpegcpp void WriteConvertedFrame(AVFrame* frame) override; - bool IsPrimed() override; + bool IsPrimed() const override; private: diff --git a/include/ffmpegcpp/FrameSinks/FrameSink.h b/include/ffmpegcpp/FrameSinks/FrameSink.h index 8690078..48b7640 100644 --- a/include/ffmpegcpp/FrameSinks/FrameSink.h +++ b/include/ffmpegcpp/FrameSinks/FrameSink.h @@ -12,7 +12,7 @@ namespace ffmpegcpp virtual void Close() = 0; - virtual bool IsPrimed() = 0; + virtual bool IsPrimed() const = 0; virtual ~FrameSink() {} }; diff --git a/include/ffmpegcpp/FrameSinks/VideoEncoder.h b/include/ffmpegcpp/FrameSinks/VideoEncoder.h index 37632dc..d69f0b3 100644 --- a/include/ffmpegcpp/FrameSinks/VideoEncoder.h +++ b/include/ffmpegcpp/FrameSinks/VideoEncoder.h @@ -30,7 +30,7 @@ namespace ffmpegcpp void WriteFrame(AVFrame* frame, AVRational* timeBase) override; void Close() override; - bool IsPrimed() override; + bool IsPrimed() const override; private: diff --git a/include/ffmpegcpp/FrameSinks/VideoFilter.h b/include/ffmpegcpp/FrameSinks/VideoFilter.h index 62bd18e..fd0ed5f 100644 --- a/include/ffmpegcpp/FrameSinks/VideoFilter.h +++ b/include/ffmpegcpp/FrameSinks/VideoFilter.h @@ -21,7 +21,7 @@ namespace ffmpegcpp void WriteFrame(AVFrame* frame, AVRational* timeBase) override; void Close() override; - bool IsPrimed() override; + bool IsPrimed() const override; private: diff --git a/include/ffmpegcpp/Muxing/AudioOutputStream.h b/include/ffmpegcpp/Muxing/AudioOutputStream.h index a752b36..9720288 100644 --- a/include/ffmpegcpp/Muxing/AudioOutputStream.h +++ b/include/ffmpegcpp/Muxing/AudioOutputStream.h @@ -22,7 +22,7 @@ namespace ffmpegcpp void WritePacket(AVPacket* pkt, OpenCodec* openCodec) override; - bool IsPrimed() override; + bool IsPrimed() const override; protected: diff --git a/include/ffmpegcpp/Muxing/Muxer.h b/include/ffmpegcpp/Muxing/Muxer.h index a0f4d3b..b90e7e7 100644 --- a/include/ffmpegcpp/Muxing/Muxer.h +++ b/include/ffmpegcpp/Muxing/Muxer.h @@ -26,7 +26,7 @@ namespace ffmpegcpp { void Close(); - bool IsPrimed(); + bool IsPrimed(); // ToDo: this should be const... private: diff --git a/include/ffmpegcpp/Muxing/OutputStream.h b/include/ffmpegcpp/Muxing/OutputStream.h index d0ab665..a001f11 100644 --- a/include/ffmpegcpp/Muxing/OutputStream.h +++ b/include/ffmpegcpp/Muxing/OutputStream.h @@ -23,7 +23,7 @@ namespace ffmpegcpp virtual void WritePacket(AVPacket* pkt, OpenCodec* openCodec) = 0; - virtual bool IsPrimed() = 0; + virtual bool IsPrimed() const = 0; void DrainPacketQueue(); diff --git a/include/ffmpegcpp/Muxing/VideoOutputStream.h b/include/ffmpegcpp/Muxing/VideoOutputStream.h index 0cc49e8..a722319 100644 --- a/include/ffmpegcpp/Muxing/VideoOutputStream.h +++ b/include/ffmpegcpp/Muxing/VideoOutputStream.h @@ -21,7 +21,7 @@ namespace ffmpegcpp void WritePacket(AVPacket* pkt, OpenCodec* openCodec) override; - bool IsPrimed() override; + bool IsPrimed() const override; protected: diff --git a/include/ffmpegcpp/OpenCodec.h b/include/ffmpegcpp/OpenCodec.h index 68b1da9..cc770f5 100644 --- a/include/ffmpegcpp/OpenCodec.h +++ b/include/ffmpegcpp/OpenCodec.h @@ -11,7 +11,7 @@ namespace ffmpegcpp OpenCodec(AVCodecContext* openCodecContext); ~OpenCodec(); - AVCodecContext* GetContext(); + AVCodecContext* GetContext() const; private: diff --git a/include/ffmpegcpp/Sources/Demuxer.h b/include/ffmpegcpp/Sources/Demuxer.h index 41f27b2..33eed5a 100644 --- a/include/ffmpegcpp/Sources/Demuxer.h +++ b/include/ffmpegcpp/Sources/Demuxer.h @@ -3,6 +3,7 @@ #include "Sources/InputSource.h" #include "FFmpegResource.h" +#include #include enum AVMediaType; @@ -39,11 +40,11 @@ namespace ffmpegcpp void DecodeAudioStream(int streamId, AudioFrameSink* frameSink); void DecodeVideoStream(int streamId, VideoFrameSink* frameSink); - std::vector GetAudioStreamInfo(); - std::vector GetVideoStreamInfo(); + std::vector GetAudioStreamInfo() const; + std::vector GetVideoStreamInfo() const; void PreparePipeline() override; - bool IsDone() override; + bool IsDone() const override; void Step() override; private: @@ -52,8 +53,8 @@ namespace ffmpegcpp const char* fileName; - std::vector GetStreamInfo(AVMediaType mediaType); - StreamInfo CreateInfo(int streamIndex, AVStream* stream, AVCodec* codec); + std::vector GetStreamInfo(AVMediaType mediaType) const; + StreamInfo CreateInfo(int streamIndex, AVStream* stream, AVCodec* codec) const; std::vector> inputStreams; diff --git a/include/ffmpegcpp/Sources/EncodedFileSource.h b/include/ffmpegcpp/Sources/EncodedFileSource.h index 54cd535..76a43cc 100644 --- a/include/ffmpegcpp/Sources/EncodedFileSource.h +++ b/include/ffmpegcpp/Sources/EncodedFileSource.h @@ -26,7 +26,7 @@ namespace ffmpegcpp virtual ~EncodedFileSource(); void PreparePipeline() override; - bool IsDone() override; + bool IsDone() const override; void Step() override; private: diff --git a/include/ffmpegcpp/Sources/InputSource.h b/include/ffmpegcpp/Sources/InputSource.h index c89dd13..1f4bef2 100644 --- a/include/ffmpegcpp/Sources/InputSource.h +++ b/include/ffmpegcpp/Sources/InputSource.h @@ -9,7 +9,7 @@ namespace ffmpegcpp virtual ~InputSource() {} virtual void PreparePipeline() = 0; - virtual bool IsDone() = 0; + virtual bool IsDone() const = 0; virtual void Step() = 0; }; diff --git a/include/ffmpegcpp/Sources/RawAudioDataSource.h b/include/ffmpegcpp/Sources/RawAudioDataSource.h index f80ffcd..e982802 100644 --- a/include/ffmpegcpp/Sources/RawAudioDataSource.h +++ b/include/ffmpegcpp/Sources/RawAudioDataSource.h @@ -22,7 +22,7 @@ namespace ffmpegcpp void WriteData(void* data, int sampleCount); void Close(); - bool IsPrimed(); + bool IsPrimed() const; private: diff --git a/include/ffmpegcpp/Sources/RawAudioFileSource.h b/include/ffmpegcpp/Sources/RawAudioFileSource.h index b25328d..a4942f7 100644 --- a/include/ffmpegcpp/Sources/RawAudioFileSource.h +++ b/include/ffmpegcpp/Sources/RawAudioFileSource.h @@ -16,7 +16,7 @@ namespace ffmpegcpp RawAudioFileSource(const char* fileName, const char* inputFormat, int sampleRate, int channels, AudioFrameSink* frameSink); void PreparePipeline() override; - bool IsDone() override; + bool IsDone() const override; void Step() override; private: diff --git a/include/ffmpegcpp/Sources/RawVideoDataSource.h b/include/ffmpegcpp/Sources/RawVideoDataSource.h index 9ee9a78..1817208 100644 --- a/include/ffmpegcpp/Sources/RawVideoDataSource.h +++ b/include/ffmpegcpp/Sources/RawVideoDataSource.h @@ -23,10 +23,10 @@ namespace ffmpegcpp void WriteFrame(void* data, int bytesPerRow); void Close(); - int GetWidth(); - int GetHeight(); + int GetWidth() const; + int GetHeight() const; - bool IsPrimed(); + bool IsPrimed() const; private: diff --git a/include/ffmpegcpp/Sources/RawVideoFileSource.h b/include/ffmpegcpp/Sources/RawVideoFileSource.h index 86a80ce..b2b80b3 100644 --- a/include/ffmpegcpp/Sources/RawVideoFileSource.h +++ b/include/ffmpegcpp/Sources/RawVideoFileSource.h @@ -20,7 +20,7 @@ namespace ffmpegcpp //RawVideoFileSource(const char* fileName, int width, int height, const char* frameRate, AVPixelFormat format, VideoFrameSink* frameSink); void PreparePipeline() override; - bool IsDone() override; + bool IsDone() const override; void Step() override; private: diff --git a/include/ffmpegcpp/ffmpegcpp.h b/include/ffmpegcpp/ffmpegcpp.h index 5cc3fb3..4fb65ea 100644 --- a/include/ffmpegcpp/ffmpegcpp.h +++ b/include/ffmpegcpp/ffmpegcpp.h @@ -24,6 +24,8 @@ #include "Codecs/JPGCodec.h" #include "Codecs/Codec.h" +#include "Demuxing/InputStream.h" #include "FFmpegException.h" #include "FFmpegResource.h" + diff --git a/src/Codecs/AudioCodec.cpp b/src/Codecs/AudioCodec.cpp index 7b3342f..2961995 100644 --- a/src/Codecs/AudioCodec.cpp +++ b/src/Codecs/AudioCodec.cpp @@ -17,10 +17,6 @@ namespace ffmpegcpp { } - AudioCodec::~AudioCodec() - { - } - /* check that a given sample format is supported by the encoder */ static int check_sample_fmt(const AVCodec *codec, enum AVSampleFormat sample_fmt) { @@ -79,7 +75,7 @@ namespace ffmpegcpp return best_ch_layout; } - bool AudioCodec::IsChannelsSupported(int channels) + bool AudioCodec::IsChannelsSupported(int channels) const { int64_t channelLayout = av_get_default_channel_layout(channels); const uint64_t *p = codecContext->codec->channel_layouts; @@ -91,7 +87,7 @@ namespace ffmpegcpp return false; } - bool AudioCodec::IsFormatSupported(AVSampleFormat format) + bool AudioCodec::IsFormatSupported(AVSampleFormat format) const { const enum AVSampleFormat *p = codecContext->codec->sample_fmts; @@ -103,7 +99,7 @@ namespace ffmpegcpp return false; } - bool AudioCodec::IsSampleRateSupported(int sampleRate) + bool AudioCodec::IsSampleRateSupported(int sampleRate) const { const int *p; if (!codecContext->codec->supported_samplerates) return true; // all sample rates are fair game @@ -116,13 +112,13 @@ namespace ffmpegcpp return false; } - AVSampleFormat AudioCodec::GetDefaultSampleFormat() + AVSampleFormat AudioCodec::GetDefaultSampleFormat() const { AVSampleFormat format = (codecContext->codec->sample_fmts ? codecContext->codec->sample_fmts[0] : AV_SAMPLE_FMT_FLTP); return format; } - int AudioCodec::GetDefaultSampleRate() + int AudioCodec::GetDefaultSampleRate() const { return select_sample_rate(codecContext->codec); } diff --git a/src/Codecs/VideoCodec.cpp b/src/Codecs/VideoCodec.cpp index a8ac347..a935e8e 100644 --- a/src/Codecs/VideoCodec.cpp +++ b/src/Codecs/VideoCodec.cpp @@ -28,7 +28,7 @@ namespace ffmpegcpp codecContext->global_quality = FF_QP2LAMBDA * 0; } - bool VideoCodec::IsPixelFormatSupported(AVPixelFormat format) + bool VideoCodec::IsPixelFormatSupported(AVPixelFormat format) const { if (format == AV_PIX_FMT_NONE) return true; // let the codec deal with this const enum AVPixelFormat *p = codecContext->codec->pix_fmts; @@ -40,7 +40,7 @@ namespace ffmpegcpp return false; } - bool VideoCodec::IsFrameRateSupported(AVRational* frameRate) + bool VideoCodec::IsFrameRateSupported(AVRational* frameRate) const { if (!codecContext->codec->supported_framerates) return true; // all frame rates are fair game const AVRational *p = codecContext->codec->supported_framerates; @@ -80,14 +80,14 @@ namespace ffmpegcpp return Codec::Open(); } - AVPixelFormat VideoCodec::GetDefaultPixelFormat() + AVPixelFormat VideoCodec::GetDefaultPixelFormat() const { const enum AVPixelFormat *p = codecContext->codec->pix_fmts; if (*p == AV_PIX_FMT_NONE) throw FFmpegException("Codec " + string(codecContext->codec->name) + " does not have a default pixel format, you have to specify one"); return *p; } - AVRational VideoCodec::GetClosestSupportedFrameRate(AVRational originalFrameRate) + AVRational VideoCodec::GetClosestSupportedFrameRate(AVRational originalFrameRate) const { if (!codecContext->codec->supported_framerates) { diff --git a/src/Demuxing/InputStream.cpp b/src/Demuxing/InputStream.cpp index 42fd62a..70f9d07 100644 --- a/src/Demuxing/InputStream.cpp +++ b/src/Demuxing/InputStream.cpp @@ -122,7 +122,7 @@ namespace ffmpegcpp output->Close(); } - bool InputStream::IsPrimed() + bool InputStream::IsPrimed() const { return output->IsPrimed(); } diff --git a/src/Demuxing/VideoInputStream.cpp b/src/Demuxing/VideoInputStream.cpp index f162dae..5dd598e 100644 --- a/src/Demuxing/VideoInputStream.cpp +++ b/src/Demuxing/VideoInputStream.cpp @@ -11,10 +11,6 @@ namespace ffmpegcpp SetFrameSink(frameSink); } - VideoInputStream::~VideoInputStream() - { - } - void VideoInputStream::ConfigureCodecContext() { diff --git a/src/FrameSinks/AudioEncoder.cpp b/src/FrameSinks/AudioEncoder.cpp index ec2405c..680a6b8 100644 --- a/src/FrameSinks/AudioEncoder.cpp +++ b/src/FrameSinks/AudioEncoder.cpp @@ -122,7 +122,7 @@ namespace ffmpegcpp } } - bool AudioEncoder::IsPrimed() + bool AudioEncoder::IsPrimed() const { return output->IsPrimed(); } diff --git a/src/FrameSinks/VideoEncoder.cpp b/src/FrameSinks/VideoEncoder.cpp index 8371c97..6600e20 100644 --- a/src/FrameSinks/VideoEncoder.cpp +++ b/src/FrameSinks/VideoEncoder.cpp @@ -148,7 +148,7 @@ namespace ffmpegcpp } } - bool VideoEncoder::IsPrimed() + bool VideoEncoder::IsPrimed() const { return output->IsPrimed(); } diff --git a/src/FrameSinks/VideoFilter.cpp b/src/FrameSinks/VideoFilter.cpp index d0f5643..c16a6d6 100644 --- a/src/FrameSinks/VideoFilter.cpp +++ b/src/FrameSinks/VideoFilter.cpp @@ -179,7 +179,7 @@ namespace ffmpegcpp } - bool VideoFilter::IsPrimed() + bool VideoFilter::IsPrimed() const { return target->IsPrimed(); } diff --git a/src/Muxing/AudioOutputStream.cpp b/src/Muxing/AudioOutputStream.cpp index c7c081f..d914f49 100644 --- a/src/Muxing/AudioOutputStream.cpp +++ b/src/Muxing/AudioOutputStream.cpp @@ -90,7 +90,7 @@ namespace ffmpegcpp } } - bool AudioOutputStream::IsPrimed() + bool AudioOutputStream::IsPrimed() const { return initialized; } diff --git a/src/Muxing/VideoOutputStream.cpp b/src/Muxing/VideoOutputStream.cpp index dbfdd15..09fa10d 100644 --- a/src/Muxing/VideoOutputStream.cpp +++ b/src/Muxing/VideoOutputStream.cpp @@ -87,7 +87,7 @@ namespace ffmpegcpp pkt->duration = stream->time_base.den / stream->time_base.num / stream->avg_frame_rate.num * stream->avg_frame_rate.den; } - bool VideoOutputStream::IsPrimed() + bool VideoOutputStream::IsPrimed() const { return initialized; } diff --git a/src/OpenCodec.cpp b/src/OpenCodec.cpp index 4228288..7a7e356 100644 --- a/src/OpenCodec.cpp +++ b/src/OpenCodec.cpp @@ -22,7 +22,7 @@ namespace ffmpegcpp avcodec_free_context(&context); } - AVCodecContext* OpenCodec::GetContext() + AVCodecContext* OpenCodec::GetContext() const { return context; } diff --git a/src/Sources/Demuxer.cpp b/src/Sources/Demuxer.cpp index a94e0a6..1caf57e 100644 --- a/src/Sources/Demuxer.cpp +++ b/src/Sources/Demuxer.cpp @@ -55,17 +55,17 @@ namespace ffmpegcpp pkt->size = 0; } - vector Demuxer::GetAudioStreamInfo() + vector Demuxer::GetAudioStreamInfo() const { return GetStreamInfo(AVMEDIA_TYPE_AUDIO); } - vector Demuxer::GetVideoStreamInfo() + vector Demuxer::GetVideoStreamInfo() const { return GetStreamInfo(AVMEDIA_TYPE_VIDEO); } - vector Demuxer::GetStreamInfo(AVMediaType mediaType) + vector Demuxer::GetStreamInfo(AVMediaType mediaType) const { vector streamInfo; for (int i = 0; i < containerContext->nb_streams; ++i) @@ -87,7 +87,7 @@ namespace ffmpegcpp return streamInfo; } - StreamInfo Demuxer::CreateInfo(int streamIndex, AVStream* stream, AVCodec* codec) + StreamInfo Demuxer::CreateInfo(int streamIndex, AVStream* stream, AVCodec* codec) const { StreamInfo info; info.streamId = streamIndex; @@ -167,7 +167,7 @@ namespace ffmpegcpp } while (!allPrimed && !IsDone()); } - bool Demuxer::IsDone() + bool Demuxer::IsDone() const { return done; } diff --git a/src/Sources/EncodedFileSource.cpp b/src/Sources/EncodedFileSource.cpp index 22f686b..f00c581 100644 --- a/src/Sources/EncodedFileSource.cpp +++ b/src/Sources/EncodedFileSource.cpp @@ -124,7 +124,7 @@ namespace ffmpegcpp } } - bool EncodedFileSource::IsDone() + bool EncodedFileSource::IsDone() const { return done; } diff --git a/src/Sources/RawAudioDataSource.cpp b/src/Sources/RawAudioDataSource.cpp index de9439e..0432a4d 100644 --- a/src/Sources/RawAudioDataSource.cpp +++ b/src/Sources/RawAudioDataSource.cpp @@ -65,7 +65,7 @@ namespace ffmpegcpp output->Close(); } - bool RawAudioDataSource::IsPrimed() + bool RawAudioDataSource::IsPrimed() const { return output->IsPrimed(); } diff --git a/src/Sources/RawAudioFileSource.cpp b/src/Sources/RawAudioFileSource.cpp index b8164c1..c678267 100644 --- a/src/Sources/RawAudioFileSource.cpp +++ b/src/Sources/RawAudioFileSource.cpp @@ -41,7 +41,7 @@ namespace ffmpegcpp demuxer->PreparePipeline(); } - bool RawAudioFileSource::IsDone() + bool RawAudioFileSource::IsDone() const { return demuxer->IsDone(); } diff --git a/src/Sources/RawVideoDataSource.cpp b/src/Sources/RawVideoDataSource.cpp index 252c8bb..f1d3179 100644 --- a/src/Sources/RawVideoDataSource.cpp +++ b/src/Sources/RawVideoDataSource.cpp @@ -77,17 +77,17 @@ namespace ffmpegcpp output->Close(); } - int RawVideoDataSource::GetWidth() + int RawVideoDataSource::GetWidth() const { return frame->width; } - int RawVideoDataSource::GetHeight() + int RawVideoDataSource::GetHeight() const { return frame->height; } - bool RawVideoDataSource::IsPrimed() + bool RawVideoDataSource::IsPrimed() const { return output->IsPrimed(); } diff --git a/src/Sources/RawVideoFileSource.cpp b/src/Sources/RawVideoFileSource.cpp index dc9cd69..2d248d3 100644 --- a/src/Sources/RawVideoFileSource.cpp +++ b/src/Sources/RawVideoFileSource.cpp @@ -67,7 +67,7 @@ namespace ffmpegcpp demuxer->PreparePipeline(); } - bool RawVideoFileSource::IsDone() + bool RawVideoFileSource::IsDone() const { return demuxer->IsDone(); } From c070af883fac6a3c465b6e68da7643f726ad4190 Mon Sep 17 00:00:00 2001 From: Wim van Aarle Date: Thu, 20 Dec 2018 09:15:59 +0100 Subject: [PATCH 28/31] removed std.h --- include/ffmpegcpp/FFmpegException.h | 6 +++--- include/ffmpegcpp/std.h | 5 ----- src/Demuxing/InputStream.cpp | 1 - src/FrameSinks/AudioEncoder.cpp | 1 - src/Muxing/Muxer.cpp | 1 - src/Sources/Demuxer.cpp | 1 - src/Sources/RawAudioFileSource.cpp | 1 - src/Sources/RawVideoFileSource.cpp | 1 - 8 files changed, 3 insertions(+), 14 deletions(-) delete mode 100644 include/ffmpegcpp/std.h diff --git a/include/ffmpegcpp/FFmpegException.h b/include/ffmpegcpp/FFmpegException.h index d3da0dd..4130fbe 100644 --- a/include/ffmpegcpp/FFmpegException.h +++ b/include/ffmpegcpp/FFmpegException.h @@ -2,7 +2,8 @@ #include "ffmpeg.h" -#include "std.h" +#include +#include namespace ffmpegcpp { @@ -15,12 +16,11 @@ namespace ffmpegcpp FFmpegException(std::string error, int returnValue); - virtual char const* what() const + char const* what() const override { return std::exception::what(); } - private: char error[AV_ERROR_MAX_STRING_SIZE]; diff --git a/include/ffmpegcpp/std.h b/include/ffmpegcpp/std.h deleted file mode 100644 index 97f7e65..0000000 --- a/include/ffmpegcpp/std.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once - -#include -#include -#include diff --git a/src/Demuxing/InputStream.cpp b/src/Demuxing/InputStream.cpp index 70f9d07..e99c4be 100644 --- a/src/Demuxing/InputStream.cpp +++ b/src/Demuxing/InputStream.cpp @@ -3,7 +3,6 @@ #include "ffmpeg.h" #include "FFmpegException.h" #include "FrameSinks/FrameSink.h" -#include "std.h" using namespace std; diff --git a/src/FrameSinks/AudioEncoder.cpp b/src/FrameSinks/AudioEncoder.cpp index 680a6b8..94633ed 100644 --- a/src/FrameSinks/AudioEncoder.cpp +++ b/src/FrameSinks/AudioEncoder.cpp @@ -8,7 +8,6 @@ #include "Muxing/Muxer.h" #include "Muxing/OutputStream.h" #include "OpenCodec.h" -#include "std.h" using namespace std; diff --git a/src/Muxing/Muxer.cpp b/src/Muxing/Muxer.cpp index a237ee6..1c939f1 100644 --- a/src/Muxing/Muxer.cpp +++ b/src/Muxing/Muxer.cpp @@ -3,7 +3,6 @@ #include "ffmpeg.h" #include "FFmpegException.h" #include "Muxing/OutputStream.h" -#include "std.h" #include diff --git a/src/Sources/Demuxer.cpp b/src/Sources/Demuxer.cpp index 1caf57e..d26add1 100644 --- a/src/Sources/Demuxer.cpp +++ b/src/Sources/Demuxer.cpp @@ -6,7 +6,6 @@ #include "Demuxing/VideoInputStream.h" #include "ffmpeg.h" #include "FFmpegException.h" -#include "std.h" #include #include diff --git a/src/Sources/RawAudioFileSource.cpp b/src/Sources/RawAudioFileSource.cpp index c678267..ec0f5b5 100644 --- a/src/Sources/RawAudioFileSource.cpp +++ b/src/Sources/RawAudioFileSource.cpp @@ -3,7 +3,6 @@ #include "ffmpeg.h" #include "FFmpegException.h" #include "Sources/Demuxer.h" -#include "std.h" using namespace std; diff --git a/src/Sources/RawVideoFileSource.cpp b/src/Sources/RawVideoFileSource.cpp index 2d248d3..c8adec5 100644 --- a/src/Sources/RawVideoFileSource.cpp +++ b/src/Sources/RawVideoFileSource.cpp @@ -3,7 +3,6 @@ #include "ffmpeg.h" #include "FFmpegException.h" #include "Sources/Demuxer.h" -#include "std.h" using namespace std; From d49c1c700aec08f26be41007cf2b3bce84ddcc29 Mon Sep 17 00:00:00 2001 From: Wim van Aarle Date: Thu, 20 Dec 2018 10:04:16 +0100 Subject: [PATCH 29/31] removed some compile warnings --- examples/demo/GeneratedAudioSource.cpp | 2 +- src/AudioFormatConverter.cpp | 1 - src/Muxing/Muxer.cpp | 3 ++- src/Muxing/OutputStream.cpp | 5 ++++- src/Sources/Demuxer.cpp | 4 ++-- src/Sources/EncodedFileSource.cpp | 2 +- 6 files changed, 10 insertions(+), 7 deletions(-) diff --git a/examples/demo/GeneratedAudioSource.cpp b/examples/demo/GeneratedAudioSource.cpp index 5c33e14..fe19250 100644 --- a/examples/demo/GeneratedAudioSource.cpp +++ b/examples/demo/GeneratedAudioSource.cpp @@ -36,7 +36,7 @@ void GeneratedAudioSource::Step() { /* encode a single tone sound */ float t = 0.0f; - float tincr = 2 * M_PI * 440.0 / sampleRate; + float tincr = (float)(2.0 * M_PI * 440.0) / (float)sampleRate; for (int i = 0; i < 120; i++) { /* make sure the frame is writable -- makes a copy if the encoder diff --git a/src/AudioFormatConverter.cpp b/src/AudioFormatConverter.cpp index fce0a54..688dfcb 100644 --- a/src/AudioFormatConverter.cpp +++ b/src/AudioFormatConverter.cpp @@ -149,7 +149,6 @@ namespace ffmpegcpp * If there is less than the maximum possible frame size in the FIFO * buffer use this number. Otherwise, use the maximum possible frame size. */ const int frame_size = FFMIN(av_audio_fifo_size(fifo.get()), converted_frame->nb_samples); - int data_written; converted_frame->nb_samples = frame_size; /* Read as many samples from the FIFO buffer as required to fill the frame. diff --git a/src/Muxing/Muxer.cpp b/src/Muxing/Muxer.cpp index 1c939f1..9046afe 100644 --- a/src/Muxing/Muxer.cpp +++ b/src/Muxing/Muxer.cpp @@ -5,6 +5,7 @@ #include "Muxing/OutputStream.h" #include +#include using namespace std; @@ -128,7 +129,7 @@ namespace ffmpegcpp { Open(); opened = true; - printf("After %d cached packets, we can finally open the container\n", packetQueue.size()); + std::cout << "After " << packetQueue.size() << " cached packets, we can finally open the container\n"; // flush the queue std::for_each(begin(packetQueue), end(packetQueue), [this](const auto & tmp_pkt) diff --git a/src/Muxing/OutputStream.cpp b/src/Muxing/OutputStream.cpp index b843891..40584c8 100644 --- a/src/Muxing/OutputStream.cpp +++ b/src/Muxing/OutputStream.cpp @@ -6,6 +6,7 @@ #include "Muxing/Muxer.h" #include +#include using namespace std; @@ -45,7 +46,9 @@ namespace ffmpegcpp void OutputStream::DrainPacketQueue() { - if (packetQueue.size() > 0) printf("Drain %d packets from the packet queue...", packetQueue.size()); + if (packetQueue.size() > 0) + std::cout << "Drain " << packetQueue.size() << " packets from the packet queue..."; + std::for_each(begin(packetQueue), end(packetQueue), [this](auto & tmp_pkt) { // Write the compressed frame to the media file diff --git a/src/Sources/Demuxer.cpp b/src/Sources/Demuxer.cpp index d26add1..412941a 100644 --- a/src/Sources/Demuxer.cpp +++ b/src/Sources/Demuxer.cpp @@ -67,7 +67,7 @@ namespace ffmpegcpp vector Demuxer::GetStreamInfo(AVMediaType mediaType) const { vector streamInfo; - for (int i = 0; i < containerContext->nb_streams; ++i) + for (unsigned int i = 0; i < containerContext->nb_streams; ++i) { AVStream* stream = containerContext->streams[i]; @@ -181,7 +181,7 @@ namespace ffmpegcpp { pkt->data = nullptr; pkt->size = 0; - for (int i = 0; i < containerContext->nb_streams; ++i) + for (unsigned int i = 0; i < containerContext->nb_streams; ++i) { auto & stream = inputStreams[i]; if (stream != nullptr) diff --git a/src/Sources/EncodedFileSource.cpp b/src/Sources/EncodedFileSource.cpp index f00c581..0aee9ea 100644 --- a/src/Sources/EncodedFileSource.cpp +++ b/src/Sources/EncodedFileSource.cpp @@ -146,7 +146,7 @@ namespace ffmpegcpp while (data_size > 0) { ret = av_parser_parse2(parser.get(), codecContext.get(), &pkt->data, &pkt->size, - data, data_size, AV_NOPTS_VALUE, AV_NOPTS_VALUE, 0); + data, static_cast(data_size), AV_NOPTS_VALUE, AV_NOPTS_VALUE, 0); if (ret < 0) { throw FFmpegException("Error while parsing file", ret); From 9b0be3c96b645a9c0ce21bdf4b4a9e9b68f9d443 Mon Sep 17 00:00:00 2001 From: Wim van Aarle Date: Thu, 20 Dec 2018 10:04:33 +0100 Subject: [PATCH 30/31] replaced char * with std::strings --- examples/decode_audio/decode_audio.cpp | 4 +- examples/demo/demo.cpp | 47 ++++++++++--------- examples/encode_audio/encode_audio.cpp | 7 ++- include/ffmpegcpp/CodecDeducer.h | 8 ++-- include/ffmpegcpp/Codecs/AudioCodec.h | 4 +- include/ffmpegcpp/Codecs/Codec.h | 9 ++-- include/ffmpegcpp/Codecs/H264NVEncCodec.h | 4 +- include/ffmpegcpp/Codecs/H265NVEncCodec.h | 4 +- include/ffmpegcpp/Codecs/VP9Codec.h | 5 +- include/ffmpegcpp/Codecs/VideoCodec.h | 4 +- include/ffmpegcpp/FFmpegException.h | 4 +- include/ffmpegcpp/FrameSinks/VideoFilter.h | 6 ++- include/ffmpegcpp/Muxing/Muxer.h | 2 +- include/ffmpegcpp/Sources/Demuxer.h | 6 +-- include/ffmpegcpp/Sources/EncodedFileSource.h | 8 ++-- .../ffmpegcpp/Sources/RawAudioFileSource.h | 3 +- .../ffmpegcpp/Sources/RawVideoFileSource.h | 3 +- src/CodecDeducer.cpp | 10 ++-- src/Codecs/AudioCodec.cpp | 2 +- src/Codecs/Codec.cpp | 14 +++--- src/Codecs/H264NVEncCodec.cpp | 2 +- src/Codecs/H265NVEncCodec.cpp | 2 +- src/Codecs/VP9Codec.cpp | 2 +- src/Codecs/VideoCodec.cpp | 2 +- src/FFmpegException.cpp | 4 +- src/FrameSinks/VideoFilter.cpp | 4 +- src/Muxing/Muxer.cpp | 6 +-- src/Sources/Demuxer.cpp | 12 ++--- src/Sources/EncodedFileSource.cpp | 8 ++-- src/Sources/RawAudioFileSource.cpp | 6 +-- src/Sources/RawVideoFileSource.cpp | 2 +- 31 files changed, 114 insertions(+), 90 deletions(-) diff --git a/examples/decode_audio/decode_audio.cpp b/examples/decode_audio/decode_audio.cpp index 8376520..9eb51cc 100644 --- a/examples/decode_audio/decode_audio.cpp +++ b/examples/decode_audio/decode_audio.cpp @@ -8,9 +8,9 @@ class RawAudioFileSink : public ffmpegcpp::AudioFrameSink { public: - RawAudioFileSink(const char* fileName) + RawAudioFileSink(const std::string & fileName) { - file = fopen(fileName, "wb"); + file = fopen(fileName.c_str(), "wb"); } void WriteFrame(AVFrame* frame, AVRational* timeBase) override diff --git a/examples/demo/demo.cpp b/examples/demo/demo.cpp index 94b711b..6e82aaf 100644 --- a/examples/demo/demo.cpp +++ b/examples/demo/demo.cpp @@ -17,16 +17,19 @@ void PlayDemo(int argc, char** argv) { // These are example video and audio sources used below. - const char* rawVideoFile = "samples/carphone_qcif.y4m"; - int rawVideoWidth = 176; int rawVideoHeight = 162; - const char* rawAudioFile = "samples/Vivaldi_s16le_2_channels_samplerate_11025.dat"; - const char* rawAudioFormat = "s16le"; int rawAudioSampleRate = 11025; int rawAudioChannels = 2; + std::string rawVideoFile = "samples/carphone_qcif.y4m"; + int rawVideoWidth = 176; + int rawVideoHeight = 162; + std::string rawAudioFile = "samples/Vivaldi_s16le_2_channels_samplerate_11025.dat"; + std::string rawAudioFormat = "s16le"; + int rawAudioSampleRate = 11025; + int rawAudioChannels = 2; - const char* encodedVideoFile = "samples/carphone.h264"; - const char* encodedAudioFile = "samples/Vivaldi_Sonata_eminor_.mp3"; + std::string encodedVideoFile = "samples/carphone.h264"; + std::string encodedAudioFile = "samples/Vivaldi_Sonata_eminor_.mp3"; - const char* containerWithVideoAndAudioFile = "samples/big_buck_bunny.mp4"; - const char* containerWithAudioFile = "samples/DesiJourney.wav"; + std::string containerWithVideoAndAudioFile = "samples/big_buck_bunny.mp4"; + std::string containerWithAudioFile = "samples/DesiJourney.wav"; // hard-code the settings here, but let them be overridden by the arguments std::string inputAudioSource = "CONTAINER"; // options are RAW, ENCODED, CONTAINER, GENERATED @@ -71,13 +74,13 @@ void PlayDemo(int argc, char** argv) std::unique_ptr audioCodec; if (outputAudioCodec == "MP2") { - printf("Encoding audio as MP2...\n"); + std::cout << "Encoding audio as MP2...\n"; audioCodec = std::make_unique(AV_CODEC_ID_MP2); } else if (outputAudioCodec == "AAC") { - printf("Encoding audio as AAC...\n"); + std::cout << "Encoding audio as AAC...\n"; audioCodec = std::make_unique(AV_CODEC_ID_AAC); } @@ -102,21 +105,21 @@ void PlayDemo(int argc, char** argv) std::unique_ptr videoCodec; if (outputVideoCodec == "H264") { - printf("Encoding video as H264 on Nvidia GPU...\n"); + std::cout << "Encoding video as H264 on Nvidia GPU...\n"; auto h264Codec = std::make_unique(); h264Codec->SetPreset("hq"); videoCodec = std::move(h264Codec); } else if (outputVideoCodec == "H265") { - printf("Encoding video as H265 on Nvidia GPU...\n"); + std::cout << "Encoding video as H265 on Nvidia GPU...\n"; auto h265Codec = std::make_unique(); h265Codec->SetPreset("hq"); videoCodec = std::move(h265Codec); } else if (outputVideoCodec == "VP9") { - printf("Encoding video as VP9...\n"); + std::cout << "Encoding video as VP9...\n"; auto vp9Codec = std::make_unique(); vp9Codec->SetLossless(true); videoCodec = std::move(vp9Codec); @@ -144,25 +147,25 @@ void PlayDemo(int argc, char** argv) { if (inputAudioSource == "RAW") { - printf("Pulling audio from %s...\n", rawAudioFile); + std::cout << "Pulling audio from " << rawAudioFile << "...\n"; audioInputSource = std::make_unique(rawAudioFile, rawAudioFormat, rawAudioSampleRate, rawAudioChannels, audioEncoder.get()); } else if (inputAudioSource == "ENCODED") { - printf("Pulling audio from %s...\n", encodedAudioFile); + std::cout << "Pulling audio from " << encodedAudioFile << "...\n"; audioInputSource = std::make_unique(encodedAudioFile, AV_CODEC_ID_MP3, audioEncoder.get()); } else if (inputAudioSource == "CONTAINER") { // if the input comes from a container, we use the demuxer class - it is just an input source like any other - printf("Pulling audio from %s...\n", containerWithAudioFile); + std::cout << "Pulling audio from " << containerWithAudioFile << "...\n"; auto demuxer = std::make_unique(containerWithAudioFile); demuxer->DecodeBestAudioStream(audioEncoder.get()); audioInputSource = std::move(demuxer); } else if (inputAudioSource == "GENERATED") { - printf("Generating 440Hz audio tone...\n"); + std::cout << "Generating 440Hz audio tone...\n"; audioInputSource = std::make_unique(audioEncoder.get()); } } @@ -177,7 +180,7 @@ void PlayDemo(int argc, char** argv) std::unique_ptr videoFilter; if (videoFilterConfig != nullptr && videoEncoder != nullptr) { - printf("Applying filter %s to video...\n", videoFilterConfig); + std::cout << "Applying filter " << videoFilterConfig << " to video...\n"; videoFilter = std::make_unique(videoFilterConfig, videoEncoder.get()); } @@ -191,24 +194,24 @@ void PlayDemo(int argc, char** argv) { if (inputVideoSource == "RAW") { - printf("Pulling video from %s...\n", rawVideoFile); + std::cout << "Pulling video from " << rawVideoFile << "...\n"; videoInputSource = std::make_unique(rawVideoFile, videoFilter.get()); } else if (inputVideoSource == "ENCODED") { - printf("Pulling video from %s...\n", encodedVideoFile); + std::cout << "Pulling video from " << encodedVideoFile << "...\n"; videoInputSource = std::make_unique(encodedVideoFile, videoFilter.get()); } else if (inputVideoSource == "CONTAINER") { - printf("Pulling video from %s...\n", containerWithVideoAndAudioFile); + std::cout << "Pulling video from " << containerWithVideoAndAudioFile << "...\n"; auto demuxer = std::make_unique(containerWithVideoAndAudioFile); demuxer->DecodeBestVideoStream(videoFilter.get()); videoInputSource = std::move(demuxer); } else if (inputVideoSource == "GENERATED") { - printf("Generating checkerboard video pattern...\n"); + std::cout << "Generating checkerboard video pattern...\n"; videoInputSource = std::make_unique(640, 480, videoFilter.get()); } } diff --git a/examples/encode_audio/encode_audio.cpp b/examples/encode_audio/encode_audio.cpp index 8471e87..f5cb0a4 100644 --- a/examples/encode_audio/encode_audio.cpp +++ b/examples/encode_audio/encode_audio.cpp @@ -1,6 +1,7 @@ #include #include +#include #include "ffmpegcpp.h" @@ -22,8 +23,10 @@ int main() // Load the raw audio file so we can process it. // We need to provide some info because we can't derive it from the raw format. // Hand it the encoder so it will pass on its raw data to the encoder, which will in turn pass it on to the muxer. - const char* rawAudioFile = "samples/Vivaldi_s16le_2_channels_samplerate_11025.dat"; - const char* rawAudioFormat = "s16le"; int rawAudioSampleRate = 11025; int rawAudioChannels = 2; + std::string rawAudioFile = "samples/Vivaldi_s16le_2_channels_samplerate_11025.dat"; + std::string rawAudioFormat = "s16le"; + int rawAudioSampleRate = 11025; + int rawAudioChannels = 2; auto audioFile = std::make_unique(rawAudioFile, rawAudioFormat, rawAudioSampleRate, rawAudioChannels, encoder.get()); // Prepare the output pipeline. This will push a small amount of frames to the file sink until it IsPrimed returns true. diff --git a/include/ffmpegcpp/CodecDeducer.h b/include/ffmpegcpp/CodecDeducer.h index 04b9221..3771d52 100644 --- a/include/ffmpegcpp/CodecDeducer.h +++ b/include/ffmpegcpp/CodecDeducer.h @@ -1,5 +1,7 @@ #pragma once +#include + enum AVCodecID; struct AVCodec; @@ -9,13 +11,13 @@ namespace ffmpegcpp { public: - static AVCodec* DeduceEncoderFromFilename(const char* fileName); + static AVCodec* DeduceEncoderFromFilename(const std::string & fileName); static AVCodec* DeduceEncoder(AVCodecID codecId); - static AVCodec* DeduceEncoder(const char* codecName); + static AVCodec* DeduceEncoder(const std::string & codecName); static AVCodec* DeduceDecoder(AVCodecID codecId); - static AVCodec* DeduceDecoder(const char* codecName); + static AVCodec* DeduceDecoder(const std::string & codecName); }; } diff --git a/include/ffmpegcpp/Codecs/AudioCodec.h b/include/ffmpegcpp/Codecs/AudioCodec.h index 4183513..b3073aa 100644 --- a/include/ffmpegcpp/Codecs/AudioCodec.h +++ b/include/ffmpegcpp/Codecs/AudioCodec.h @@ -2,6 +2,8 @@ #include "Codecs/Codec.h" +#include + enum AVCodecID; enum AVSampleFormat; @@ -13,7 +15,7 @@ namespace ffmpegcpp { public: - AudioCodec(const char* codecName); + AudioCodec(const std::string & codecName); AudioCodec(AVCodecID codecId); std::unique_ptr Open(int bitRate, AVSampleFormat format, int sampleRate); diff --git a/include/ffmpegcpp/Codecs/Codec.h b/include/ffmpegcpp/Codecs/Codec.h index 866e548..1633900 100644 --- a/include/ffmpegcpp/Codecs/Codec.h +++ b/include/ffmpegcpp/Codecs/Codec.h @@ -3,6 +3,7 @@ #include "FFmpegResource.h" #include +#include enum AVCodecID; struct AVCodecContext; @@ -15,12 +16,12 @@ namespace ffmpegcpp { public: - Codec(const char* codecName); + Codec(const std::string & codecName); Codec(AVCodecID codecId); - void SetOption(const char* name, const char* value); - void SetOption(const char* name, int value); - void SetOption(const char* name, double value); + void SetOption(const std::string & name, const std::string & value); + void SetOption(const std::string & name, int value); + void SetOption(const std::string & name, double value); void SetGlobalContainerHeader(); // used by the Muxer for configuration purposes diff --git a/include/ffmpegcpp/Codecs/H264NVEncCodec.h b/include/ffmpegcpp/Codecs/H264NVEncCodec.h index 2d99be5..1ad40d7 100644 --- a/include/ffmpegcpp/Codecs/H264NVEncCodec.h +++ b/include/ffmpegcpp/Codecs/H264NVEncCodec.h @@ -1,6 +1,8 @@ #pragma once #include "VideoCodec.h" +#include + namespace ffmpegcpp { @@ -11,7 +13,7 @@ namespace ffmpegcpp H264NVEncCodec(); - void SetPreset(const char* preset); + void SetPreset(const std::string & preset); }; diff --git a/include/ffmpegcpp/Codecs/H265NVEncCodec.h b/include/ffmpegcpp/Codecs/H265NVEncCodec.h index 58099b0..2374fa7 100644 --- a/include/ffmpegcpp/Codecs/H265NVEncCodec.h +++ b/include/ffmpegcpp/Codecs/H265NVEncCodec.h @@ -1,6 +1,8 @@ #pragma once #include "VideoCodec.h" +#include + namespace ffmpegcpp { @@ -11,7 +13,7 @@ namespace ffmpegcpp H265NVEncCodec(); - void SetPreset(const char* preset); + void SetPreset(const std::string & preset); }; diff --git a/include/ffmpegcpp/Codecs/VP9Codec.h b/include/ffmpegcpp/Codecs/VP9Codec.h index c49b215..3bb00b3 100644 --- a/include/ffmpegcpp/Codecs/VP9Codec.h +++ b/include/ffmpegcpp/Codecs/VP9Codec.h @@ -1,6 +1,8 @@ #pragma once #include "VideoCodec.h" +#include + namespace ffmpegcpp { @@ -11,12 +13,11 @@ namespace ffmpegcpp VP9Codec(); - void SetDeadline(const char* deadline); + void SetDeadline(const std::string & deadline); void SetCpuUsed(int cpuUsed); void SetLossless(bool lossless); void SetCrf(int crf); }; - } \ No newline at end of file diff --git a/include/ffmpegcpp/Codecs/VideoCodec.h b/include/ffmpegcpp/Codecs/VideoCodec.h index 4e6b04d..bf3d165 100644 --- a/include/ffmpegcpp/Codecs/VideoCodec.h +++ b/include/ffmpegcpp/Codecs/VideoCodec.h @@ -2,6 +2,8 @@ #include "Codec.h" +#include + enum AVCodecID; enum AVSampleFormat; struct AVRational; @@ -14,7 +16,7 @@ namespace ffmpegcpp { public: - VideoCodec(const char* codecName); + VideoCodec(const std::string & codecName); VideoCodec(AVCodecID codecId); virtual ~VideoCodec(); diff --git a/include/ffmpegcpp/FFmpegException.h b/include/ffmpegcpp/FFmpegException.h index 4130fbe..7b0671d 100644 --- a/include/ffmpegcpp/FFmpegException.h +++ b/include/ffmpegcpp/FFmpegException.h @@ -12,9 +12,9 @@ namespace ffmpegcpp public: - FFmpegException(std::string error); + FFmpegException(const std::string & error); - FFmpegException(std::string error, int returnValue); + FFmpegException(const std::string & error, int returnValue); char const* what() const override { diff --git a/include/ffmpegcpp/FrameSinks/VideoFilter.h b/include/ffmpegcpp/FrameSinks/VideoFilter.h index fd0ed5f..0060ba8 100644 --- a/include/ffmpegcpp/FrameSinks/VideoFilter.h +++ b/include/ffmpegcpp/FrameSinks/VideoFilter.h @@ -3,6 +3,8 @@ #include "FrameSinks/VideoFrameSink.h" #include "FFmpegResource.h" +#include + struct AVFilterContext; struct AVFilterGraph; struct AVFrame; @@ -16,7 +18,7 @@ namespace ffmpegcpp public: - VideoFilter(const char* filterString, VideoFrameSink* target); + VideoFilter(const std::string & filterString, VideoFrameSink* target); void WriteFrame(AVFrame* frame, AVRational* timeBase) override; void Close() override; @@ -30,7 +32,7 @@ namespace ffmpegcpp VideoFrameSink* target; - const char* filterString; + std::string filterString; AVPixelFormat outputFormat; FFmpegResource filter_graph; diff --git a/include/ffmpegcpp/Muxing/Muxer.h b/include/ffmpegcpp/Muxing/Muxer.h index b90e7e7..031846d 100644 --- a/include/ffmpegcpp/Muxing/Muxer.h +++ b/include/ffmpegcpp/Muxing/Muxer.h @@ -17,7 +17,7 @@ namespace ffmpegcpp { { public: - Muxer(const char* fileName); + Muxer(const std::string & fileName); ~Muxer(); void AddOutputStream(OutputStream* stream); diff --git a/include/ffmpegcpp/Sources/Demuxer.h b/include/ffmpegcpp/Sources/Demuxer.h index 33eed5a..dc110e3 100644 --- a/include/ffmpegcpp/Sources/Demuxer.h +++ b/include/ffmpegcpp/Sources/Demuxer.h @@ -31,8 +31,8 @@ namespace ffmpegcpp { public: - Demuxer(const char* fileName); - Demuxer(const char* fileName, AVInputFormat* inputFormat, AVDictionary *inputFormatOptions); + Demuxer(const std::string & fileName); + Demuxer(const std::string & fileName, AVInputFormat* inputFormat, AVDictionary *inputFormatOptions); void DecodeBestAudioStream(AudioFrameSink* frameSink); void DecodeBestVideoStream(VideoFrameSink* frameSink); @@ -51,7 +51,7 @@ namespace ffmpegcpp bool done = false; - const char* fileName; + std::string fileName; std::vector GetStreamInfo(AVMediaType mediaType) const; StreamInfo CreateInfo(int streamIndex, AVStream* stream, AVCodec* codec) const; diff --git a/include/ffmpegcpp/Sources/EncodedFileSource.h b/include/ffmpegcpp/Sources/EncodedFileSource.h index 76a43cc..c3a0609 100644 --- a/include/ffmpegcpp/Sources/EncodedFileSource.h +++ b/include/ffmpegcpp/Sources/EncodedFileSource.h @@ -3,6 +3,8 @@ #include "Sources/InputSource.h" #include "FFmpegResource.h" +#include + enum AVCodecID; struct AVCodec; struct AVCodecContext; @@ -21,8 +23,8 @@ namespace ffmpegcpp { public: - EncodedFileSource(const char* inFileName, AVCodecID codecId, FrameSink* output); - EncodedFileSource(const char* inFileName, const char* codecName, FrameSink* output); + EncodedFileSource(const std::string & inFileName, AVCodecID codecId, FrameSink* output); + EncodedFileSource(const std::string & inFileName, const std::string & codecName, FrameSink* output); virtual ~EncodedFileSource(); void PreparePipeline() override; @@ -49,7 +51,7 @@ namespace ffmpegcpp FILE* file; - void Init(const char* inFileName, AVCodec* codec, FrameSink* output); + void Init(const std::string & inFileName, AVCodec* codec, FrameSink* output); void Decode(AVPacket *packet, AVFrame* targetFrame); diff --git a/include/ffmpegcpp/Sources/RawAudioFileSource.h b/include/ffmpegcpp/Sources/RawAudioFileSource.h index a4942f7..f553d3a 100644 --- a/include/ffmpegcpp/Sources/RawAudioFileSource.h +++ b/include/ffmpegcpp/Sources/RawAudioFileSource.h @@ -3,6 +3,7 @@ #include "Sources/InputSource.h" #include +#include namespace ffmpegcpp { @@ -13,7 +14,7 @@ namespace ffmpegcpp { public: - RawAudioFileSource(const char* fileName, const char* inputFormat, int sampleRate, int channels, AudioFrameSink* frameSink); + RawAudioFileSource(const std::string & fileName, const std::string & inputFormat, int sampleRate, int channels, AudioFrameSink* frameSink); void PreparePipeline() override; bool IsDone() const override; diff --git a/include/ffmpegcpp/Sources/RawVideoFileSource.h b/include/ffmpegcpp/Sources/RawVideoFileSource.h index b2b80b3..1b0e024 100644 --- a/include/ffmpegcpp/Sources/RawVideoFileSource.h +++ b/include/ffmpegcpp/Sources/RawVideoFileSource.h @@ -3,6 +3,7 @@ #include "Sources/InputSource.h" #include +#include namespace ffmpegcpp { @@ -13,7 +14,7 @@ namespace ffmpegcpp { public: - RawVideoFileSource(const char* fileName, VideoFrameSink* frameSink); + RawVideoFileSource(const std::string & fileName, VideoFrameSink* frameSink); // I couldn't get this to work. The thing is that it also crashes weirdly when I run ffmpeg directly, // so I think it's more an issue of ffmpeg than one of my library. diff --git a/src/CodecDeducer.cpp b/src/CodecDeducer.cpp index 07a0d2b..7821dde 100644 --- a/src/CodecDeducer.cpp +++ b/src/CodecDeducer.cpp @@ -7,9 +7,9 @@ using namespace std; namespace ffmpegcpp { - AVCodec* CodecDeducer::DeduceEncoder(const char* codecName) + AVCodec* CodecDeducer::DeduceEncoder(const std::string & codecName) { - AVCodec* codec = avcodec_find_encoder_by_name(codecName); + AVCodec* codec = avcodec_find_encoder_by_name(codecName.c_str()); if (!codec) { throw FFmpegException("Codec " + string(codecName) + " not found"); @@ -27,9 +27,9 @@ namespace ffmpegcpp return codec; } - AVCodec* CodecDeducer::DeduceDecoder(const char* codecName) + AVCodec* CodecDeducer::DeduceDecoder(const std::string & codecName) { - AVCodec* codec = avcodec_find_decoder_by_name(codecName); + AVCodec* codec = avcodec_find_decoder_by_name(codecName.c_str()); if (!codec) { throw FFmpegException("Codec " + string(codecName) + " not found"); @@ -47,7 +47,7 @@ namespace ffmpegcpp return codec; } - AVCodec* CodecDeducer::DeduceEncoderFromFilename(const char* fileName) + AVCodec* CodecDeducer::DeduceEncoderFromFilename(const std::string & fileName) { throw FFmpegException("Not implemented yet"); } diff --git a/src/Codecs/AudioCodec.cpp b/src/Codecs/AudioCodec.cpp index 2961995..6904f9a 100644 --- a/src/Codecs/AudioCodec.cpp +++ b/src/Codecs/AudioCodec.cpp @@ -7,7 +7,7 @@ using namespace std; namespace ffmpegcpp { - AudioCodec::AudioCodec(const char* codecName) + AudioCodec::AudioCodec(const std::string & codecName) : Codec(codecName) { } diff --git a/src/Codecs/Codec.cpp b/src/Codecs/Codec.cpp index 42548b8..8589b99 100644 --- a/src/Codecs/Codec.cpp +++ b/src/Codecs/Codec.cpp @@ -27,7 +27,7 @@ namespace namespace ffmpegcpp { - Codec::Codec(const char* codecName) + Codec::Codec(const std::string & codecName) { AVCodec* codec = CodecDeducer::DeduceEncoder(codecName); @@ -41,19 +41,19 @@ namespace ffmpegcpp codecContext = LoadContext(codec); } - void Codec::SetOption(const char* name, const char* value) + void Codec::SetOption(const std::string & name, const std::string & value) { - av_opt_set(codecContext->priv_data, name, value, 0); + av_opt_set(codecContext->priv_data, name.c_str(), value.c_str(), 0); } - void Codec::SetOption(const char* name, int value) + void Codec::SetOption(const std::string & name, int value) { - av_opt_set_int(codecContext->priv_data, name, value, 0); + av_opt_set_int(codecContext->priv_data, name.c_str(), value, 0); } - void Codec::SetOption(const char* name, double value) + void Codec::SetOption(const std::string & name, double value) { - av_opt_set_double(codecContext->priv_data, name, value, 0); + av_opt_set_double(codecContext->priv_data, name.c_str(), value, 0); } std::unique_ptr Codec::Open() diff --git a/src/Codecs/H264NVEncCodec.cpp b/src/Codecs/H264NVEncCodec.cpp index fb86719..d76c386 100644 --- a/src/Codecs/H264NVEncCodec.cpp +++ b/src/Codecs/H264NVEncCodec.cpp @@ -9,7 +9,7 @@ namespace ffmpegcpp } - void H264NVEncCodec::SetPreset(const char* preset) + void H264NVEncCodec::SetPreset(const std::string & preset) { SetOption("preset", preset); } diff --git a/src/Codecs/H265NVEncCodec.cpp b/src/Codecs/H265NVEncCodec.cpp index bfc3470..745c885 100644 --- a/src/Codecs/H265NVEncCodec.cpp +++ b/src/Codecs/H265NVEncCodec.cpp @@ -9,7 +9,7 @@ namespace ffmpegcpp } - void H265NVEncCodec::SetPreset(const char* preset) + void H265NVEncCodec::SetPreset(const std::string & preset) { SetOption("preset", preset); } diff --git a/src/Codecs/VP9Codec.cpp b/src/Codecs/VP9Codec.cpp index a4e10c9..aa4f3c0 100644 --- a/src/Codecs/VP9Codec.cpp +++ b/src/Codecs/VP9Codec.cpp @@ -9,7 +9,7 @@ namespace ffmpegcpp } - void VP9Codec::SetDeadline(const char* deadline) + void VP9Codec::SetDeadline(const std::string & deadline) { SetOption("deadline", deadline); } diff --git a/src/Codecs/VideoCodec.cpp b/src/Codecs/VideoCodec.cpp index a935e8e..5b30a49 100644 --- a/src/Codecs/VideoCodec.cpp +++ b/src/Codecs/VideoCodec.cpp @@ -7,7 +7,7 @@ using namespace std; namespace ffmpegcpp { - VideoCodec::VideoCodec(const char* codecName) + VideoCodec::VideoCodec(const std::string & codecName) : Codec(codecName) { } diff --git a/src/FFmpegException.cpp b/src/FFmpegException.cpp index 660aa8b..169f90c 100644 --- a/src/FFmpegException.cpp +++ b/src/FFmpegException.cpp @@ -4,11 +4,11 @@ using namespace std; namespace ffmpegcpp { - FFmpegException::FFmpegException(string error) : exception(error.c_str()) + FFmpegException::FFmpegException(const string & error) : exception(error.c_str()) { } - FFmpegException::FFmpegException(string error, int returnValue) + FFmpegException::FFmpegException(const string & error, int returnValue) : exception( (error + ": " + av_make_error_string(this->error, AV_ERROR_MAX_STRING_SIZE, returnValue)).c_str() ) diff --git a/src/FrameSinks/VideoFilter.cpp b/src/FrameSinks/VideoFilter.cpp index c16a6d6..d420c38 100644 --- a/src/FrameSinks/VideoFilter.cpp +++ b/src/FrameSinks/VideoFilter.cpp @@ -6,7 +6,7 @@ namespace ffmpegcpp { - VideoFilter::VideoFilter(const char* filterString, VideoFrameSink* target) + VideoFilter::VideoFilter(const std::string & filterString, VideoFrameSink* target) { this->target = target; this->filterString = filterString; @@ -106,7 +106,7 @@ namespace ffmpegcpp inputs->pad_idx = 0; inputs->next = nullptr; - if ((ret = avfilter_graph_parse_ptr(filter_graph.get(), filterString, + if ((ret = avfilter_graph_parse_ptr(filter_graph.get(), filterString.c_str(), &inputs, &outputs, nullptr)) < 0) { throw FFmpegException("Failed to parse and generate filters", ret); diff --git a/src/Muxing/Muxer.cpp b/src/Muxing/Muxer.cpp index 9046afe..d5628a6 100644 --- a/src/Muxing/Muxer.cpp +++ b/src/Muxing/Muxer.cpp @@ -12,16 +12,16 @@ using namespace std; namespace ffmpegcpp { - Muxer::Muxer(const char* fileName) + Muxer::Muxer(const std::string & fileName) { this->fileName = fileName; /* allocate the output media context */ - avformat_alloc_output_context2(&containerContext, nullptr, nullptr, fileName); + avformat_alloc_output_context2(&containerContext, nullptr, nullptr, fileName.c_str()); if (!containerContext) { printf("WARNING: Could not deduce output format from file extension: using MP4. as default\n"); - avformat_alloc_output_context2(&containerContext, nullptr, "mp4", fileName); + avformat_alloc_output_context2(&containerContext, nullptr, "mp4", fileName.c_str()); } if (!containerContext) { diff --git a/src/Sources/Demuxer.cpp b/src/Sources/Demuxer.cpp index 412941a..9b0c8ab 100644 --- a/src/Sources/Demuxer.cpp +++ b/src/Sources/Demuxer.cpp @@ -15,30 +15,30 @@ using namespace std; namespace ffmpegcpp { - Demuxer::Demuxer(const char* fileName) + Demuxer::Demuxer(const std::string & fileName) : Demuxer(fileName, nullptr, nullptr) { } - Demuxer::Demuxer(const char* fileName, AVInputFormat* inputFormat, AVDictionary *format_opts) + Demuxer::Demuxer(const std::string & fileName, AVInputFormat* inputFormat, AVDictionary *format_opts) { this->fileName = fileName; // open input file, and allocate format context int ret; auto container_ctx = containerContext.get(); - if ((ret = avformat_open_input(&container_ctx, fileName, inputFormat, &format_opts)) < 0) + if ((ret = avformat_open_input(&container_ctx, fileName.c_str(), inputFormat, &format_opts)) < 0) { - throw FFmpegException("Failed to open input container " + string(fileName), ret); + throw FFmpegException("Failed to open input container " + fileName, ret); } // retrieve stream information if (ret = (avformat_find_stream_info(containerContext.get(), nullptr)) < 0) { - throw FFmpegException("Failed to read streams from " + string(fileName), ret); + throw FFmpegException("Failed to read streams from " + fileName, ret); } - for (int i = 0; i < containerContext->nb_streams; ++i) + for (unsigned int i = 0; i < containerContext->nb_streams; ++i) { inputStreams.emplace_back(nullptr); } diff --git a/src/Sources/EncodedFileSource.cpp b/src/Sources/EncodedFileSource.cpp index 0aee9ea..4142090 100644 --- a/src/Sources/EncodedFileSource.cpp +++ b/src/Sources/EncodedFileSource.cpp @@ -9,7 +9,7 @@ using namespace std; namespace ffmpegcpp { - EncodedFileSource::EncodedFileSource(const char* inFileName, const char* codecName, FrameSink* output) + EncodedFileSource::EncodedFileSource(const std::string & inFileName, const std::string & codecName, FrameSink* output) { try { @@ -23,7 +23,7 @@ namespace ffmpegcpp } } - EncodedFileSource::EncodedFileSource(const char* inFileName, AVCodecID codecId, FrameSink* output) + EncodedFileSource::EncodedFileSource(const std::string & inFileName, AVCodecID codecId, FrameSink* output) { try { @@ -53,7 +53,7 @@ namespace ffmpegcpp fclose(file); } - void EncodedFileSource::Init(const char* inFileName, AVCodec* codec, FrameSink* output) + void EncodedFileSource::Init(const std::string & inFileName, AVCodec* codec, FrameSink* output) { this->output = output; @@ -75,7 +75,7 @@ namespace ffmpegcpp throw FFmpegException("Failed to open context for codec " + string(codec->name), ret); } - file = fopen(inFileName, "rb"); + file = fopen(inFileName.c_str(), "rb"); if (!file) { throw FFmpegException("Could not open file " + string(inFileName)); diff --git a/src/Sources/RawAudioFileSource.cpp b/src/Sources/RawAudioFileSource.cpp index ec0f5b5..b8484a4 100644 --- a/src/Sources/RawAudioFileSource.cpp +++ b/src/Sources/RawAudioFileSource.cpp @@ -8,14 +8,14 @@ using namespace std; namespace ffmpegcpp { - RawAudioFileSource::RawAudioFileSource(const char* fileName, const char* inputFormat, int sampleRate, int channels, AudioFrameSink* frameSink) + RawAudioFileSource::RawAudioFileSource(const std::string & fileName, const std::string & inputFormat, int sampleRate, int channels, AudioFrameSink* frameSink) { // try to deduce the input format from the input format name AVInputFormat *file_iformat; - if (!(file_iformat = av_find_input_format(inputFormat))) + if (!(file_iformat = av_find_input_format(inputFormat.c_str()))) { - throw FFmpegException("Unknown input format: " + string(inputFormat)); + throw FFmpegException("Unknown input format: " + inputFormat); } AVDictionary* format_opts = nullptr; diff --git a/src/Sources/RawVideoFileSource.cpp b/src/Sources/RawVideoFileSource.cpp index c8adec5..929159f 100644 --- a/src/Sources/RawVideoFileSource.cpp +++ b/src/Sources/RawVideoFileSource.cpp @@ -8,7 +8,7 @@ using namespace std; namespace ffmpegcpp { - RawVideoFileSource::RawVideoFileSource(const char* fileName, VideoFrameSink* frameSink) + RawVideoFileSource::RawVideoFileSource(const std::string & fileName, VideoFrameSink* frameSink) { // create the demuxer - it can handle figuring out the video type on its own apparently From 814276ea31ec967599cad312e8f51eea0ce4798c Mon Sep 17 00:00:00 2001 From: Wim van Aarle Date: Fri, 21 Dec 2018 14:47:33 +0100 Subject: [PATCH 31/31] code cleanup --- include/ffmpegcpp/Sources/Demuxer.h | 13 +++--- include/ffmpegcpp/Sources/InputSource.h | 4 -- src/Sources/Demuxer.cpp | 60 +++++++------------------ src/Sources/RawVideoFileSource.cpp | 5 +-- 4 files changed, 24 insertions(+), 58 deletions(-) diff --git a/include/ffmpegcpp/Sources/Demuxer.h b/include/ffmpegcpp/Sources/Demuxer.h index dc110e3..5a7eac0 100644 --- a/include/ffmpegcpp/Sources/Demuxer.h +++ b/include/ffmpegcpp/Sources/Demuxer.h @@ -22,7 +22,7 @@ namespace ffmpegcpp struct StreamInfo { - int streamId; + unsigned int streamId; AVCodec* codec; AVStream* stream; }; @@ -31,8 +31,7 @@ namespace ffmpegcpp { public: - Demuxer(const std::string & fileName); - Demuxer(const std::string & fileName, AVInputFormat* inputFormat, AVDictionary *inputFormatOptions); + Demuxer(const std::string & fileName, AVInputFormat* inputFormat = nullptr, AVDictionary *inputFormatOptions = nullptr); void DecodeBestAudioStream(AudioFrameSink* frameSink); void DecodeBestVideoStream(VideoFrameSink* frameSink); @@ -49,18 +48,18 @@ namespace ffmpegcpp private: + std::vector GetStreamInfo(AVMediaType mediaType) const; + + void DecodePacket(); + bool done = false; std::string fileName; - std::vector GetStreamInfo(AVMediaType mediaType) const; - StreamInfo CreateInfo(int streamIndex, AVStream* stream, AVCodec* codec) const; - std::vector> inputStreams; FFmpegResource containerContext; FFmpegResource pkt; - void DecodePacket(); }; } diff --git a/include/ffmpegcpp/Sources/InputSource.h b/include/ffmpegcpp/Sources/InputSource.h index 1f4bef2..fddb1ac 100644 --- a/include/ffmpegcpp/Sources/InputSource.h +++ b/include/ffmpegcpp/Sources/InputSource.h @@ -6,13 +6,9 @@ namespace ffmpegcpp { public: - virtual ~InputSource() {} - virtual void PreparePipeline() = 0; virtual bool IsDone() const = 0; virtual void Step() = 0; }; } - - diff --git a/src/Sources/Demuxer.cpp b/src/Sources/Demuxer.cpp index 9b0c8ab..f91c056 100644 --- a/src/Sources/Demuxer.cpp +++ b/src/Sources/Demuxer.cpp @@ -10,30 +10,21 @@ #include #include -using namespace std; - namespace ffmpegcpp { - - Demuxer::Demuxer(const std::string & fileName) - : Demuxer(fileName, nullptr, nullptr) - { - } - Demuxer::Demuxer(const std::string & fileName, AVInputFormat* inputFormat, AVDictionary *format_opts) { this->fileName = fileName; // open input file, and allocate format context - int ret; auto container_ctx = containerContext.get(); - if ((ret = avformat_open_input(&container_ctx, fileName.c_str(), inputFormat, &format_opts)) < 0) + if (int ret = avformat_open_input(&container_ctx, fileName.c_str(), inputFormat, &format_opts); ret < 0) { throw FFmpegException("Failed to open input container " + fileName, ret); } // retrieve stream information - if (ret = (avformat_find_stream_info(containerContext.get(), nullptr)) < 0) + if (int ret = avformat_find_stream_info(containerContext.get(), nullptr); ret < 0) { throw FFmpegException("Failed to read streams from " + fileName, ret); } @@ -44,7 +35,7 @@ namespace ffmpegcpp } // initialize packet, set data to NULL, let the demuxer fill it - pkt = MakeFFmpegResource(av_packet_alloc()); + pkt = av_packet_alloc(); if (!pkt) { throw FFmpegException("Failed to create packet for input stream"); @@ -54,19 +45,19 @@ namespace ffmpegcpp pkt->size = 0; } - vector Demuxer::GetAudioStreamInfo() const + std::vector Demuxer::GetAudioStreamInfo() const { return GetStreamInfo(AVMEDIA_TYPE_AUDIO); } - vector Demuxer::GetVideoStreamInfo() const + std::vector Demuxer::GetVideoStreamInfo() const { return GetStreamInfo(AVMEDIA_TYPE_VIDEO); } - vector Demuxer::GetStreamInfo(AVMediaType mediaType) const + std::vector Demuxer::GetStreamInfo(AVMediaType mediaType) const { - vector streamInfo; + std::vector streamInfo; for (unsigned int i = 0; i < containerContext->nb_streams; ++i) { AVStream* stream = containerContext->streams[i]; @@ -75,45 +66,34 @@ namespace ffmpegcpp AVCodec* codec = CodecDeducer::DeduceDecoder(stream->codecpar->codec_id); if (!codec) { - throw FFmpegException(string("Failed to deduce codec for stream ") + std::to_string(i) + " in container"); + throw FFmpegException("Failed to deduce codec for stream " + std::to_string(i) + " in container"); } if (codec->type == mediaType) { - streamInfo.push_back(CreateInfo(i, stream, codec)); + streamInfo.push_back({ i, codec, stream }); } } return streamInfo; } - StreamInfo Demuxer::CreateInfo(int streamIndex, AVStream* stream, AVCodec* codec) const - { - StreamInfo info; - info.streamId = streamIndex; - info.stream = stream; - info.codec = codec; - return info; - } - void Demuxer::DecodeBestAudioStream(AudioFrameSink* frameSink) { - int ret = av_find_best_stream(containerContext.get(), AVMEDIA_TYPE_AUDIO, -1, -1, nullptr, 0); - if (ret < 0) + int streamIndex = av_find_best_stream(containerContext.get(), AVMEDIA_TYPE_AUDIO, -1, -1, nullptr, 0); + if (streamIndex < 0) { - throw FFmpegException("Could not find " + string(av_get_media_type_string(AVMEDIA_TYPE_AUDIO)) + " stream in input file " + fileName, ret); + throw FFmpegException("Could not find " + std::string(av_get_media_type_string(AVMEDIA_TYPE_AUDIO)) + " stream in input file " + fileName, streamIndex); } - int streamIndex = ret; return DecodeAudioStream(streamIndex, frameSink); } void Demuxer::DecodeBestVideoStream(VideoFrameSink* frameSink) { - int ret = av_find_best_stream(containerContext.get(), AVMEDIA_TYPE_VIDEO, -1, -1, nullptr, 0); - if (ret < 0) + int streamIndex = av_find_best_stream(containerContext.get(), AVMEDIA_TYPE_VIDEO, -1, -1, nullptr, 0); + if (streamIndex < 0) { - throw FFmpegException("Could not find " + string(av_get_media_type_string(AVMEDIA_TYPE_VIDEO)) + " stream in input file " + fileName, ret); + throw FFmpegException("Could not find " + std::string(av_get_media_type_string(AVMEDIA_TYPE_VIDEO)) + " stream in input file " + fileName, streamIndex); } - int streamIndex = ret; return DecodeVideoStream(streamIndex, frameSink); } @@ -126,11 +106,8 @@ namespace ffmpegcpp } // create the stream - AVStream* stream = containerContext->streams[streamIndex]; - auto inputStream = std::make_unique(frameSink, stream); + auto inputStream = std::make_unique(frameSink, containerContext->streams[streamIndex]); inputStream->Open(); - - // remember and return inputStreams[streamIndex] = std::move(inputStream); } @@ -143,11 +120,8 @@ namespace ffmpegcpp } // create the stream - AVStream* stream = containerContext->streams[streamIndex]; - auto inputStream = std::make_unique(frameSink, stream); + auto inputStream = std::make_unique(frameSink, containerContext->streams[streamIndex]); inputStream->Open(); - - // remember and return inputStreams[streamIndex] = std::move(inputStream); } diff --git a/src/Sources/RawVideoFileSource.cpp b/src/Sources/RawVideoFileSource.cpp index 929159f..47c8bac 100644 --- a/src/Sources/RawVideoFileSource.cpp +++ b/src/Sources/RawVideoFileSource.cpp @@ -4,17 +4,14 @@ #include "FFmpegException.h" #include "Sources/Demuxer.h" -using namespace std; - namespace ffmpegcpp { RawVideoFileSource::RawVideoFileSource(const std::string & fileName, VideoFrameSink* frameSink) { - // create the demuxer - it can handle figuring out the video type on its own apparently try { - demuxer = std::make_unique(fileName, nullptr, nullptr); + demuxer = std::make_unique(fileName); demuxer->DecodeBestVideoStream(frameSink); } catch (FFmpegException e)