diff --git a/mythtv/libs/libmyth/audio/audiooutputdigitalencoder.cpp b/mythtv/libs/libmyth/audio/audiooutputdigitalencoder.cpp
index bd6dbcd..0a60141 100644
a
|
b
|
AudioOutputDigitalEncoder::~AudioOutputDigitalEncoder() |
63 | 63 | void AudioOutputDigitalEncoder::Reset(void) |
64 | 64 | { |
65 | 65 | if (av_context) |
66 | | { |
67 | | avcodec_close(av_context); |
68 | | av_freep(&av_context); |
69 | | } |
| 66 | avcodec_free_context(&av_context); |
| 67 | |
70 | 68 | av_frame_free(&m_frame); |
71 | 69 | |
72 | 70 | delete m_spdifenc; |
… |
… |
bool AudioOutputDigitalEncoder::Init( |
125 | 123 | } |
126 | 124 | |
127 | 125 | av_context = avcodec_alloc_context3(codec); |
128 | | avcodec_get_context_defaults3(av_context, codec); |
129 | 126 | |
130 | 127 | av_context->bit_rate = bitrate; |
131 | 128 | av_context->sample_rate = samplerate; |
diff --git a/mythtv/libs/libmythtv/AirPlay/mythraopconnection.cpp b/mythtv/libs/libmythtv/AirPlay/mythraopconnection.cpp
index f91d71c..861204f 100644
a
|
b
|
void MythRAOPConnection::DestroyDecoder(void) |
1686 | 1686 | { |
1687 | 1687 | if (m_codeccontext) |
1688 | 1688 | { |
1689 | | avcodec_close(m_codeccontext); |
1690 | | av_free(m_codeccontext); |
| 1689 | avcodec_free_context(&m_codeccontext); |
1691 | 1690 | } |
1692 | 1691 | m_codec = NULL; |
1693 | | m_codeccontext = NULL; |
1694 | 1692 | } |
1695 | 1693 | |
1696 | 1694 | bool MythRAOPConnection::OpenAudioDevice(void) |
diff --git a/mythtv/libs/libmythtv/avformatwriter.cpp b/mythtv/libs/libmythtv/avformatwriter.cpp
index 7540fad..ed3ba0a 100644
a
|
b
|
int AVFormatWriter::WriteVideoFrame(VideoFrame *frame) |
256 | 256 | av_init_packet(&pkt); |
257 | 257 | pkt.data = NULL; |
258 | 258 | pkt.size = 0; |
| 259 | AVCodecContext *avctx = gCodecMap->getCodecContext(m_videoStream); |
259 | 260 | { |
260 | 261 | QMutexLocker locker(avcodeclock); |
261 | | ret = avcodec_encode_video2(m_videoStream->codec, &pkt, |
| 262 | ret = avcodec_encode_video2(avctx, &pkt, |
262 | 263 | m_picture, &got_pkt); |
263 | 264 | } |
264 | 265 | |
… |
… |
int AVFormatWriter::WriteAudioFrame(unsigned char *buf, int /*fnum*/, long long |
326 | 327 | |
327 | 328 | bool got_packet = false; |
328 | 329 | int ret = 0; |
| 330 | AVCodecContext *avctx = gCodecMap->getCodecContext(m_audioStream); |
329 | 331 | int samples_per_avframe = m_audioFrameSize * m_audioChannels; |
330 | 332 | int sampleSizeIn = AudioOutputSettings::SampleSize(FORMAT_S16); |
331 | 333 | AudioFormat format = |
332 | | AudioOutputSettings::AVSampleFormatToFormat(m_audioStream->codec->sample_fmt); |
| 334 | AudioOutputSettings::AVSampleFormatToFormat(avctx->sample_fmt); |
333 | 335 | int sampleSizeOut = AudioOutputSettings::SampleSize(format); |
334 | 336 | |
335 | 337 | AVPacket pkt; |
… |
… |
int AVFormatWriter::WriteAudioFrame(unsigned char *buf, int /*fnum*/, long long |
337 | 339 | pkt.data = NULL; |
338 | 340 | pkt.size = 0; |
339 | 341 | |
340 | | if (av_get_packed_sample_fmt(m_audioStream->codec->sample_fmt) == AV_SAMPLE_FMT_FLT) |
| 342 | if (av_get_packed_sample_fmt(avctx->sample_fmt) == AV_SAMPLE_FMT_FLT) |
341 | 343 | { |
342 | 344 | AudioOutputUtil::toFloat(FORMAT_S16, (void *)m_audioInBuf, (void *)buf, |
343 | 345 | samples_per_avframe * sampleSizeIn); |
344 | 346 | buf = m_audioInBuf; |
345 | 347 | } |
346 | | if (av_sample_fmt_is_planar(m_audioStream->codec->sample_fmt)) |
| 348 | if (av_sample_fmt_is_planar(avctx->sample_fmt)) |
347 | 349 | { |
348 | 350 | AudioOutputUtil::DeinterleaveSamples(format, |
349 | 351 | m_audioChannels, |
… |
… |
int AVFormatWriter::WriteAudioFrame(unsigned char *buf, int /*fnum*/, long long |
364 | 366 | |
365 | 367 | m_audPicture->linesize[0] = m_audioFrameSize; |
366 | 368 | m_audPicture->nb_samples = m_audioFrameSize; |
367 | | m_audPicture->format = m_audioStream->codec->sample_fmt; |
| 369 | m_audPicture->format = avctx->sample_fmt; |
368 | 370 | m_audPicture->extended_data = m_audPicture->data; |
369 | 371 | |
370 | 372 | m_bufferedAudioFrameTimes.push_back(timecode); |
… |
… |
int AVFormatWriter::WriteAudioFrame(unsigned char *buf, int /*fnum*/, long long |
376 | 378 | // by 2 calls, this could be optimized |
377 | 379 | // into separate routines or separate threads. |
378 | 380 | got_packet = false; |
379 | | ret = avcodec_receive_packet(m_audioStream->codec, &pkt); |
| 381 | ret = avcodec_receive_packet(avctx, &pkt); |
380 | 382 | if (ret == 0) |
381 | 383 | got_packet = true; |
382 | 384 | if (ret == AVERROR(EAGAIN)) |
383 | 385 | ret = 0; |
384 | 386 | if (ret == 0) |
385 | | ret = avcodec_send_frame(m_audioStream->codec, m_audPicture); |
| 387 | ret = avcodec_send_frame(avctx, m_audPicture); |
386 | 388 | // if ret from avcodec_send_frame is AVERROR(EAGAIN) then |
387 | 389 | // there are 2 packets to be received while only 1 frame to be |
388 | 390 | // sent. The code does not cater for this. Hopefully it will not happen. |
… |
… |
AVStream* AVFormatWriter::AddVideoStream(void) |
466 | 468 | } |
467 | 469 | st->id = 0; |
468 | 470 | |
469 | | c = st->codec; |
470 | 471 | |
471 | 472 | codec = avcodec_find_encoder(m_ctx->oformat->video_codec); |
472 | 473 | if (!codec) |
… |
… |
AVStream* AVFormatWriter::AddVideoStream(void) |
476 | 477 | return NULL; |
477 | 478 | } |
478 | 479 | |
479 | | avcodec_get_context_defaults3(c, codec); |
| 480 | gCodecMap->freeCodecContext(st); |
| 481 | c = gCodecMap->getCodecContext(st, codec); |
480 | 482 | |
481 | 483 | c->codec = codec; |
482 | 484 | c->codec_id = m_ctx->oformat->video_codec; |
… |
… |
bool AVFormatWriter::OpenVideo(void) |
576 | 578 | { |
577 | 579 | AVCodecContext *c; |
578 | 580 | |
579 | | c = m_videoStream->codec; |
| 581 | c = gCodecMap->getCodecContext(m_videoStream); |
580 | 582 | |
581 | 583 | if (!m_width || !m_height) |
582 | 584 | return false; |
… |
… |
AVStream* AVFormatWriter::AddAudioStream(void) |
620 | 622 | } |
621 | 623 | st->id = 1; |
622 | 624 | |
623 | | c = st->codec; |
| 625 | c = gCodecMap->getCodecContext(st, NULL, true); |
| 626 | |
624 | 627 | c->codec_id = m_ctx->oformat->audio_codec; |
625 | 628 | c->codec_type = AVMEDIA_TYPE_AUDIO; |
626 | 629 | c->bit_rate = m_audioBitrate; |
… |
… |
bool AVFormatWriter::OpenAudio(void) |
664 | 667 | AVCodecContext *c; |
665 | 668 | AVCodec *codec; |
666 | 669 | |
667 | | c = m_audioStream->codec; |
| 670 | c = gCodecMap->getCodecContext(m_audioStream); |
668 | 671 | |
669 | 672 | c->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL; |
670 | 673 | |
diff --git a/mythtv/libs/libmythtv/mhi.cpp b/mythtv/libs/libmythtv/mhi.cpp
index eba6e34..b7605d2 100644
a
|
b
|
void MHIBitmap::CreateFromMPEG(const unsigned char *data, int length) |
1970 | 1970 | Close: |
1971 | 1971 | pkt.data = buff; |
1972 | 1972 | av_packet_unref(&pkt); |
1973 | | avcodec_close(c); |
1974 | | av_free(c); |
| 1973 | avcodec_free_context(&c); |
1975 | 1974 | } |
1976 | 1975 | |
1977 | 1976 | // Scale the bitmap. Only used for image derived from MPEG I-frames. |
diff --git a/mythtv/libs/libmythtv/mythavutil.cpp b/mythtv/libs/libmythtv/mythavutil.cpp
index 7706bd1..aabf020 100644
a
|
b
|
MythCodecMap::~MythCodecMap() |
389 | 389 | freeAllCodecContexts(); |
390 | 390 | } |
391 | 391 | |
392 | | AVCodecContext *MythCodecMap::getCodecContext(const AVStream *stream, const AVCodec *pCodec) |
| 392 | AVCodecContext *MythCodecMap::getCodecContext(const AVStream *stream, |
| 393 | const AVCodec *pCodec, bool nullCodec) |
393 | 394 | { |
394 | 395 | QMutexLocker lock(&mapLock); |
395 | 396 | AVCodecContext *avctx = streamMap.value(stream, NULL); |
… |
… |
AVCodecContext *MythCodecMap::getCodecContext(const AVStream *stream, const AVCo |
397 | 398 | { |
398 | 399 | if (stream == NULL || stream->codecpar == NULL) |
399 | 400 | return NULL; |
400 | | if (!pCodec) |
401 | | pCodec = avcodec_find_decoder(stream->codecpar->codec_id); |
402 | | if (!pCodec) |
| 401 | if (nullCodec) |
| 402 | pCodec = NULL; |
| 403 | else |
403 | 404 | { |
404 | | LOG(VB_GENERAL, LOG_WARNING, |
405 | | QString("avcodec_find_decoder fail for %1").arg(stream->codecpar->codec_id)); |
406 | | return NULL; |
| 405 | if (!pCodec) |
| 406 | pCodec = avcodec_find_decoder(stream->codecpar->codec_id); |
| 407 | if (!pCodec) |
| 408 | { |
| 409 | LOG(VB_GENERAL, LOG_WARNING, |
| 410 | QString("avcodec_find_decoder fail for %1").arg(stream->codecpar->codec_id)); |
| 411 | return NULL; |
| 412 | } |
407 | 413 | } |
408 | 414 | avctx = avcodec_alloc_context3(pCodec); |
409 | | if (avcodec_parameters_to_context(avctx, stream->codecpar) != NULL) |
| 415 | if (avcodec_parameters_to_context(avctx, stream->codecpar) < 0) |
410 | 416 | avcodec_free_context(&avctx); |
411 | 417 | if (avctx) |
412 | 418 | { |
diff --git a/mythtv/libs/libmythtv/mythavutil.h b/mythtv/libs/libmythtv/mythavutil.h
index cd57361..3e16df0 100644
a
|
b
|
class MythCodecMap |
92 | 92 | MythCodecMap(); |
93 | 93 | ~MythCodecMap(); |
94 | 94 | static MythCodecMap *getInstance(); |
95 | | AVCodecContext *getCodecContext(const AVStream*, const AVCodec *pCodec = NULL); |
| 95 | AVCodecContext *getCodecContext(const AVStream*, |
| 96 | const AVCodec *pCodec = NULL, bool nullCodec = false); |
96 | 97 | AVCodecContext *hasCodecContext(const AVStream*); |
97 | 98 | void freeCodecContext(const AVStream*); |
98 | 99 | void freeAllCodecContexts(); |
diff --git a/mythtv/libs/libmythtv/nuppeldecoder.cpp b/mythtv/libs/libmythtv/nuppeldecoder.cpp
index 010b144..9ecd237 100644
a
|
b
|
bool NuppelDecoder::InitAVCodecVideo(int codec) |
702 | 702 | directrendering = true; |
703 | 703 | |
704 | 704 | if (mpa_vidctx) |
705 | | av_free(mpa_vidctx); |
| 705 | avcodec_free_context(&mpa_vidctx); |
706 | 706 | |
707 | 707 | mpa_vidctx = avcodec_alloc_context3(NULL); |
708 | 708 | |
… |
… |
void NuppelDecoder::CloseAVCodecVideo(void) |
742 | 742 | { |
743 | 743 | QMutexLocker locker(avcodeclock); |
744 | 744 | |
745 | | if (mpa_vidcodec) |
746 | | { |
747 | | avcodec_close(mpa_vidctx); |
748 | | |
749 | | if (mpa_vidctx) |
750 | | { |
751 | | av_free(mpa_vidctx); |
752 | | mpa_vidctx = NULL; |
753 | | } |
754 | | } |
| 745 | if (mpa_vidcodec && mpa_vidctx) |
| 746 | avcodec_free_context(&mpa_vidctx); |
755 | 747 | } |
756 | 748 | |
757 | 749 | bool NuppelDecoder::InitAVCodecAudio(int codec) |
… |
… |
bool NuppelDecoder::InitAVCodecAudio(int codec) |
781 | 773 | } |
782 | 774 | |
783 | 775 | if (mpa_audctx) |
784 | | av_free(mpa_audctx); |
| 776 | avcodec_free_context(&mpa_audctx); |
785 | 777 | |
786 | 778 | mpa_audctx = avcodec_alloc_context3(NULL); |
787 | 779 | |
… |
… |
void NuppelDecoder::CloseAVCodecAudio(void) |
802 | 794 | { |
803 | 795 | QMutexLocker locker(avcodeclock); |
804 | 796 | |
805 | | if (mpa_audcodec) |
806 | | { |
807 | | avcodec_close(mpa_audctx); |
808 | | |
809 | | if (mpa_audctx) |
810 | | { |
811 | | av_free(mpa_audctx); |
812 | | mpa_audctx = NULL; |
813 | | } |
814 | | } |
| 797 | if (mpa_audcodec && mpa_audctx) |
| 798 | avcodec_free_context(&mpa_audctx); |
815 | 799 | } |
816 | 800 | |
817 | 801 | static void CopyToVideo(unsigned char *buf, int video_width, |
diff --git a/mythtv/libs/libmythtv/privatedecoder_crystalhd.cpp b/mythtv/libs/libmythtv/privatedecoder_crystalhd.cpp
index 6c8841d..91f7a6e 100644
a
|
b
|
|
1 | 1 | #include "privatedecoder_crystalhd.h" |
2 | 2 | #include "mythlogging.h" |
| 3 | #include "mythavutil.h" |
3 | 4 | #include "fourcc.h" |
4 | 5 | #include "unistd.h" |
5 | 6 | |
… |
… |
bool PrivateDecoderCrystalHD::HasBufferedFrames(void) |
424 | 425 | int PrivateDecoderCrystalHD::ProcessPacket(AVStream *stream, AVPacket *pkt) |
425 | 426 | { |
426 | 427 | int result = -1; |
427 | | AVCodecContext *avctx = stream->codec; |
| 428 | AVCodecContext *avctx = gCodecMap->getCodecContext(stream); |
428 | 429 | if (!avctx) |
429 | 430 | return result; |
430 | 431 | |
… |
… |
int PrivateDecoderCrystalHD::GetFrame(AVStream *stream, |
516 | 517 | if (!stream || !m_device || !picture) |
517 | 518 | return result; |
518 | 519 | |
519 | | AVCodecContext *avctx = stream->codec; |
| 520 | AVCodecContext *avctx = gCodecMap->getCodecContext(stream); |
| 521 | |
520 | 522 | if (!avctx || !StartFetcherThread()) |
521 | 523 | return result; |
522 | 524 | |
diff --git a/mythtv/libs/libmythtv/privatedecoder_vda.cpp b/mythtv/libs/libmythtv/privatedecoder_vda.cpp
index f98a2d5..21a5656 100644
a
|
b
|
|
6 | 6 | #define ERR QString("VDADec error: ") |
7 | 7 | |
8 | 8 | #include "mythframe.h" |
| 9 | #include "mythavutil.h" |
9 | 10 | #include "util-osx-cocoa.h" |
10 | 11 | #include "privatedecoder_vda.h" |
11 | 12 | #include "util-osx.h" |
… |
… |
int PrivateDecoderVDA::GetFrame(AVStream *stream, |
550 | 551 | if (!m_lib || !stream) |
551 | 552 | return result; |
552 | 553 | |
553 | | AVCodecContext *avctx = stream->codec; |
| 554 | AVCodecContext *avctx = gCodecMap->getCodecContext(stream); |
554 | 555 | if (!avctx) |
555 | 556 | return result; |
556 | 557 | |
diff --git a/mythtv/libs/libmythtv/recorders/NuppelVideoRecorder.cpp b/mythtv/libs/libmythtv/recorders/NuppelVideoRecorder.cpp
index c8b2e80..cf9daf8 100644
a
|
b
|
NuppelVideoRecorder::~NuppelVideoRecorder(void) |
270 | 270 | if (mpa_vidcodec) |
271 | 271 | { |
272 | 272 | QMutexLocker locker(avcodeclock); |
273 | | avcodec_close(mpa_vidctx); |
| 273 | avcodec_free_context(&mpa_vidctx); |
274 | 274 | } |
275 | 275 | |
276 | | if (mpa_vidctx) |
277 | | av_free(mpa_vidctx); |
278 | | mpa_vidctx = NULL; |
279 | | |
280 | 276 | if (videoFilters) |
281 | 277 | delete videoFilters; |
282 | 278 | if (FiltMan) |
… |
… |
bool NuppelVideoRecorder::SetupAVCodecVideo(void) |
525 | 521 | if (mpa_vidcodec) |
526 | 522 | { |
527 | 523 | QMutexLocker locker(avcodeclock); |
528 | | avcodec_close(mpa_vidctx); |
| 524 | avcodec_free_context(&mpa_vidctx); |
529 | 525 | } |
530 | 526 | |
531 | | if (mpa_vidctx) |
532 | | av_free(mpa_vidctx); |
533 | | mpa_vidctx = NULL; |
534 | | |
535 | 527 | QByteArray vcodec = videocodec.toLatin1(); |
536 | 528 | mpa_vidcodec = avcodec_find_encoder_by_name(vcodec.constData()); |
537 | 529 | |
diff --git a/mythtv/programs/mythtranscode/external/replex/replex.c b/mythtv/programs/mythtranscode/external/replex/replex.c
index f5821f7..932f75c 100644
a
|
b
|
static int encode_mp2_audio(audio_frame_t *aframe, uint8_t *buffer, int bufsize) |
218 | 218 | "frame size (%d) does not equal required size (%d)?", |
219 | 219 | out_size, bufsize); |
220 | 220 | free(samples); |
221 | | avcodec_close(c); |
222 | | av_free(c); |
| 221 | avcodec_free_context(&c); |
223 | 222 | return 1; |
224 | 223 | } |
225 | 224 | |
226 | 225 | free(samples); |
227 | | avcodec_close(c); |
228 | | av_free(c); |
| 226 | avcodec_free_context(&c); |
229 | 227 | |
230 | 228 | return 0; |
231 | 229 | } |
diff --git a/mythtv/programs/mythtranscode/mpeg2fix.cpp b/mythtv/programs/mythtranscode/mpeg2fix.cpp
index f25b16d..2a85480 100644
a
|
b
|
bool MPEG2fixup::InitAV(QString inputfile, const char *type, int64_t offset) |
874 | 874 | |
875 | 875 | for (unsigned int i = 0; i < inputFC->nb_streams; i++) |
876 | 876 | { |
877 | | switch (inputFC->streams[i]->codec->codec_type) |
| 877 | switch (inputFC->streams[i]->codecpar->codec_type) |
878 | 878 | { |
879 | 879 | case AVMEDIA_TYPE_VIDEO: |
880 | 880 | if (vid_id == -1) |
… |
… |
bool MPEG2fixup::InitAV(QString inputfile, const char *type, int64_t offset) |
883 | 883 | |
884 | 884 | case AVMEDIA_TYPE_AUDIO: |
885 | 885 | if (!allaudio && ext_count > 0 && |
886 | | inputFC->streams[i]->codec->channels < 2 && |
887 | | inputFC->streams[i]->codec->sample_rate < 100000) |
| 886 | inputFC->streams[i]->codecpar->channels < 2 && |
| 887 | inputFC->streams[i]->codecpar->sample_rate < 100000) |
888 | 888 | { |
889 | 889 | LOG(VB_GENERAL, LOG_ERR, |
890 | 890 | QString("Skipping audio stream: %1").arg(i)); |
891 | 891 | break; |
892 | 892 | } |
893 | | if (inputFC->streams[i]->codec->codec_id == AV_CODEC_ID_AC3 || |
894 | | inputFC->streams[i]->codec->codec_id == AV_CODEC_ID_MP3 || |
895 | | inputFC->streams[i]->codec->codec_id == AV_CODEC_ID_MP2) |
| 893 | if (inputFC->streams[i]->codecpar->codec_id == AV_CODEC_ID_AC3 || |
| 894 | inputFC->streams[i]->codecpar->codec_id == AV_CODEC_ID_MP3 || |
| 895 | inputFC->streams[i]->codecpar->codec_id == AV_CODEC_ID_MP2) |
896 | 896 | { |
897 | 897 | aud_map[i] = ext_count++; |
898 | 898 | aFrame[i] = new FrameList(); |
… |
… |
bool MPEG2fixup::InitAV(QString inputfile, const char *type, int64_t offset) |
900 | 900 | else |
901 | 901 | LOG(VB_GENERAL, LOG_ERR, |
902 | 902 | QString("Skipping unsupported audio stream: %1") |
903 | | .arg(inputFC->streams[i]->codec->codec_id)); |
| 903 | .arg(inputFC->streams[i]->codecpar->codec_id)); |
904 | 904 | break; |
905 | 905 | default: |
906 | 906 | LOG(VB_GENERAL, LOG_ERR, |
907 | 907 | QString("Skipping unsupported codec %1 on stream %2") |
908 | | .arg(inputFC->streams[i]->codec->codec_type).arg(i)); |
| 908 | .arg(inputFC->streams[i]->codecpar->codec_type).arg(i)); |
909 | 909 | break; |
910 | 910 | } |
911 | 911 | } |
… |
… |
bool MPEG2fixup::BuildFrame(AVPacket *pkt, QString fname) |
1328 | 1328 | SetRepeat(pkt->data, pkt->size, info->display_picture->nb_fields, |
1329 | 1329 | !!(info->display_picture->flags & PIC_FLAG_TOP_FIELD_FIRST)); |
1330 | 1330 | |
1331 | | avcodec_close(c); |
1332 | | av_freep(&c); |
| 1331 | avcodec_free_context(&c); |
1333 | 1332 | |
1334 | 1333 | return false; |
1335 | 1334 | } |
… |
… |
int MPEG2fixup::GetFrame(AVPacket *pkt) |
1458 | 1457 | return 1; |
1459 | 1458 | } |
1460 | 1459 | |
1461 | | switch (inputFC->streams[pkt->stream_index]->codec->codec_type) |
| 1460 | switch (inputFC->streams[pkt->stream_index]->codecpar->codec_type) |
1462 | 1461 | { |
1463 | 1462 | case AVMEDIA_TYPE_VIDEO: |
1464 | 1463 | vFrame.append(tmpFrame); |
diff --git a/mythtv/programs/mythutil/musicmetautils.cpp b/mythtv/programs/mythutil/musicmetautils.cpp
index e303a60..de2c8510 100644
a
|
b
|
static int CalcTrackLength(const MythUtilCommandLineParser &cmdline) |
275 | 275 | AVStream *st = inputFC->streams[i]; |
276 | 276 | char buf[256]; |
277 | 277 | |
278 | | avcodec_string(buf, sizeof(buf), st->codec, false); |
| 278 | const AVCodec *pCodec = avcodec_find_decoder(st->codecpar->codec_id); |
| 279 | if (!pCodec) |
| 280 | { |
| 281 | LOG(VB_GENERAL, LOG_WARNING, |
| 282 | QString("avcodec_find_decoder fail for %1").arg(st->codecpar->codec_id)); |
| 283 | continue; |
| 284 | } |
| 285 | AVCodecContext *avctx = avcodec_alloc_context3(pCodec); |
| 286 | avcodec_parameters_to_context(avctx, st->codecpar); |
| 287 | av_codec_set_pkt_timebase(avctx, st->time_base); |
| 288 | |
| 289 | avcodec_string(buf, sizeof(buf), avctx, false); |
279 | 290 | |
280 | | switch (inputFC->streams[i]->codec->codec_type) |
| 291 | switch (inputFC->streams[i]->codecpar->codec_type) |
281 | 292 | { |
282 | 293 | case AVMEDIA_TYPE_AUDIO: |
283 | 294 | { |
… |
… |
static int CalcTrackLength(const MythUtilCommandLineParser &cmdline) |
299 | 310 | default: |
300 | 311 | LOG(VB_GENERAL, LOG_ERR, |
301 | 312 | QString("Skipping unsupported codec %1 on stream %2") |
302 | | .arg(inputFC->streams[i]->codec->codec_type).arg(i)); |
| 313 | .arg(inputFC->streams[i]->codecpar->codec_type).arg(i)); |
303 | 314 | break; |
304 | 315 | } |
| 316 | avcodec_free_context(&avctx); |
305 | 317 | } |
306 | 318 | |
307 | 319 | // Close input file |