707cfc2b71503d97b06f4c5532514e44e2f97ff7
[AGL/meta-agl.git] / meta-agl-bsp / meta-ti / recipes-arago / gstreamer / gstreamer1.0-plugins-bad / 0002-parsers-Pick-previos-bug-fixes-on-different-parsers.patch
1 From c748e947ff35c4137178aef9bf229e0c67952982 Mon Sep 17 00:00:00 2001
2 From: Pooja Prajod <a0132412@ti.com>
3 Date: Fri, 20 Jan 2017 14:57:29 +0530
4 Subject: [PATCH 2/5] parsers: Pick previos bug fixes on different parsers
5
6 The following bug fixes which were previously identified are picked :
7 1. Increase rank for vc1parse and jpegparse
8 2. Modify h264 and mpeg4 parsers to interpolate pts
9 3. Fix create() width and height calculation on h264parse
10
11 Signed-off-by: Pooja Prajod <a0132412@ti.com>
12 ---
13  gst/jpegformat/gstjpegformat.c        |  2 +-
14  gst/jpegformat/gstjpegparse.c         |  2 +-
15  gst/videoparsers/gsth264parse.c       | 22 +++++++---------------
16  gst/videoparsers/gstmpeg4videoparse.c |  2 +-
17  gst/videoparsers/gstmpegvideoparse.c  |  2 +-
18  gst/videoparsers/plugin.c             |  2 +-
19  6 files changed, 12 insertions(+), 20 deletions(-)
20
21 diff --git a/gst/jpegformat/gstjpegformat.c b/gst/jpegformat/gstjpegformat.c
22 index b410466..ecb9311 100644
23 --- a/gst/jpegformat/gstjpegformat.c
24 +++ b/gst/jpegformat/gstjpegformat.c
25 @@ -30,7 +30,7 @@
26  static gboolean
27  plugin_init (GstPlugin * plugin)
28  {
29 -  if (!gst_element_register (plugin, "jpegparse", GST_RANK_NONE,
30 +  if (!gst_element_register (plugin, "jpegparse", GST_RANK_PRIMARY + 2,
31            GST_TYPE_JPEG_PARSE))
32      return FALSE;
33    if (!gst_element_register (plugin, "jifmux", GST_RANK_SECONDARY,
34 diff --git a/gst/jpegformat/gstjpegparse.c b/gst/jpegformat/gstjpegparse.c
35 index 77e53a6..5bfba7b 100644
36 --- a/gst/jpegformat/gstjpegparse.c
37 +++ b/gst/jpegformat/gstjpegparse.c
38 @@ -151,7 +151,7 @@ gst_jpeg_parse_class_init (GstJpegParseClass * klass)
39  
40    gst_element_class_set_static_metadata (gstelement_class,
41        "JPEG stream parser",
42 -      "Video/Parser",
43 +      "Codec/Parser/Video",
44        "Parse JPEG images into single-frame buffers",
45        "Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>");
46  
47 diff --git a/gst/videoparsers/gsth264parse.c b/gst/videoparsers/gsth264parse.c
48 index 05b6b75..6fe2914 100644
49 --- a/gst/videoparsers/gsth264parse.c
50 +++ b/gst/videoparsers/gsth264parse.c
51 @@ -162,7 +162,7 @@ static void
52  gst_h264_parse_init (GstH264Parse * h264parse)
53  {
54    h264parse->frame_out = gst_adapter_new ();
55 -  gst_base_parse_set_pts_interpolation (GST_BASE_PARSE (h264parse), FALSE);
56 +  gst_base_parse_set_pts_interpolation (GST_BASE_PARSE (h264parse), TRUE);
57    GST_PAD_SET_ACCEPT_INTERSECT (GST_BASE_PARSE_SINK_PAD (h264parse));
58    GST_PAD_SET_ACCEPT_TEMPLATE (GST_BASE_PARSE_SINK_PAD (h264parse));
59  }
60 @@ -1722,13 +1722,8 @@ gst_h264_parse_update_src_caps (GstH264Parse * h264parse, GstCaps * caps)
61      gint fps_num, fps_den;
62      gint par_n, par_d;
63  
64 -    if (sps->frame_cropping_flag) {
65 -      crop_width = sps->crop_rect_width;
66 -      crop_height = sps->crop_rect_height;
67 -    } else {
68 -      crop_width = sps->width;
69 -      crop_height = sps->height;
70 -    }
71 +    crop_width = (sps->crop_rect_width > sps->width)? sps->crop_rect_width: sps->width;
72 +    crop_height = (sps->crop_rect_height > sps->height)? sps->crop_rect_height: sps->height;
73  
74      if (G_UNLIKELY (h264parse->width != crop_width ||
75              h264parse->height != crop_height)) {
76 @@ -1762,7 +1757,7 @@ gst_h264_parse_update_src_caps (GstH264Parse * h264parse, GstCaps * caps)
77      }
78  
79      if (G_UNLIKELY (modified || h264parse->update_caps)) {
80 -      gint width, height;
81 +      gint width=0, height=0;
82        GstClockTime latency;
83  
84        const gchar *caps_mview_mode = NULL;
85 @@ -1774,16 +1769,13 @@ gst_h264_parse_update_src_caps (GstH264Parse * h264parse, GstCaps * caps)
86  
87        caps = gst_caps_copy (sink_caps);
88  
89 -      /* sps should give this but upstream overrides */
90        if (s && gst_structure_has_field (s, "width"))
91          gst_structure_get_int (s, "width", &width);
92 -      else
93 -        width = h264parse->width;
94 -
95 +      width = (width > h264parse->width)? width: h264parse->width;
96 +     
97        if (s && gst_structure_has_field (s, "height"))
98          gst_structure_get_int (s, "height", &height);
99 -      else
100 -        height = h264parse->height;
101 +      height = (height > h264parse->height)? height: h264parse->height;
102  
103        if (s == NULL ||
104            !gst_structure_get_fraction (s, "pixel-aspect-ratio", &par_n,
105 diff --git a/gst/videoparsers/gstmpeg4videoparse.c b/gst/videoparsers/gstmpeg4videoparse.c
106 index a1fd3b2..7912254 100644
107 --- a/gst/videoparsers/gstmpeg4videoparse.c
108 +++ b/gst/videoparsers/gstmpeg4videoparse.c
109 @@ -185,7 +185,7 @@ gst_mpeg4vparse_init (GstMpeg4VParse * parse)
110    parse->interval = DEFAULT_CONFIG_INTERVAL;
111    parse->last_report = GST_CLOCK_TIME_NONE;
112  
113 -  gst_base_parse_set_pts_interpolation (GST_BASE_PARSE (parse), FALSE);
114 +  gst_base_parse_set_pts_interpolation (GST_BASE_PARSE (parse), TRUE);
115    GST_PAD_SET_ACCEPT_INTERSECT (GST_BASE_PARSE_SINK_PAD (parse));
116    GST_PAD_SET_ACCEPT_TEMPLATE (GST_BASE_PARSE_SINK_PAD (parse));
117  }
118 diff --git a/gst/videoparsers/gstmpegvideoparse.c b/gst/videoparsers/gstmpegvideoparse.c
119 index bf71a3e..f203cca 100644
120 --- a/gst/videoparsers/gstmpegvideoparse.c
121 +++ b/gst/videoparsers/gstmpegvideoparse.c
122 @@ -175,7 +175,7 @@ gst_mpegv_parse_init (GstMpegvParse * parse)
123  {
124    parse->config_flags = FLAG_NONE;
125  
126 -  gst_base_parse_set_pts_interpolation (GST_BASE_PARSE (parse), FALSE);
127 +  gst_base_parse_set_pts_interpolation (GST_BASE_PARSE (parse), TRUE);
128    GST_PAD_SET_ACCEPT_INTERSECT (GST_BASE_PARSE_SINK_PAD (parse));
129    GST_PAD_SET_ACCEPT_TEMPLATE (GST_BASE_PARSE_SINK_PAD (parse));
130  }
131 diff --git a/gst/videoparsers/plugin.c b/gst/videoparsers/plugin.c
132 index 79d1df6..fb866b5 100644
133 --- a/gst/videoparsers/plugin.c
134 +++ b/gst/videoparsers/plugin.c
135 @@ -51,7 +51,7 @@ plugin_init (GstPlugin * plugin)
136    ret |= gst_element_register (plugin, "h265parse",
137        GST_RANK_SECONDARY, GST_TYPE_H265_PARSE);
138    ret |= gst_element_register (plugin, "vc1parse",
139 -      GST_RANK_NONE, GST_TYPE_VC1_PARSE);
140 +      GST_RANK_PRIMARY + 2, GST_TYPE_VC1_PARSE);
141  
142    return ret;
143  }
144 -- 
145 1.9.1
146