|
9 | 9 | #include "packet.h"
|
10 | 10 | #include "dictionary.h"
|
11 | 11 | #include "codec.h"
|
| 12 | +#include "codecparameters.h" |
12 | 13 |
|
13 | 14 | #include "codeccontext.h"
|
14 | 15 |
|
@@ -311,7 +312,7 @@ CodecContext2::CodecContext2(const Stream &st, const Codec &codec, Direction dir
|
311 | 312 | #else
|
312 | 313 | m_raw = avcodec_alloc_context3(c.raw());
|
313 | 314 | if (m_raw) {
|
314 |
| - avcodec_parameters_to_context(m_raw, st.raw()->codecpar); |
| 315 | + st.codecParameters().copyTo(*this); |
315 | 316 | }
|
316 | 317 | #endif
|
317 | 318 |
|
@@ -397,8 +398,9 @@ void CodecContext2::setCodec(const Codec &codec, bool resetDefaults, Direction d
|
397 | 398 | FF_ENABLE_DEPRECATION_WARNINGS
|
398 | 399 | #else
|
399 | 400 | // TBD: need a check
|
400 |
| - if (m_stream.isValid()) |
401 |
| - avcodec_parameters_from_context(m_stream.raw()->codecpar, m_raw); |
| 401 | + if (m_stream.isValid()) { |
| 402 | + m_stream.codecParameters().copyFrom(*this); |
| 403 | + } |
402 | 404 | #endif
|
403 | 405 | }
|
404 | 406 |
|
@@ -507,9 +509,9 @@ void CodecContext2::copyContextFrom(const CodecContext2 &other, OptionalErrorCod
|
507 | 509 | throws_if(ec, stat, ffmpeg_category());
|
508 | 510 | FF_ENABLE_DEPRECATION_WARNINGS
|
509 | 511 | #else
|
510 |
| - AVCodecParameters params{}; |
511 |
| - avcodec_parameters_from_context(¶ms, other.m_raw); |
512 |
| - avcodec_parameters_to_context(m_raw, ¶ms); |
| 512 | + CodecParameters params; |
| 513 | + params.copyFrom(other); |
| 514 | + params.copyTo(*this); |
513 | 515 | #endif
|
514 | 516 | m_raw->codec_tag = 0;
|
515 | 517 | }
|
|
0 commit comments