Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor fixes across the code #47

Merged
merged 3 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ gst_web_codecs_video_decoder_on_output (val video_frame)
frame = gst_video_decoder_get_oldest_frame (GST_VIDEO_DECODER (self));
GST_DEBUG_OBJECT (self,
"queued frame %" GST_TIME_FORMAT " decoded frame %" GST_TIME_FORMAT,
GST_TIME_ARGS (GST_TIME_AS_MSECONDS (frame->pts)),
GST_TIME_ARGS (video_frame["timestamp"].as<int> ()));
GST_TIME_ARGS (frame->pts),
GST_TIME_ARGS (GST_MSECOND * video_frame["timestamp"].as<int> ()));

/* Configure the output */
if (!self->output_state) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ enum
PROP_LAST
};

#define GST_CAT_DEFAULT gst_web_canvas_sink_debug_category
GST_DEBUG_CATEGORY_STATIC (gst_web_canvas_sink_debug_category);

#define gst_web_canvas_sink_parent_class parent_class
G_DEFINE_TYPE (GstWebCanvasSink, gst_web_canvas_sink, GST_TYPE_VIDEO_SINK);

Expand Down Expand Up @@ -167,7 +170,6 @@ gst_web_canvas_sink_setup (gpointer data)
{
GstWebCanvasSinkSetupData *setup_data = (GstWebCanvasSinkSetupData *) data;
GstWebCanvasSink *self = setup_data->self;
GstVideoSink *sink = GST_VIDEO_SINK (self);

/* FIXME how to handle the case of multiple canvases? */
self->val_canvas = val::module_property ("canvas");
Expand All @@ -185,6 +187,9 @@ gst_web_canvas_sink_show_frame (GstVideoSink *sink, GstBuffer *buf)
GstCapsFeatures *features;
GstCaps *caps;

GST_DEBUG_OBJECT (self, "show frame, pts = %" GST_TIME_FORMAT,
GST_TIME_ARGS (GST_BUFFER_PTS (buf)));

/* Check the format */
caps = gst_pad_get_current_caps (GST_BASE_SINK (sink)->sinkpad);
features = gst_caps_get_features (caps, 0);
Expand All @@ -203,6 +208,8 @@ gst_web_canvas_sink_show_frame (GstVideoSink *sink, GstBuffer *buf)
gst_web_runner_send_message (runner, cb, &data);
gst_object_unref (GST_OBJECT (runner));

GST_DEBUG_OBJECT (self, "show frame done, pts = %" GST_TIME_FORMAT,
GST_TIME_ARGS (GST_BUFFER_PTS (buf)));
return GST_FLOW_OK;
}

Expand Down Expand Up @@ -360,4 +367,7 @@ gst_web_canvas_sink_class_init (GstWebCanvasSinkClass *klass)
videosink_class->set_info = gst_web_canvas_sink_set_info;

gobject_class->finalize = gst_web_canvas_sink_finalize;

GST_DEBUG_CATEGORY_INIT (gst_web_canvas_sink_debug_category, "webcanvassink",
0, "Web Canvas Sink");
}
34 changes: 17 additions & 17 deletions gst.wasm/subprojects/gst-plugins-web/gst/web/gstwebfetchsrc.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ enum
PROP_MAX
};

typedef struct _WebFetchSrc
typedef struct _GstWebFetchSrc
{
GstPushSrc element;

Expand All @@ -57,11 +57,11 @@ typedef struct _WebFetchSrc
gsize download_offset;
gsize download_end;
gsize resource_size;
} WebFetchSrc;
} GstWebFetchSrc;

