static void http_progress_play_priv_data_init (HTTPStreaming *httpstreaming, RequestData *request_data, HTTPStreamingPrivateData *priv_data) { priv_data->job = gstreamill_get_job (httpstreaming->gstreamill, request_data->uri); priv_data->livejob_age = priv_data->job->age; priv_data->chunk_size = 0; priv_data->send_count = 2; priv_data->chunk_size_str = g_strdup (""); priv_data->chunk_size_str_len = 0; request_data->priv_data = priv_data; request_data->bytes_send = 0; }
/** * gstreamill_unaccess: * @uri: (in): job access uri. * * current_access minus 1. * * Returns: none */ void gstreamill_unaccess (Gstreamill *gstreamill, gchar *uri) { Job *job; job = gstreamill_get_job (gstreamill, uri); if (job == NULL) { GST_ERROR ("Job %s not found.", uri); return; } g_mutex_lock (&(job->access_mutex)); job->current_access -= 1; g_mutex_unlock (&(job->access_mutex)); return; }
/** * gstreamill_get_encoder_output: * @uri: (in): access uri, e.g. /live/test/encoder/0 * * Get the EncoderOutput by access uri. * * Returns: the encoder output */ EncoderOutput * gstreamill_get_encoder_output (Gstreamill *gstreamill, gchar *uri) { Job *job; guint index; GRegex *regex = NULL; GMatchInfo *match_info = NULL; gchar *e; index = -1; regex = g_regex_new ("^/(live|dvr)/.*/encoder/(?<encoder>[0-9]+).*", G_REGEX_OPTIMIZE, 0, NULL); g_regex_match (regex, uri, 0, &match_info); if (g_match_info_matches (match_info)) { e = g_match_info_fetch_named (match_info, "encoder"); index = g_ascii_strtoll (e, NULL, 10); g_free (e); } if (match_info != NULL) { g_match_info_free (match_info); } if (regex != NULL) { g_regex_unref (regex); } if (index == -1) { GST_INFO ("Not a encoder uri: %s", uri); return NULL; } job = gstreamill_get_job (gstreamill, uri); if (job == NULL) { GST_ERROR ("Job %s not found.", uri); return NULL; } if (*(job->output->state) != JOB_STATE_PLAYING) { GST_ERROR ("FATAL: Job %s state is not playing", job->name); return NULL; } if (index >= job->output->encoder_count) { GST_ERROR ("Encoder %s not found.", uri); return NULL; } g_mutex_lock (&(job->access_mutex)); job->current_access += 1; g_mutex_unlock (&(job->access_mutex)); return &job->output->encoders[index]; }
/** * gstreamill_get_master_m3u8playlist: * @uri: (in): job uri * * Get Job's master playlist. * * Returns: master m3u8 playlist */ gchar * gstreamill_get_master_m3u8playlist (Gstreamill *gstreamill, gchar *uri) { Job *job; gchar *master_m3u8_playlist; job = gstreamill_get_job (gstreamill, uri); if (job == NULL) { GST_ERROR ("Job %s not found.", uri); return NULL; } if (job->output->master_m3u8_playlist == NULL) { master_m3u8_playlist = NULL; } else { master_m3u8_playlist = g_strdup (job->output->master_m3u8_playlist); } return master_m3u8_playlist; }
/** * gstreamill_get_master_m3u8playlist: * @uri: (in): job uri * * Get Job's master playlist. * * Returns: master m3u8 playlist */ gchar * gstreamill_get_master_m3u8playlist (Gstreamill *gstreamill, gchar *uri) { Job *job; gchar *master_m3u8_playlist, *p; job = gstreamill_get_job (gstreamill, uri); if (job == NULL) { GST_ERROR ("Job %s not found.", uri); return NULL; } p = g_strdup_printf ("/live/%s/playlist.m3u8", job->name); if (g_strcmp0 (p, uri) == 0) { master_m3u8_playlist = g_strdup (job->output->master_m3u8_playlist); } else { master_m3u8_playlist = NULL; } g_free (p); return master_m3u8_playlist; }