Skip to content

Commit fd8b8cc

Browse files
committed
merge
2 parents f6ee799 + 0f8f7a8 commit fd8b8cc

35 files changed

+198
-110
lines changed
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<PropertyGroup />
3+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
4+
<LocalDebuggerWorkingDirectory>$(OutDir)</LocalDebuggerWorkingDirectory>
5+
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
6+
</PropertyGroup>
7+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
8+
<LocalDebuggerWorkingDirectory>$(OutDir)</LocalDebuggerWorkingDirectory>
9+
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
10+
</PropertyGroup>
411
</Project>

source/ffmpeg-cpp/difference/obj/x64/Release/difference.log

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
 Generating code
2-
All 492 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.
1+
 difference.cpp
2+
Generating code
3+
13 of 498 functions ( 2.6%) were compiled, the rest were copied from previous compilation.
4+
0 functions were new in current compilation
5+
4 functions had inline decision re-evaluated but remain unchanged
36
Finished generating code
47
difference.vcxproj -> D:\WonderMedia\ffmpeg\ffmpeg-cpp\source\ffmpeg-cpp\difference\..\..\..\bin\x64\Release\difference.exe
58
D:\WonderMedia\ffmpeg\ffmpeg-cpp\source\ffmpeg-cpp\difference\..\..\..\samples\big_buck_bunny.mp4
-4.12 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
24 KB
Binary file not shown.

source/ffmpeg-cpp/ffmpeg-cpp/Demuxing/AudioInputStream.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace ffmpegcpp
44
{
5-
AudioInputStream::AudioInputStream(AudioFrameSink* frameSink, AVStream* stream)
6-
: InputStream(stream)
5+
AudioInputStream::AudioInputStream(AudioFrameSink* frameSink, AVFormatContext* format, AVStream* stream)
6+
: InputStream(format, stream)
77
{
88
SetFrameSink(frameSink);
99
}

source/ffmpeg-cpp/ffmpeg-cpp/Demuxing/AudioInputStream.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace ffmpegcpp
1111

1212
public:
1313

14-
AudioInputStream(AudioFrameSink* frameSink, AVStream* stream);
14+
AudioInputStream(AudioFrameSink* frameSink, AVFormatContext* format, AVStream* stream);
1515
~AudioInputStream();
1616

1717
protected:

source/ffmpeg-cpp/ffmpeg-cpp/Demuxing/InputStream.cpp

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ using namespace std;
66

77
namespace ffmpegcpp
88
{
9-
InputStream::InputStream(AVStream* stream)
9+
InputStream::InputStream(AVFormatContext* format, AVStream* stream)
1010
{
1111
this->stream = stream;
12+
this->format = format;
1213

1314
// find decoder for the stream
1415
AVCodec* codec = CodecDeducer::DeduceDecoder(stream->codecpar->codec_id);
@@ -85,14 +86,43 @@ namespace ffmpegcpp
8586
av_frame_free(&frame);
8687
frame = nullptr;
8788
}
89+
if (metaData != nullptr)
90+
{
91+
delete metaData;
92+
metaData = nullptr;
93+
}
8894
}
8995

9096
void InputStream::SetFrameSink(FrameSink* frameSink)
9197
{
9298
output = frameSink->CreateStream();
9399
}
94100

95-
int inputSampleCount = 0;
101+
StreamData* InputStream::DiscoverMetaData()
102+
{
103+
/*metaData = new StreamData();
104+
105+
AVRational* time_base = &timeBaseCorrectedByTicksPerFrame;
106+
if (!timeBaseCorrectedByTicksPerFrame.num)
107+
{
108+
time_base = &stream->time_base;
109+
}
110+
111+
metaData->timeBase.num = time_base->num;
112+
metaData->timeBase.den = time_base->den;*/
113+
114+
AVRational overrideFrameRate;
115+
overrideFrameRate.num = 0;
116+
117+
AVRational tb = overrideFrameRate.num ? av_inv_q(overrideFrameRate) : stream->time_base;
118+
AVRational fr = overrideFrameRate;
119+
if (!fr.num) fr = av_guess_frame_rate(format, stream, NULL);
120+
121+
StreamData* metaData = new StreamData();
122+
metaData->timeBase = tb;
123+
metaData->frameRate = fr;
124+
return metaData;
125+
}
96126

97127
void InputStream::DecodePacket(AVPacket *pkt)
98128
{
@@ -122,16 +152,16 @@ namespace ffmpegcpp
122152
frame->sample_aspect_ratio = stream->sample_aspect_ratio;
123153
}
124154

125-
AVRational* time_base = &timeBaseCorrectedByTicksPerFrame;
126-
if (!timeBaseCorrectedByTicksPerFrame.num)
155+
// the meta data does not exist yet - we figure it out!
156+
if (metaData == nullptr)
127157
{
128-
time_base = &stream->time_base;
158+
metaData = DiscoverMetaData();
129159
}
130160

131161
// push the frame to the next stage.
132162
// The time_base is filled in in the codecContext after the first frame is decoded
133163
// so we can fetch it from there.
134-
output->WriteFrame(frame, time_base);
164+
output->WriteFrame(frame, metaData);
135165
}
136166
}
137167

0 commit comments

Comments
 (0)