On 10/15/2012 09:36 AM, Diego Biurrun wrote:
> On Mon, Oct 15, 2012 at 06:01:17PM +0200, John Stebbins wrote:
>> On 10/15/2012 05:38 PM, Diego Biurrun wrote:
>>> On Sun, Oct 14, 2012 at 05:41:03PM +0200, John Stebbins wrote:
>>>> On 10/14/2012 05:14 PM, Luca Barbato wrote:
>>>>> On 10/14/2012 04:52 PM, John Stebbins wrote:
>>>>>> +    uint8_t forced;
>>>>> why uint8_t ? I guess it would require a version bump btw.
>>>>>
>>>>> In itself looks a good feature (and probably the players would enjoy
>>>>> having this information)
>>>> Is the version number bump something I should do in the patch, or do you
>>>> prefer handling that yourselves?
>>> It's preferable you do it lest it be forgotten.
>>
>> Ok.  I'm unfamiliar with how libav versioning works.  Can you educate me
>> or point me to the write document? I.e. what file and what define gets
>> changed in this case?
> 
> http://www.libav.org/developer.html#Development-Policy
> 
>   16. Remember to check if you need to bump versions for the specific
>   libav parts (libavutil, libavcodec, libavformat) you are changing. You
>   need to change the version integer. Incrementing the first component
>   means no backward compatibility to previous versions (e.g. removal of
>   a function from the public API). Incrementing the second component
>   means backward compatible change (e.g. addition of a function to the
>   public API or extension of an existing data structure). Incrementing
>   the third component means a noteworthy binary compatible change (e.g.
>   encoder bug fix that matters for the decoder).
> 
> In your case I think bumping the minor number should be appropriate.
> 

Thanks. Patch updated.

-- 
John      GnuPG fingerprint: D0EC B3DB C372 D1F1 0B01  83F0 49F1 D7B2 60D4 D0F7
From adee2760bd0d60223e2315a22b6e8e4b6cb54acd Mon Sep 17 00:00:00 2001
From: John Stebbins <[email protected]>
Date: Sat, 20 Oct 2012 09:56:11 -0700
Subject: [PATCH] PGS subtitles: Expose forced flag

Useful for detection of subtitles displayed during foreign language
scenes.
---
 libavcodec/avcodec.h   |    3 +++
 libavcodec/pgssubdec.c |   11 ++++++++---
 libavcodec/version.h   |    2 +-
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index cda6703..806eec8 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -3137,6 +3137,8 @@ enum AVSubtitleType {
     SUBTITLE_ASS,
 };
 
+#define AV_SUBTITLE_FLAG_FORCED 0x00000001
+
 typedef struct AVSubtitleRect {
     int x;         ///< top left corner  of pict, undefined when pict is not set
     int y;         ///< top left corner  of pict, undefined when pict is not set
@@ -3159,6 +3161,7 @@ typedef struct AVSubtitleRect {
      * struct.
      */
     char *ass;
+    int flags;
 } AVSubtitleRect;
 
 typedef struct AVSubtitle {
diff --git a/libavcodec/pgssubdec.c b/libavcodec/pgssubdec.c
index 9fd26d8..0326ea8 100644
--- a/libavcodec/pgssubdec.c
+++ b/libavcodec/pgssubdec.c
@@ -45,6 +45,7 @@ typedef struct PGSSubPresentation {
     int y;
     int id_number;
     int object_number;
+    uint8_t composition_flag;
 } PGSSubPresentation;
 
 typedef struct PGSSubPicture {
@@ -299,16 +300,17 @@ static void parse_presentation_segment(AVCodecContext *avctx,
     buf += 3;
 
     ctx->presentation.object_number = bytestream_get_byte(&buf);
+    ctx->presentation.composition_flag = 0;
     if (!ctx->presentation.object_number)
         return;
 
     /*
-     * Skip 4 bytes of unknown:
+     * Skip 3 bytes of unknown:
      *     object_id_ref (2 bytes),
      *     window_id_ref,
-     *     composition_flag (0x80 - object cropped, 0x40 - object forced)
      */
-    buf += 4;
+    buf += 3;
+    ctx->presentation.composition_flag = bytestream_get_byte(&buf);
 
     x = bytestream_get_be16(&buf);
     y = bytestream_get_be16(&buf);
@@ -368,6 +370,9 @@ static int display_end_segment(AVCodecContext *avctx, void *data,
     sub->rects[0]  = av_mallocz(sizeof(*sub->rects[0]));
     sub->num_rects = 1;
 
+    if (ctx->presentation.composition_flag & 0x40)
+        sub->rects[0]->flags |= AV_SUBTITLE_FLAG_FORCED;
+
     sub->rects[0]->x    = ctx->presentation.x;
     sub->rects[0]->y    = ctx->presentation.y;
     sub->rects[0]->w    = ctx->picture.w;
diff --git a/libavcodec/version.h b/libavcodec/version.h
index b702f4b..5ee7c7c 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -27,7 +27,7 @@
  */
 
 #define LIBAVCODEC_VERSION_MAJOR 54
-#define LIBAVCODEC_VERSION_MINOR 31
+#define LIBAVCODEC_VERSION_MINOR 32
 #define LIBAVCODEC_VERSION_MICRO  0
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
-- 
1.7.9.5

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to