<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Sebastian, <br><br>So, I'm not sure precisely what's going on, but I think it might - maybe - have something to do with the fact that I'm using the MFX (Intel Media SDK) GStreamer modules, and that perhaps things aren't playing well together. Let me explain. I've got an example application that, all it does, is encode a static image of the scientist Richard Feynman to disk as an MP4 file (500 frames). I use it to kind of tinker and explore the various parts of the GStreamer pipeline. <br><br>I have found that if I set the output caps to NV12, the gst_buffer_map() call fails: <br><br><div>static GstStaticPadTemplate gst_feynman_template = GST_STATIC_PAD_TEMPLATE("src",</div><div><span style="white-space:pre"> </span>GST_PAD_SRC,</div><div><span style="white-space:pre"> </span>GST_PAD_ALWAYS,</div><div><span style="white-space:pre"> </span>GST_STATIC_CAPS(GST_VIDEO_CAPS_MAKE("{NV12}"))</div><div>);<br><br>If, on the other hand, I change this to AYUV, it works: <br><br><div>static GstStaticPadTemplate gst_feynman_template = GST_STATIC_PAD_TEMPLATE("src",</div><div><span style="white-space:pre"> </span>GST_PAD_SRC,</div><div><span style="white-space:pre"> </span>GST_PAD_ALWAYS,</div><div><span style="white-space:pre"> </span>GST_STATIC_CAPS(GST_VIDEO_CAPS_MAKE("{AYUV}"))</div><div>);</div><div><br></div><div>It doesn't matter what I actually send as this failure happens before I send anything at all. During the first invocation to fill the buffer, the gst_buffer_map call fails as I've indicated in previous emails if I specify NV12. As I'm writing this email out certain things are starting to becoming clearer, and I presume what's happening is that per the handshake between my source DLL and the downstream gstmfx.dll (and the x264 encoder therein) something is failing to initialize properly, thereby causing the GStreamer pipeline to fail to also initialize the GstBuffer for me properly. Specifically, the gstmfxenc_h264.c encoder is failing to handle NV12 properly (or me asking it to handle this format is failing on its side and therefore falling back to some standard GStreamer allocator/handler (I don't know the terminology well as I'm still learning)). <br><br>I know that the gstmfx encoder suite advertises that it supports these formats: <br><br><div># define GST_MFX_SUPPORTED_INPUT_FORMATS \</div><div> "{ NV12, YV12, I420, YUY2, P010_10LE, BGRA, BGRx }"<br><br>What tipped me off was inspecting the GstBuffer object in-memory, and seeing when I specified NV12, the GstBuffer->Pool->Object->name was "mfxvideobufferpool0", whereas if I specify AYUV, the name is "videobufferpool0". <br><br>So, does this appear to be a bug in the intel media encoder side of things? Or am I still not using something correctly? If it is a bug in the Intel side of things, do you have any advise on how to track it down? They've been pretty unhelpful so far regarding various other issues I've encountered using their stuff. <br><br>Here is the full source to my Feynman encoder: <br><br><div>#include <gst/gst.h></div><div>#include <gst/base/gstpushsrc.h></div><div>#include <gst/video/gstvideometa.h></div><div>#include <gst/video/gstvideopool.h></div><div><br></div><div>#include <Windows.h></div><div>#include <stdio.h></div><div><br></div><div>#define PACKAGE "gst_feynman"</div><div><br></div><div>//<a href="https://gstreamer.freedesktop.org/documentation/plugin-development/basics/boiler.html">https://gstreamer.freedesktop.org/documentation/plugin-development/basics/boiler.html</a></div><div>/* Definition of structure storing data for this element. */</div><div>typedef struct _GstFeynman</div><div>{</div><div><span style="white-space:pre"> </span>GstPushSrc element;</div><div><span style="white-space:pre"> </span>GstPad* sourcepad;</div><div><br></div><div><span style="white-space:pre"> </span>/* running time and frames for current caps */</div><div><span style="white-space:pre"> </span>GstClockTime running_time; /* total running time */</div><div><span style="white-space:pre"> </span>gint64 n_frames; /* total frames sent */</div><div><span style="white-space:pre"> </span>gboolean reverse;</div><div><br></div><div><span style="white-space:pre"> </span>/* previous caps running time and frames */</div><div><span style="white-space:pre"> </span>GstClockTime accum_rtime; /* accumulated running_time */</div><div><span style="white-space:pre"> </span>gint64 accum_frames; /* accumulated frames */</div><div><br></div><div><span style="white-space:pre"> </span>GstVideoInfo info; /* protected by the object or stream lock */</div><div><br></div><div><span style="white-space:pre"> </span> /* private */</div><div> /* FIXME 2.0: Change type to GstClockTime */</div><div><span style="white-space:pre"> </span>gint64 timestamp_offset; /* base offset */</div><div><br></div><div><span style="white-space:pre"> </span>gpointer* lines;</div><div><br></div><div><span style="white-space:pre"> </span>guint n_lines;</div><div><span style="white-space:pre"> </span>gint offset;</div><div>} GstFeynman;</div><div><br></div><div>/* Standard definition defining a class for this element. */</div><div>typedef struct _GstFeynmanClass</div><div>{</div><div><span style="white-space:pre"> </span>//<a href="https://github.com/GStreamer/gst-plugins-base/tree/master/gst/videotestsrc">https://github.com/GStreamer/gst-plugins-base/tree/master/gst/videotestsrc</a></div><div><span style="white-space:pre"> </span>//<a href="https://github.com/GStreamer/gst-plugins-base/blob/master/gst/videotestsrc/gstvideotestsrc.h">https://github.com/GStreamer/gst-plugins-base/blob/master/gst/videotestsrc/gstvideotestsrc.h</a></div><div><span style="white-space:pre"> </span>GstPushSrcClass parent_class;</div><div>} GstFeynmanClass;</div><div><br></div><div><br></div><div>/* Standard macros for defining types for this element. */</div><div>#define GST_FEYNMAN_TYPE (gst_feynman_get_type())</div><div>#define GST_FEYNMAN(obj) \</div><div> (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_FEYNMAN_TYPE,GstFeynman))</div><div>#define GST_FEYNMAN_CLASS(klass) \</div><div> (G_TYPE_CHECK_CLASS_CAST((klass),GST_FEYNMAN_TYPE,GstFeynmanClass))</div><div>#define GST_IS_FEYNMAN(obj) \</div><div> (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_FEYNMAN_TYPE))</div><div>#define GST_IS_FEYNMAN_CLASS(klass) \</div><div> (G_TYPE_CHECK_CLASS_TYPE((klass),GST_FEYNMAN_TYPE))</div><div><br></div><div>/* Standard function returning type information. */</div><div>GType gst_feynman_get_type(void);</div><div><br></div><div>#define gst_feynman_parent_class parent_class</div><div>G_DEFINE_TYPE(GstFeynman, gst_feynman, GST_TYPE_PUSH_SRC);</div><div><br></div><div>#define VTS_VIDEO_CAPS GST_VIDEO_CAPS_MAKE (GST_VIDEO_FORMATS_ALL) </div><div><br></div><div><br></div><div>static GstStaticPadTemplate gst_feynman_template = GST_STATIC_PAD_TEMPLATE("src",</div><div><span style="white-space:pre"> </span>GST_PAD_SRC,</div><div><span style="white-space:pre"> </span>GST_PAD_ALWAYS,</div><div><span style="white-space:pre"> </span>GST_STATIC_CAPS(GST_VIDEO_CAPS_MAKE("{AYUV}"))</div><div>);</div><div><br></div><div>static void gst_feynman_set_property(GObject* object, guint prop_id,</div><div><span style="white-space:pre"> </span>const GValue* value, GParamSpec* pspec);</div><div>static void gst_feynman_get_property(GObject* object, guint prop_id,</div><div><span style="white-space:pre"> </span>GValue* value, GParamSpec* pspec);</div><div>static GstFlowReturn</div><div>gst_feynman_src_fill(GstPushSrc* psrc, GstBuffer* buffer);</div><div>static gboolean gst_feynman_start(GstBaseSrc* basesrc);</div><div>static gboolean gst_feynman_stop(GstBaseSrc* basesrc);</div><div>static gboolean gst_feynman_set_caps(GstBaseSrc* bsrc, GstCaps* caps);</div><div>static gboolean gst_feynman_is_seekable(GstBaseSrc* src);</div><div>static GstCaps* gst_feynman_src_fixate(GstBaseSrc* bsrc, GstCaps* caps);</div><div><br></div><div>/* initialize the myfilter's class */</div><div>static void gst_feynman_class_init(GstFeynmanClass* klass)</div><div>{</div><div><span style="white-space:pre"> </span>// get the "object class". </div><div><span style="white-space:pre"> </span>GObjectClass* gobject_class = (GObjectClass*)klass;</div><div><span style="white-space:pre"> </span>GstElementClass* gstelement_class = (GstElementClass*)klass;</div><div><span style="white-space:pre"> </span>GstBaseSrcClass* gstbasesrc_class = (GstBaseSrcClass*)klass;</div><div><span style="white-space:pre"> </span>GstPushSrcClass* gstpushsrc_class = (GstPushSrcClass*)klass;</div><div><br></div><div><span style="white-space:pre"> </span>// set the getters and setters for properties. </div><div><span style="white-space:pre"> </span>gobject_class->set_property = gst_feynman_set_property;</div><div><span style="white-space:pre"> </span>gobject_class->get_property = gst_feynman_get_property;</div><div><br></div><div><span style="white-space:pre"> </span>gst_element_class_set_static_metadata(gstelement_class,</div><div><span style="white-space:pre"> </span>"Video test source", "Source/Video",</div><div><span style="white-space:pre"> </span>"Creates a test video stream", "David A. Schleef <<a href="mailto:ds@schleef.org">ds@schleef.org</a>>");</div><div><br></div><div><span style="white-space:pre"> </span>// assign the pad to this class. </div><div><span style="white-space:pre"> </span>gst_element_class_add_static_pad_template(gstelement_class,</div><div><span style="white-space:pre"> </span>&gst_feynman_template);</div><div><br></div><div><span style="white-space:pre"> </span>gstbasesrc_class->fixate = gst_feynman_src_fixate;</div><div><span style="white-space:pre"> </span>gstbasesrc_class->is_seekable = gst_feynman_is_seekable;</div><div><span style="white-space:pre"> </span>gstbasesrc_class->set_caps = gst_feynman_set_caps;</div><div><span style="white-space:pre"> </span>gstbasesrc_class->start = gst_feynman_start;</div><div><span style="white-space:pre"> </span>gstbasesrc_class->stop = gst_feynman_stop;</div><div><span style="white-space:pre"> </span>gstpushsrc_class->fill = gst_feynman_src_fill;</div><div>}</div><div><br></div><div>static GstCaps* gst_feynman_src_fixate(GstBaseSrc* bsrc, GstCaps* caps)</div><div>{</div><div><span style="white-space:pre"> </span>GstFeynman* src = GST_FEYNMAN(bsrc);</div><div><span style="white-space:pre"> </span>GstStructure* structure;</div><div><br></div><div><span style="white-space:pre"> </span>caps = gst_caps_make_writable(caps);</div><div><span style="white-space:pre"> </span>structure = gst_caps_get_structure(caps, 0);</div><div><br></div><div><span style="white-space:pre"> </span>gst_structure_fixate_field_nearest_int(structure, "width", 320);</div><div><span style="white-space:pre"> </span>gst_structure_fixate_field_nearest_int(structure, "height", 240);</div><div><br></div><div><span style="white-space:pre"> </span>if (gst_structure_has_field(structure, "framerate"))</div><div><span style="white-space:pre"> </span>gst_structure_fixate_field_nearest_fraction(structure, "framerate", 30, 1);</div><div><span style="white-space:pre"> </span>else</div><div><span style="white-space:pre"> </span>gst_structure_set(structure, "framerate", GST_TYPE_FRACTION, 30, 1, NULL);</div><div><br></div><div><span style="white-space:pre"> </span>if (gst_structure_has_field(structure, "pixel-aspect-ratio"))</div><div><span style="white-space:pre"> </span>gst_structure_fixate_field_nearest_fraction(structure,</div><div><span style="white-space:pre"> </span>"pixel-aspect-ratio", 1, 1);</div><div><span style="white-space:pre"> </span>else</div><div><span style="white-space:pre"> </span>gst_structure_set(structure, "pixel-aspect-ratio", GST_TYPE_FRACTION, 1, 1,</div><div><span style="white-space:pre"> </span>NULL);</div><div><br></div><div><span style="white-space:pre"> </span>if (gst_structure_has_field(structure, "colorimetry"))</div><div><span style="white-space:pre"> </span>gst_structure_fixate_field_string(structure, "colorimetry", "bt601");</div><div><span style="white-space:pre"> </span>if (gst_structure_has_field(structure, "chroma-site"))</div><div><span style="white-space:pre"> </span>gst_structure_fixate_field_string(structure, "chroma-site", "mpeg2");</div><div><br></div><div><span style="white-space:pre"> </span>if (gst_structure_has_field(structure, "interlace-mode"))</div><div><span style="white-space:pre"> </span>gst_structure_fixate_field_string(structure, "interlace-mode",</div><div><span style="white-space:pre"> </span>"progressive");</div><div><span style="white-space:pre"> </span>else</div><div><span style="white-space:pre"> </span>gst_structure_set(structure, "interlace-mode", G_TYPE_STRING,</div><div><span style="white-space:pre"> </span>"progressive", NULL);</div><div><br></div><div><span style="white-space:pre"> </span>if (gst_structure_has_field(structure, "multiview-mode"))</div><div><span style="white-space:pre"> </span>gst_structure_fixate_field_string(structure, "multiview-mode",</div><div><span style="white-space:pre"> </span>gst_video_multiview_mode_to_caps_string</div><div><span style="white-space:pre"> </span>(GST_VIDEO_MULTIVIEW_MODE_MONO));</div><div><span style="white-space:pre"> </span>else</div><div><span style="white-space:pre"> </span>gst_structure_set(structure, "multiview-mode", G_TYPE_STRING,</div><div><span style="white-space:pre"> </span>gst_video_multiview_mode_to_caps_string(GST_VIDEO_MULTIVIEW_MODE_MONO),</div><div><span style="white-space:pre"> </span>NULL);</div><div><br></div><div><span style="white-space:pre"> </span>caps = GST_BASE_SRC_CLASS(parent_class)->fixate(bsrc, caps);</div><div><br></div><div><span style="white-space:pre"> </span>return caps;</div><div>}</div><div><br></div><div><br></div><div>static gboolean gst_feynman_is_seekable(GstBaseSrc* psrc)</div><div>{</div><div><span style="white-space:pre"> </span>/* we're seekable... */</div><div><span style="white-space:pre"> </span>return FALSE;</div><div>}</div><div><br></div><div>static gboolean gst_feynman_set_caps(GstBaseSrc* bsrc, GstCaps* caps)</div><div>{</div><div><span style="white-space:pre"> </span>const GstStructure* structure;</div><div><span style="white-space:pre"> </span>GstFeynman* feynman;</div><div><span style="white-space:pre"> </span>GstVideoInfo info;</div><div><span style="white-space:pre"> </span>guint i;</div><div><span style="white-space:pre"> </span>guint n_lines = 1;</div><div><span style="white-space:pre"> </span>gint offset = 0;</div><div><br></div><div><span style="white-space:pre"> </span>feynman = GST_FEYNMAN(bsrc);</div><div><br></div><div><span style="white-space:pre"> </span>structure = gst_caps_get_structure(caps, 0);</div><div><br></div><div><span style="white-space:pre"> </span>GST_OBJECT_LOCK(feynman);</div><div><br></div><div><span style="white-space:pre"> </span>gst_video_info_from_caps(&info, caps);</div><div><br></div><div><span style="white-space:pre"> </span>//info.width = 320; </div><div><span style="white-space:pre"> </span>//info.height = 240; </div><div><span style="white-space:pre"> </span>//info.fps_n = 30; </div><div><span style="white-space:pre"> </span>//info.fps_d = 1; </div><div><br></div><div><span style="white-space:pre"> </span>feynman->lines = (gpointer*)g_malloc(sizeof(gpointer) * n_lines);</div><div><span style="white-space:pre"> </span>for (i = 0; i < n_lines; i++)</div><div><span style="white-space:pre"> </span>feynman->lines[i] = g_malloc((info.width + 16) * 8);</div><div><span style="white-space:pre"> </span>feynman->n_lines = n_lines;</div><div><span style="white-space:pre"> </span>feynman->offset = offset;</div><div><br></div><div><span style="white-space:pre"> </span>/* looks ok here */</div><div><span style="white-space:pre"> </span>feynman->info = info;</div><div><br></div><div><span style="white-space:pre"> </span>GST_OBJECT_UNLOCK(feynman);</div><div><br></div><div><span style="white-space:pre"> </span>return TRUE;</div><div>}</div><div><br></div><div>static gboolean gst_feynman_stop(GstBaseSrc * basesrc)</div><div>{</div><div><span style="white-space:pre"> </span>return TRUE;</div><div>}</div><div><br></div><div>static gboolean gst_feynman_start(GstBaseSrc * basesrc)</div><div>{</div><div><span style="white-space:pre"> </span>GstFeynman* src = GST_FEYNMAN(basesrc);</div><div><br></div><div><span style="white-space:pre"> </span>GST_OBJECT_LOCK(src);</div><div><span style="white-space:pre"> </span>src->running_time = 0;</div><div><span style="white-space:pre"> </span>src->n_frames = 0;</div><div><span style="white-space:pre"> </span>src->accum_frames = 0;</div><div><span style="white-space:pre"> </span>src->accum_rtime = 0;</div><div><br></div><div><span style="white-space:pre"> </span>gst_video_info_init(&src->info);</div><div><span style="white-space:pre"> </span>GST_OBJECT_UNLOCK(src);</div><div><br></div><div><span style="white-space:pre"> </span>return TRUE;</div><div>}</div><div><br></div><div>static void gst_feynman_init(GstFeynman * src)</div><div>{</div><div><span style="white-space:pre"> </span>OutputDebugStringA("Feynman: gst_feynman_init called.");</div><div><br></div><div><span style="white-space:pre"> </span>gst_base_src_set_format(GST_BASE_SRC(src), GST_FORMAT_TIME);</div><div><span style="white-space:pre"> </span>gst_base_src_set_live(GST_BASE_SRC(src), 1);</div><div><br></div><div><span style="white-space:pre"> </span>return;</div><div>}</div><div><br></div><div>static gboolean plugin_init(GstPlugin * plugin)</div><div>{</div><div><span style="white-space:pre"> </span>OutputDebugStringA("Feynman: plugin_init called.");</div><div><br></div><div><span style="white-space:pre"> </span>return gst_element_register(plugin, "gstfeynman",</div><div><span style="white-space:pre"> </span>GST_RANK_NONE, GST_FEYNMAN_TYPE);</div><div>}</div><div><br></div><div>static gboolean gst_feynman_query(GstBaseSrc * bsrc, GstQuery * query)</div><div>{</div><div><span style="white-space:pre"> </span>return GST_BASE_SRC_CLASS(parent_class)->query(bsrc, query);</div><div>}</div><div><br></div><div>static void gst_feynman_set_property(GObject * object, guint prop_id,</div><div><span style="white-space:pre"> </span>const GValue * value, GParamSpec * pspec)</div><div>{</div><div><span style="white-space:pre"> </span>return;</div><div>}</div><div><br></div><div>static void gst_feynman_get_property(GObject * object, guint prop_id,</div><div><span style="white-space:pre"> </span>GValue * value, GParamSpec * pspec)</div><div>{</div><div><span style="white-space:pre"> </span>return;</div><div>}</div><div><br></div><div><br></div><div>#define CLIP(X) ( (X) > 255 ? 255 : (X) < 0 ? 0 : X)</div><div><br></div><div>// RGB -> YUV</div><div>#define RGB2Y(R, G, B) CLIP(( ( 66 * (R) + 129 * (G) + 25 * (B) + 128) >> 8) + 16)</div><div>#define RGB2U(R, G, B) CLIP(( ( -38 * (R) - 74 * (G) + 112 * (B) + 128) >> 8) + 128)</div><div>#define RGB2V(R, G, B) CLIP(( ( 112 * (R) - 94 * (G) - 18 * (B) + 128) >> 8) + 128)</div><div><br></div><div>static GstFlowReturn gst_feynman_src_fill(GstPushSrc * psrc,</div><div><span style="white-space:pre"> </span>GstBuffer * buffer)</div><div>{</div><div><span style="white-space:pre"> </span>GstFeynman* src;</div><div><span style="white-space:pre"> </span>GstClockTime next_time;</div><div><span style="white-space:pre"> </span>GstVideoFrame frame;</div><div><span style="white-space:pre"> </span>gconstpointer pal;</div><div><span style="white-space:pre"> </span>gsize palsize;</div><div><br></div><div><span style="white-space:pre"> </span>src = GST_FEYNMAN(psrc);</div><div><br></div><div><span style="white-space:pre"> </span>printf(".");</div><div><br></div><div><span style="white-space:pre"> </span>if (G_UNLIKELY(GST_VIDEO_INFO_FORMAT(&src->info) ==</div><div><span style="white-space:pre"> </span>GST_VIDEO_FORMAT_UNKNOWN))</div><div><span style="white-space:pre"> </span>goto not_negotiated;</div><div><br></div><div><span style="white-space:pre"> </span>/* 0 framerate and we are at the second frame, eos */</div><div><span style="white-space:pre"> </span>if (G_UNLIKELY(src->info.fps_n == 0 && src->n_frames == 1))</div><div><span style="white-space:pre"> </span>goto eos;</div><div><br></div><div><span style="white-space:pre"> </span>if (G_UNLIKELY(src->n_frames == -1)) {</div><div><span style="white-space:pre"> </span>/* EOS for reverse playback */</div><div><span style="white-space:pre"> </span>goto eos;</div><div><span style="white-space:pre"> </span>}</div><div><br></div><div><span style="white-space:pre"> </span>GST_LOG_OBJECT(src,</div><div><span style="white-space:pre"> </span>"creating buffer from pool for frame %" G_GINT64_FORMAT, src->n_frames);</div><div><br></div><div><span style="white-space:pre"> </span>GST_BUFFER_PTS(buffer) =</div><div><span style="white-space:pre"> </span>src->accum_rtime + src->timestamp_offset + src->running_time;</div><div><span style="white-space:pre"> </span>GST_BUFFER_DTS(buffer) = GST_CLOCK_TIME_NONE;</div><div><br></div><div><span style="white-space:pre"> </span>gst_object_sync_values(GST_OBJECT(psrc), GST_BUFFER_PTS(buffer));</div><div><br></div><div><span style="white-space:pre"> </span>///////////////////////// SHOW FEYNMAN 1////////////////////////////////////</div><div><span style="white-space:pre"> </span>//if (!gst_video_frame_map(&frame, &src->info, buffer, GST_MAP_WRITE))</div><div><span style="white-space:pre"> </span>//<span style="white-space:pre"> </span>goto invalid_frame;</div><div><br></div><div><span style="white-space:pre"> </span>//FILE* f = fopen("feynman.dat", "rb+");</div><div><span style="white-space:pre"> </span>//int* line = (int*)malloc(frame.info.width * 4);</div><div><span style="white-space:pre"> </span>//unsigned char lineBuffer[320 * 3]; </div><div><span style="white-space:pre"> </span>//for (int j = 0; j < frame.info.height; j++)</div><div><span style="white-space:pre"> </span>//{</div><div><span style="white-space:pre"> </span>//<span style="white-space:pre"> </span>fread(lineBuffer, 1, sizeof(lineBuffer), f);</div><div><br></div><div><span style="white-space:pre"> </span>//<span style="white-space:pre"> </span>for (int i = 0; i < frame.info.width; i++)</div><div><span style="white-space:pre"> </span>//<span style="white-space:pre"> </span>{</div><div><span style="white-space:pre"> </span>//<span style="white-space:pre"> </span>int b = lineBuffer[i * 3];</div><div><span style="white-space:pre"> </span>//<span style="white-space:pre"> </span>int g = lineBuffer[i * 3 + 1];</div><div><span style="white-space:pre"> </span>//<span style="white-space:pre"> </span>int r = lineBuffer[i * 3 + 2];</div><div><br></div><div><span style="white-space:pre"> </span>//<span style="white-space:pre"> </span>int Y = r * .299000 + g * .587000 + b * .114000; </div><div><span style="white-space:pre"> </span>//<span style="white-space:pre"> </span>int U = r * -.168736 + g * -.331264 + b * .500000 + 128;</div><div><span style="white-space:pre"> </span>//<span style="white-space:pre"> </span>int V = r * .500000 + g * -.418688 + b * -.081312 + 128; </div><div><br></div><div><span style="white-space:pre"> </span>//<span style="white-space:pre"> </span>int value = (0 << 0) | (Y << 8) | (U << 16) | ((guint32) V << 24);</div><div><br></div><div><span style="white-space:pre"> </span>//<span style="white-space:pre"> </span>line[i] = value; </div><div><span style="white-space:pre"> </span>//<span style="white-space:pre"> </span>}</div><div><br></div><div><span style="white-space:pre"> </span>//<span style="white-space:pre"> </span>frame.info.finfo->pack_func(frame.info.finfo,</div><div><span style="white-space:pre"> </span>//<span style="white-space:pre"> </span>GST_VIDEO_PACK_FLAG_NONE, line, 0, frame.data, frame.info.stride,</div><div><span style="white-space:pre"> </span>//<span style="white-space:pre"> </span>frame.info.chroma_site, j, frame.info.width);</div><div><span style="white-space:pre"> </span>//}</div><div><span style="white-space:pre"> </span>//free(line);</div><div><span style="white-space:pre"> </span>//fclose(f);</div><div><br></div><div><span style="white-space:pre"> </span>//if ((pal = gst_video_format_get_palette(GST_VIDEO_FRAME_FORMAT(&frame),</div><div><span style="white-space:pre"> </span>//<span style="white-space:pre"> </span>&palsize))) {</div><div><span style="white-space:pre"> </span>//<span style="white-space:pre"> </span>memcpy(GST_VIDEO_FRAME_PLANE_DATA(&frame, 1), pal, palsize);</div><div><span style="white-space:pre"> </span>//}</div><div><br></div><div><span style="white-space:pre"> </span>//gst_video_frame_unmap(&frame);</div><div><span style="white-space:pre"> </span>/////////////////////////////////////////////////////////////////////////</div><div><br></div><div><span style="white-space:pre"> </span>////////////////////////////SHOW FEYNMAN 2//////////////////////////////</div><div><span style="white-space:pre"> </span>FILE* f = fopen("feynman.yuv", "rb+");</div><div><span style="white-space:pre"> </span>fseek(f, 0, SEEK_END); </div><div><span style="white-space:pre"> </span>int length = ftell(f); </div><div><span style="white-space:pre"> </span>fseek(f, 0, SEEK_SET); </div><div><span style="white-space:pre"> </span>GstMapInfo info;</div><div><span style="white-space:pre"> </span>gst_buffer_map(buffer, &info, GST_MAP_WRITE);</div><div><span style="white-space:pre"> </span>char* buff = (char*)malloc(length);</div><div><span style="white-space:pre"> </span>fread(buff, 1, length, f);</div><div><span style="white-space:pre"> </span>memcpy(info.data, buff, length);</div><div><span style="white-space:pre"> </span>gst_buffer_unmap(buffer, &info);</div><div><span style="white-space:pre"> </span>fclose(f);</div><div><span style="white-space:pre"> </span>///////////////////////////////////////////////////////////////////////</div><div><br></div><div><br></div><div><span style="white-space:pre"> </span>// the data becomes planar when it is sent downstream. </div><div><span style="white-space:pre"> </span>//GstMapInfo info; </div><div><span style="white-space:pre"> </span>//gst_buffer_map(buffer, &info, GST_MAP_READ);</div><div><span style="white-space:pre"> </span>//FILE* fout = fopen("feynman.yuv", "wb+");</div><div><span style="white-space:pre"> </span>//fwrite(info.data, 1, info.size, fout);</div><div><span style="white-space:pre"> </span>//fclose(fout);</div><div><span style="white-space:pre"> </span>//gst_buffer_unmap(buffer, &info); </div><div><br></div><div><span style="white-space:pre"> </span>GST_DEBUG_OBJECT(src, "Timestamp: %" GST_TIME_FORMAT " = accumulated %"</div><div><span style="white-space:pre"> </span>GST_TIME_FORMAT " + offset: %"</div><div><span style="white-space:pre"> </span>GST_TIME_FORMAT " + running time: %" GST_TIME_FORMAT,</div><div><span style="white-space:pre"> </span>GST_TIME_ARGS(GST_BUFFER_PTS(buffer)), GST_TIME_ARGS(src->accum_rtime),</div><div><span style="white-space:pre"> </span>GST_TIME_ARGS(src->timestamp_offset), GST_TIME_ARGS(src->running_time));</div><div><br></div><div><span style="white-space:pre"> </span>GST_BUFFER_OFFSET(buffer) = src->accum_frames + src->n_frames;</div><div><span style="white-space:pre"> </span>if (src->reverse) {</div><div><span style="white-space:pre"> </span>src->n_frames--;</div><div><span style="white-space:pre"> </span>}</div><div><span style="white-space:pre"> </span>else {</div><div><span style="white-space:pre"> </span>src->n_frames++;</div><div><span style="white-space:pre"> </span>}</div><div><span style="white-space:pre"> </span>GST_BUFFER_OFFSET_END(buffer) = GST_BUFFER_OFFSET(buffer) + 1;</div><div><span style="white-space:pre"> </span>if (src->info.fps_n) {</div><div><span style="white-space:pre"> </span>next_time = gst_util_uint64_scale(src->n_frames,</div><div><span style="white-space:pre"> </span>src->info.fps_d * GST_SECOND, src->info.fps_n);</div><div><span style="white-space:pre"> </span>if (src->reverse) {</div><div><span style="white-space:pre"> </span>GST_BUFFER_DURATION(buffer) = src->running_time - next_time;</div><div><span style="white-space:pre"> </span>}</div><div><span style="white-space:pre"> </span>else {</div><div><span style="white-space:pre"> </span>GST_BUFFER_DURATION(buffer) = next_time - src->running_time;</div><div><span style="white-space:pre"> </span>}</div><div><span style="white-space:pre"> </span>}</div><div><span style="white-space:pre"> </span>else {</div><div><span style="white-space:pre"> </span>next_time = src->timestamp_offset;</div><div><span style="white-space:pre"> </span>/* NONE means forever */</div><div><span style="white-space:pre"> </span>GST_BUFFER_DURATION(buffer) = GST_CLOCK_TIME_NONE;</div><div><span style="white-space:pre"> </span>}</div><div><br></div><div><span style="white-space:pre"> </span>src->running_time = next_time;</div><div><br></div><div><span style="white-space:pre"> </span>return GST_FLOW_OK;</div><div><br></div><div>not_negotiated:</div><div><span style="white-space:pre"> </span>{</div><div><span style="white-space:pre"> </span>return GST_FLOW_NOT_NEGOTIATED;</div><div><span style="white-space:pre"> </span>}</div><div>eos:</div><div><span style="white-space:pre"> </span>{</div><div><span style="white-space:pre"> </span>GST_DEBUG_OBJECT(src, "eos: 0 framerate, frame %d", (gint)src->n_frames);</div><div><span style="white-space:pre"> </span>return GST_FLOW_EOS;</div><div><span style="white-space:pre"> </span>}</div><div>invalid_frame:</div><div><span style="white-space:pre"> </span>{</div><div><span style="white-space:pre"> </span>GST_DEBUG_OBJECT(src, "invalid frame");</div><div><span style="white-space:pre"> </span>return GST_FLOW_OK;</div><div><span style="white-space:pre"> </span>}</div><div>}</div><div><br></div><div>GST_PLUGIN_DEFINE(</div><div><span style="white-space:pre"> </span>GST_VERSION_MAJOR,</div><div><span style="white-space:pre"> </span>GST_VERSION_MINOR,</div><div><span style="white-space:pre"> </span>feynman,</div><div><span style="white-space:pre"> </span>"feynman",</div><div><span style="white-space:pre"> </span>plugin_init,</div><div><span style="white-space:pre"> </span>".1",</div><div><span style="white-space:pre"> </span>"LGPL",</div><div><span style="white-space:pre"> </span>"gst_feynman",</div><div><span style="white-space:pre"> </span>"<a href="http://gstreamer.net/">http://gstreamer.net/</a>"</div><div>)</div></div></div><br></div></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Apr 29, 2019 at 5:31 AM Ben Rush <<a href="mailto:ben@ben-rush.net">ben@ben-rush.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto">Yes, and I believe I have possibly narrowed it down. I should be able to provide a self-contained example as well as even a cause for it sometime today. <div dir="auto"><br></div><div dir="auto">Thank you for your response. </div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Apr 29, 2019, 01:29 Sebastian Dröge <<a href="mailto:sebastian@centricular.com" target="_blank">sebastian@centricular.com</a> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Sun, 2019-04-28 at 10:23 -0500, Ben Rush wrote:<br>
> Just to be clear, I'm seeing examples of others doing what I want to<br>
> do. That is, write directly to the GstBuffer as a GstPushSrc.<br>
> Examples include: <br>
> <br>
> <a href="https://github.com/GStreamer/gst-plugins-bad/blob/master/gst/frei0r/gstfrei0rsrc.c" rel="noreferrer noreferrer" target="_blank">https://github.com/GStreamer/gst-plugins-bad/blob/master/gst/frei0r/gstfrei0rsrc.c</a> (between lines 96 to<br>
> 106)<br>
> <a href="https://gitlab.collabora.com/gkiagia/gst-plugins-bad/blob/8cdfb13658a069cf8c45a3265bf865849d3dc8e9/ext/neon/gstneonhttpsrc.c" rel="noreferrer noreferrer" target="_blank">https://gitlab.collabora.com/gkiagia/gst-plugins-bad/blob/8cdfb13658a069cf8c45a3265bf865849d3dc8e9/ext/neon/gstneonhttpsrc.c</a> (between lines 955 to<br>
> 995)<br>
> <br>
> Among others. So, I don't feel like what I'm doing is strange or out<br>
> of the ordinary. It's just that the map function call fails (returns<br>
> false) and gives me a null buffer to write to when I try to open it<br>
> with GST_MAP_WRITE. It succeeds when I try to open it with<br>
> GST_MAP_READ, but that makes no sense when I'm trying to WRITE to the<br>
> buffer. <br>
<br>
Can you provide a standalone testcase for this so we have an idea what<br>
your code is doing exactly and a way to reproduce it?<br>
<br>
As you say yourself, it's rather useless to have a non-writable buffer<br>
inside fill() and that definitely shouldn't happen.<br>
<br>
-- <br>
Sebastian Dröge, Centricular Ltd · <a href="https://www.centricular.com" rel="noreferrer noreferrer" target="_blank">https://www.centricular.com</a><br>
<br>
_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org" rel="noreferrer" target="_blank">gstreamer-devel@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" rel="noreferrer noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a></blockquote></div>
</blockquote></div>