G_DECLARE_FINAL_TYPE (
WebFetchSrc, gst_web_fetch_src, GST, WEB_FETCH_SRC, GstPushSrc)
G_DEFINE_TYPE_WITH_CODE (WebFetchSrc, gst_web_fetch_src, GST_TYPE_PUSH_SRC,
GstWebFetchSrc, gst_web_fetch_src, GST, WEB_FETCH_SRC, GstPushSrc)
G_DEFINE_TYPE_WITH_CODE (GstWebFetchSrc, gst_web_fetch_src, GST_TYPE_PUSH_SRC,
G_IMPLEMENT_INTERFACE (
GST_TYPE_URI_HANDLER, gst_web_fetch_src_uri_handler_init));
GST_ELEMENT_REGISTER_DEFINE (
Expand All @@ -86,7 +86,7 @@ static gboolean
gst_web_fetch_src_urihandler_set_uri (
GstURIHandler *handler, const gchar *uri, GError **error)
{
WebFetchSrc *self = GST_WEB_FETCH_SRC (handler);
GstWebFetchSrc *self = GST_WEB_FETCH_SRC (handler);

g_return_val_if_fail (GST_IS_URI_HANDLER (handler), FALSE);
g_return_val_if_fail (uri != NULL, FALSE);
Expand All @@ -109,7 +109,7 @@ static gchar *
gst_web_fetch_src_urihandler_get_uri (GstURIHandler *handler)
{
gchar *ret;
WebFetchSrc *self;
GstWebFetchSrc *self;

g_return_val_if_fail (GST_IS_URI_HANDLER (handler), NULL);
self = GST_WEB_FETCH_SRC (handler);
Expand All @@ -133,13 +133,13 @@ gst_web_fetch_src_uri_handler_init (gpointer g_iface, gpointer iface_data)
}

static void
gst_web_fetch_src_init (WebFetchSrc *src)
gst_web_fetch_src_init (GstWebFetchSrc *src)
{
}

static gsize
gst_web_fetch_src_parse_content_size_field (
WebFetchSrc *self, emscripten_fetch_t *fetch)
GstWebFetchSrc *self, emscripten_fetch_t *fetch)
{
gsize length, ret = 0;

Expand Down Expand Up @@ -188,7 +188,7 @@ gst_web_fetch_src_parse_content_size_field (
/* Called with the GST_OBJECT_LOCK taken */
static GstBuffer *
gst_web_fetch_src_fetch_range (
WebFetchSrc *self, gchar *uri, gsize range_start, gsize range_end)
GstWebFetchSrc *self, gchar *uri, gsize range_start, gsize range_end)
{
gchar range_field[256];
gchar *headers[] = { "Range", range_field, NULL };
Expand Down Expand Up @@ -302,7 +302,7 @@ gst_web_fetch_src_fetch_range (
static GstFlowReturn
gst_web_fetch_src_create (GstPushSrc *psrc, GstBuffer **outbuf)
{
WebFetchSrc *self = GST_WEB_FETCH_SRC (psrc);
GstWebFetchSrc *self = GST_WEB_FETCH_SRC (psrc);
GstFlowReturn ret = GST_FLOW_OK;
gchar *uri;

Expand Down Expand Up @@ -337,7 +337,7 @@ static GstStateChangeReturn
gst_web_fetch_src_change_state (GstElement *element, GstStateChange transition)
{
GstStateChangeReturn ret;
WebFetchSrc *self = GST_WEB_FETCH_SRC (element);
GstWebFetchSrc *self = GST_WEB_FETCH_SRC (element);

switch (transition) {
case GST_STATE_CHANGE_READY_TO_PAUSED:
Expand Down Expand Up @@ -372,7 +372,7 @@ gst_web_fetch_src_change_state (GstElement *element, GstStateChange transition)
static gboolean
gst_web_fetch_src_get_size (GstBaseSrc *bsrc, guint64 *size)
{
WebFetchSrc *self = GST_WEB_FETCH_SRC (bsrc);
GstWebFetchSrc *self = GST_WEB_FETCH_SRC (bsrc);
gboolean ret = FALSE;

GST_OBJECT_LOCK (self);
Expand All @@ -397,7 +397,7 @@ gst_web_fetch_src_is_seekable (GstBaseSrc *bsrc)
static gboolean
gst_web_fetch_src_do_seek (GstBaseSrc *bsrc, GstSegment *segment)
{
WebFetchSrc *self = GST_WEB_FETCH_SRC (bsrc);
GstWebFetchSrc *self = GST_WEB_FETCH_SRC (bsrc);

g_return_val_if_fail (gst_web_fetch_src_is_seekable (bsrc), FALSE);
g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (segment->start), FALSE);
Expand All @@ -420,7 +420,7 @@ static void
gst_web_fetch_src_set_property (
GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
{
WebFetchSrc *self = GST_WEB_FETCH_SRC (object);
GstWebFetchSrc *self = GST_WEB_FETCH_SRC (object);

switch (prop_id) {
case PROP_LOCATION:
Expand All @@ -437,7 +437,7 @@ static void
gst_web_fetch_src_get_property (
GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
{
WebFetchSrc *self = GST_WEB_FETCH_SRC (object);
GstWebFetchSrc *self = GST_WEB_FETCH_SRC (object);

switch (prop_id) {
case PROP_LOCATION:
Expand All @@ -453,15 +453,15 @@ gst_web_fetch_src_get_property (
static void
gst_web_fetch_src_finalize (GObject *obj)
{
WebFetchSrc *self = GST_WEB_FETCH_SRC (obj);
GstWebFetchSrc *self = GST_WEB_FETCH_SRC (obj);

g_free (self->uri);

G_OBJECT_CLASS (gst_web_fetch_src_parent_class)->finalize (obj);
}

static void
gst_web_fetch_src_class_init (WebFetchSrcClass *klass)
gst_web_fetch_src_class_init (GstWebFetchSrcClass *klass)
{
static GstStaticPadTemplate srcpadtemplate = GST_STATIC_PAD_TEMPLATE (
"src", GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS_ANY);
Expand Down
Loading