mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-20 23:36:38 +00:00
examples: make snapshot example actually compile and work
https://bugzilla.gnome.org/show_bug.cgi?id=684063
This commit is contained in:
parent
5e0dfec62c
commit
06777095e8
1 changed files with 4 additions and 2 deletions
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#define CAPS "video/x-raw,format=RGB24,width=160,pixel-aspect-ratio=1/1"
|
#define CAPS "video/x-raw,format=RGB,width=160,pixel-aspect-ratio=1/1"
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char *argv[])
|
main (int argc, char *argv[])
|
||||||
|
@ -108,6 +108,7 @@ main (int argc, char *argv[])
|
||||||
/* if we have a buffer now, convert it to a pixbuf. It's possible that we
|
/* if we have a buffer now, convert it to a pixbuf. It's possible that we
|
||||||
* don't have a buffer because we went EOS right away or had an error. */
|
* don't have a buffer because we went EOS right away or had an error. */
|
||||||
if (sample) {
|
if (sample) {
|
||||||
|
GstBuffer *buffer;
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
GstStructure *s;
|
GstStructure *s;
|
||||||
|
|
||||||
|
@ -115,7 +116,7 @@ main (int argc, char *argv[])
|
||||||
* that it can only be an rgb buffer. The only thing we have not specified
|
* that it can only be an rgb buffer. The only thing we have not specified
|
||||||
* on the caps is the height, which is dependant on the pixel-aspect-ratio
|
* on the caps is the height, which is dependant on the pixel-aspect-ratio
|
||||||
* of the source material */
|
* of the source material */
|
||||||
sample_caps = gst_sample_get_caps (sample);
|
caps = gst_sample_get_caps (sample);
|
||||||
if (!caps) {
|
if (!caps) {
|
||||||
g_print ("could not get snapshot format\n");
|
g_print ("could not get snapshot format\n");
|
||||||
exit (-1);
|
exit (-1);
|
||||||
|
@ -132,6 +133,7 @@ main (int argc, char *argv[])
|
||||||
|
|
||||||
/* create pixmap from buffer and save, gstreamer video buffers have a stride
|
/* create pixmap from buffer and save, gstreamer video buffers have a stride
|
||||||
* that is rounded up to the nearest multiple of 4 */
|
* that is rounded up to the nearest multiple of 4 */
|
||||||
|
buffer = gst_sample_get_buffer (sample);
|
||||||
gst_buffer_map (buffer, &map, GST_MAP_READ);
|
gst_buffer_map (buffer, &map, GST_MAP_READ);
|
||||||
pixbuf = gdk_pixbuf_new_from_data (map.data,
|
pixbuf = gdk_pixbuf_new_from_data (map.data,
|
||||||
GDK_COLORSPACE_RGB, FALSE, 8, width, height,
|
GDK_COLORSPACE_RGB, FALSE, 8, width, height,
|
||||||
|
|
Loading…
Reference in a new issue