There are still a couple of deprecated calls that I’m not sure what to do with. They are both related to some logic around AVCodecContext.coded_frame. I couldn’t find anywhere that really documented what that was, or where it was intended to move to. I left the warnings on.
Showing the changes to libavdevice/decklink_dec.cpp (1 of 1 file). Show all
Unified · Split
| @@ -249,9 +249,7 @@ HRESULT decklink_input_callback::VideoInputFrameArrived( · 248 unmodified lines | ||
| 249 | 249 | // Handle Video Frame |
| 250 | 250 | if (videoFrame) { |
| 251 | 251 | AVPacket pkt; |
| 252 | − AVCodecContext *c; | |
| 253 | 252 | av_init_packet(&pkt); |
| 254 | − c = ctx->video_st->codec; | |
| 255 | 253 | if (ctx->frameCount % 25 == 0) { |
| 256 | 254 | unsigned long long qsize = avpacket_queue_size(&ctx->queue); |
| 257 | 255 | av_log(avctx, AV_LOG_DEBUG, |
| @@ -354,7 +352,6 @@ HRESULT decklink_input_callback::VideoInputFrameArrived( · 96 unmodified lines | ||
| 354 | 352 | } |
| 355 | 353 | #endif |
| 356 | 354 | |
| 357 | − c->frame_number++; | |
| 358 | 355 | if (avpacket_queue_put(&ctx->queue, &pkt) < 0) { |
| 359 | 356 | ++ctx->dropped; |
| 360 | 357 | } |
| @@ -362,14 +359,12 @@ HRESULT decklink_input_callback::VideoInputFrameArrived( · 1 unmodified line | ||
| 362 | 359 | |
| 363 | 360 | // Handle Audio Frame |
| 364 | 361 | if (audioFrame) { |
| 365 | − AVCodecContext *c; | |
| 366 | 362 | AVPacket pkt; |
| 367 | 363 | BMDTimeValue audio_pts; |
| 368 | 364 | av_init_packet(&pkt); |
| 369 | 365 | |
| 370 | − c = ctx->audio_st->codec; | |
| 371 | 366 | //hack among hacks |
| 372 | − pkt.size = audioFrame->GetSampleFrameCount() * ctx->audio_st->codec->channels * (16 / 8); | |
| 367 | + pkt.size = audioFrame->GetSampleFrameCount() * ctx->audio_st->codecpar->channels * (16 / 8); | |
| 373 | 368 | audioFrame->GetBytes(&audioFrameBytes); |
| 374 | 369 | audioFrame->GetPacketTime(&audio_pts, ctx->audio_st->time_base.den); |
| 375 | 370 | pkt.pts = audio_pts / ctx->audio_st->time_base.num; |
| @@ -386,7 +381,6 @@ HRESULT decklink_input_callback::VideoInputFrameArrived( · 10 unmodified lines | ||
| 386 | 381 | pkt.stream_index = ctx->audio_st->index; |
| 387 | 382 | pkt.data = (uint8_t *)audioFrameBytes; |
| 388 | 383 | |
| 389 | − c->frame_number++; | |
| 390 | 384 | if (avpacket_queue_put(&ctx->queue, &pkt) < 0) { |
| 391 | 385 | ++ctx->dropped; |
| 392 | 386 | } |
| @@ -551,10 +545,10 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx) · 158 unmodified lines | ||
| 551 | 545 | av_log(avctx, AV_LOG_ERROR, "Cannot add stream\n"); |
| 552 | 546 | goto error; |
| 553 | 547 | } |
| 554 | − st->codec->codec_type = AVMEDIA_TYPE_AUDIO; | |
| 555 | − st->codec->codec_id = AV_CODEC_ID_PCM_S16LE; | |
| 556 | − st->codec->sample_rate = bmdAudioSampleRate48kHz; | |
| 557 | − st->codec->channels = cctx->audio_channels; | |
| 548 | + st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; | |
| 549 | + st->codecpar->codec_id = AV_CODEC_ID_PCM_S16LE; | |
| 550 | + st->codecpar->sample_rate = bmdAudioSampleRate48kHz; | |
| 551 | + st->codecpar->channels = cctx->audio_channels; | |
| 558 | 552 | avpriv_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */ |
| 559 | 553 | ctx->audio_st=st; |
| 560 | 554 | |
| @@ -563,21 +557,21 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx) · 2 unmodified lines | ||
| 563 | 557 | av_log(avctx, AV_LOG_ERROR, "Cannot add stream\n"); |
| 564 | 558 | goto error; |
| 565 | 559 | } |
| 566 | − st->codec->codec_type = AVMEDIA_TYPE_VIDEO; | |
| 567 | − st->codec->width = ctx->bmd_width; | |
| 568 | − st->codec->height = ctx->bmd_height; | |
| 560 | + st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; | |
| 561 | + st->codecpar->width = ctx->bmd_width; | |
| 562 | + st->codecpar->height = ctx->bmd_height; | |
| 569 | 563 | |
| 570 | − st->codec->time_base.den = ctx->bmd_tb_den; | |
| 571 | − st->codec->time_base.num = ctx->bmd_tb_num; | |
| 572 | − st->codec->bit_rate = av_image_get_buffer_size(st->codec->pix_fmt, ctx->bmd_width, ctx->bmd_height, 1) * 1/av_q2d(st->codec->time_base) * 8; | |
| 564 | + st->time_base.den = ctx->bmd_tb_den; | |
| 565 | + st->time_base.num = ctx->bmd_tb_num; | |
| 566 | + st->codecpar->bit_rate = av_image_get_buffer_size((AVPixelFormat)st->codecpar->format, ctx->bmd_width, ctx->bmd_height, 1) * 1/av_q2d(st->time_base) * 8; | |
| 573 | 567 | |
| 574 | 568 | if (cctx->v210) { |
| 575 | − st->codec->codec_id = AV_CODEC_ID_V210; | |
| 576 | − st->codec->codec_tag = MKTAG('V', '2', '1', '0'); | |
| 569 | + st->codecpar->codec_id = AV_CODEC_ID_V210; | |
| 570 | + st->codecpar->codec_tag = MKTAG('V', '2', '1', '0'); | |
| 577 | 571 | } else { |
| 578 | − st->codec->codec_id = AV_CODEC_ID_RAWVIDEO; | |
| 579 | − st->codec->pix_fmt = AV_PIX_FMT_UYVY422; | |
| 580 | − st->codec->codec_tag = MKTAG('U', 'Y', 'V', 'Y'); | |
| 572 | + st->codecpar->codec_id = AV_CODEC_ID_RAWVIDEO; | |
| 573 | + st->codecpar->format = AV_PIX_FMT_UYVY422; | |
| 574 | + st->codecpar->codec_tag = MKTAG('U', 'Y', 'V', 'Y'); | |
| 581 | 575 | } |
| 582 | 576 | |
| 583 | 577 | avpriv_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */ |
| @@ -590,16 +584,16 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx) · 6 unmodified lines | ||
| 590 | 584 | av_log(avctx, AV_LOG_ERROR, "Cannot add stream\n"); |
| 591 | 585 | goto error; |
| 592 | 586 | } |
| 593 | − st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE; | |
| 594 | − st->codec->time_base.den = ctx->bmd_tb_den; | |
| 595 | − st->codec->time_base.num = ctx->bmd_tb_num; | |
| 596 | − st->codec->codec_id = AV_CODEC_ID_DVB_TELETEXT; | |
| 587 | + st->codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE; | |
| 588 | + st->time_base.den = ctx->bmd_tb_den; | |
| 589 | + st->time_base.num = ctx->bmd_tb_num; | |
| 590 | + st->codecpar->codec_id = AV_CODEC_ID_DVB_TELETEXT; | |
| 597 | 591 | avpriv_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */ |
| 598 | 592 | ctx->teletext_st = st; |
| 599 | 593 | } |
| 600 | 594 | |
| 601 | − av_log(avctx, AV_LOG_VERBOSE, "Using %d input audio channels\n", ctx->audio_st->codec->channels); | |
| 602 | − result = ctx->dli->EnableAudioInput(bmdAudioSampleRate48kHz, bmdAudioSampleType16bitInteger, ctx->audio_st->codec->channels); | |
| 595 | + av_log(avctx, AV_LOG_VERBOSE, "Using %d input audio channels\n", ctx->audio_st->codecpar->channels); | |
| 596 | + result = ctx->dli->EnableAudioInput(bmdAudioSampleRate48kHz, bmdAudioSampleType16bitInteger, ctx->audio_st->codecpar->channels); | |
| 603 | 597 | |
| 604 | 598 | if (result != S_OK) { |
| 605 | 599 | av_log(avctx, AV_LOG_ERROR, "Cannot enable audio input\n"); |