Commit 62a1e003 authored by Michael Niedermayer's avatar Michael Niedermayer

avformat/mlvdec: Use AVFormatContext->open_cb()

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent a228f7d5
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "libavutil/intreadwrite.h" #include "libavutil/intreadwrite.h"
#include "libavutil/rational.h" #include "libavutil/rational.h"
#include "avformat.h" #include "avformat.h"
#include "avio_internal.h"
#include "internal.h" #include "internal.h"
#include "riff.h" #include "riff.h"
...@@ -331,11 +332,17 @@ static int read_header(AVFormatContext *avctx) ...@@ -331,11 +332,17 @@ static int read_header(AVFormatContext *avctx)
if (strlen(avctx->filename) > 2) { if (strlen(avctx->filename) > 2) {
int i; int i;
char *filename = av_strdup(avctx->filename); char *filename = av_strdup(avctx->filename);
AVOpenCallback open_func = avctx->open_cb;
if (!filename) if (!filename)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
if (!open_func)
open_func = ffio_open2_wrapper;
for (i = 0; i < 100; i++) { for (i = 0; i < 100; i++) {
snprintf(filename + strlen(filename) - 2, 3, "%02d", i); snprintf(filename + strlen(filename) - 2, 3, "%02d", i);
if (avio_open2(&mlv->pb[i], filename, AVIO_FLAG_READ, &avctx->interrupt_callback, NULL) < 0) if (open_func(avctx, &mlv->pb[i], filename, AVIO_FLAG_READ, &avctx->interrupt_callback, NULL) < 0)
break; break;
if (check_file_header(mlv->pb[i], guid) < 0) { if (check_file_header(mlv->pb[i], guid) < 0) {
av_log(avctx, AV_LOG_WARNING, "ignoring %s; bad format or guid mismatch\n", filename); av_log(avctx, AV_LOG_WARNING, "ignoring %s; bad format or guid mismatch\n", filename);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment