mirror of
https://github.com/morgan9e/UxPlay
synced 2026-04-15 00:34:05 +09:00
cleanup uninitialized variables in /renderers
This commit is contained in:
@@ -68,14 +68,13 @@ static const char aac_eld_caps[] ="audio/mpeg,mpegversion=(int)4,channnels=(int)
|
|||||||
|
|
||||||
static gboolean check_plugins (void)
|
static gboolean check_plugins (void)
|
||||||
{
|
{
|
||||||
gboolean ret;
|
GstRegistry *registry = NULL;
|
||||||
GstRegistry *registry;
|
|
||||||
const gchar *needed[] = { "app", "libav", "playback", "autodetect", "videoparsersbad", NULL};
|
const gchar *needed[] = { "app", "libav", "playback", "autodetect", "videoparsersbad", NULL};
|
||||||
const gchar *gst[] = {"plugins-base", "libav", "plugins-base", "plugins-good", "plugins-bad", NULL};
|
const gchar *gst[] = {"plugins-base", "libav", "plugins-base", "plugins-good", "plugins-bad", NULL};
|
||||||
registry = gst_registry_get ();
|
registry = gst_registry_get ();
|
||||||
ret = TRUE;
|
gboolean ret = TRUE;
|
||||||
for (int i = 0; i < g_strv_length ((gchar **) needed); i++) {
|
for (int i = 0; i < g_strv_length ((gchar **) needed); i++) {
|
||||||
GstPlugin *plugin;
|
GstPlugin *plugin = NULL;
|
||||||
plugin = gst_registry_find_plugin (registry, needed[i]);
|
plugin = gst_registry_find_plugin (registry, needed[i]);
|
||||||
if (!plugin) {
|
if (!plugin) {
|
||||||
g_print ("Required gstreamer plugin '%s' not found\n"
|
g_print ("Required gstreamer plugin '%s' not found\n"
|
||||||
@@ -96,10 +95,9 @@ static gboolean check_plugins (void)
|
|||||||
|
|
||||||
static gboolean check_plugin_feature (const gchar *needed_feature)
|
static gboolean check_plugin_feature (const gchar *needed_feature)
|
||||||
{
|
{
|
||||||
gboolean ret;
|
GstPluginFeature *plugin_feature = NULL;
|
||||||
GstPluginFeature *plugin_feature;
|
|
||||||
GstRegistry *registry = gst_registry_get ();
|
GstRegistry *registry = gst_registry_get ();
|
||||||
ret = TRUE;
|
gboolean ret = TRUE;
|
||||||
|
|
||||||
plugin_feature = gst_registry_find_feature (registry, needed_feature, GST_TYPE_ELEMENT_FACTORY);
|
plugin_feature = gst_registry_find_feature (registry, needed_feature, GST_TYPE_ELEMENT_FACTORY);
|
||||||
if (!plugin_feature) {
|
if (!plugin_feature) {
|
||||||
@@ -290,8 +288,7 @@ void audio_renderer_start(unsigned char *ct) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void audio_renderer_render_buffer(unsigned char* data, int *data_len, unsigned short *seqnum, uint64_t *ntp_time) {
|
void audio_renderer_render_buffer(unsigned char* data, int *data_len, unsigned short *seqnum, uint64_t *ntp_time) {
|
||||||
GstBuffer *buffer;
|
GstBuffer *buffer = NULL;
|
||||||
bool valid;
|
|
||||||
|
|
||||||
if (!render_audio) return; /* do nothing unless render_audio == TRUE */
|
if (!render_audio) return; /* do nothing unless render_audio == TRUE */
|
||||||
|
|
||||||
@@ -322,6 +319,7 @@ void audio_renderer_render_buffer(unsigned char* data, int *data_len, unsigned s
|
|||||||
GST_BUFFER_PTS(buffer) = pts;
|
GST_BUFFER_PTS(buffer) = pts;
|
||||||
}
|
}
|
||||||
gst_buffer_fill(buffer, 0, data, *data_len);
|
gst_buffer_fill(buffer, 0, data, *data_len);
|
||||||
|
bool valid = false;
|
||||||
switch (renderer->ct){
|
switch (renderer->ct){
|
||||||
case 8: /*AAC-ELD*/
|
case 8: /*AAC-ELD*/
|
||||||
switch (data[0]){
|
switch (data[0]){
|
||||||
@@ -383,8 +381,8 @@ void audio_renderer_destroy() {
|
|||||||
static gboolean gstreamer_audio_pipeline_bus_callback(GstBus *bus, GstMessage *message, void *loop) {
|
static gboolean gstreamer_audio_pipeline_bus_callback(GstBus *bus, GstMessage *message, void *loop) {
|
||||||
switch (GST_MESSAGE_TYPE(message)) {
|
switch (GST_MESSAGE_TYPE(message)) {
|
||||||
case GST_MESSAGE_ERROR: {
|
case GST_MESSAGE_ERROR: {
|
||||||
GError *err;
|
GError *err = NULL;
|
||||||
gchar *debug;
|
gchar *debug = NULL;
|
||||||
gst_message_parse_error (message, &err, &debug);
|
gst_message_parse_error (message, &err, &debug);
|
||||||
logger_log(logger, LOGGER_INFO, "GStreamer error (audio): %s %s", GST_MESSAGE_SRC_NAME(message),err->message);
|
logger_log(logger, LOGGER_INFO, "GStreamer error (audio): %s %s", GST_MESSAGE_SRC_NAME(message),err->message);
|
||||||
g_error_free(err);
|
g_error_free(err);
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
#include "x_display_fix.h"
|
#include "x_display_fix.h"
|
||||||
static bool fullscreen = false;
|
static bool fullscreen = false;
|
||||||
static bool alt_keypress = false;
|
static bool alt_keypress = false;
|
||||||
static unsigned char X11_search_attempts;
|
static unsigned char X11_search_attempts = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static GstClockTime gst_video_pipeline_base_time = GST_CLOCK_TIME_NONE;
|
static GstClockTime gst_video_pipeline_base_time = GST_CLOCK_TIME_NONE;
|
||||||
@@ -48,15 +48,15 @@ static bool logger_debug = false;
|
|||||||
static gint64 hls_requested_start_position = 0;
|
static gint64 hls_requested_start_position = 0;
|
||||||
static gint64 hls_seek_start = 0;
|
static gint64 hls_seek_start = 0;
|
||||||
static gint64 hls_seek_end = 0;
|
static gint64 hls_seek_end = 0;
|
||||||
static gint64 hls_duration;
|
static gint64 hls_duration = 0;
|
||||||
static gboolean hls_seek_enabled;
|
static gboolean hls_seek_enabled = FALSE;
|
||||||
static gboolean hls_playing;
|
static gboolean hls_playing = FALSE;
|
||||||
static gboolean hls_buffer_empty;
|
static gboolean hls_buffer_empty = FALSE;
|
||||||
static gboolean hls_buffer_full;
|
static gboolean hls_buffer_full = FALSE;
|
||||||
static int type_264;
|
static int type_264 = 0;
|
||||||
static int type_265;
|
static int type_265 = 0;
|
||||||
static int type_hls;
|
static int type_hls = 0;
|
||||||
static int type_jpeg;
|
static int type_jpeg = 0;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
//GST_PLAY_FLAG_VIDEO = (1 << 0),
|
//GST_PLAY_FLAG_VIDEO = (1 << 0),
|
||||||
@@ -204,7 +204,7 @@ GstElement *make_video_sink(const char *videosink, const char *videosink_options
|
|||||||
|
|
||||||
/* add any fullscreen options "property=pval" included in string videosink_options*/
|
/* add any fullscreen options "property=pval" included in string videosink_options*/
|
||||||
/* OK to use strtok_r in Windows with MSYS2 (POSIX); use strtok_s for MSVC */
|
/* OK to use strtok_r in Windows with MSYS2 (POSIX); use strtok_s for MSVC */
|
||||||
char *token;
|
char *token = NULL;
|
||||||
char *text = options;
|
char *text = options;
|
||||||
|
|
||||||
while((token = strtok_r(text, " ", &text))) {
|
while((token = strtok_r(text, " ", &text))) {
|
||||||
@@ -308,7 +308,7 @@ void video_renderer_init(logger_t *render_logger, const char *server_name, video
|
|||||||
g_object_set(G_OBJECT (renderer_type[i]->pipeline), "video-sink", playbin_videosink, NULL);
|
g_object_set(G_OBJECT (renderer_type[i]->pipeline), "video-sink", playbin_videosink, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gint flags;
|
gint flags = 0;
|
||||||
g_object_get(renderer_type[i]->pipeline, "flags", &flags, NULL);
|
g_object_get(renderer_type[i]->pipeline, "flags", &flags, NULL);
|
||||||
flags |= GST_PLAY_FLAG_DOWNLOAD;
|
flags |= GST_PLAY_FLAG_DOWNLOAD;
|
||||||
flags |= GST_PLAY_FLAG_BUFFERING; // set by default in playbin3, but not in playbin2; is it needed?
|
flags |= GST_PLAY_FLAG_BUFFERING; // set by default in playbin3, but not in playbin2; is it needed?
|
||||||
@@ -477,7 +477,7 @@ void video_renderer_resume() {
|
|||||||
|
|
||||||
void video_renderer_start() {
|
void video_renderer_start() {
|
||||||
GstState state;
|
GstState state;
|
||||||
const gchar *state_name;
|
const gchar *state_name = NULL;
|
||||||
if (hls_video) {
|
if (hls_video) {
|
||||||
g_object_set (G_OBJECT (renderer->pipeline), "uri", renderer->uri, NULL);
|
g_object_set (G_OBJECT (renderer->pipeline), "uri", renderer->uri, NULL);
|
||||||
gst_element_set_state (renderer->pipeline, GST_STATE_PAUSED);
|
gst_element_set_state (renderer->pipeline, GST_STATE_PAUSED);
|
||||||
@@ -563,7 +563,7 @@ int video_renderer_cycle() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void video_renderer_display_jpeg(const void *data, int *data_len) {
|
void video_renderer_display_jpeg(const void *data, int *data_len) {
|
||||||
GstBuffer *buffer;
|
GstBuffer *buffer = NULL;
|
||||||
if (type_jpeg == -1) {
|
if (type_jpeg == -1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -576,7 +576,7 @@ void video_renderer_display_jpeg(const void *data, int *data_len) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint64_t video_renderer_render_buffer(unsigned char* data, int *data_len, int *nal_count, uint64_t *ntp_time) {
|
uint64_t video_renderer_render_buffer(unsigned char* data, int *data_len, int *nal_count, uint64_t *ntp_time) {
|
||||||
GstBuffer *buffer;
|
GstBuffer *buffer = NULL;
|
||||||
GstClockTime pts = (GstClockTime) *ntp_time; /*now in nsecs */
|
GstClockTime pts = (GstClockTime) *ntp_time; /*now in nsecs */
|
||||||
//GstClockTimeDiff latency = GST_CLOCK_DIFF(gst_element_get_current_clock_time (renderer->appsrc), pts);
|
//GstClockTimeDiff latency = GST_CLOCK_DIFF(gst_element_get_current_clock_time (renderer->appsrc), pts);
|
||||||
if (sync) {
|
if (sync) {
|
||||||
@@ -793,7 +793,7 @@ static gboolean gstreamer_video_pipeline_bus_callback(GstBus *bus, GstMessage *m
|
|||||||
/* monitor hls video position until seek to hls_start_position is achieved */
|
/* monitor hls video position until seek to hls_start_position is achieved */
|
||||||
if (hls_video && hls_requested_start_position) {
|
if (hls_video && hls_requested_start_position) {
|
||||||
if (strstr(GST_MESSAGE_SRC_NAME(message), "sink")) {
|
if (strstr(GST_MESSAGE_SRC_NAME(message), "sink")) {
|
||||||
gint64 pos;
|
gint64 pos = -1;
|
||||||
if (!GST_CLOCK_TIME_IS_VALID(hls_duration)) {
|
if (!GST_CLOCK_TIME_IS_VALID(hls_duration)) {
|
||||||
gst_element_query_duration (renderer->pipeline, GST_FORMAT_TIME, &hls_duration);
|
gst_element_query_duration (renderer->pipeline, GST_FORMAT_TIME, &hls_duration);
|
||||||
}
|
}
|
||||||
@@ -838,9 +838,9 @@ static gboolean gstreamer_video_pipeline_bus_callback(GstBus *bus, GstMessage *m
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_MESSAGE_ERROR: {
|
case GST_MESSAGE_ERROR: {
|
||||||
GError *err;
|
GError *err = NULL;
|
||||||
gchar *debug;
|
gchar *debug = NULL;
|
||||||
gboolean flushing;
|
gboolean flushing = FALSE;
|
||||||
gst_message_parse_error (message, &err, &debug);
|
gst_message_parse_error (message, &err, &debug);
|
||||||
logger_log(logger, LOGGER_INFO, "GStreamer error (video): %s %s", GST_MESSAGE_SRC_NAME(message),err->message);
|
logger_log(logger, LOGGER_INFO, "GStreamer error (video): %s %s", GST_MESSAGE_SRC_NAME(message),err->message);
|
||||||
if (!hls_video && strstr(err->message,"Internal data stream error")) {
|
if (!hls_video && strstr(err->message,"Internal data stream error")) {
|
||||||
@@ -886,7 +886,7 @@ static gboolean gstreamer_video_pipeline_bus_callback(GstBus *bus, GstMessage *m
|
|||||||
hls_playing = FALSE;
|
hls_playing = FALSE;
|
||||||
}
|
}
|
||||||
hls_playing = TRUE;
|
hls_playing = TRUE;
|
||||||
GstQuery *query;
|
GstQuery *query = NULL;
|
||||||
query = gst_query_new_seeking(GST_FORMAT_TIME);
|
query = gst_query_new_seeking(GST_FORMAT_TIME);
|
||||||
if (gst_element_query(renderer->pipeline, query)) {
|
if (gst_element_query(renderer->pipeline, query)) {
|
||||||
gst_query_parse_seeking (query, NULL, &hls_seek_enabled, &hls_seek_start, &hls_seek_end);
|
gst_query_parse_seeking (query, NULL, &hls_seek_enabled, &hls_seek_start, &hls_seek_end);
|
||||||
@@ -925,7 +925,7 @@ static gboolean gstreamer_video_pipeline_bus_callback(GstBus *bus, GstMessage *m
|
|||||||
GstEvent *event = NULL;
|
GstEvent *event = NULL;
|
||||||
if (gst_navigation_message_parse_event (message, &event)) {
|
if (gst_navigation_message_parse_event (message, &event)) {
|
||||||
GstNavigationEventType event_type = gst_navigation_event_get_type (event);
|
GstNavigationEventType event_type = gst_navigation_event_get_type (event);
|
||||||
const gchar *key;
|
const gchar *key = NULL;
|
||||||
switch (event_type) {
|
switch (event_type) {
|
||||||
case GST_NAVIGATION_EVENT_KEY_PRESS:
|
case GST_NAVIGATION_EVENT_KEY_PRESS:
|
||||||
if (gst_navigation_event_parse_key_event (event, &key)) {
|
if (gst_navigation_event_parse_key_event (event, &key)) {
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ extern "C" {
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
struct X11_Window_s {
|
struct X11_Window_s {
|
||||||
Display * display;
|
Display *display;
|
||||||
Window window;
|
Window window;
|
||||||
} typedef X11_Window_t;
|
} typedef X11_Window_t;
|
||||||
|
|
||||||
@@ -57,7 +57,6 @@ static int free_X11_Display(X11_Window_t *X11) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Window enum_windows(const char * str, Display * display, Window window, int depth) {
|
static Window enum_windows(const char * str, Display * display, Window window, int depth) {
|
||||||
int i;
|
|
||||||
char* name = NULL;
|
char* name = NULL;
|
||||||
XFetchName(display, window, &name);
|
XFetchName(display, window, &name);
|
||||||
if (name) {
|
if (name) {
|
||||||
@@ -70,10 +69,10 @@ static Window enum_windows(const char * str, Display * display, Window window, i
|
|||||||
|
|
||||||
Window _root, parent;
|
Window _root, parent;
|
||||||
Window* children = NULL;
|
Window* children = NULL;
|
||||||
unsigned int n;
|
unsigned int n = 0;
|
||||||
XQueryTree(display, window, &_root, &parent, &children, &n);
|
XQueryTree(display, window, &_root, &parent, &children, &n);
|
||||||
if (children != NULL) {
|
if (children != NULL) {
|
||||||
for (i = 0; i < n; i++) {
|
for (int i = 0; i < n; i++) {
|
||||||
Window w = enum_windows(str, display, children[i], depth + 1);
|
Window w = enum_windows(str, display, children[i], depth + 1);
|
||||||
if (w) {
|
if (w) {
|
||||||
XFree(children);
|
XFree(children);
|
||||||
|
|||||||
Reference in New Issue
Block a user