Advertisement
Guest User

Untitled

a guest
Feb 11th, 2015
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.20 KB | None | 0 0
  1. commit e96a2343c9a7db0cefb58608339fd852a82a0e99
  2. Author: Eejya Singh <singh.eejya@gmail.com>
  3. Date: Wed Feb 11 22:46:36 2015 +0530
  4.  
  5. ASS markup stripper
  6.  
  7. diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
  8. index 99467bb..3c0e487 100644
  9. --- a/libavcodec/avcodec.h
  10. +++ b/libavcodec/avcodec.h
  11. @@ -766,7 +766,7 @@ typedef struct RcOverride{
  12. #define CODEC_FLAG2_SHOW_ALL 0x00400000 ///< Show all frames before the first keyframe
  13. #define CODEC_FLAG2_EXPORT_MVS 0x10000000 ///< Export motion vectors through frame side data
  14. #define CODEC_FLAG2_SKIP_MANUAL 0x20000000 ///< Do not skip samples and export skip information as frame side data
  15. -
  16. +#define CODEC_FLAG2_RAWTEXTSUB 0x40000000 ///<Strip markup from ASS subtitles
  17. /* Unsupported options :
  18. * Syntax Arithmetic coding (SAC)
  19. * Reference Picture Selection
  20. diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
  21. index 1d5b078..d448fef 100644
  22. --- a/libavcodec/options_table.h
  23. +++ b/libavcodec/options_table.h
  24. @@ -90,6 +90,7 @@ static const AVOption avcodec_options[] = {
  25. {"showall", "Show all frames before the first keyframe", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG2_SHOW_ALL }, INT_MIN, INT_MAX, V|D, "flags2"},
  26. {"export_mvs", "export motion vectors through frame side data", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG2_EXPORT_MVS}, INT_MIN, INT_MAX, V|D, "flags2"},
  27. {"skip_manual", "do not skip samples and export skip information as frame side data", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG2_SKIP_MANUAL}, INT_MIN, INT_MAX, V|D, "flags2"},
  28. +{"rawtextsub", "Strip ASS markup from subs", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG2_RAWTEXTSUB }, INT_MIN, INT_MAX, V|S, "flags2"},
  29. {"me_method", "set motion estimation method", OFFSET(me_method), AV_OPT_TYPE_INT, {.i64 = ME_EPZS }, INT_MIN, INT_MAX, V|E, "me_method"},
  30. {"zero", "zero motion estimation (fastest)", 0, AV_OPT_TYPE_CONST, {.i64 = ME_ZERO }, INT_MIN, INT_MAX, V|E, "me_method" },
  31. {"full", "full motion estimation (slowest)", 0, AV_OPT_TYPE_CONST, {.i64 = ME_FULL }, INT_MIN, INT_MAX, V|E, "me_method" },
  32. diff --git a/libavcodec/utils.c b/libavcodec/utils.c
  33. index 1ec5cae..a56037f 100644
  34. --- a/libavcodec/utils.c
  35. +++ b/libavcodec/utils.c
  36. @@ -2701,7 +2701,11 @@ static int utf8_check(const uint8_t *str)
  37. }
  38. return 1;
  39. }
  40. -
  41. +static int dummy_function(AVCodecContext *avctx)
  42. +{
  43. + av_log(avctx, 0,"Hello World!");
  44. + return 0;
  45. +}
  46. int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
  47. int *got_sub_ptr,
  48. AVPacket *avpkt)
  49. @@ -2758,7 +2762,11 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
  50. sub->end_display_time = av_rescale_q(avpkt->duration,
  51. avctx->pkt_timebase, ms);
  52. }
  53. -
  54. + if(avctx->flags2 & CODEC_FLAG2_RAWTEXTSUB)
  55. + {
  56. + dummy_function(avctx);
  57. + av_log(avctx,0,"Dummy Function being called!\n");
  58. + }
  59. for (i = 0; i < sub->num_rects; i++) {
  60. if (sub->rects[i]->ass && !utf8_check(sub->rects[i]->ass)) {
  61. av_log(avctx, AV_LOG_ERROR,
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement