aboutsummaryrefslogtreecommitdiffhomepage
path: root/sub
diff options
context:
space:
mode:
authorGravatar wm4 <wm4@nowhere>2015-01-06 18:05:20 +0100
committerGravatar wm4 <wm4@nowhere>2015-01-06 18:05:20 +0100
commit64e86b5b4ded09765a571796d1dff8cc6177d997 (patch)
treed8cef42e2f1b70d201258cf222912511cb4f2893 /sub
parentc3db52a0bf0895d29c6d877da63684fdecdc9a86 (diff)
sd_lavc: apply fallback to video resolution only for vobsubs
Commit 87c13de6 added a fallback to video resolution if the subtitle resolution is unknown. Apparently this fixed some broken files with vobsubs. This broke some DVB subtitles. Apparently .ts captures with 1920x1080 video resolution and 720x576 subtitles do exist. The sample at hand had some streams with 720x576 resolution and no sub resolution set, and some streams with 1920x1080 resolution and sub resolution set (both against the same 1920x1080 video). My conclusion is that 720x576 is the only reasonable fallback for DVB (but I can't be sure). The fallback is removed for PGS too. I don't know about the PGS case; it seems the sub resolution must always be set, so it shouldn't matter. Fixes #1425.
Diffstat (limited to 'sub')
-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];