static gboolean gst_vaapi_video_memory_is_span (GstVaapiVideoMemory * mem1, GstVaapiVideoMemory * mem2, gsize * offset_ptr) { GST_FIXME ("unimplemented GstVaapiVideoAllocator::mem_is_span() hook"); return FALSE; }
gboolean gst_lv2_check_required_features (const LilvPlugin * lv2plugin) { LilvNodes *required_features = lilv_plugin_get_required_features (lv2plugin); if (required_features) { LilvIter *i; gint j; gboolean missing = FALSE; for (i = lilv_nodes_begin (required_features); !lilv_nodes_is_end (required_features, i); i = lilv_nodes_next (required_features, i)) { const LilvNode *required_feature = lilv_nodes_get (required_features, i); const char *required_feature_uri = lilv_node_as_uri (required_feature); missing = TRUE; for (j = 0; lv2_features[j]; j++) { if (!strcmp (lv2_features[j]->URI, required_feature_uri)) { missing = FALSE; break; } } if (missing) { GST_FIXME ("lv2 plugin %s needs host feature: %s", lilv_node_as_uri (lilv_plugin_get_uri (lv2plugin)), required_feature_uri); break; } } lilv_nodes_free (required_features); return (!missing); } return TRUE; }
/* VCD int to fourcc */ GstVideoFormat vcd_int_to_gst_video_format(int value) { if (value == VCD_PIXEL_FORMAT_NV21) { return GST_VIDEO_FORMAT_NV21; } if (value == VCD_PIXEL_FORMAT_RGB_565) { return GST_VIDEO_FORMAT_RGB16; } if (value == VCD_PIXEL_FORMAT_YUY2) { return GST_VIDEO_FORMAT_YUY2; } if (value == VCD_PIXEL_FORMAT_YV12) { GST_FIXME("Ignoring since many Android devices that claim to support and produce YV12 actually produce NV21 instead"); /* return GST_VIDEO_FORMAT_YV12; */ return GST_VIDEO_FORMAT_UNKNOWN; } if (value == VCD_PIXEL_FORMAT_NV16) { goto vcd_int_to_gst_video_format_invalid_fmt; } if (value == VCD_PIXEL_FORMAT_JPEG) { goto vcd_int_to_gst_video_format_invalid_fmt; } /* if here... error... */ goto vcd_int_to_gst_video_format_invalid_fmt; /* * propagate unhandled errors */ vcd_int_to_gst_video_format_invalid_fmt: { GA_LOGERROR("%s: ERROR: Video fmt (%d) from Android device not supported by GStreamer. Will use GST_VIDEO_FORMAT_UNKNOWN", __FUNCTION__, value); return GST_VIDEO_FORMAT_UNKNOWN; } }
static GstVaapiVideoMemory * gst_vaapi_video_memory_share (GstVaapiVideoMemory * mem, gssize offset, gssize size) { GST_FIXME ("unimplemented GstVaapiVideoAllocator::mem_share() hook"); return NULL; }
static int gst_droidcamsrc_stream_window_set_swap_interval (struct preview_stream_ops *w, int interval) { GST_FIXME ("ignoring swap interval %d", interval); return 0; }
static int gst_droidcamsrc_stream_window_set_timestamp (struct preview_stream_ops *w, int64_t timestamp) { GST_FIXME ("set timestamp"); // TODO: return 0; }
static int gst_droidcamsrc_stream_window_lock_buffer (struct preview_stream_ops *w, buffer_handle_t * buffer) { GST_FIXME ("lock buffer"); // TODO: return 0; }
static void gst_cd_foo_src_close (GstAudioCdSrc * audiocdsrc) { GstCdFooSrc *src = GST_CD_FOO_SRC (audiocdsrc); if (src->cur_test->cddb_discid != 0) { GST_FIXME ("Fix DISCID comparison: extract discid"); #if 0 g_assert (audiocdsrc->discid == src->cur_test->cddb_discid); #endif } if (src->cur_test->musicbrainz_discid != NULL) { GST_FIXME ("Fix MB DISCID comparison: extract musicbrainz discid"); #if 0 g_assert (g_str_equal (audiocdsrc->mb_discid, src->cur_test->musicbrainz_discid)); #endif } }
static gpointer listen_thread (gpointer data) { HTTPServer *http_server = (HTTPServer *)data; struct epoll_event event_list[kMaxRequests]; gint n, i; for (;;) { n = epoll_wait (http_server->epollfd, event_list, kMaxRequests, -1); if (n == -1) { GST_WARNING ("epoll_wait error %s", g_strerror (errno)); continue; } for (i = 0; i < n; i++) { RequestData *request_data; if (event_list[i].data.ptr == NULL) { /* new request arrived */ accept_socket (http_server); continue; } request_data = *(RequestData **)(event_list[i].data.ptr); g_mutex_lock (&(request_data->events_mutex)); request_data->events |= event_list[i].events; g_mutex_unlock (&(request_data->events_mutex)); /* push to thread pool queue */ if ((event_list[i].events & EPOLLIN) && (request_data->status == HTTP_CONNECTED)) { GError *err = NULL; GST_DEBUG ("event on sock %d events %d", request_data->sock, request_data->events); request_data->status = HTTP_REQUEST; g_thread_pool_push (http_server->thread_pool, event_list[i].data.ptr, &err); if (err != NULL) { GST_FIXME ("Thread pool push error %s", err->message); g_error_free (err); } } if (event_list[i].events & (EPOLLOUT | EPOLLIN | EPOLLHUP | EPOLLERR)) { if ((request_data->status == HTTP_BLOCK) || (request_data->status == HTTP_REQUEST)) { g_mutex_lock (&(http_server->block_queue_mutex)); g_cond_signal (&(http_server->block_queue_cond)); g_mutex_unlock (&(http_server->block_queue_mutex)); } } GST_DEBUG ("event on sock %d events %s", request_data->sock, epoll_event_string (event_list[i])); } } return NULL; }
static void gslist_foreach_func (gpointer data, gpointer user_data) { RequestData **request_data_pointer = data; RequestData *request_data = *request_data_pointer; HTTPServer *http_server = user_data; GError *err = NULL; g_tree_remove (http_server->idle_queue, &(request_data->wakeup_time)); g_thread_pool_push (http_server->thread_pool, request_data_pointer, &err); if (err != NULL) { GST_FIXME ("Thread pool push error %s", err->message); g_error_free (err); } }
static gchar * _mangle_texture_access (const gchar * str, GstGLContext * context, GstGLTextureTarget from, GstGLTextureTarget to, GstGLSLVersion version, GstGLSLProfile profile) { const gchar *from_str = NULL, *to_str = NULL; gchar *ret, *tmp; gchar *regex_find; GRegex *regex; if (from == GST_GL_TEXTURE_TARGET_2D) from_str = "texture2D"; if (from == GST_GL_TEXTURE_TARGET_RECTANGLE) from_str = "texture2DRect"; if (from == GST_GL_TEXTURE_TARGET_EXTERNAL_OES) from_str = "texture2D"; /* GL3 || gles3 but not when external-oes unless the image_external_essl3 extension is supported */ if (profile == GST_GLSL_PROFILE_CORE || (profile == GST_GLSL_PROFILE_ES && version >= GST_GLSL_VERSION_300 && (to != GST_GL_TEXTURE_TARGET_EXTERNAL_OES || gst_gl_context_check_feature (context, "GL_OES_EGL_image_external_essl3")))) { to_str = "texture"; } else { if (to == GST_GL_TEXTURE_TARGET_2D) to_str = "texture2D"; if (to == GST_GL_TEXTURE_TARGET_RECTANGLE) to_str = "texture2DRect"; if (to == GST_GL_TEXTURE_TARGET_EXTERNAL_OES) to_str = "texture2D"; } /* followed by any amount of whitespace then a bracket */ regex_find = g_strdup_printf ("%s(?=\\s*\\()", from_str); regex = g_regex_new (regex_find, 0, 0, NULL); tmp = g_regex_replace_literal (regex, str, -1, 0, to_str, 0, NULL); g_free (regex_find); g_regex_unref (regex); if (tmp) { ret = tmp; } else { GST_FIXME ("Couldn't mangle texture access successfully from %s to %s", from_str, to_str); ret = g_strdup (str); } return ret; }
gboolean gst_vdp_video_memory_unmap (GstVideoMeta * meta, guint plane, GstMapInfo * info) { GstVdpVideoMemory *vmem = (GstVdpVideoMemory *) gst_buffer_get_memory (meta->buffer, 0); GST_DEBUG ("plane:%d", plane); GST_FIXME ("implement unmap (and potential upload on last unmap)"); release_data (vmem); return TRUE; }
static gboolean _set_uniform (GQuark field_id, const GValue * value, gpointer user_data) { GstGLShader *shader = user_data; const gchar *field_name = g_quark_to_string (field_id); if (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_INT)) { gst_gl_shader_set_uniform_1i (shader, field_name, g_value_get_int (value)); } else if (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_FLOAT)) { gst_gl_shader_set_uniform_1f (shader, field_name, g_value_get_float (value)); #ifdef HAVE_GRAPHENE } else if (G_TYPE_CHECK_VALUE_TYPE ((value), GRAPHENE_TYPE_VEC2)) { graphene_vec2_t *vec2 = g_value_get_boxed (value); float x = graphene_vec2_get_x (vec2); float y = graphene_vec2_get_y (vec2); gst_gl_shader_set_uniform_2f (shader, field_name, x, y); } else if (G_TYPE_CHECK_VALUE_TYPE ((value), GRAPHENE_TYPE_VEC3)) { graphene_vec3_t *vec3 = g_value_get_boxed (value); float x = graphene_vec3_get_x (vec3); float y = graphene_vec3_get_y (vec3); float z = graphene_vec3_get_z (vec3); gst_gl_shader_set_uniform_3f (shader, field_name, x, y, z); } else if (G_TYPE_CHECK_VALUE_TYPE ((value), GRAPHENE_TYPE_VEC4)) { graphene_vec4_t *vec4 = g_value_get_boxed (value); float x = graphene_vec4_get_x (vec4); float y = graphene_vec4_get_y (vec4); float z = graphene_vec4_get_z (vec4); float w = graphene_vec4_get_w (vec4); gst_gl_shader_set_uniform_4f (shader, field_name, x, y, z, w); } else if (G_TYPE_CHECK_VALUE_TYPE ((value), GRAPHENE_TYPE_MATRIX)) { graphene_matrix_t *matrix = g_value_get_boxed (value); float matrix_f[16]; graphene_matrix_to_float (matrix, matrix_f); gst_gl_shader_set_uniform_matrix_4fv (shader, field_name, 1, FALSE, matrix_f); #endif } else { /* FIXME: Add support for unsigned ints, non 4x4 matrices, etc */ GST_FIXME ("Don't know how to set the \'%s\' paramater. Unknown type", field_name); return TRUE; } return TRUE; }
static void block_queue_foreach_func (gpointer data, gpointer user_data) { RequestData **request_data_pointer = data; RequestData *request_data = *request_data_pointer; HTTPServer *http_server = user_data; GError *err = NULL; if ((request_data->events & (EPOLLOUT | EPOLLIN | EPOLLHUP | EPOLLERR)) || (request_data->wakeup_time < gst_clock_get_time (http_server->system_clock))) { /* EPOLL event or block time out, popup request from block queue and push to thread pool. */ g_queue_remove (http_server->block_queue, request_data_pointer); g_thread_pool_push (http_server->thread_pool, request_data_pointer, &err); if (err != NULL) { GST_FIXME ("Thread pool push error %s", err->message); g_error_free (err); } } }
/* GST video format to VCD's (Android's) format */ static int gst_video_fmt_to_vcd_fmt(GstVideoFormat gst_video_fmt) { if (gst_video_fmt == GST_VIDEO_FORMAT_YV12) { GST_FIXME("Ignoring YV12 since many Android devices that claim to support and produce YV12 actually produce NV21 instead"); /* return VCD_PIXEL_FORMAT_YV12; ...many Android devices that claim to support and produce YV12 actually produce NV21 instead */ return VCD_PIXEL_FORMAT_UNKNOWN; } if (gst_video_fmt == GST_VIDEO_FORMAT_RGB16) { return VCD_PIXEL_FORMAT_RGB_565; } if (gst_video_fmt == GST_VIDEO_FORMAT_NV21) { return VCD_PIXEL_FORMAT_NV21; } if (gst_video_fmt == GST_VIDEO_FORMAT_YUY2) { return VCD_PIXEL_FORMAT_YUY2; } return VCD_PIXEL_FORMAT_UNKNOWN; }
static gchar * _mangle_external_image_extension (const gchar * str, GstGLContext * context, GstGLTextureTarget from, GstGLTextureTarget to, GstGLSLVersion version, GstGLSLProfile profile) { GST_DEBUG ("is oes? %d, profile == ES? %d, version >= 300? %d, " "have essl3? %d", to == GST_GL_TEXTURE_TARGET_EXTERNAL_OES, profile == GST_GLSL_PROFILE_ES, version >= GST_GLSL_VERSION_300, gst_gl_context_check_feature (context, "GL_OES_EGL_image_external_essl3")); /* replace GL_OES_EGL_image_external with GL_OES_EGL_image_external_essl3 where supported */ if (to == GST_GL_TEXTURE_TARGET_EXTERNAL_OES && profile == GST_GLSL_PROFILE_ES && version >= GST_GLSL_VERSION_300) { if (gst_gl_context_check_feature (context, "GL_OES_EGL_image_external_essl3")) { GRegex *regex = g_regex_new ( /* '#extension ' with optional spacing */ "(#[ \\t]*extension[ \\t]+)" /* what we're looking to replace */ "GL_OES_EGL_image_external" /* ':' with optional spacing */ "([ \\t]*:[ \\t]*" /* some word like require, disable, etc followed by spacing and a newline */ "\\S+[ \\t]*\\R)", 0, 0, NULL); gchar *tmp = g_regex_replace (regex, str, -1, 0, "\\1GL_OES_EGL_image_external_essl3\\2", 0, NULL); g_regex_unref (regex); return tmp; } else { GST_FIXME ("Undefined situation detected. GLES3 supported but " "GL_OES_EGL_image_external_essl3 not supported. Falling back to the " "older GL_OES_EGL_image_external extension"); return g_strdup (str); } } else { return g_strdup (str); } }
static gchar * _mangle_sampler_type (const gchar * str, GstGLTextureTarget from, GstGLTextureTarget to) { const gchar *from_str = NULL, *to_str = NULL; gchar *ret, *tmp; gchar *regex_find; GRegex *regex; if (from == GST_GL_TEXTURE_TARGET_2D) from_str = "sampler2D"; if (from == GST_GL_TEXTURE_TARGET_RECTANGLE) from_str = "sampler2DRect"; if (from == GST_GL_TEXTURE_TARGET_EXTERNAL_OES) from_str = "samplerExternalOES"; if (to == GST_GL_TEXTURE_TARGET_2D) to_str = "sampler2D"; if (to == GST_GL_TEXTURE_TARGET_RECTANGLE) to_str = "sampler2DRect"; if (to == GST_GL_TEXTURE_TARGET_EXTERNAL_OES) to_str = "samplerExternalOES"; /* followed by some whitespace */ regex_find = g_strdup_printf ("%s(?=\\s)", from_str); regex = g_regex_new (regex_find, 0, 0, NULL); tmp = g_regex_replace_literal (regex, str, -1, 0, to_str, 0, NULL); g_free (regex_find); g_regex_unref (regex); if (tmp) { ret = tmp; } else { GST_FIXME ("Couldn't mangle sampler type successfully from %s to %s", from_str, to_str); ret = g_strdup (str); } return ret; }
static void _gst_mpegts_atsc_string_segment_decode_string (GstMpegtsAtscStringSegment * seg) { const gchar *from_encoding; g_return_if_fail (seg->cached_string == NULL); if (seg->compression_type != 0) { GST_FIXME ("Compressed strings not yet supported"); return; } /* FIXME add more encodings */ switch (seg->mode) { case 0x3F: from_encoding = "UTF-16BE"; break; default: from_encoding = NULL; break; } if (from_encoding != NULL && seg->compressed_data_size > 0) { GError *err = NULL; seg->cached_string = g_convert ((gchar *) seg->compressed_data, (gssize) seg->compressed_data_size, "UTF-8", from_encoding, NULL, NULL, &err); if (err) { GST_WARNING ("Failed to convert input string from codeset %s", from_encoding); g_error_free (err); } } else { seg->cached_string = g_strndup ((gchar *) seg->compressed_data, seg->compressed_data_size); } }
MpegTSBaseProgram * mpegts_base_add_program (MpegTSBase * base, gint program_number, guint16 pmt_pid) { MpegTSBaseProgram *program; GST_DEBUG_OBJECT (base, "program_number : %d, pmt_pid : %d", program_number, pmt_pid); program = mpegts_base_new_program (base, program_number, pmt_pid); /* Mark the PMT PID as being a known PSI PID */ if (G_UNLIKELY (MPEGTS_BIT_IS_SET (base->known_psi, pmt_pid))) { GST_FIXME ("Refcounting. Setting twice a PID (0x%04x) as known PSI", pmt_pid); } MPEGTS_BIT_SET (base->known_psi, pmt_pid); g_hash_table_insert (base->programs, GINT_TO_POINTER (program_number), program); return program; }
static gboolean mpegts_base_apply_pat (MpegTSBase * base, GstMpegtsSection * section) { GPtrArray *pat = gst_mpegts_section_get_pat (section); GPtrArray *old_pat; MpegTSBaseProgram *program; gint i; if (G_UNLIKELY (pat == NULL)) return FALSE; GST_INFO_OBJECT (base, "PAT"); /* Applying a new PAT does two things: * * It adds the new programs to the list of programs this element handles * and increments at the same time the number of times a program is referenced. * * * If there was a previously active PAT, It decrements the reference count * of all program it used. If a program is no longer needed, it is removed. */ old_pat = base->pat; base->pat = pat; GST_LOG ("Activating new Program Association Table"); /* activate the new table */ for (i = 0; i < pat->len; ++i) { GstMpegtsPatProgram *patp = g_ptr_array_index (pat, i); program = mpegts_base_get_program (base, patp->program_number); if (program) { /* IF the program already existed, just check if the PMT PID changed */ if (program->pmt_pid != patp->network_or_program_map_PID) { if (program->pmt_pid != G_MAXUINT16) { /* pmt pid changed */ /* FIXME: when this happens it may still be pmt pid of another * program, so setting to False may make it go through expensive * path in is_psi unnecessarily */ MPEGTS_BIT_UNSET (base->known_psi, program->pmt_pid); } program->pmt_pid = patp->network_or_program_map_PID; if (G_UNLIKELY (MPEGTS_BIT_IS_SET (base->known_psi, program->pmt_pid))) GST_FIXME ("Refcounting issue. Setting twice a PMT PID (0x%04x) as know PSI", program->pmt_pid); MPEGTS_BIT_SET (base->known_psi, patp->network_or_program_map_PID); } } else { /* Create a new program */ program = mpegts_base_add_program (base, patp->program_number, patp->network_or_program_map_PID); } /* We mark this program as being referenced by one PAT */ program->patcount += 1; } if (old_pat) { MpegTSBaseClass *klass = GST_MPEGTS_BASE_GET_CLASS (base); /* deactivate the old table */ GST_LOG ("Deactivating old Program Association Table"); for (i = 0; i < old_pat->len; ++i) { GstMpegtsPatProgram *patp = g_ptr_array_index (old_pat, i); program = mpegts_base_get_program (base, patp->program_number); if (G_UNLIKELY (program == NULL)) { GST_DEBUG_OBJECT (base, "broken PAT, duplicated entry for program %d", patp->program_number); continue; } if (--program->patcount > 0) /* the program has been referenced by the new pat, keep it */ continue; GST_INFO_OBJECT (base, "PAT removing program 0x%04x 0x%04x", patp->program_number, patp->network_or_program_map_PID); if (klass->can_remove_program (base, program)) { mpegts_base_deactivate_program (base, program); mpegts_base_remove_program (base, patp->program_number); } /* FIXME: when this happens it may still be pmt pid of another * program, so setting to False may make it go through expensive * path in is_psi unnecessarily */ if (G_UNLIKELY (MPEGTS_BIT_IS_SET (base->known_psi, patp->network_or_program_map_PID))) { GST_FIXME ("Program refcounting : Setting twice a pid (0x%04x) as known PSI", patp->network_or_program_map_PID); } MPEGTS_BIT_SET (base->known_psi, patp->network_or_program_map_PID); mpegts_packetizer_remove_stream (base->packetizer, patp->network_or_program_map_PID); } g_ptr_array_unref (old_pat); } return TRUE; }
static void mpegts_base_activate_program (MpegTSBase * base, MpegTSBaseProgram * program, guint16 pmt_pid, GstMpegtsSection * section, const GstMpegtsPMT * pmt, gboolean initial_program) { guint i; MpegTSBaseClass *klass; if (G_UNLIKELY (program->active)) return; GST_DEBUG ("Activating program %d", program->program_number); /* activate new pmt */ if (program->section) gst_mpegts_section_unref (program->section); program->section = gst_mpegts_section_ref (section); program->pmt = pmt; program->pmt_pid = pmt_pid; program->pcr_pid = pmt->pcr_pid; /* extract top-level registration_id if present */ program->registration_id = get_registration_from_descriptors (pmt->descriptors); GST_DEBUG ("program 0x%04x, registration_id %" SAFE_FOURCC_FORMAT, program->program_number, SAFE_FOURCC_ARGS (program->registration_id)); for (i = 0; i < pmt->streams->len; ++i) { GstMpegtsPMTStream *stream = g_ptr_array_index (pmt->streams, i); switch (stream->stream_type) { case GST_MPEGTS_STREAM_TYPE_SCTE_DSMCC_DCB: case GST_MPEGTS_STREAM_TYPE_SCTE_SIGNALING: { guint32 registration_id = get_registration_from_descriptors (stream->descriptors); /* Not a private section stream */ if (registration_id != DRF_ID_CUEI && registration_id != DRF_ID_ETV1) break; /* Fall through on purpose - remove this PID from known_psi */ } case GST_MPEGTS_STREAM_TYPE_PRIVATE_SECTIONS: case GST_MPEGTS_STREAM_TYPE_MHEG: case GST_MPEGTS_STREAM_TYPE_DSM_CC: case GST_MPEGTS_STREAM_TYPE_DSMCC_A: case GST_MPEGTS_STREAM_TYPE_DSMCC_B: case GST_MPEGTS_STREAM_TYPE_DSMCC_C: case GST_MPEGTS_STREAM_TYPE_DSMCC_D: case GST_MPEGTS_STREAM_TYPE_SL_FLEXMUX_SECTIONS: case GST_MPEGTS_STREAM_TYPE_METADATA_SECTIONS: /* Set known PSI streams */ if (base->parse_private_sections) MPEGTS_BIT_SET (base->known_psi, stream->pid); break; default: if (G_UNLIKELY (MPEGTS_BIT_IS_SET (base->is_pes, stream->pid))) GST_FIXME ("Refcounting issue. Setting twice a PID (0x%04x) as known PES", stream->pid); if (G_UNLIKELY (MPEGTS_BIT_IS_SET (base->known_psi, stream->pid))) { GST_FIXME ("Refcounting issue. Setting a known PSI PID (0x%04x) as known PES", stream->pid); MPEGTS_BIT_UNSET (base->known_psi, stream->pid); } MPEGTS_BIT_SET (base->is_pes, stream->pid); break; } mpegts_base_program_add_stream (base, program, stream->pid, stream->stream_type, stream); } /* We add the PCR pid last. If that PID is already used by one of the media * streams above, no new stream will be created */ mpegts_base_program_add_stream (base, program, pmt->pcr_pid, -1, NULL); MPEGTS_BIT_SET (base->is_pes, pmt->pcr_pid); program->active = TRUE; program->initial_program = initial_program; klass = GST_MPEGTS_BASE_GET_CLASS (base); if (klass->program_started != NULL) klass->program_started (base, program); GST_DEBUG_OBJECT (base, "new pmt activated"); }
static GstMemory * _vdp_video_mem_share (GstVdpVideoMemory * mem, gssize offset, gssize size) { GST_FIXME ("Implement !"); return NULL; }
static void check_pad_template (GstPadTemplate * tmpl) { const GValue *list_val, *fmt_val; GstStructure *s; gboolean *formats_supported; GstCaps *caps; guint i, num_formats; num_formats = get_num_formats (); formats_supported = g_new0 (gboolean, num_formats); caps = gst_pad_template_get_caps (tmpl); /* If this fails, we need to update this unit test */ fail_unless_equals_int (gst_caps_get_size (caps), 2); /* Remove the ANY caps features structure */ caps = gst_caps_truncate (caps); s = gst_caps_get_structure (caps, 0); fail_unless (gst_structure_has_name (s, "video/x-raw")); list_val = gst_structure_get_value (s, "format"); fail_unless (list_val != NULL); /* If this fails, we need to update this unit test */ fail_unless (GST_VALUE_HOLDS_LIST (list_val)); for (i = 0; i < gst_value_list_get_size (list_val); ++i) { GstVideoFormat fmt; const gchar *fmt_str; fmt_val = gst_value_list_get_value (list_val, i); fail_unless (G_VALUE_HOLDS_STRING (fmt_val)); fmt_str = g_value_get_string (fmt_val); GST_LOG ("format string: '%s'", fmt_str); fmt = gst_video_format_from_string (fmt_str); if (fmt == GST_VIDEO_FORMAT_UNKNOWN) g_error ("Unknown raw format '%s' in pad template caps", fmt_str); formats_supported[(guint) fmt] = TRUE; } gst_caps_unref (caps); for (i = 2; i < num_formats; ++i) { if (!formats_supported[i]) { const gchar *fmt_str = gst_video_format_to_string ((GstVideoFormat) i); switch (i) { case GST_VIDEO_FORMAT_v210: case GST_VIDEO_FORMAT_v216: case GST_VIDEO_FORMAT_NV12: case GST_VIDEO_FORMAT_NV16: case GST_VIDEO_FORMAT_NV21: case GST_VIDEO_FORMAT_NV24: case GST_VIDEO_FORMAT_UYVP: case GST_VIDEO_FORMAT_A420: case GST_VIDEO_FORMAT_YUV9: case GST_VIDEO_FORMAT_YVU9: case GST_VIDEO_FORMAT_IYU1: case GST_VIDEO_FORMAT_r210:{ static gboolean shown_fixme[100] = { FALSE, }; if (!shown_fixme[i]) { GST_FIXME ("FIXME: add %s support to videoscale", fmt_str); shown_fixme[i] = TRUE; } break; } case GST_VIDEO_FORMAT_BGR16: case GST_VIDEO_FORMAT_BGR15: case GST_VIDEO_FORMAT_RGB8P: case GST_VIDEO_FORMAT_I420_10BE: case GST_VIDEO_FORMAT_I420_10LE: case GST_VIDEO_FORMAT_I422_10BE: case GST_VIDEO_FORMAT_I422_10LE: case GST_VIDEO_FORMAT_Y444_10BE: case GST_VIDEO_FORMAT_Y444_10LE: case GST_VIDEO_FORMAT_GBR: case GST_VIDEO_FORMAT_GBR_10BE: case GST_VIDEO_FORMAT_GBR_10LE: GST_LOG ("Ignoring lack of support for format %s", fmt_str); break; default: g_error ("videoscale doesn't support format '%s'", fmt_str); break; } } } g_free (formats_supported); }
/** * gst_gl_shader_link: * @shader: a #GstGLShader * @error: a #GError * * Links the current list of #GstGLSLStage's in @shader. * * Note: must be called in the GL thread * * Returns: whether @shader could be linked together. * * Since: 1.8 */ gboolean gst_gl_shader_link (GstGLShader * shader, GError ** error) { GstGLShaderPrivate *priv; const GstGLFuncs *gl; gchar info_buffer[2048]; GLint status = GL_FALSE; gint len = 0; gboolean ret; GList *elem; g_return_val_if_fail (GST_IS_GL_SHADER (shader), FALSE); GST_OBJECT_LOCK (shader); priv = shader->priv; gl = shader->context->gl_vtable; if (priv->linked) { GST_OBJECT_UNLOCK (shader); return TRUE; } if (!_gst_glsl_funcs_fill (&shader->priv->vtable, shader->context)) { g_set_error (error, GST_GLSL_ERROR, GST_GLSL_ERROR_PROGRAM, "Failed to retreive required GLSL functions"); GST_OBJECT_UNLOCK (shader); return FALSE; } if (!_ensure_program (shader)) { g_set_error (error, GST_GLSL_ERROR, GST_GLSL_ERROR_PROGRAM, "Failed to create GL program object"); GST_OBJECT_UNLOCK (shader); return FALSE; } GST_TRACE ("shader created %u", shader->priv->program_handle); for (elem = shader->priv->stages; elem; elem = elem->next) { GstGLSLStage *stage = elem->data; if (!gst_glsl_stage_compile (stage, error)) { GST_OBJECT_UNLOCK (shader); return FALSE; } if (!gst_gl_shader_attach_unlocked (shader, stage)) { g_set_error (error, GST_GLSL_ERROR, GST_GLSL_ERROR_COMPILE, "Failed to attach shader %" GST_PTR_FORMAT "to program %" GST_PTR_FORMAT, stage, shader); GST_OBJECT_UNLOCK (shader); return FALSE; } } /* if nothing failed link shaders */ gl->LinkProgram (priv->program_handle); status = GL_FALSE; priv->vtable.GetProgramiv (priv->program_handle, GL_LINK_STATUS, &status); priv->vtable.GetProgramInfoLog (priv->program_handle, sizeof (info_buffer) - 1, &len, info_buffer); info_buffer[len] = '\0'; if (status != GL_TRUE) { GST_ERROR ("Shader linking failed:\n%s", info_buffer); g_set_error (error, GST_GLSL_ERROR, GST_GLSL_ERROR_LINK, "Shader Linking failed:\n%s", info_buffer); ret = priv->linked = FALSE; GST_OBJECT_UNLOCK (shader); return ret; } else if (len > 1) { GST_FIXME ("shader link log:\n%s\n", info_buffer); } ret = priv->linked = TRUE; GST_OBJECT_UNLOCK (shader); g_object_notify (G_OBJECT (shader), "linked"); return ret; }
int main (int argc, char **argv) { GOptionEntry options[] = { {"effects", 'e', 0, G_OPTION_ARG_STRING, &opt_effects, "Effects to use (comma-separated list of element names)", NULL}, {NULL} }; GOptionContext *ctx; GError *err = NULL; GMainLoop *loop; GstElement *src, *q1, *q2, *effect, *filter1, *filter2, *sink; gchar **effect_names, **e; ctx = g_option_context_new (""); g_option_context_add_main_entries (ctx, options, GETTEXT_PACKAGE); g_option_context_add_group (ctx, gst_init_get_option_group ()); if (!g_option_context_parse (ctx, &argc, &argv, &err)) { g_print ("Error initializing: %s\n", err->message); g_option_context_free (ctx); g_clear_error (&err); return 1; } g_option_context_free (ctx); GST_FIXME ("Multiple things to check/fix, see source code"); if (opt_effects != NULL) effect_names = g_strsplit (opt_effects, ",", -1); else effect_names = g_strsplit (DEFAULT_EFFECTS, ",", -1); for (e = effect_names; e != NULL && *e != NULL; ++e) { GstElement *el; el = gst_element_factory_make (*e, NULL); if (el) { g_print ("Adding effect '%s'\n", *e); g_queue_push_tail (&effects, el); } } pipeline = gst_pipeline_new ("pipeline"); src = gst_element_factory_make ("videotestsrc", NULL); g_object_set (src, "is-live", TRUE, NULL); filter1 = gst_element_factory_make ("capsfilter", NULL); gst_util_set_object_arg (G_OBJECT (filter1), "caps", "video/x-raw, width=320, height=240, " "format={ I420, YV12, YUY2, UYVY, AYUV, Y41B, Y42B, " "YVYU, Y444, v210, v216, NV12, NV21, UYVP, A420, YUV9, YVU9, IYU1 }"); q1 = gst_element_factory_make ("queue", NULL); blockpad = gst_element_get_static_pad (q1, "src"); conv_before = gst_element_factory_make ("videoconvert", NULL); effect = g_queue_pop_head (&effects); cur_effect = effect; conv_after = gst_element_factory_make ("videoconvert", NULL); q2 = gst_element_factory_make ("queue", NULL); filter2 = gst_element_factory_make ("capsfilter", NULL); gst_util_set_object_arg (G_OBJECT (filter2), "caps", "video/x-raw, width=320, height=240, " "format={ RGBx, BGRx, xRGB, xBGR, RGBA, BGRA, ARGB, ABGR, RGB, BGR }"); sink = gst_element_factory_make ("ximagesink", NULL); gst_bin_add_many (GST_BIN (pipeline), src, filter1, q1, conv_before, effect, conv_after, q2, sink, NULL); gst_element_link_many (src, filter1, q1, conv_before, effect, conv_after, q2, sink, NULL); gst_element_set_state (pipeline, GST_STATE_PLAYING); loop = g_main_loop_new (NULL, FALSE); gst_bus_add_watch (GST_ELEMENT_BUS (pipeline), bus_cb, loop); g_timeout_add_seconds (1, timeout_cb, loop); g_main_loop_run (loop); gst_element_set_state (pipeline, GST_STATE_NULL); gst_object_unref (pipeline); return 0; }
gchar * get_encoding_and_convert (const gchar * text, guint length) { GError *error = NULL; gchar *converted_str; guint start_text = 0; gboolean is_multibyte; LocalIconvCode encoding; GIConv giconv = (GIConv) - 1; g_return_val_if_fail (text != NULL, NULL); if (text == NULL || length == 0) return g_strdup (""); encoding = get_encoding (text, &start_text, &is_multibyte); if (encoding > _ICONV_UNKNOWN && encoding < _ICONV_MAX) { GST_DEBUG ("Encoding %s", iconvtablename[encoding]); giconv = _get_iconv (encoding, _ICONV_UTF8); } else { GST_FIXME ("Could not detect encoding. Returning NULL string"); converted_str = NULL; goto beach; } converted_str = convert_to_utf8 (text, length - start_text, start_text, giconv, is_multibyte, &error); if (error != NULL) { GST_WARNING ("Could not convert string: %s", error->message); g_free (converted_str); g_error_free (error); error = NULL; if (encoding >= _ICONV_ISO8859_2 && encoding <= _ICONV_ISO8859_15) { /* Sometimes using the standard 8859-1 set fixes issues */ GST_DEBUG ("Encoding %s", iconvtablename[_ICONV_ISO8859_1]); giconv = _get_iconv (_ICONV_ISO8859_1, _ICONV_UTF8); GST_INFO ("Trying encoding ISO 8859-1"); converted_str = convert_to_utf8 (text, length, 1, giconv, FALSE, &error); if (error != NULL) { GST_WARNING ("Could not convert string while assuming encoding ISO 8859-1: %s", error->message); g_error_free (error); goto failed; } } else if (encoding == _ICONV_ISO6937) { /* The first part of ISO 6937 is identical to ISO 8859-9, but * they differ in the second part. Some channels don't * provide the first byte that indicates ISO 8859-9 encoding. * If decoding from ISO 6937 failed, we try ISO 8859-9 here. */ giconv = _get_iconv (_ICONV_ISO8859_9, _ICONV_UTF8); GST_INFO ("Trying encoding ISO 8859-9"); converted_str = convert_to_utf8 (text, length, 0, giconv, FALSE, &error); if (error != NULL) { GST_WARNING ("Could not convert string while assuming encoding ISO 8859-9: %s", error->message); g_error_free (error); goto failed; } } else goto failed; } beach: return converted_str; failed: { text += start_text; return g_strndup (text, length - start_text); } }