<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p><font face="DejaVu Sans">You can get the caps from the sample,
        which have the width and height. Python example:</font></p>
    <p><font face="monospace">caps = sample.get_caps()<br>
        width = caps.get_structure(0).get_value("width")<br>
      </font><font face="monospace">height =
        caps.get_structure(0).get_value("height")</font><br>
    </p>
    <p><font face="DejaVu Sans">Just a guess: the 1088 pixel height
        might be because it comes from a source that only deals with
        16x16 pixel blocks? <a moz-do-not-send="true"
href="https://stackoverflow.com/questions/9259044/h264-stream-incorrect-height-8-pixels-taller"
          class="moz-txt-link-freetext">https://stackoverflow.com/questions/9259044/h264-stream-incorrect-height-8-pixels-taller</a></font></p>
    <p><font face="DejaVu Sans">Cheers,<br>
        Michiel<br>
      </font></p>
    <div class="moz-cite-prefix">On 26-09-2022 18:16, Dwight Kulkarni
      via gstreamer-devel wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAKW2B8j2EH3caf8_BNsXm-JqKAY36u8BDawfgzGQvC87JSQGyA@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">Hi all,
        <div><br>
        </div>
        <div>Have a gstreamer pipeline with: </div>
        <div>v4l2src device=/dev/video3 ! video x-raw, width-1920,
          height=1080, framerate=15/1 !  ...</div>
        <div><br>
        </div>
        <div>This terminates in an appsink called jpegsink.</div>
        <div><br>
        </div>
        <div>I am accessing the new sample like so:</div>
        <div>g_signal_connect(G_OBJECT(jpegsink),"new-sample",G_CALLBACK(new_sample_jpeg),NULL);</div>
        <div><br>
        </div>
        <div>In the new_sample_jpeg(...)  function I access the sample,
          segment, and buffer like so:</div>
        <div><br>
        </div>
        <div>GstSample* sample =
          gst_app_sink_pull_sample(GST_APP_SINK(sink));</div>
        <div>GstSegment* currsegment = gst_sample_get_segment(sample);</div>
        <div>GstBuffer* buffer = gst_sample_get_buffer(sample).</div>
        <div>GstMapInfo map;</div>
        <div>gst_buffer_map(buffer,&map,GST_MAP_READ);</div>
        <div><br>
        </div>
        <div>unsigned char* img = new unsigned char[map.size]</div>
        <div><br>
        </div>
        <div>My question is how do I get the size of the image in width
          and height from the GstSample. The size property of map given
          is the length of the array data but not the actual image size.
          When I saved the image data to file, the size of the image is
          showing 1920 x 1088 even though in the pipeline it is
          specified at 1920 x 1080. </div>
        <div><br>
        </div>
        <div><br clear="all">
          <div><br>
          </div>
          -- <br>
          <div dir="ltr" class="gmail_signature"
            data-smartmail="gmail_signature">
            <div dir="ltr">
              <div>
                <div dir="ltr">
                  <div dir="ltr">
                    <div dir="ltr"><span style="font-size:12.8px">Sincerely,</span>
                      <div><br>
                      </div>
                      <div>Dwight Kulkarni    <br>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>