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 @@ -426,8 +426,12 @@ void FFmpegReader::Open() {
426426 }
427427
428428 // Open video codec
429- if (avcodec_open2 (pCodecCtx, pCodec, &opts) < 0 )
430- throw InvalidCodec (" A video codec was found, but could not be opened." , path);
429+ int avcodec_return = avcodec_open2 (pCodecCtx, pCodec, &opts);
430+ if (avcodec_return < 0 ) {
431+ std::stringstream avcodec_error_msg;
432+ avcodec_error_msg << " A video codec was found, but could not be opened. Error: " << av_err2string (avcodec_return);
433+ throw InvalidCodec (avcodec_error_msg.str (), path);
434+ }
431435
432436#if USE_HW_ACCEL
433437 if (hw_de_on && hw_de_supported) {
@@ -569,13 +573,13 @@ void FFmpegReader::Open() {
569573 CheckFPS ();
570574 }
571575
576+ // Mark as "open"
577+ is_open = true ;
578+
572579 // Seek back to beginning of file (if not already seeking)
573580 if (!is_seeking) {
574581 Seek (1 );
575582 }
576-
577- // Mark as "open"
578- is_open = true ;
579583 }
580584}
581585
You can’t perform that action at this time.
0 commit comments