File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed
Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -394,7 +394,8 @@ int main(int argc, char *argv[])
394394 exit (1 );
395395 }
396396
397- if (avcodec_open2 (avctx, codec, NULL ) < 0 ) {
397+ if (avcodec_parameters_to_context (avctx, par) < 0 ||
398+ avcodec_open2 (avctx, codec, NULL ) < 0 ) {
398399 avcodec_free_context (&avctx);
399400 av_log (NULL , AV_LOG_ERROR, " Codec open failed\n " );
400401 exit (1 );
@@ -685,6 +686,8 @@ void Player::StopRunning()
685686void Player::ScheduleNextFrame (bool prerolling)
686687{
687688 AVPacket pkt;
689+ void *frame;
690+ int ret;
688691
689692 if (serial_fd > 0 && packet_queue_get (&dataqueue, &pkt, 0 )) {
690693 if (pkt.data [0 ] != ' ' ){
@@ -704,12 +707,13 @@ void Player::ScheduleNextFrame(bool prerolling)
704707 pix,
705708 bmdFrameFlagDefault,
706709 &videoFrame);
707- void *frame;
708- int got_picture;
709710 videoFrame->GetBytes (&frame);
710711
711- avcodec_decode_video2 (video.codec , avframe, &got_picture, &pkt);
712- if (got_picture) {
712+ avcodec_send_packet (video.codec , &pkt);
713+
714+ // TODO: support receiving multiple frames
715+ ret = avcodec_receive_frame (video.codec , avframe);
716+ if (ret >= 0 ) {
713717 uint8_t *data[4 ];
714718 int linesize[4 ];
715719
You can’t perform that action at this time.
0 commit comments