[FFmpeg-cvslog] avcodec/dvdsubenc: accept forced flag

Oliver Fromme git at videolan.org
Tue May 20 00:20:54 CEST 2014


ffmpeg | branch: master | Oliver Fromme <oliver at fromme.com> | Sun May 18 15:29:28 2014 +0200| [ab6228316a595ecc1ee462a34a4f19e1ffeb9062] | committer: Michael Niedermayer

avcodec/dvdsubenc: accept forced flag

Reviewed-by: Anshul <anshul.ffmpeg at gmail.com>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ab6228316a595ecc1ee462a34a4f19e1ffeb9062
---

 libavcodec/dvdsubenc.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/libavcodec/dvdsubenc.c b/libavcodec/dvdsubenc.c
index 11858c7..d19d071 100644
--- a/libavcodec/dvdsubenc.c
+++ b/libavcodec/dvdsubenc.c
@@ -259,6 +259,7 @@ static int encode_dvd_subtitles(AVCodecContext *avctx,
     AVSubtitleRect vrect;
     uint8_t *vrect_data = NULL;
     int x2, y2;
+    int forced = 0;
 
     if (rects == 0 || h->rects == NULL)
         return AVERROR(EINVAL);
@@ -267,6 +268,12 @@ static int encode_dvd_subtitles(AVCodecContext *avctx,
             av_log(avctx, AV_LOG_ERROR, "Bitmap subtitle required\n");
             return AVERROR(EINVAL);
         }
+    /* Mark this subtitle forced if any of the rectangles is forced. */
+    for (i = 0; i < rects; i++)
+        if ((h->rects[i]->flags & AV_SUBTITLE_FLAG_FORCED) != 0) {
+            forced = 1;
+            break;
+        }
     vrect = *h->rects[0];
 
     if (rects > 1) {
@@ -371,7 +378,7 @@ static int encode_dvd_subtitles(AVCodecContext *avctx,
     bytestream_put_be16(&q, offset1);
     bytestream_put_be16(&q, offset2);
 
-    *q++ = 0x01; // start command
+    *q++ = forced ? 0x00 : 0x01; // start command
     *q++ = 0xff; // terminating command
 
     // send stop display command last



More information about the ffmpeg-cvslog mailing list