summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sub/sd_lavc.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/sub/sd_lavc.c b/sub/sd_lavc.c
index 4bdd6ea548..50af016313 100644
--- a/sub/sd_lavc.c
+++ b/sub/sd_lavc.c
@@ -69,9 +69,18 @@ static bool supports_format(const char *format)
}
}
-static void guess_resolution(enum AVCodecID type, int *w, int *h)
+static void get_resolution(struct sd *sd, int wh[2])
{
- if (type == AV_CODEC_ID_DVD_SUBTITLE) {
+ struct sd_lavc_priv *priv = sd->priv;
+ enum AVCodecID codec = priv->avctx->codec_id;
+ int *w = &wh[0], *h = &wh[1];
+ *w = priv->avctx->width;
+ *h = priv->avctx->height;
+ if (codec == AV_CODEC_ID_DVD_SUBTITLE) {
+ if (*w <= 0 || *h <= 0) {
+ *w = priv->video_params.w;
+ *h = priv->video_params.h;
+ }
/* XXX Although the video frame is some size, the SPU frame is
always maximum size i.e. 720 wide and 576 or 480 high */
// For HD files in MKV the VobSub resolution can be higher though,
@@ -89,18 +98,6 @@ static void guess_resolution(enum AVCodecID type, int *w, int *h)
}
}
-static void get_resolution(struct sd *sd, int wh[2])
-{
- struct sd_lavc_priv *priv = sd->priv;
- wh[0] = priv->avctx->width;
- wh[1] = priv->avctx->height;
- if (wh[0] <= 0 || wh[1] <= 0) {
- wh[0] = priv->video_params.w;
- wh[1] = priv->video_params.h;
- }
- guess_resolution(priv->avctx->codec_id, &wh[0], &wh[1]);
-}
-
static void set_mp4_vobsub_idx(AVCodecContext *avctx, char *src, int w, int h)
{
char pal_s[128];