Comments (2)
Hi,
All magic located here:
vdec = VideoDecoderContext(vst);
Just look into CodecContext2::CodecContext2(const Stream &st, const Codec &codec, Direction direction, AVMediaType type)
To simplify research, CodecContext2()
called like:
CodecContext2(vst, Codec(), Direction::Decoding, AVMEDIA_TYPE_VIDEO)
Null Codec here means "use vst for the codec selection" and needed only for some corner cases, when codec overriding are needed:
... CodecContext2()...
...
Codec c = codec;
if (codec.isNull())
{
if (st.direction() == Direction::Decoding)
c = findDecodingCodec(codecId);
else
c = findEncodingCodec(codecId);
}
...
Open routine can be simplified to:
vdec.open(ec);
This mostly same to
vdec.open(Codec(), ec);
For opening this routine are used:
void CodecContext2::open(const Codec &codec, AVDictionary **options, OptionalErrorCode ec)
{
clear_if(ec);
if (isOpened() || !isValid()) {
throws_if(ec, isOpened() ? Errors::CodecAlreadyOpened : Errors::CodecInvalid);
return;
}
int stat = avcodec_open2(m_raw, codec.raw(), options);
if (stat < 0)
throws_if(ec, stat, ffmpeg_category());
}
You may be confused, that avcodec_open2()
calls with NULL
codec. But, look into avcodec_open2()
description:
* @param codec The codec to open this context for. If a non-NULL codec has been
* previously passed to avcodec_alloc_context3() or
* for this context, then this parameter MUST be either NULL or
* equal to the previously passed codec.
We are initialized VideoDecoderContext
with the Stream reference. And already pass correct codec to the avcodec_alloc_context3()
. So, now you have two ways:
- Add extra unuseful code to pass correct codec into
open()
- Or just pass Empty/Null codec in to it )
from avcpp.
Ah! Codec()
provides Null Codec :-)
And sorry for the long delay :-)
from avcpp.
Related Issues (20)
- Create aggregate headers roughly corresponding to FFmpeg's libraries
- `av::Rational`: define other relational operators
- Broken with FFmpeg 5.1 HOT 2
- CMake: INTERFACE_LIBRARY targets may only have whitelisted properties. HOT 2
- FFmpeg 5.1: fix channel_layout API HOT 1
- Is this project still alive? HOT 1
- Using multiple audio Resamplers on the same stream HOT 2
- avcpp is not usable as meson subproject (uninstalled) due to headers in src directory HOT 3
- Failed to build AV_ENABLE_STATIC only version
- Basic video filtering example HOT 2
- save avpack raw data into h264 file, but it can't play,help! HOT 4
- how can i use avcpp to push h264 rtmp stream to web server?
- Vcpkg support HOT 1
- Why disable socket timeout temporarily in FormatContext::findStreamInfo? HOT 3
- compile ffmpeg with cuda surpport, so can avcpp use hwaccelerate? HOT 1
- problem: not with libpostproc?
- Debugging the library HOT 1
- Error compiling catch on Ubuntu 21 gcc 11.2.0 HOT 2
- Support for gpu-accelerated decoding? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from avcpp.