#define MMPLAYER_USE_FILE_FOR_BUFFERING(player) \
(((player)->profile.uri_type != MM_PLAYER_URI_TYPE_HLS) && \
- (player->ini.http_use_file_buffer) && \
- (player->http_file_buffering_path) && \
- (strlen(player->http_file_buffering_path) > 0) )
+ (player->ini.http_use_file_buffer) && \
+ (player->http_file_buffering_path) && \
+ (strlen(player->http_file_buffering_path) > 0))
#define MM_PLAYER_NAME "mmplayer"
/*---------------------------------------------------------------------------
static GstElement * __mmplayer_create_decodebin(mm_player_t* player);
static gboolean __mmplayer_try_to_plug_decodebin(mm_player_t* player, GstPad *srcpad, const GstCaps *caps);
-static void __mmplayer_typefind_have_type( GstElement *tf, guint probability, GstCaps *caps, gpointer data);
+static void __mmplayer_typefind_have_type( GstElement *tf, guint probability, GstCaps *caps, gpointer data);
static gboolean __mmplayer_try_to_plug(mm_player_t* player, GstPad *pad, const GstCaps *caps);
static void __mmplayer_pipeline_complete(GstElement *decodebin, gpointer data);
static gboolean __mmplayer_is_midi_type(gchar* str_caps);
-static gboolean __mmplayer_is_only_mp3_type (gchar *str_caps);
+static gboolean __mmplayer_is_only_mp3_type(gchar *str_caps);
static void __mmplayer_set_audio_attrs(mm_player_t* player, GstCaps* caps);
//static void __mmplayer_check_video_zero_cpoy(mm_player_t* player, GstElementFactory* factory);
static gboolean __mmplayer_feature_filter(GstPluginFeature *feature, gpointer data);
static void __mmplayer_add_new_pad(GstElement *element, GstPad *pad, gpointer data);
-static void __mmplayer_gst_rtp_no_more_pads (GstElement *element, gpointer data);
-//static void __mmplayer_gst_wfd_dynamic_pad (GstElement *element, GstPad *pad, gpointer data);
-static void __mmplayer_gst_rtp_dynamic_pad (GstElement *element, GstPad *pad, gpointer data);
-static gboolean __mmplayer_get_stream_service_type( mm_player_t* player );
-static gboolean __mmplayer_update_subtitle( GstElement* object, GstBuffer *buffer, GstPad *pad, gpointer data);
+static void __mmplayer_gst_rtp_no_more_pads(GstElement *element, gpointer data);
+//static void __mmplayer_gst_wfd_dynamic_pad(GstElement *element, GstPad *pad, gpointer data);
+static void __mmplayer_gst_rtp_dynamic_pad(GstElement *element, GstPad *pad, gpointer data);
+static gboolean __mmplayer_get_stream_service_type(mm_player_t* player);
+static gboolean __mmplayer_update_subtitle(GstElement* object, GstBuffer *buffer, GstPad *pad, gpointer data);
static void __mmplayer_init_factories(mm_player_t* player);
static void __mmplayer_release_misc(mm_player_t* player);
static void __mmplayer_release_misc_post(mm_player_t* player);
static gboolean __mmplayer_init_gstreamer(mm_player_t* player);
-static GstBusSyncReply __mmplayer_bus_sync_callback (GstBus * bus, GstMessage * message, gpointer data);
+static GstBusSyncReply __mmplayer_bus_sync_callback(GstBus * bus, GstMessage * message, gpointer data);
static gboolean __mmplayer_gst_callback(GstBus *bus, GstMessage *msg, gpointer data);
static gboolean __mmplayer_gst_extract_tag_from_msg(mm_player_t* player, GstMessage *msg);
static gboolean __mmplayer_gst_handle_duration(mm_player_t* player, GstMessage* msg);
-int __mmplayer_switch_audio_sink (mm_player_t* player);
+int __mmplayer_switch_audio_sink(mm_player_t* player);
static gboolean __mmplayer_gst_remove_fakesink(mm_player_t* player, MMPlayerGstElement* fakesink);
-static GstPadProbeReturn __mmplayer_audio_stream_probe (GstPad *pad, GstPadProbeInfo *info, gpointer u_data);
+static GstPadProbeReturn __mmplayer_audio_stream_probe(GstPad *pad, GstPadProbeInfo *info, gpointer u_data);
static void __mmplayer_video_stream_decoded_preroll_cb(GstElement* object, GstBuffer *buffer, GstPad *pad, gpointer data);
static void __mmplayer_video_stream_decoded_render_cb(GstElement* object, GstBuffer *buffer, GstPad *pad, gpointer data);
-static GstPadProbeReturn __mmplayer_subtitle_adjust_position_probe (GstPad *pad, GstPadProbeInfo *info, gpointer u_data);
-static int __mmplayer_change_selector_pad (mm_player_t* player, MMPlayerTrackType type, int index);
+static GstPadProbeReturn __mmplayer_subtitle_adjust_position_probe(GstPad *pad, GstPadProbeInfo *info, gpointer u_data);
+static int __mmplayer_change_selector_pad(mm_player_t* player, MMPlayerTrackType type, int index);
-static gboolean __mmplayer_check_subtitle( mm_player_t* player );
-static gboolean __mmplayer_handle_streaming_error ( mm_player_t* player, GstMessage * message );
-static void __mmplayer_handle_eos_delay( mm_player_t* player, int delay_in_ms );
-static void __mmplayer_cancel_eos_timer( mm_player_t* player );
+static gboolean __mmplayer_check_subtitle(mm_player_t* player);
+static gboolean __mmplayer_handle_streaming_error (mm_player_t* player, GstMessage * message);
+static void __mmplayer_handle_eos_delay(mm_player_t* player, int delay_in_ms);
+static void __mmplayer_cancel_eos_timer(mm_player_t* player);
static gboolean __mmplayer_eos_timer_cb(gpointer u_data);
-static gboolean __mmplayer_link_decoder( mm_player_t* player,GstPad *srcpad);
-static gboolean __mmplayer_link_sink( mm_player_t* player,GstPad *srcpad);
+static gboolean __mmplayer_link_decoder(mm_player_t* player,GstPad *srcpad);
+static gboolean __mmplayer_link_sink(mm_player_t* player,GstPad *srcpad);
static int __mmplayer_handle_missed_plugin(mm_player_t* player);
static int __mmplayer_check_not_supported_codec(mm_player_t* player, const gchar* factory_class, const gchar* mime);
static gboolean __mmplayer_configure_audio_callback(mm_player_t* player);
-static void __mmplayer_add_sink( mm_player_t* player, GstElement* sink);
-static void __mmplayer_del_sink( mm_player_t* player, GstElement* sink);
+static void __mmplayer_add_sink(mm_player_t* player, GstElement* sink);
+static void __mmplayer_del_sink(mm_player_t* player, GstElement* sink);
static void __mmplayer_release_signal_connection(mm_player_t* player, MMPlayerSignalType type);
static gpointer __mmplayer_next_play_thread(gpointer data);
static gpointer __mmplayer_repeat_thread(gpointer data);
static gboolean __mmplayer_add_dump_buffer_probe(mm_player_t *player, GstElement *element);
static GstPadProbeReturn __mmplayer_dump_buffer_probe_cb(GstPad *pad, GstPadProbeInfo *info, gpointer u_data);
-static void __mmplayer_release_dump_list (GList *dump_list);
+static void __mmplayer_release_dump_list(GList *dump_list);
static int __gst_realize(mm_player_t* player);
static int __gst_unrealize(mm_player_t* player);
static int __gst_resume(mm_player_t* player, gboolean async);
static gboolean __gst_seek(mm_player_t* player, GstElement * element, gdouble rate,
GstFormat format, GstSeekFlags flags, GstSeekType cur_type,
- gint64 cur, GstSeekType stop_type, gint64 stop );
-static int __gst_pending_seek ( mm_player_t* player );
+ gint64 cur, GstSeekType stop_type, gint64 stop);
+static int __gst_pending_seek(mm_player_t* player);
static int __gst_set_position(mm_player_t* player, int format, unsigned long position, gboolean internal_called);
static int __gst_get_position(mm_player_t* player, int format, unsigned long *position);
static int __gst_adjust_subtitle_position(mm_player_t* player, int format, int position);
static int __gst_set_message_callback(mm_player_t* player, MMMessageCallback callback, gpointer user_param);
-static gboolean __gst_send_event_to_sink( mm_player_t* player, GstEvent* event );
+static gboolean __gst_send_event_to_sink(mm_player_t* player, GstEvent* event);
static int __mmplayer_set_pcm_extraction(mm_player_t* player);
-static gboolean __mmplayer_can_extract_pcm( mm_player_t* player );
+static gboolean __mmplayer_can_extract_pcm(mm_player_t* player);
/*fadeout */
static void __mmplayer_do_sound_fadedown(mm_player_t* player, unsigned int time);
static void __gst_appsrc_feed_subtitle_data(GstElement *element, guint size, gpointer user_data);
static void __gst_appsrc_enough_audio_data(GstElement *element, gpointer user_data);
static void __gst_appsrc_enough_video_data(GstElement *element, gpointer user_data);
-static gboolean __gst_seek_audio_data (GstElement * appsrc, guint64 position, gpointer user_data);
-static gboolean __gst_seek_video_data (GstElement * appsrc, guint64 position, gpointer user_data);
-static gboolean __gst_seek_subtitle_data (GstElement * appsrc, guint64 position, gpointer user_data);
-static void __mmplayer_gst_caps_notify_cb (GstPad * pad, GParamSpec * unused, gpointer data);
+static gboolean __gst_seek_audio_data(GstElement * appsrc, guint64 position, gpointer user_data);
+static gboolean __gst_seek_video_data(GstElement * appsrc, guint64 position, gpointer user_data);
+static gboolean __gst_seek_subtitle_data(GstElement * appsrc, guint64 position, gpointer user_data);
+static void __mmplayer_gst_caps_notify_cb(GstPad * pad, GParamSpec * unused, gpointer data);
static void __mmplayer_audio_stream_clear_buffer(mm_player_t* player, gboolean send_all);
static void __mmplayer_audio_stream_send_data(mm_player_t* player, mm_player_audio_stream_buff_t *a_buffer);
#if 0 //debug
static void
-print_tag (const GstTagList * list, const gchar * tag, gpointer unused)
+print_tag(const GstTagList * list, const gchar * tag, gpointer unused)
{
gint i, count;
- count = gst_tag_list_get_tag_size (list, tag);
+ count = gst_tag_list_get_tag_size(list, tag);
LOGD("count = %d", count);
for (i = 0; i < count; i++) {
gchar *str;
- if (gst_tag_get_type (tag) == G_TYPE_STRING) {
- if (!gst_tag_list_get_string_index (list, tag, i, &str))
- g_assert_not_reached ();
+ if (gst_tag_get_type(tag) == G_TYPE_STRING) {
+ if (!gst_tag_list_get_string_index(list, tag, i, &str))
+ g_assert_not_reached();
} else {
str =
- g_strdup_value_contents (gst_tag_list_get_value_index (list, tag, i));
+ g_strdup_value_contents(gst_tag_list_get_value_index(list, tag, i));
}
if (i == 0) {
- g_print (" %15s: %s\n", gst_tag_get_nick (tag), str);
+ g_print(" %15s: %s\n", gst_tag_get_nick(tag), str);
} else {
- g_print (" : %s\n", str);
+ g_print(" : %s\n", str);
}
- g_free (str);
+ g_free(str);
}
}
#endif
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, FALSE );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
/* check player state here */
- if ( MMPLAYER_CURRENT_STATE(player) != MM_PLAYER_STATE_PAUSED &&
- MMPLAYER_CURRENT_STATE(player) != MM_PLAYER_STATE_PLAYING )
+ if (MMPLAYER_CURRENT_STATE(player) != MM_PLAYER_STATE_PAUSED &&
+ MMPLAYER_CURRENT_STATE(player) != MM_PLAYER_STATE_PLAYING)
{
/* give warning now only */
LOGW("be careful. content attributes may not available in this state ");
/* get content attribute first */
attrs = MMPLAYER_GET_ATTRS(player);
- if ( !attrs )
+ if (!attrs)
{
LOGE("cannot get content attribute");
return FALSE;
/* get update flag */
- if ( flag & ATTR_MISSING_ONLY )
+ if (flag & ATTR_MISSING_ONLY)
{
missing_only = TRUE;
LOGD("updating missed attr only");
}
- if ( flag & ATTR_ALL )
+ if (flag & ATTR_ALL)
{
all = TRUE;
has_duration = FALSE;
LOGD("updating all attrs");
}
- if ( missing_only && all )
+ if (missing_only && all)
{
LOGW("cannot use ATTR_MISSING_ONLY and ATTR_ALL. ignoring ATTR_MISSING_ONLY flag!");
missing_only = FALSE;
}
- if ( (flag & ATTR_DURATION) || (!has_duration && missing_only) || all )
+ if ((flag & ATTR_DURATION) || (!has_duration && missing_only) || all)
{
LOGD("try to update duration");
has_duration = FALSE;
- if (gst_element_query_duration(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &dur_nsec ))
+ if (gst_element_query_duration(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &dur_nsec))
{
player->duration = dur_nsec;
LOGW("duration : %lld msec", GST_TIME_AS_MSECONDS(dur_nsec));
}
/* try to get streaming service type */
- stream_service_type = __mmplayer_get_stream_service_type( player );
- mm_attrs_set_int_by_name ( attrs, "streaming_type", stream_service_type );
+ stream_service_type = __mmplayer_get_stream_service_type(player);
+ mm_attrs_set_int_by_name(attrs, "streaming_type", stream_service_type);
/* check duration is OK */
- if ( dur_nsec == 0 && !MMPLAYER_IS_LIVE_STREAMING( player ) )
+ if (dur_nsec == 0 && !MMPLAYER_IS_LIVE_STREAMING(player))
{
/* FIXIT : find another way to get duration here. */
LOGE("finally it's failed to get duration from pipeline. progressbar will not work correctely!");
}
}
- if ( (flag & ATTR_AUDIO) || (!has_audio_attrs && missing_only) || all )
+ if ((flag & ATTR_AUDIO) || (!has_audio_attrs && missing_only) || all)
{
/* update audio params
NOTE : We need original audio params and it can be only obtained from src pad of audio
LOGD("try to update audio attrs");
has_audio_attrs = FALSE;
- if ( player->pipeline->audiobin &&
- player->pipeline->audiobin[MMPLAYER_A_SINK].gst )
+ if (player->pipeline->audiobin &&
+ player->pipeline->audiobin[MMPLAYER_A_SINK].gst)
{
GstCaps *caps_a = NULL;
GstPad* pad = NULL;
gint samplerate = 0, channels = 0;
pad = gst_element_get_static_pad(
- player->pipeline->audiobin[MMPLAYER_A_CONV].gst, "sink" );
+ player->pipeline->audiobin[MMPLAYER_A_CONV].gst, "sink");
- if ( pad )
+ if (pad)
{
- caps_a = gst_pad_get_current_caps( pad );
+ caps_a = gst_pad_get_current_caps(pad);
- if ( caps_a )
+ if (caps_a)
{
- p = gst_caps_get_structure (caps_a, 0);
+ p = gst_caps_get_structure(caps_a, 0);
mm_attrs_get_int_by_name(attrs, "content_audio_samplerate", &samplerate);
- gst_structure_get_int (p, "rate", &samplerate);
+ gst_structure_get_int(p, "rate", &samplerate);
mm_attrs_set_int_by_name(attrs, "content_audio_samplerate", samplerate);
- gst_structure_get_int (p, "channels", &channels);
+ gst_structure_get_int(p, "channels", &channels);
mm_attrs_set_int_by_name(attrs, "content_audio_channels", channels);
SECURE_LOGD("samplerate : %d channels : %d", samplerate, channels);
- gst_caps_unref( caps_a );
+ gst_caps_unref(caps_a);
caps_a = NULL;
has_audio_attrs = TRUE;
LOGW("not ready to get audio caps");
}
- gst_object_unref( pad );
+ gst_object_unref(pad);
}
else
{
}
}
- if ( (flag & ATTR_VIDEO) || (!has_video_attrs && missing_only) || all )
+ if ((flag & ATTR_VIDEO) || (!has_video_attrs && missing_only) || all)
{
LOGD("try to update video attrs");
has_video_attrs = FALSE;
- if ( player->pipeline->videobin &&
- player->pipeline->videobin[MMPLAYER_V_SINK].gst )
+ if (player->pipeline->videobin &&
+ player->pipeline->videobin[MMPLAYER_V_SINK].gst)
{
GstCaps *caps_v = NULL;
GstPad* pad = NULL;
gint tmpNu, tmpDe;
gint width, height;
- pad = gst_element_get_static_pad( player->pipeline->videobin[MMPLAYER_V_SINK].gst, "sink" );
- if ( pad )
+ pad = gst_element_get_static_pad(player->pipeline->videobin[MMPLAYER_V_SINK].gst, "sink");
+ if (pad)
{
- caps_v = gst_pad_get_current_caps( pad );
+ caps_v = gst_pad_get_current_caps(pad);
/* Use v_stream_caps, if fail to get video_sink sink pad*/
if (!caps_v && player->v_stream_caps)
if (caps_v)
{
- p = gst_caps_get_structure (caps_v, 0);
- gst_structure_get_int (p, "width", &width);
+ p = gst_caps_get_structure(caps_v, 0);
+ gst_structure_get_int(p, "width", &width);
mm_attrs_set_int_by_name(attrs, "content_video_width", width);
- gst_structure_get_int (p, "height", &height);
+ gst_structure_get_int(p, "height", &height);
mm_attrs_set_int_by_name(attrs, "content_video_height", height);
- gst_structure_get_fraction (p, "framerate", &tmpNu, &tmpDe);
+ gst_structure_get_fraction(p, "framerate", &tmpNu, &tmpDe);
- SECURE_LOGD("width : %d height : %d", width, height );
+ SECURE_LOGD("width : %d height : %d", width, height);
- gst_caps_unref( caps_v );
+ gst_caps_unref(caps_v);
caps_v = NULL;
if (tmpDe > 0)
{
LOGD("no negitiated caps from videosink");
}
- gst_object_unref( pad );
+ gst_object_unref(pad);
pad = NULL;
}
else
}
- if ( (flag & ATTR_BITRATE) || (!has_bitrate && missing_only) || all )
+ if ((flag & ATTR_BITRATE) || (!has_bitrate && missing_only) || all)
{
has_bitrate = FALSE;
if (MMPLAYER_IS_RTSP_STREAMING(player))
{
- if(player->total_bitrate)
+ if (player->total_bitrate)
{
mm_attrs_set_int_by_name(attrs, "content_video_bitrate", player->total_bitrate);
has_bitrate = TRUE;
}
/* validate all */
- if ( mmf_attrs_commit ( attrs ) )
+ if ( mmf_attrs_commit(attrs))
{
LOGE("failed to update attributes\n");
return FALSE;
return TRUE;
}
-static gboolean __mmplayer_get_stream_service_type( mm_player_t* player )
+static gboolean __mmplayer_get_stream_service_type(mm_player_t* player)
{
gint streaming_type = STREAMING_SERVICE_NONE;
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL ( player &&
+ MMPLAYER_RETURN_VAL_IF_FAIL(player &&
player->pipeline &&
player->pipeline->mainbin &&
player->pipeline->mainbin[MMPLAYER_M_SRC].gst,
- FALSE );
+ FALSE);
/* streaming service type if streaming */
- if ( ! MMPLAYER_IS_STREAMING(player) )
+ if (!MMPLAYER_IS_STREAMING(player))
return STREAMING_SERVICE_NONE;
if (MMPLAYER_IS_HTTP_STREAMING(player))
STREAMING_SERVICE_LIVE : STREAMING_SERVICE_VOD;
}
- switch ( streaming_type )
+ switch (streaming_type)
{
case STREAMING_SERVICE_LIVE:
LOGD("it's live streaming");
gboolean interrupted_by_resource = FALSE;
int ret = MM_ERROR_NONE;
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, FALSE );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
- if ( MMPLAYER_CURRENT_STATE(player) == state )
+ if (MMPLAYER_CURRENT_STATE(player) == state)
{
LOGW("already same state(%s)\n", MMPLAYER_STATE_GET_NAME(state));
MMPLAYER_PENDING_STATE(player) = MM_PLAYER_STATE_NONE;
MMPLAYER_CURRENT_STATE(player) = state;
/* FIXIT : it's better to do like below code
- if ( MMPLAYER_CURRENT_STATE(player) == MMPLAYER_TARGET_STATE(player) )
+ if (MMPLAYER_CURRENT_STATE(player) == MMPLAYER_TARGET_STATE(player))
MMPLAYER_PENDING_STATE(player) = MM_PLAYER_STATE_NONE;
and add more code to handling PENDING_STATE.
*/
- if ( MMPLAYER_CURRENT_STATE(player) == MMPLAYER_PENDING_STATE(player) )
+ if (MMPLAYER_CURRENT_STATE(player) == MMPLAYER_PENDING_STATE(player))
MMPLAYER_PENDING_STATE(player) = MM_PLAYER_STATE_NONE;
/* print state */
interrupted_by_focus = player->sound_focus.by_asm_cb;
interrupted_by_resource = player->resource_manager.by_rm_cb;
- switch ( MMPLAYER_CURRENT_STATE(player) )
+ switch (MMPLAYER_CURRENT_STATE(player))
{
case MM_PLAYER_STATE_NULL:
case MM_PLAYER_STATE_READY:
if (player->cmd == MMPLAYER_COMMAND_STOP)
{
sound_result = _mmplayer_sound_release_focus(&player->sound_focus);
- if ( sound_result != MM_ERROR_NONE )
+ if (sound_result != MM_ERROR_NONE)
{
LOGE("failed to release sound focus\n");
return MM_ERROR_POLICY_INTERNAL;
case MM_PLAYER_STATE_PAUSED:
{
- if ( ! player->sent_bos )
+ if (!player->sent_bos)
{
int found = 0;
#define MMPLAYER_MAX_SOUND_PRIORITY 3
/* it's first time to update all content attrs. */
- _mmplayer_update_content_attrs( player, ATTR_ALL );
+ _mmplayer_update_content_attrs(player, ATTR_ALL);
/* set max sound priority to keep own sound and not to mute other's one */
mm_attrs_get_int_by_name(player->attrs, "content_video_found", &found);
if (found)
}
/* add audio callback probe if condition is satisfied */
- if ( ! player->audio_cb_probe_id && player->set_mode.pcm_extraction && !player->audio_stream_render_cb_ex)
+ if (!player->audio_cb_probe_id && player->set_mode.pcm_extraction && !player->audio_stream_render_cb_ex)
{
__mmplayer_configure_audio_callback(player);
/* FIXIT : handle return value */
if (!MMPLAYER_IS_STREAMING(player) || (player->streamer && !player->streamer->is_buffering))
{
sound_result = _mmplayer_sound_release_focus(&player->sound_focus);
- if ( sound_result != MM_ERROR_NONE )
+ if (sound_result != MM_ERROR_NONE)
{
LOGE("failed to release sound focus\n");
return MM_ERROR_POLICY_INTERNAL;
case MM_PLAYER_STATE_PLAYING:
{
/* try to get content metadata */
- if ( ! player->sent_bos )
+ if (!player->sent_bos)
{
/* NOTE : giving ATTR_MISSING_ONLY may have dependency with
* c-api since c-api doesn't use _start() anymore. It may not work propery with
* legacy mmfw-player api */
- _mmplayer_update_content_attrs( player, ATTR_MISSING_ONLY);
+ _mmplayer_update_content_attrs(player, ATTR_MISSING_ONLY);
}
- if ( (player->cmd == MMPLAYER_COMMAND_START) || (player->cmd == MMPLAYER_COMMAND_RESUME) )
+ if ((player->cmd == MMPLAYER_COMMAND_START) || (player->cmd == MMPLAYER_COMMAND_RESUME))
{
if (!player->sent_bos)
{
- __mmplayer_handle_missed_plugin ( player );
+ __mmplayer_handle_missed_plugin(player);
}
sound_result = _mmplayer_sound_acquire_focus(&player->sound_focus);
if (sound_result != MM_ERROR_NONE)
msg.union_type = MM_MSG_UNION_CODE;
msg.code = MM_ERROR_POLICY_INTERRUPTED;
- MMPLAYER_POST_MSG( player, MM_MESSAGE_STATE_INTERRUPTED, &msg);
+ MMPLAYER_POST_MSG(player, MM_MESSAGE_STATE_INTERRUPTED, &msg);
_mmplayer_unrealize((MMHandleType)player);
}
}
}
- if ( player->resumed_by_rewind && player->playback_rate < 0.0 )
+ if (player->resumed_by_rewind && player->playback_rate < 0.0)
{
/* initialize because auto resume is done well. */
player->resumed_by_rewind = FALSE;
player->playback_rate = 1.0;
}
- if ( !player->sent_bos )
+ if (!player->sent_bos)
{
/* check audio codec field is set or not
* we can get it from typefinder or codec's caps.
* Because, parser don't make related TAG.
* So, if it's not set yet, fill it with found data.
*/
- if ( ! audio_codec )
+ if (!audio_codec)
{
- if ( g_strrstr(player->type, "audio/midi"))
+ if (g_strrstr(player->type, "audio/midi"))
{
audio_codec = g_strdup("MIDI");
}
- else if ( g_strrstr(player->type, "audio/x-amr"))
+ else if (g_strrstr(player->type, "audio/x-amr"))
{
audio_codec = g_strdup("AMR");
}
- else if ( g_strrstr(player->type, "audio/mpeg") && !g_strrstr(player->type, "mpegversion=(int)1"))
+ else if (g_strrstr(player->type, "audio/mpeg") && !g_strrstr(player->type, "mpegversion= (int)1"))
{
audio_codec = g_strdup("AAC");
}
msg.state.previous = MMPLAYER_PREV_STATE(player);
msg.state.current = MMPLAYER_CURRENT_STATE(player);
- LOGD ("player reach the target state (%s)", MMPLAYER_STATE_GET_NAME(MMPLAYER_TARGET_STATE(player)));
+ LOGD("player reach the target state (%s)", MMPLAYER_STATE_GET_NAME(MMPLAYER_TARGET_STATE(player)));
/* state changed by focus or resource callback */
- if ( interrupted_by_focus || interrupted_by_resource )
+ if (interrupted_by_focus || interrupted_by_resource)
{
msg.union_type = MM_MSG_UNION_CODE;
if (interrupted_by_focus)
msg.code = player->sound_focus.focus_changed_msg; /* FIXME: player.c convert function have to be modified. */
else if (interrupted_by_resource)
msg.code = MM_MSG_CODE_INTERRUPTED_BY_RESOURCE_CONFLICT;
- MMPLAYER_POST_MSG( player, MM_MESSAGE_STATE_INTERRUPTED, &msg );
+ MMPLAYER_POST_MSG(player, MM_MESSAGE_STATE_INTERRUPTED, &msg);
}
/* state changed by usecase */
else
{
- MMPLAYER_POST_MSG( player, MM_MESSAGE_STATE_CHANGED, &msg );
+ MMPLAYER_POST_MSG(player, MM_MESSAGE_STATE_CHANGED, &msg);
}
}
else
{
- LOGD ("intermediate state, do nothing.\n");
+ LOGD("intermediate state, do nothing.\n");
MMPLAYER_PRINT_STATE(player);
return ret;
}
- if ( post_bos )
+ if (post_bos)
{
- MMPLAYER_POST_MSG ( player, MM_MESSAGE_BEGIN_OF_STREAM, NULL );
+ MMPLAYER_POST_MSG(player, MM_MESSAGE_BEGIN_OF_STREAM, NULL);
player->sent_bos = TRUE;
}
mm_player_t* player = (mm_player_t*) data;
MMPlayerGstElement *mainbin = NULL;
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, NULL );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, NULL);
g_mutex_lock(&player->next_play_thread_mutex);
- while ( ! player->next_play_thread_exit )
+ while (!player->next_play_thread_exit)
{
LOGD("next play thread started. waiting for signal.\n");
- g_cond_wait(&player->next_play_thread_cond, &player->next_play_thread_mutex );
+ g_cond_wait(&player->next_play_thread_cond, &player->next_play_thread_mutex);
LOGD("reconfigure pipeline for gapless play.\n");
- if ( player->next_play_thread_exit )
+ if (player->next_play_thread_exit)
{
- if(player->gapless.reconfigure)
+ if (player->gapless.reconfigure)
{
player->gapless.reconfigure = false;
MMPLAYER_PLAYBACK_UNLOCK(player);
MMHandleType attrs = 0;
gint count = 0;
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, NULL );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, NULL);
g_mutex_lock(&player->repeat_thread_mutex);
- while ( ! player->repeat_thread_exit )
+ while (!player->repeat_thread_exit)
{
LOGD("repeat thread started. waiting for signal.\n");
- g_cond_wait(&player->repeat_thread_cond, &player->repeat_thread_mutex );
+ g_cond_wait(&player->repeat_thread_cond, &player->repeat_thread_mutex);
- if ( player->repeat_thread_exit )
+ if (player->repeat_thread_exit)
{
LOGD("exiting repeat thread\n");
break;
break;
}
- if ( player->section_repeat )
+ if (player->section_repeat)
{
ret_value = _mmplayer_activate_section_repeat((MMHandleType)player, player->section_repeat_start, player->section_repeat_end);
}
else
{
- if ( player->playback_rate < 0.0 )
+ if (player->playback_rate < 0.0)
{
player->resumed_by_rewind = TRUE;
_mmplayer_set_mute((MMHandleType)player, 0);
- MMPLAYER_POST_MSG( player, MM_MESSAGE_RESUMED_BY_REW, NULL );
+ MMPLAYER_POST_MSG(player, MM_MESSAGE_RESUMED_BY_REW, NULL);
}
- ret_value = __gst_seek( player, player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, player->playback_rate,
+ ret_value = __gst_seek(player, player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, player->playback_rate,
GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH, GST_SEEK_TYPE_SET,
0, GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE);
player->sent_bos = FALSE;
}
- if ( ! ret_value )
+ if (!ret_value)
{
LOGE("failed to set position to zero for rewind\n");
continue;
}
/* decrease play count */
- if ( count > 1 )
+ if (count > 1)
{
/* we successeded to rewind. update play count and then wait for next EOS */
count--;
mm_attrs_set_int_by_name(attrs, "profile_play_count", count);
/* commit attribute */
- if ( mmf_attrs_commit ( attrs ) )
+ if (mmf_attrs_commit(attrs))
{
LOGE("failed to commit attribute\n");
}
unsigned long pos_msec = 0;
struct stat sb;
- MMPLAYER_RETURN_IF_FAIL( player && player->pipeline && player->pipeline->mainbin);
+ MMPLAYER_RETURN_IF_FAIL(player && player->pipeline && player->pipeline->mainbin);
__gst_get_position(player, MM_PLAYER_POS_FORMAT_TIME, &pos_msec); // update last_position
attrs = MMPLAYER_GET_ATTRS(player);
- if ( !attrs )
+ if (!attrs)
{
LOGE("fail to get attributes.\n");
return;
}
static int
-__mmplayer_handle_buffering_message ( mm_player_t* player )
+__mmplayer_handle_buffering_message(mm_player_t* player)
{
int ret = MM_ERROR_NONE;
MMPlayerStateType prev_state = MM_PLAYER_STATE_NONE;
MMPlayerStateType target_state = MM_PLAYER_STATE_NONE;
MMPlayerStateType pending_state = MM_PLAYER_STATE_NONE;
- if( !player || !player->streamer || (MMPLAYER_IS_LIVE_STREAMING(player) && MMPLAYER_IS_RTSP_STREAMING(player)))
+ if (!player || !player->streamer || (MMPLAYER_IS_LIVE_STREAMING(player) && MMPLAYER_IS_RTSP_STREAMING(player)))
{
LOGW("do nothing for buffering msg\n");
ret = MM_ERROR_PLAYER_INVALID_STATE;
target_state = MMPLAYER_TARGET_STATE(player);
pending_state = MMPLAYER_PENDING_STATE(player);
- LOGD( "player state : prev %s, current %s, pending %s, target %s, buffering %d",
+ LOGD("player state : prev %s, current %s, pending %s, target %s, buffering %d",
MMPLAYER_STATE_GET_NAME(prev_state),
MMPLAYER_STATE_GET_NAME(current_state),
MMPLAYER_STATE_GET_NAME(pending_state),
MMPLAYER_STATE_GET_NAME(target_state),
player->streamer->is_buffering);
- if ( !player->streamer->is_buffering )
+ if (!player->streamer->is_buffering)
{
/* NOTE : if buffering has done, player has to go to target state. */
- switch ( target_state )
+ switch (target_state)
{
case MM_PLAYER_STATE_PAUSED :
{
- switch ( pending_state )
+ switch (pending_state)
{
case MM_PLAYER_STATE_PLAYING:
{
- __gst_pause ( player, TRUE );
+ __gst_pause(player, TRUE);
}
break;
case MM_PLAYER_STATE_READY:
default :
{
- LOGW("invalid pending state [%s].\n", MMPLAYER_STATE_GET_NAME(pending_state) );
+ LOGW("invalid pending state [%s].\n", MMPLAYER_STATE_GET_NAME(pending_state));
}
break;
}
case MM_PLAYER_STATE_PLAYING :
{
- switch ( pending_state )
+ switch (pending_state)
{
case MM_PLAYER_STATE_NONE:
{
if (current_state != MM_PLAYER_STATE_PLAYING)
- __gst_resume ( player, TRUE );
+ __gst_resume(player, TRUE);
}
break;
/* NOTE: It should be worked as asynchronously.
* Because, buffering can be completed during autoplugging when pipeline would try to go playing state directly.
*/
- __gst_resume ( player, TRUE );
+ __gst_resume(player, TRUE);
}
break;
case MM_PLAYER_STATE_READY:
default :
{
- LOGW("invalid pending state [%s].\n", MMPLAYER_STATE_GET_NAME(pending_state) );
+ LOGW("invalid pending state [%s].\n", MMPLAYER_STATE_GET_NAME(pending_state));
}
break;
}
case MM_PLAYER_STATE_NONE :
default:
{
- LOGW("invalid target state [%s].\n", MMPLAYER_STATE_GET_NAME(target_state) );
+ LOGW("invalid target state [%s].\n", MMPLAYER_STATE_GET_NAME(target_state));
}
break;
}
/* NOTE : during the buffering, pause the player for stopping pipeline clock.
* it's for stopping the pipeline clock to prevent dropping the data in sink element.
*/
- switch ( pending_state )
+ switch (pending_state)
{
case MM_PLAYER_STATE_NONE:
{
if (current_state != MM_PLAYER_STATE_PAUSED)
{
LOGD("set pause state during buffering\n");
- __gst_pause ( player, TRUE );
+ __gst_pause(player, TRUE);
// to cover the weak-signal environment.
if (MMPLAYER_IS_RTSP_STREAMING(player))
LOGD("[RTSP] seek to the buffering start point\n");
- if (__gst_get_position(player, MM_PLAYER_POS_FORMAT_TIME, &position ))
+ if (__gst_get_position(player, MM_PLAYER_POS_FORMAT_TIME, &position))
{
LOGE("failed to get position\n");
break;
case MM_PLAYER_STATE_PLAYING:
{
- __gst_pause ( player, TRUE );
+ __gst_pause(player, TRUE);
}
break;
case MM_PLAYER_STATE_READY:
default :
{
- LOGW("invalid pending state [%s].\n", MMPLAYER_STATE_GET_NAME(pending_state) );
+ LOGW("invalid pending state [%s].\n", MMPLAYER_STATE_GET_NAME(pending_state));
}
break;
}
MMPlayerGstElement *textbin;
MMPLAYER_FENTER();
- MMPLAYER_RETURN_IF_FAIL ( player &&
+ MMPLAYER_RETURN_IF_FAIL(player &&
player->pipeline &&
player->pipeline->textbin);
- MMPLAYER_RETURN_IF_FAIL (player->pipeline->textbin[MMPLAYER_T_IDENTITY].gst);
+ MMPLAYER_RETURN_IF_FAIL(player->pipeline->textbin[MMPLAYER_T_IDENTITY].gst);
textbin = player->pipeline->textbin;
g_object_set(textbin[MMPLAYER_T_IDENTITY].gst, "drop-probability", (gfloat)0.0, NULL);
g_object_set(textbin[MMPLAYER_T_FAKE_SINK].gst, "async", TRUE, NULL);
- LOGD ("non-connected with external display");
+ LOGD("non-connected with external display");
player->is_subtitle_force_drop = FALSE;
}
gboolean ret = TRUE;
static gboolean async_done = FALSE;
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, FALSE );
- MMPLAYER_RETURN_VAL_IF_FAIL ( msg && GST_IS_MESSAGE(msg), FALSE );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
+ MMPLAYER_RETURN_VAL_IF_FAIL(msg && GST_IS_MESSAGE(msg), FALSE);
- switch ( GST_MESSAGE_TYPE( msg ) )
+ switch (GST_MESSAGE_TYPE(msg))
{
case GST_MESSAGE_UNKNOWN:
LOGD("unknown message received\n");
/* NOTE : EOS event is comming multiple time. watch out it */
/* check state. we only process EOS when pipeline state goes to PLAYING */
- if ( ! (player->cmd == MMPLAYER_COMMAND_START || player->cmd == MMPLAYER_COMMAND_RESUME) )
+ if (!(player->cmd == MMPLAYER_COMMAND_START || player->cmd == MMPLAYER_COMMAND_RESUME))
{
LOGD("EOS received on non-playing state. ignoring it\n");
break;
if (player->pipeline->textbin)
__mmplayer_drop_subtitle(player, TRUE);
- if ( (player->audio_stream_cb) && (player->set_mode.pcm_extraction) && (!player->audio_stream_render_cb_ex))
+ if ((player->audio_stream_cb) && (player->set_mode.pcm_extraction) && (!player->audio_stream_render_cb_ex))
{
GstPad *pad = NULL;
- pad = gst_element_get_static_pad (player->pipeline->audiobin[MMPLAYER_A_SINK].gst, "sink");
+ pad = gst_element_get_static_pad(player->pipeline->audiobin[MMPLAYER_A_SINK].gst, "sink");
LOGD("release audio callback\n");
/* release audio callback */
- gst_pad_remove_probe (pad, player->audio_cb_probe_id);
+ gst_pad_remove_probe(pad, player->audio_cb_probe_id);
player->audio_cb_probe_id = 0;
/* audio callback should be free because it can be called even though probe remove.*/
player->audio_stream_cb = NULL;
/* get play count */
attrs = MMPLAYER_GET_ATTRS(player);
- if ( attrs )
+ if (attrs)
{
gboolean smooth_repeat = FALSE;
LOGD("remaining play count: %d, playback rate: %f\n", count, player->playback_rate);
- if ( count > 1 || count == -1 || player->playback_rate < 0.0 ) /* default value is 1 */
+ if (count > 1 || count == -1 || player->playback_rate < 0.0) /* default value is 1 */
{
- if ( smooth_repeat )
+ if (smooth_repeat)
{
LOGD("smooth repeat enabled. seeking operation will be excuted in new thread\n");
- g_cond_signal( &player->repeat_thread_cond );
+ g_cond_signal(&player->repeat_thread_cond);
break;
}
{
gint ret_value = 0;
- if ( player->section_repeat )
+ if (player->section_repeat)
{
ret_value = _mmplayer_activate_section_repeat((MMHandleType)player, player->section_repeat_start, player->section_repeat_end);
}
else
{
- if ( player->playback_rate < 0.0 )
+ if (player->playback_rate < 0.0)
{
player->resumed_by_rewind = TRUE;
_mmplayer_set_mute((MMHandleType)player, 0);
- MMPLAYER_POST_MSG( player, MM_MESSAGE_RESUMED_BY_REW, NULL );
+ MMPLAYER_POST_MSG(player, MM_MESSAGE_RESUMED_BY_REW, NULL);
}
- __mmplayer_handle_eos_delay( player, player->ini.delay_before_repeat );
+ __mmplayer_handle_eos_delay(player, player->ini.delay_before_repeat);
/* initialize */
player->sent_bos = FALSE;
}
- if ( MM_ERROR_NONE != ret_value )
+ if (MM_ERROR_NONE != ret_value)
{
LOGE("failed to set position to zero for rewind\n");
}
}
if (player->pipeline)
- MMPLAYER_GENERATE_DOT_IF_ENABLED ( player, "pipeline-status-eos" );
+ MMPLAYER_GENERATE_DOT_IF_ENABLED(player, "pipeline-status-eos");
/* post eos message to application */
- __mmplayer_handle_eos_delay( player, player->ini.eos_delay );
+ __mmplayer_handle_eos_delay(player, player->ini.eos_delay);
/* reset last position */
player->last_position = 0;
gchar* debug = NULL;
/* generating debug info before returning error */
- MMPLAYER_GENERATE_DOT_IF_ENABLED ( player, "pipeline-status-error" );
+ MMPLAYER_GENERATE_DOT_IF_ENABLED(player, "pipeline-status-error");
/* get error code */
- gst_message_parse_error( msg, &error, &debug );
+ gst_message_parse_error(msg, &error, &debug);
- if ( gst_structure_has_name ( gst_message_get_structure(msg), "streaming_error" ) )
+ if (gst_structure_has_name(gst_message_get_structure(msg), "streaming_error"))
{
/* Note : the streaming error from the streaming source is handled
* using __mmplayer_handle_streaming_error.
*/
- __mmplayer_handle_streaming_error ( player, msg );
+ __mmplayer_handle_streaming_error(player, msg);
/* dump state of all element */
- __mmplayer_dump_pipeline_state( player );
+ __mmplayer_dump_pipeline_state(player);
}
else
{
/* traslate gst error code to msl error code. then post it
* to application if needed
*/
- __mmplayer_handle_gst_error( player, msg, error );
+ __mmplayer_handle_gst_error(player, msg, error);
if (debug)
{
- LOGE ("error debug : %s", debug);
+ LOGE("error debug : %s", debug);
}
}
if (MMPLAYER_IS_HTTP_PD(player))
{
- _mmplayer_unrealize_pd_downloader ((MMHandleType)player);
+ _mmplayer_unrealize_pd_downloader((MMHandleType)player);
}
- MMPLAYER_FREEIF( debug );
- g_error_free( error );
+ MMPLAYER_FREEIF(debug);
+ g_error_free(error);
}
break;
LOGD("warning : %s\n", error->message);
LOGD("debug : %s\n", debug);
- MMPLAYER_POST_MSG( player, MM_MESSAGE_WARNING, NULL );
+ MMPLAYER_POST_MSG(player, MM_MESSAGE_WARNING, NULL);
- MMPLAYER_FREEIF( debug );
- g_error_free( error );
+ MMPLAYER_FREEIF(debug);
+ g_error_free(error);
}
break;
case GST_MESSAGE_TAG:
{
LOGD("GST_MESSAGE_TAG\n");
- if ( ! __mmplayer_gst_extract_tag_from_msg( player, msg ) )
+ if (!__mmplayer_gst_extract_tag_from_msg(player, msg))
{
LOGW("failed to extract tags from gstmessage\n");
}
/* ignore the buffering messages during building pipeline, *
* not to block the main loop */
if (MMPLAYER_CURRENT_STATE(player) <= MM_PLAYER_STATE_READY) {
- LOGW("ignore the buffering msg (state:%d)", MMPLAYER_CURRENT_STATE(player));
+ LOGW("ignore the buffering msg(state:%d)", MMPLAYER_CURRENT_STATE(player));
break;
}
{
gint buffer_percent = 0;
- gst_message_parse_buffering (msg, &buffer_percent);
+ gst_message_parse_buffering(msg, &buffer_percent);
if (buffer_percent == MAX_BUFFER_PERCENT)
{
- LOGD ("Ignored all the previous buffering msg! (got %d%%)\n", buffer_percent);
+ LOGD("Ignored all the previous buffering msg!(got %d%%)\n", buffer_percent);
player->streamer->is_buffering_done = FALSE;
}
break;
}
- MMPLAYER_CMD_LOCK( player );
+ MMPLAYER_CMD_LOCK(player);
__mmplayer_update_buffer_setting(player, msg);
- if(__mmplayer_handle_buffering_message ( player ) == MM_ERROR_NONE) {
+ if (__mmplayer_handle_buffering_message(player) == MM_ERROR_NONE) {
msg_param.connection.buffering = player->streamer->buffering_percent;
- MMPLAYER_POST_MSG ( player, MM_MESSAGE_BUFFERING, &msg_param );
+ MMPLAYER_POST_MSG(player, MM_MESSAGE_BUFFERING, &msg_param);
if (MMPLAYER_IS_RTSP_STREAMING(player) &&
(player->streamer->buffering_percent >= MAX_BUFFER_PERCENT))
{
if (MMPLAYER_TARGET_STATE(player) == MM_PLAYER_STATE_PAUSED)
{
player->doing_seek = FALSE;
- MMPLAYER_POST_MSG ( player, MM_MESSAGE_SEEK_COMPLETED, NULL );
+ MMPLAYER_POST_MSG(player, MM_MESSAGE_SEEK_COMPLETED, NULL);
}
else if (MMPLAYER_TARGET_STATE(player) == MM_PLAYER_STATE_PLAYING)
{
}
}
}
- MMPLAYER_CMD_UNLOCK( player );
+ MMPLAYER_CMD_UNLOCK(player);
}
break;
GstState newstate = GST_STATE_NULL;
GstState pending = GST_STATE_NULL;
- if ( ! ( player->pipeline && player->pipeline->mainbin ) )
+ if (!(player->pipeline && player->pipeline->mainbin))
{
LOGE("player pipeline handle is null");
break;
mainbin = player->pipeline->mainbin;
/* we only handle messages from pipeline */
- if( msg->src != (GstObject *)mainbin[MMPLAYER_M_PIPE].gst )
+ if (msg->src != (GstObject *)mainbin[MMPLAYER_M_PIPE].gst)
break;
/* get state info from msg */
- voldstate = gst_structure_get_value (gst_message_get_structure(msg), "old-state");
- vnewstate = gst_structure_get_value (gst_message_get_structure(msg), "new-state");
- vpending = gst_structure_get_value (gst_message_get_structure(msg), "pending-state");
+ voldstate = gst_structure_get_value(gst_message_get_structure(msg), "old-state");
+ vnewstate = gst_structure_get_value(gst_message_get_structure(msg), "new-state");
+ vpending = gst_structure_get_value(gst_message_get_structure(msg), "pending-state");
if (!voldstate || !vnewstate) {
LOGE("received msg has wrong format.");
LOGD("state changed [%s] : %s ---> %s final : %s\n",
GST_OBJECT_NAME(GST_MESSAGE_SRC(msg)),
- gst_element_state_get_name( (GstState)oldstate ),
- gst_element_state_get_name( (GstState)newstate ),
- gst_element_state_get_name( (GstState)pending ) );
+ gst_element_state_get_name((GstState)oldstate),
+ gst_element_state_get_name((GstState)newstate),
+ gst_element_state_get_name((GstState)pending));
if (oldstate == newstate)
{
break;
}
- switch(newstate)
+ switch (newstate)
{
case GST_STATE_VOID_PENDING:
break;
{
gboolean prepare_async = FALSE;
- if ( ! player->audio_cb_probe_id && player->set_mode.pcm_extraction && !player->audio_stream_render_cb_ex)
+ if (!player->audio_cb_probe_id && player->set_mode.pcm_extraction && !player->audio_stream_render_cb_ex)
__mmplayer_configure_audio_callback(player);
if (!player->sent_bos && oldstate == GST_STATE_READY) // managed prepare async case
LOGD("checking prepare mode for async transition - %d", prepare_async);
}
- if ( MMPLAYER_IS_STREAMING(player) || MMPLAYER_IS_MS_BUFF_SRC(player) || prepare_async )
+ if (MMPLAYER_IS_STREAMING(player) || MMPLAYER_IS_MS_BUFF_SRC(player) || prepare_async)
{
- MMPLAYER_SET_STATE ( player, MM_PLAYER_STATE_PAUSED );
+ MMPLAYER_SET_STATE(player, MM_PLAYER_STATE_PAUSED);
if (MMPLAYER_IS_STREAMING(player) && (player->streamer))
{
case GST_STATE_PLAYING:
{
- if ( MMPLAYER_IS_STREAMING(player) ) // managed prepare async case when buffering is completed
+ if (MMPLAYER_IS_STREAMING(player)) // managed prepare async case when buffering is completed
{
// pending state should be reset oyherwise, it's still playing even though it's resumed after bufferging.
if ((MMPLAYER_CURRENT_STATE(player) != MM_PLAYER_STATE_PLAYING) ||
(MMPLAYER_PENDING_STATE(player) == MM_PLAYER_STATE_PLAYING))
{
- MMPLAYER_SET_STATE ( player, MM_PLAYER_STATE_PLAYING);
+ MMPLAYER_SET_STATE(player, MM_PLAYER_STATE_PLAYING);
}
}
{
player->doing_seek = FALSE;
async_done = FALSE;
- MMPLAYER_POST_MSG ( player, MM_MESSAGE_SEEK_COMPLETED, NULL );
+ MMPLAYER_POST_MSG(player, MM_MESSAGE_SEEK_COMPLETED, NULL);
}
}
break;
GstClock *clock = NULL;
gboolean need_new_clock = FALSE;
- gst_message_parse_clock_lost (msg, &clock);
- LOGD("GST_MESSAGE_CLOCK_LOST : %s\n", (clock ? GST_OBJECT_NAME (clock) : "NULL"));
+ gst_message_parse_clock_lost(msg, &clock);
+ LOGD("GST_MESSAGE_CLOCK_LOST : %s\n", (clock ? GST_OBJECT_NAME(clock) : "NULL"));
if (!player->videodec_linked)
{
}
if (need_new_clock) {
- LOGD ("Provide clock is TRUE, do pause->resume\n");
+ LOGD("Provide clock is TRUE, do pause->resume\n");
__gst_pause(player, FALSE);
__gst_resume(player, FALSE);
}
case GST_MESSAGE_NEW_CLOCK:
{
GstClock *clock = NULL;
- gst_message_parse_new_clock (msg, &clock);
- LOGD("GST_MESSAGE_NEW_CLOCK : %s\n", (clock ? GST_OBJECT_NAME (clock) : "NULL"));
+ gst_message_parse_new_clock(msg, &clock);
+ LOGD("GST_MESSAGE_NEW_CLOCK : %s\n", (clock ? GST_OBJECT_NAME(clock) : "NULL"));
}
break;
MMHandleType attrs = 0;
attrs = MMPLAYER_GET_ATTRS(player);
- if ( !attrs )
+ if (!attrs)
{
LOGE("cannot get content attribute");
ret = FALSE;
break;
}
- if(gst_message_get_structure(msg) == NULL)
+ if (gst_message_get_structure(msg) == NULL)
break;
structure_name = gst_structure_get_name(gst_message_get_structure(msg));
gint num_buffers = 0;
gint extra_num_buffers = 0;
- if (gst_structure_get_int (gst_message_get_structure(msg), "num_buffers", &num_buffers)) {
+ if (gst_structure_get_int(gst_message_get_structure(msg), "num_buffers", &num_buffers)) {
player->video_num_buffers = num_buffers;
LOGD("video_num_buffers : %d", player->video_num_buffers);
}
- if (gst_structure_get_int (gst_message_get_structure(msg), "extra_num_buffers", &extra_num_buffers)) {
+ if (gst_structure_get_int(gst_message_get_structure(msg), "extra_num_buffers", &extra_num_buffers)) {
player->video_extra_num_buffers = extra_num_buffers;
LOGD("num_of_vout_extra num buffers : %d", extra_num_buffers);
}
if (!strcmp(structure_name, "Language_list"))
{
const GValue *lang_list = NULL;
- lang_list = gst_structure_get_value (gst_message_get_structure(msg), "lang_list");
- if(lang_list != NULL)
+ lang_list = gst_structure_get_value(gst_message_get_structure(msg), "lang_list");
+ if (lang_list != NULL)
{
- count = g_list_length((GList *)g_value_get_pointer (lang_list));
+ count = g_list_length((GList *)g_value_get_pointer(lang_list));
if (count > 1)
- LOGD("Total audio tracks (from parser) = %d \n",count);
+ LOGD("Total audio tracks(from parser) = %d \n",count);
}
}
- if (!strcmp (structure_name, "Ext_Sub_Language_List"))
+ if (!strcmp(structure_name, "Ext_Sub_Language_List"))
{
const GValue *lang_list = NULL;
MMPlayerLangStruct *temp = NULL;
- lang_list = gst_structure_get_value (gst_message_get_structure(msg), "lang_list");
+ lang_list = gst_structure_get_value(gst_message_get_structure(msg), "lang_list");
if (lang_list != NULL)
{
- count = g_list_length ((GList *)g_value_get_pointer (lang_list));
+ count = g_list_length((GList *)g_value_get_pointer(lang_list));
if (count)
{
- player->subtitle_language_list = (GList *)g_value_get_pointer (lang_list);
+ player->subtitle_language_list = (GList *)g_value_get_pointer(lang_list);
mm_attrs_set_int_by_name(attrs, "content_text_track_num", (gint)count);
- if (mmf_attrs_commit (attrs))
+ if (mmf_attrs_commit(attrs))
LOGE("failed to commit.\n");
LOGD("Total subtitle tracks = %d \n", count);
}
while (count)
{
- temp = g_list_nth_data (player->subtitle_language_list, count - 1);
+ temp = g_list_nth_data(player->subtitle_language_list, count - 1);
if (temp)
{
- LOGD ("value of lang_key is %s and lang_code is %s",
+ LOGD("value of lang_key is %s and lang_code is %s",
temp->language_key, temp->language_code);
}
count--;
}
/* custom message */
- if (!strcmp (structure_name, "audio_codec_not_supported")) {
+ if (!strcmp(structure_name, "audio_codec_not_supported")) {
MMMessageParamType msg_param = {0,};
msg_param.code = MM_ERROR_PLAYER_AUDIO_CODEC_NOT_FOUND;
MMPLAYER_POST_MSG(player, MM_MESSAGE_ERROR, &msg_param);
LOGD("GST_MESSAGE_ASYNC_DONE : %s\n", GST_ELEMENT_NAME(GST_MESSAGE_SRC(msg)));
/* we only handle messages from pipeline */
- if( msg->src != (GstObject *)player->pipeline->mainbin[MMPLAYER_M_PIPE].gst )
+ if (msg->src != (GstObject *)player->pipeline->mainbin[MMPLAYER_M_PIPE].gst)
break;
if (player->doing_seek)
if (MMPLAYER_TARGET_STATE(player) == MM_PLAYER_STATE_PAUSED)
{
player->doing_seek = FALSE;
- MMPLAYER_POST_MSG ( player, MM_MESSAGE_SEEK_COMPLETED, NULL );
+ MMPLAYER_POST_MSG(player, MM_MESSAGE_SEEK_COMPLETED, NULL);
}
else if (MMPLAYER_TARGET_STATE(player) == MM_PLAYER_STATE_PLAYING)
{
if (player->streamer->buffer_handle[BUFFER_TYPE_MUXED].buffer)
{
- query = gst_query_new_buffering ( GST_FORMAT_PERCENT );
- if ( gst_element_query (player->streamer->buffer_handle[BUFFER_TYPE_MUXED].buffer, query ) )
+ query = gst_query_new_buffering(GST_FORMAT_PERCENT);
+ if (gst_element_query(player->streamer->buffer_handle[BUFFER_TYPE_MUXED].buffer, query))
{
- gst_query_parse_buffering_percent ( query, &busy, &percent);
+ gst_query_parse_buffering_percent(query, &busy, &percent);
}
- gst_query_unref (query);
+ gst_query_unref(query);
LOGD("buffered percent(%s): %d\n",
GST_ELEMENT_NAME(player->streamer->buffer_handle[BUFFER_TYPE_MUXED].buffer), percent);
/* FIXIT : this cause so many warnings/errors from glib/gstreamer. we should not call it since
* gst_element_post_message api takes ownership of the message.
*/
- //gst_message_unref( msg );
+ //gst_message_unref(msg);
return ret;
}
else
{
/* handling audio clip which has vbr. means duration is keep changing */
- _mmplayer_update_content_attrs (player, ATTR_DURATION );
+ _mmplayer_update_content_attrs(player, ATTR_DURATION);
}
MMPLAYER_FLEAVE();
{\
if (string != NULL)\
{\
- SECURE_LOGD ( "update tag string : %s\n", string); \
+ SECURE_LOGD("update tag string : %s\n", string); \
mm_attrs_set_string_by_name(attribute, playertag, string); \
g_free(string);\
string = NULL;\
LOGD("failed to get image data from tag");\
return FALSE;\
}\
- SECURE_LOGD ( "update album cover data : %p, size : %d\n", info.data, info.size);\
+ SECURE_LOGD("update album cover data : %p, size : %d\n", info.data, info.size);\
MMPLAYER_FREEIF(player->album_art); \
player->album_art = (gchar *)g_malloc(info.size); \
if (player->album_art) \
{ \
msg_param.data = (void *)player->album_art; \
msg_param.size = info.size; \
- MMPLAYER_POST_MSG (player, MM_MESSAGE_IMAGE_BUFFER, &msg_param); \
- SECURE_LOGD ( "post message image buffer data : %p, size : %d\n", info.data, info.size); \
+ MMPLAYER_POST_MSG(player, MM_MESSAGE_IMAGE_BUFFER, &msg_param); \
+ SECURE_LOGD("post message image buffer data : %p, size : %d\n", info.data, info.size); \
} \
} \
gst_buffer_unmap(buffer, &info); \
#define MMPLAYER_UPDATE_TAG_UINT(gsttag, attribute, playertag) \
if (gst_tag_list_get_uint(tag_list, gsttag, &v_uint))\
{\
- if(v_uint)\
+ if (v_uint)\
{\
if (!strncmp(gsttag, GST_TAG_BITRATE, strlen(GST_TAG_BITRATE))) \
{\
player->total_bitrate += player->bitrate[player->updated_maximum_bitrate_count]; \
player->updated_bitrate_count++; \
mm_attrs_set_int_by_name(attribute, playertag, player->total_bitrate);\
- SECURE_LOGD ( "update bitrate %d[bps] of stream #%d.\n", v_uint, player->updated_bitrate_count);\
+ SECURE_LOGD("update bitrate %d[bps] of stream #%d.\n", v_uint, player->updated_bitrate_count);\
}\
}\
else if (!strncmp(gsttag, GST_TAG_MAXIMUM_BITRATE, strlen(GST_TAG_MAXIMUM_BITRATE))) \
player->total_maximum_bitrate += player->maximum_bitrate[player->updated_maximum_bitrate_count]; \
player->updated_maximum_bitrate_count++; \
mm_attrs_set_int_by_name(attribute, playertag, player->total_maximum_bitrate); \
- SECURE_LOGD ( "update maximum bitrate %d[bps] of stream #%d\n", v_uint, player->updated_maximum_bitrate_count);\
+ SECURE_LOGD("update maximum bitrate %d[bps] of stream #%d\n", v_uint, player->updated_maximum_bitrate_count);\
}\
}\
else\
{\
string = g_strdup_printf("%d", g_date_get_year(date));\
mm_attrs_set_string_by_name(attribute, playertag, string);\
- SECURE_LOGD ( "metainfo year : %s\n", string);\
+ SECURE_LOGD("metainfo year : %s\n", string);\
MMPLAYER_FREEIF(string);\
g_date_free(date);\
}\
}
#define MMPLAYER_UPDATE_TAG_UINT64(gsttag, attribute, playertag) \
-if(gst_tag_list_get_uint64(tag_list, gsttag, &v_uint64))\
+if (gst_tag_list_get_uint64(tag_list, gsttag, &v_uint64))\
{\
- if(v_uint64)\
+ if (v_uint64)\
{\
/* FIXIT : don't know how to store date */\
g_assert(1);\
}
#define MMPLAYER_UPDATE_TAG_DOUBLE(gsttag, attribute, playertag) \
-if(gst_tag_list_get_double(tag_list, gsttag, &v_double))\
+if (gst_tag_list_get_double(tag_list, gsttag, &v_double))\
{\
- if(v_double)\
+ if (v_double)\
{\
/* FIXIT : don't know how to store date */\
g_assert(1);\
//guint64 v_uint64 = 0;
//gdouble v_double = 0;
- MMPLAYER_RETURN_VAL_IF_FAIL( player && msg, FALSE );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player && msg, FALSE);
attrs = MMPLAYER_GET_ATTRS(player);
- MMPLAYER_RETURN_VAL_IF_FAIL( attrs, FALSE );
+ MMPLAYER_RETURN_VAL_IF_FAIL(attrs, FALSE);
/* get tag list from gst message */
gst_message_parse_tag(msg, &tag_list);
/* MMPLAYER_UPDATE_TAG_DOUBLE(GST_TAG_BEATS_PER_MINUTE, ?, ?); */
MMPLAYER_UPDATE_TAG_STRING(GST_TAG_IMAGE_ORIENTATION, attrs, "content_video_orientation");
- if ( mmf_attrs_commit ( attrs ) )
+ if (mmf_attrs_commit(attrs))
LOGE("failed to commit.\n");
gst_tag_list_free(tag_list);
}
static void
-__mmplayer_gst_rtp_no_more_pads (GstElement *element, gpointer data) // @
+__mmplayer_gst_rtp_no_more_pads(GstElement *element, gpointer data) // @
{
mm_player_t* player = (mm_player_t*) data;
* [3] typefinding has happend in audio but audiosink is created already before no-more-pad signal
* and the video will be dumped via filesink.
*/
- if ( player->num_dynamic_pad == 0 )
+ if (player->num_dynamic_pad == 0)
{
LOGD("it seems pad caps is directely used for autoplugging. removing fakesink now\n");
- if ( ! __mmplayer_gst_remove_fakesink( player,
- &player->pipeline->mainbin[MMPLAYER_M_SRC_FAKESINK]) )
+ if (!__mmplayer_gst_remove_fakesink(player,
+ &player->pipeline->mainbin[MMPLAYER_M_SRC_FAKESINK]))
{
/* NOTE : __mmplayer_pipeline_complete() can be called several time. because
- * signaling mechanism ( pad-added, no-more-pad, new-decoded-pad ) from various
+ * signaling mechanism(pad-added, no-more-pad, new-decoded-pad) from various
* source element are not same. To overcome this situation, this function will called
* several places and several times. Therefore, this is not an error case.
*/
}
/* create dot before error-return. for debugging */
- MMPLAYER_GENERATE_DOT_IF_ENABLED ( player, "pipeline-no-more-pad" );
+ MMPLAYER_GENERATE_DOT_IF_ENABLED(player, "pipeline-no-more-pad");
player->no_more_pad = TRUE;
MMPLAYER_RETURN_VAL_IF_FAIL(fakesink, TRUE);
/* lock */
- g_mutex_lock(&player->fsink_lock );
+ g_mutex_lock(&player->fsink_lock);
- if ( ! fakesink->gst )
+ if (!fakesink->gst)
{
goto ERROR;
}
/* get parent of fakesink */
- parent = (GstElement*)gst_object_get_parent( (GstObject*)fakesink->gst );
- if ( ! parent )
+ parent = (GstElement*)gst_object_get_parent((GstObject*)fakesink->gst);
+ if (!parent)
{
LOGD("fakesink already removed\n");
goto ERROR;
}
- gst_element_set_locked_state( fakesink->gst, TRUE );
+ gst_element_set_locked_state(fakesink->gst, TRUE);
/* setting the state to NULL never returns async
* so no need to wait for completion of state transiton
*/
- if ( GST_STATE_CHANGE_FAILURE == gst_element_set_state (fakesink->gst, GST_STATE_NULL) )
+ if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(fakesink->gst, GST_STATE_NULL))
{
LOGE("fakesink state change failure!\n");
}
/* remove fakesink from it's parent */
- if ( ! gst_bin_remove( GST_BIN( parent ), fakesink->gst ) )
+ if (!gst_bin_remove(GST_BIN(parent), fakesink->gst))
{
LOGE("failed to remove fakesink\n");
- gst_object_unref( parent );
+ gst_object_unref(parent);
goto ERROR;
}
- gst_object_unref( parent );
+ gst_object_unref(parent);
LOGD("state-holder removed\n");
- gst_element_set_locked_state( fakesink->gst, FALSE );
+ gst_element_set_locked_state(fakesink->gst, FALSE);
- g_mutex_unlock( &player->fsink_lock );
+ g_mutex_unlock(&player->fsink_lock);
return TRUE;
ERROR:
- if ( fakesink->gst )
+ if (fakesink->gst)
{
- gst_element_set_locked_state( fakesink->gst, FALSE );
+ gst_element_set_locked_state(fakesink->gst, FALSE);
}
- g_mutex_unlock( &player->fsink_lock );
+ g_mutex_unlock(&player->fsink_lock);
return FALSE;
}
static void
-__mmplayer_gst_rtp_dynamic_pad (GstElement *element, GstPad *pad, gpointer data) // @
+__mmplayer_gst_rtp_dynamic_pad(GstElement *element, GstPad *pad, gpointer data) // @
{
GstPad *sinkpad = NULL;
GstCaps* caps = NULL;
MMPLAYER_FENTER();
- MMPLAYER_RETURN_IF_FAIL( element && pad );
+ MMPLAYER_RETURN_IF_FAIL(element && pad);
MMPLAYER_RETURN_IF_FAIL( player &&
player->pipeline &&
- player->pipeline->mainbin );
+ player->pipeline->mainbin);
/* payload type is recognizable. increase num_dynamic and wait for sinkbin creation.
player->num_dynamic_pad++;
LOGD("stream count inc : %d\n", player->num_dynamic_pad);
- caps = gst_pad_query_caps( pad, NULL );
+ caps = gst_pad_query_caps(pad, NULL);
- MMPLAYER_CHECK_NULL( caps );
+ MMPLAYER_CHECK_NULL(caps);
/* clear previous result*/
player->have_dynamic_pad = FALSE;
str = gst_caps_get_structure(caps, 0);
- if ( ! str )
+ if (!str)
{
- LOGE ("cannot get structure from caps.\n");
+ LOGE("cannot get structure from caps.\n");
goto ERROR;
}
- name = gst_structure_get_name (str);
- if ( ! name )
+ name = gst_structure_get_name(str);
+ if (!name)
{
- LOGE ("cannot get mimetype from structure.\n");
+ LOGE("cannot get mimetype from structure.\n");
goto ERROR;
}
if (strstr(name, "video"))
{
gint stype = 0;
- mm_attrs_get_int_by_name (player->attrs, "display_surface_type", &stype);
+ mm_attrs_get_int_by_name(player->attrs, "display_surface_type", &stype);
if (stype == MM_DISPLAY_SURFACE_NULL || stype == MM_DISPLAY_SURFACE_REMOTE)
{
/* clear previous result*/
player->have_dynamic_pad = FALSE;
- if ( !__mmplayer_try_to_plug_decodebin(player, pad, caps))
+ if (!__mmplayer_try_to_plug_decodebin(player, pad, caps))
{
LOGE("failed to autoplug for caps");
goto ERROR;
}
/* check if there's dynamic pad*/
- if( player->have_dynamic_pad )
+ if (player->have_dynamic_pad)
{
LOGE("using pad caps assums there's no dynamic pad !\n");
goto ERROR;
}
- gst_caps_unref( caps );
+ gst_caps_unref(caps);
caps = NULL;
NEW_ELEMENT:
/* excute new_element if created*/
- if ( new_element )
+ if (new_element)
{
LOGD("adding new element to pipeline\n");
/* set state to READY before add to bin */
- MMPLAYER_ELEMENT_SET_STATE( new_element, GST_STATE_READY );
+ MMPLAYER_ELEMENT_SET_STATE(new_element, GST_STATE_READY);
/* add new element to the pipeline */
- if ( FALSE == gst_bin_add( GST_BIN(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst), new_element) )
+ if (FALSE == gst_bin_add(GST_BIN(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst), new_element) )
{
LOGE("failed to add autoplug element to bin\n");
goto ERROR;
}
/* get pad from element */
- sinkpad = gst_element_get_static_pad ( GST_ELEMENT(new_element), "sink" );
- if ( !sinkpad )
+ sinkpad = gst_element_get_static_pad(GST_ELEMENT(new_element), "sink");
+ if (!sinkpad)
{
LOGE("failed to get sinkpad from autoplug element\n");
goto ERROR;
}
/* link it */
- if ( GST_PAD_LINK_OK != GST_PAD_LINK(pad, sinkpad) )
+ if (GST_PAD_LINK_OK != GST_PAD_LINK(pad, sinkpad))
{
LOGE("failed to link autoplug element\n");
goto ERROR;
}
- gst_object_unref (sinkpad);
+ gst_object_unref(sinkpad);
sinkpad = NULL;
/* run. setting PLAYING here since streamming source is live source */
- MMPLAYER_ELEMENT_SET_STATE( new_element, GST_STATE_PLAYING );
+ MMPLAYER_ELEMENT_SET_STATE(new_element, GST_STATE_PLAYING);
}
MMPLAYER_FLEAVE();
STATE_CHANGE_FAILED:
ERROR:
/* FIXIT : take care if new_element has already added to pipeline */
- if ( new_element )
+ if (new_element)
gst_object_unref(GST_OBJECT(new_element));
- if ( sinkpad )
+ if (sinkpad)
gst_object_unref(GST_OBJECT(sinkpad));
- if ( caps )
+ if (caps)
gst_object_unref(GST_OBJECT(caps));
/* FIXIT : how to inform this error to MSL ????? */
/* FIXIT : check indent */
#if 0
static void
-__mmplayer_gst_wfd_dynamic_pad (GstElement *element, GstPad *pad, gpointer data) // @
+__mmplayer_gst_wfd_dynamic_pad(GstElement *element, GstPad *pad, gpointer data) // @
{
GstPad *sinkpad = NULL;
GstCaps* caps = NULL;
MMPLAYER_FENTER();
- MMPLAYER_RETURN_IF_FAIL( element && pad );
- MMPLAYER_RETURN_IF_FAIL( player &&
+ MMPLAYER_RETURN_IF_FAIL(element && pad);
+ MMPLAYER_RETURN_IF_FAIL( player &&
player->pipeline &&
- player->pipeline->mainbin );
+ player->pipeline->mainbin);
LOGD("stream count inc : %d\n", player->num_dynamic_pad);
{
LOGD("using pad caps to autopluging instead of doing typefind\n");
- caps = gst_pad_query_caps( pad );
- MMPLAYER_CHECK_NULL( caps );
+ caps = gst_pad_query_caps(pad);
+ MMPLAYER_CHECK_NULL(caps);
/* clear previous result*/
player->have_dynamic_pad = FALSE;
new_element = gst_element_factory_make("rtpmp2tdepay", "wfd_rtp_depay");
- if ( !new_element )
+ if (!new_element)
{
- LOGE ( "failed to create wfd rtp depay element\n" );
+ LOGE("failed to create wfd rtp depay element\n");
goto ERROR;
}
- MMPLAYER_ELEMENT_SET_STATE( new_element, GST_STATE_READY );
+ MMPLAYER_ELEMENT_SET_STATE(new_element, GST_STATE_READY);
/* add new element to the pipeline */
- if ( FALSE == gst_bin_add( GST_BIN(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst), new_element) )
+ if (FALSE == gst_bin_add(GST_BIN(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst), new_element) )
{
LOGD("failed to add autoplug element to bin\n");
goto ERROR;
}
/* get pad from element */
- sinkpad = gst_element_get_static_pad ( GST_ELEMENT(new_element), "sink" );
- if ( !sinkpad )
+ sinkpad = gst_element_get_static_pad(GST_ELEMENT(new_element), "sink");
+ if (!sinkpad)
{
LOGD("failed to get sinkpad from autoplug element\n");
goto ERROR;
}
/* link it */
- if ( GST_PAD_LINK_OK != GST_PAD_LINK(pad, sinkpad) )
+ if (GST_PAD_LINK_OK != GST_PAD_LINK(pad, sinkpad))
{
LOGD("failed to link autoplug element\n");
goto ERROR;
}
- gst_object_unref (sinkpad);
+ gst_object_unref(sinkpad);
sinkpad = NULL;
- pad = gst_element_get_static_pad ( GST_ELEMENT(new_element), "src" );
- caps = gst_pad_query_caps( pad );
- MMPLAYER_CHECK_NULL( caps );
- MMPLAYER_ELEMENT_SET_STATE( new_element, GST_STATE_PLAYING );
+ pad = gst_element_get_static_pad(GST_ELEMENT(new_element), "src");
+ caps = gst_pad_query_caps(pad);
+ MMPLAYER_CHECK_NULL(caps);
+ MMPLAYER_ELEMENT_SET_STATE(new_element, GST_STATE_PLAYING);
/* create typefind */
- new_element = gst_element_factory_make( "typefind", NULL );
- if ( ! new_element )
+ new_element = gst_element_factory_make("typefind", NULL);
+ if (!new_element)
{
LOGD("failed to create typefind\n");
goto ERROR;
}
- MMPLAYER_SIGNAL_CONNECT( player,
+ MMPLAYER_SIGNAL_CONNECT( player,
G_OBJECT(new_element),
MM_PLAYER_SIGNAL_TYPE_AUTOPLUG,
"have-type",
G_CALLBACK(__mmplayer_typefind_have_type),
- (gpointer)player);
+ (gpointer)player);
player->have_dynamic_pad = FALSE;
}
/* excute new_element if created*/
- if ( new_element )
+ if (new_element)
{
LOGD("adding new element to pipeline\n");
/* set state to READY before add to bin */
- MMPLAYER_ELEMENT_SET_STATE( new_element, GST_STATE_READY );
+ MMPLAYER_ELEMENT_SET_STATE(new_element, GST_STATE_READY);
/* add new element to the pipeline */
- if ( FALSE == gst_bin_add( GST_BIN(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst), new_element) )
+ if (FALSE == gst_bin_add(GST_BIN(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst), new_element) )
{
LOGD("failed to add autoplug element to bin\n");
goto ERROR;
}
/* get pad from element */
- sinkpad = gst_element_get_static_pad ( GST_ELEMENT(new_element), "sink" );
- if ( !sinkpad )
+ sinkpad = gst_element_get_static_pad(GST_ELEMENT(new_element), "sink");
+ if (!sinkpad)
{
LOGD("failed to get sinkpad from autoplug element\n");
goto ERROR;
}
/* link it */
- if ( GST_PAD_LINK_OK != GST_PAD_LINK(pad, sinkpad) )
+ if (GST_PAD_LINK_OK != GST_PAD_LINK(pad, sinkpad))
{
LOGD("failed to link autoplug element\n");
goto ERROR;
}
- gst_object_unref (sinkpad);
+ gst_object_unref(sinkpad);
sinkpad = NULL;
/* run. setting PLAYING here since streamming source is live source */
- MMPLAYER_ELEMENT_SET_STATE( new_element, GST_STATE_PLAYING );
+ MMPLAYER_ELEMENT_SET_STATE(new_element, GST_STATE_PLAYING);
}
/* store handle to futher manipulation */
STATE_CHANGE_FAILED:
ERROR:
/* FIXIT : take care if new_element has already added to pipeline */
- if ( new_element )
+ if (new_element)
gst_object_unref(GST_OBJECT(new_element));
- if ( sinkpad )
+ if (sinkpad)
gst_object_unref(GST_OBJECT(sinkpad));
- if ( caps )
+ if (caps)
gst_object_unref(GST_OBJECT(caps));
/* FIXIT : how to inform this error to MSL ????? */
static GstPadProbeReturn
__mmplayer_gst_selector_blocked(GstPad* pad, GstPadProbeInfo *info, gpointer data)
{
- LOGD ("pad(%s:%s) is blocked", GST_DEBUG_PAD_NAME(pad));
+ LOGD("pad(%s:%s) is blocked", GST_DEBUG_PAD_NAME(pad));
return GST_PAD_PROBE_OK;
}
static GstPadProbeReturn
-__mmplayer_gst_selector_event_probe (GstPad * pad, GstPadProbeInfo * info, gpointer data)
+__mmplayer_gst_selector_event_probe(GstPad * pad, GstPadProbeInfo * info, gpointer data)
{
GstPadProbeReturn ret = GST_PAD_PROBE_OK;
- GstEvent *event = GST_PAD_PROBE_INFO_DATA (info);
+ GstEvent *event = GST_PAD_PROBE_INFO_DATA(info);
mm_player_t* player = (mm_player_t*)data;
GstCaps* caps = NULL;
GstStructure* str = NULL;
const gchar* name = NULL;
MMPlayerTrackType stream_type = MM_PLAYER_TRACK_TYPE_VIDEO;
- if (GST_EVENT_TYPE (event) != GST_EVENT_STREAM_START &&
- GST_EVENT_TYPE (event) != GST_EVENT_FLUSH_STOP &&
- GST_EVENT_TYPE (event) != GST_EVENT_SEGMENT)
+ if (GST_EVENT_TYPE(event) != GST_EVENT_STREAM_START &&
+ GST_EVENT_TYPE(event) != GST_EVENT_FLUSH_STOP &&
+ GST_EVENT_TYPE(event) != GST_EVENT_SEGMENT)
return ret;
caps = gst_pad_query_caps(pad, NULL);
LOGD("stream type is %d", stream_type);
- switch (GST_EVENT_TYPE (event)) {
+ switch (GST_EVENT_TYPE(event)) {
case GST_EVENT_STREAM_START:
{
gint64 stop_running_time = 0;
}
position_running_time =
- gst_segment_to_running_time (&player->gapless.segment[idx],
+ gst_segment_to_running_time(&player->gapless.segment[idx],
GST_FORMAT_TIME, player->gapless.segment[idx].position);
LOGD("[type:%d] time info %" GST_TIME_FORMAT " , %"
GST_TIME_FORMAT" , %" GST_TIME_FORMAT,
idx,
- GST_TIME_ARGS (stop_running_time),
- GST_TIME_ARGS (position_running_time),
- GST_TIME_ARGS(gst_segment_to_running_time (&player->gapless.segment[idx],
+ GST_TIME_ARGS(stop_running_time),
+ GST_TIME_ARGS(position_running_time),
+ GST_TIME_ARGS(gst_segment_to_running_time(&player->gapless.segment[idx],
GST_FORMAT_TIME, player->gapless.segment[idx].start)));
position_running_time = MAX(position_running_time, stop_running_time);
case GST_EVENT_FLUSH_STOP:
{
LOGD("[%d] GST_EVENT_FLUSH_STOP", stream_type);
- gst_segment_init (&player->gapless.segment[stream_type], GST_FORMAT_UNDEFINED);
+ gst_segment_init(&player->gapless.segment[stream_type], GST_FORMAT_UNDEFINED);
player->gapless.start_time[stream_type] = 0;
break;
}
GstEvent *tmpev;
LOGD("[%d] GST_EVENT_SEGMENT", stream_type);
- gst_event_copy_segment (event, &segment);
+ gst_event_copy_segment(event, &segment);
if (segment.format == GST_FORMAT_TIME)
{
LOGD("[%d] new base: %" GST_TIME_FORMAT, stream_type, GST_TIME_ARGS(player->gapless.segment[stream_type].base));
- tmpev = gst_event_new_segment (&player->gapless.segment[stream_type]);
- gst_event_set_seqnum (tmpev, gst_event_get_seqnum (event));
- gst_event_unref (event);
+ tmpev = gst_event_new_segment(&player->gapless.segment[stream_type]);
+ gst_event_set_seqnum(tmpev, gst_event_get_seqnum(event));
+ gst_event_unref(event);
GST_PAD_PROBE_INFO_DATA(info) = tmpev;
}
break;
}
static void
-__mmplayer_gst_decode_pad_added (GstElement *elem, GstPad *pad, gpointer data)
+__mmplayer_gst_decode_pad_added(GstElement *elem, GstPad *pad, gpointer data)
{
mm_player_t* player = NULL;
GstElement* pipeline = NULL;
/* check handles */
player = (mm_player_t*)data;
- MMPLAYER_RETURN_IF_FAIL (elem && pad);
- MMPLAYER_RETURN_IF_FAIL (player && player->pipeline && player->pipeline->mainbin);
+ MMPLAYER_RETURN_IF_FAIL(elem && pad);
+ MMPLAYER_RETURN_IF_FAIL(player && player->pipeline && player->pipeline->mainbin);
- //LOGD ("pad-added signal handling\n");
+ //LOGD("pad-added signal handling\n");
pipeline = player->pipeline->mainbin[MMPLAYER_M_PIPE].gst;
/* get mimetype from caps */
- caps = gst_pad_query_caps (pad, NULL);
- if ( !caps )
+ caps = gst_pad_query_caps(pad, NULL);
+ if (!caps)
{
- LOGE ("cannot get caps from pad.\n");
+ LOGE("cannot get caps from pad.\n");
goto ERROR;
}
- str = gst_caps_get_structure (caps, 0);
- if ( ! str )
+ str = gst_caps_get_structure(caps, 0);
+ if (!str)
{
- LOGE ("cannot get structure from caps.\n");
+ LOGE("cannot get structure from caps.\n");
goto ERROR;
}
- name = gst_structure_get_name (str);
- if ( ! name )
+ name = gst_structure_get_name(str);
+ if (!name)
{
- LOGE ("cannot get mimetype from structure.\n");
+ LOGE("cannot get mimetype from structure.\n");
goto ERROR;
}
MMPLAYER_LOG_GST_CAPS_TYPE(caps);
- //LOGD ("detected mimetype : %s\n", name);
+ //LOGD("detected mimetype : %s\n", name);
if (strstr(name, "video"))
{
gint stype = 0;
- mm_attrs_get_int_by_name (player->attrs, "display_surface_type", &stype);
+ mm_attrs_get_int_by_name(player->attrs, "display_surface_type", &stype);
/* don't make video because of not required, and not support multiple track */
if (stype == MM_DISPLAY_SURFACE_NULL)
{
- LOGD ("no video sink by null surface");
+ LOGD("no video sink by null surface");
MMPlayerResourceState resource_state = RESOURCE_STATE_NONE;
if (_mmplayer_resource_manager_get_state(&player->resource_manager, &resource_state)
== MM_ERROR_NONE)
{
player->set_mode.video_zc = TRUE;
}
- MMPLAYER_FREEIF( caps_str );
+ MMPLAYER_FREEIF(caps_str);
if (player->v_stream_caps)
{
player->v_stream_caps = NULL;
}
- LOGD ("create fakesink instead of videobin");
+ LOGD("create fakesink instead of videobin");
/* fake sink */
- fakesink = gst_element_factory_make ("fakesink", NULL);
+ fakesink = gst_element_factory_make("fakesink", NULL);
if (fakesink == NULL)
{
- LOGE ("ERROR : fakesink create error\n");
+ LOGE("ERROR : fakesink create error\n");
goto ERROR;
}
/* store it as it's sink element */
__mmplayer_add_sink(player, player->video_fakesink);
- gst_bin_add (GST_BIN(pipeline), fakesink);
+ gst_bin_add(GST_BIN(pipeline), fakesink);
// link
- sinkpad = gst_element_get_static_pad (fakesink, "sink");
+ sinkpad = gst_element_get_static_pad(fakesink, "sink");
if (GST_PAD_LINK_OK != gst_pad_link(pad, sinkpad))
{
- LOGW ("failed to link fakesink\n");
- gst_object_unref (GST_OBJECT(fakesink));
+ LOGW("failed to link fakesink\n");
+ gst_object_unref(GST_OBJECT(fakesink));
goto ERROR;
}
if (MMPLAYER_IS_MS_BUFF_SRC(player))
{
- __mmplayer_gst_decode_callback (elem, pad, player);
+ __mmplayer_gst_decode_callback(elem, pad, player);
return;
}
- LOGD ("video selector \n");
+ LOGD("video selector \n");
elemId = MMPLAYER_M_V_INPUT_SELECTOR;
stream_type = MM_PLAYER_TRACK_TYPE_VIDEO;
}
if (MMPLAYER_IS_MS_BUFF_SRC(player))
{
- __mmplayer_gst_decode_callback (elem, pad, player);
+ __mmplayer_gst_decode_callback(elem, pad, player);
return;
}
- LOGD ("audio selector \n");
+ LOGD("audio selector \n");
elemId = MMPLAYER_M_A_INPUT_SELECTOR;
stream_type = MM_PLAYER_TRACK_TYPE_AUDIO;
- gst_structure_get_int (str, "rate", &samplerate);
- gst_structure_get_int (str, "channels", &channels);
+ gst_structure_get_int(str, "rate", &samplerate);
+ gst_structure_get_int(str, "channels", &channels);
if ((channels > 0 && samplerate == 0)) {//exclude audio decoding
/* fake sink */
- fakesink = gst_element_factory_make ("fakesink", NULL);
+ fakesink = gst_element_factory_make("fakesink", NULL);
if (fakesink == NULL)
{
- LOGE ("ERROR : fakesink create error\n");
+ LOGE("ERROR : fakesink create error\n");
goto ERROR;
}
- gst_bin_add (GST_BIN(pipeline), fakesink);
+ gst_bin_add(GST_BIN(pipeline), fakesink);
/* link */
- sinkpad = gst_element_get_static_pad (fakesink, "sink");
+ sinkpad = gst_element_get_static_pad(fakesink, "sink");
if (GST_PAD_LINK_OK != gst_pad_link(pad, sinkpad))
{
- LOGW ("failed to link fakesink\n");
- gst_object_unref (GST_OBJECT(fakesink));
+ LOGW("failed to link fakesink\n");
+ gst_object_unref(GST_OBJECT(fakesink));
goto ERROR;
}
- g_object_set (G_OBJECT (fakesink), "async", TRUE, NULL);
- g_object_set (G_OBJECT (fakesink), "sync", TRUE, NULL);
- gst_element_set_state (fakesink, GST_STATE_PAUSED);
+ g_object_set(G_OBJECT(fakesink), "async", TRUE, NULL);
+ g_object_set(G_OBJECT(fakesink), "sync", TRUE, NULL);
+ gst_element_set_state(fakesink, GST_STATE_PAUSED);
goto DONE;
}
}
else if (strstr(name, "text"))
{
- LOGD ("text selector \n");
+ LOGD("text selector \n");
elemId = MMPLAYER_M_T_INPUT_SELECTOR;
stream_type = MM_PLAYER_TRACK_TYPE_TEXT;
}
else
{
- LOGE ("wrong elem id \n");
+ LOGE("wrong elem id \n");
goto ERROR;
}
}
selector = player->pipeline->mainbin[elemId].gst;
if (selector == NULL)
{
- selector = gst_element_factory_make ("input-selector", NULL);
- LOGD ("Creating input-selector\n");
+ selector = gst_element_factory_make("input-selector", NULL);
+ LOGD("Creating input-selector\n");
if (selector == NULL)
{
- LOGE ("ERROR : input-selector create error\n");
+ LOGE("ERROR : input-selector create error\n");
goto ERROR;
}
- g_object_set (selector, "sync-streams", TRUE, NULL);
+ g_object_set(selector, "sync-streams", TRUE, NULL);
player->pipeline->mainbin[elemId].id = elemId;
player->pipeline->mainbin[elemId].gst = selector;
first_track = TRUE;
// player->selector[stream_type].active_pad_index = DEFAULT_TRACK; // default
- srcpad = gst_element_get_static_pad (selector, "src");
+ srcpad = gst_element_get_static_pad(selector, "src");
- LOGD ("blocking %s:%s", GST_DEBUG_PAD_NAME(srcpad));
+ LOGD("blocking %s:%s", GST_DEBUG_PAD_NAME(srcpad));
player->selector[stream_type].block_id = gst_pad_add_probe(srcpad, GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM,
__mmplayer_gst_selector_blocked, NULL, NULL);
player->selector[stream_type].event_probe_id = gst_pad_add_probe(srcpad, GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM|GST_PAD_PROBE_TYPE_EVENT_FLUSH,
__mmplayer_gst_selector_event_probe, player, NULL);
- gst_element_set_state (selector, GST_STATE_PAUSED);
- gst_bin_add (GST_BIN(pipeline), selector);
+ gst_element_set_state(selector, GST_STATE_PAUSED);
+ gst_bin_add(GST_BIN(pipeline), selector);
} else
- LOGD ("input-selector is already created.\n");
+ LOGD("input-selector is already created.\n");
// link
- LOGD ("Calling request pad with selector %p \n", selector);
- sinkpad = gst_element_get_request_pad (selector, "sink_%u");
+ LOGD("Calling request pad with selector %p \n", selector);
+ sinkpad = gst_element_get_request_pad(selector, "sink_%u");
- LOGD ("got pad %s:%s from selector", GST_DEBUG_PAD_NAME (sinkpad));
+ LOGD("got pad %s:%s from selector", GST_DEBUG_PAD_NAME(sinkpad));
if (GST_PAD_LINK_OK != gst_pad_link(pad, sinkpad))
{
- LOGW ("failed to link selector\n");
- gst_object_unref (GST_OBJECT(selector));
+ LOGW("failed to link selector\n");
+ gst_object_unref(GST_OBJECT(selector));
goto ERROR;
}
if (first_track)
{
- LOGD ("this is first track --> active track \n");
- g_object_set (selector, "active-pad", sinkpad, NULL);
+ LOGD("this is first track --> active track \n");
+ g_object_set(selector, "active-pad", sinkpad, NULL);
}
_mmplayer_track_update_info(player, stream_type, sinkpad);
if (caps)
{
- gst_caps_unref (caps);
+ gst_caps_unref(caps);
}
if (sinkpad)
{
- gst_object_unref (GST_OBJECT(sinkpad));
+ gst_object_unref(GST_OBJECT(sinkpad));
sinkpad = NULL;
}
if (srcpad)
{
- gst_object_unref (GST_OBJECT(srcpad));
+ gst_object_unref(GST_OBJECT(srcpad));
srcpad = NULL;
}
gint active_index = 0;
// [link] input-selector :: textbin
- srcpad = gst_element_get_static_pad (text_selector, "src");
+ srcpad = gst_element_get_static_pad(text_selector, "src");
if (!srcpad)
{
LOGE("failed to get srcpad from selector\n");
return;
}
- LOGD ("got pad %s:%s from text selector\n", GST_DEBUG_PAD_NAME(srcpad));
+ LOGD("got pad %s:%s from text selector\n", GST_DEBUG_PAD_NAME(srcpad));
active_index = player->selector[MM_PLAYER_TRACK_TYPE_TEXT].active_pad_index;
if ((active_index != DEFAULT_TRACK) &&
}
player->no_more_pad = TRUE;
- __mmplayer_gst_decode_callback (text_selector, srcpad, player);
+ __mmplayer_gst_decode_callback(text_selector, srcpad, player);
- LOGD ("unblocking %s:%s", GST_DEBUG_PAD_NAME(srcpad));
+ LOGD("unblocking %s:%s", GST_DEBUG_PAD_NAME(srcpad));
if (player->selector[MM_PLAYER_TRACK_TYPE_TEXT].block_id)
{
- gst_pad_remove_probe (srcpad, player->selector[MM_PLAYER_TRACK_TYPE_TEXT].block_id);
+ gst_pad_remove_probe(srcpad, player->selector[MM_PLAYER_TRACK_TYPE_TEXT].block_id);
player->selector[MM_PLAYER_TRACK_TYPE_TEXT].block_id = 0;
}
player->has_closed_caption = TRUE;
attrs = MMPLAYER_GET_ATTRS(player);
- if ( attrs )
+ if (attrs)
{
- mm_attrs_set_int_by_name(attrs, "content_text_track_num",(gint)player->selector[MM_PLAYER_TRACK_TYPE_TEXT].total_track_num);
- if (mmf_attrs_commit (attrs))
+ mm_attrs_set_int_by_name(attrs, "content_text_track_num", (gint)player->selector[MM_PLAYER_TRACK_TYPE_TEXT].total_track_num);
+ if (mmf_attrs_commit(attrs))
LOGE("failed to commit.\n");
}
else
if (srcpad)
{
- gst_object_unref ( GST_OBJECT(srcpad) );
+ gst_object_unref(GST_OBJECT(srcpad));
srcpad = NULL;
}
}
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL (player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
- LOGD ("Change Audio mode to %d\n", ch_idx);
+ LOGD("Change Audio mode to %d\n", ch_idx);
player->use_deinterleave = TRUE;
if ((!player->pipeline) || (!player->pipeline->mainbin))
{
- LOGD ("pre setting : %d\n", ch_idx);
+ LOGD("pre setting : %d\n", ch_idx);
player->audio_mode.active_pad_index = ch_idx;
return result;
{
if (player->max_audio_channels < 2)
{
- LOGD ("mono channel track only\n");
+ LOGD("mono channel track only\n");
return result;
}
- LOGW ("selector doesn't exist\n");
+ LOGW("selector doesn't exist\n");
return result; /* keep playing */
}
- LOGD ("total_ch_num : %d\n", player->audio_mode.total_track_num);
+ LOGD("total_ch_num : %d\n", player->audio_mode.total_track_num);
if (player->audio_mode.total_track_num < 2)
{
- LOGW ("there is no another audio path\n");
+ LOGW("there is no another audio path\n");
return result; /* keep playing */
}
if ((ch_idx < 0) || (ch_idx >= player->audio_mode.total_track_num))
{
- LOGW ("Not a proper ch_idx : %d \n", ch_idx);
+ LOGW("Not a proper ch_idx : %d \n", ch_idx);
return result; /* keep playing */
}
/*To get the new pad from the selector*/
- change_pad_name = g_strdup_printf ("sink%d", ch_idx);
+ change_pad_name = g_strdup_printf("sink%d", ch_idx);
if (change_pad_name == NULL)
{
- LOGW ("Pad does not exists\n");
+ LOGW("Pad does not exists\n");
goto ERROR; /* keep playing */
}
- LOGD ("new active pad name: %s\n", change_pad_name);
+ LOGD("new active pad name: %s\n", change_pad_name);
- sinkpad = gst_element_get_static_pad (mainbin[MMPLAYER_M_A_SELECTOR].gst, change_pad_name);
+ sinkpad = gst_element_get_static_pad(mainbin[MMPLAYER_M_A_SELECTOR].gst, change_pad_name);
if (sinkpad == NULL)
{
//result = MM_ERROR_PLAYER_INTERNAL;
goto ERROR; /* keep playing */
}
- LOGD ("Set Active Pad - %s:%s\n", GST_DEBUG_PAD_NAME(sinkpad));
- g_object_set (mainbin[MMPLAYER_M_A_SELECTOR].gst, "active-pad", sinkpad, NULL);
+ LOGD("Set Active Pad - %s:%s\n", GST_DEBUG_PAD_NAME(sinkpad));
+ g_object_set(mainbin[MMPLAYER_M_A_SELECTOR].gst, "active-pad", sinkpad, NULL);
caps = gst_pad_get_current_caps(sinkpad);
MMPLAYER_LOG_GST_CAPS_TYPE(caps);
- __mmplayer_set_audio_attrs (player, caps);
+ __mmplayer_set_audio_attrs(player, caps);
player->audio_mode.active_pad_index = ch_idx;
ERROR:
if (sinkpad)
- gst_object_unref (sinkpad);
+ gst_object_unref(sinkpad);
MMPLAYER_FREEIF(change_pad_name);
gchar* caps_str= NULL;
MMPLAYER_FENTER();
- MMPLAYER_RETURN_IF_FAIL (player && player->pipeline && player->pipeline->mainbin);
+ MMPLAYER_RETURN_IF_FAIL(player && player->pipeline && player->pipeline->mainbin);
caps_str = gst_caps_to_string(gst_pad_get_current_caps(pad));
- LOGD ("deinterleave new caps : %s\n", caps_str);
+ LOGD("deinterleave new caps : %s\n", caps_str);
MMPLAYER_FREEIF(caps_str);
if ((queue = __mmplayer_element_create_and_link(player, pad, "queue")) == NULL)
{
- LOGE ("ERROR : queue create error\n");
+ LOGE("ERROR : queue create error\n");
goto ERROR;
}
goto ERROR;
}
- srcpad = gst_element_get_static_pad (queue, "src");
- sinkpad = gst_element_get_request_pad (selector, "sink_%u");
+ srcpad = gst_element_get_static_pad(queue, "src");
+ sinkpad = gst_element_get_request_pad(selector, "sink_%u");
- LOGD ("link (%s:%s - %s:%s)\n", GST_DEBUG_PAD_NAME(srcpad), GST_DEBUG_PAD_NAME(sinkpad));
+ LOGD("link(%s:%s - %s:%s)\n", GST_DEBUG_PAD_NAME(srcpad), GST_DEBUG_PAD_NAME(sinkpad));
if (GST_PAD_LINK_OK != gst_pad_link(srcpad, sinkpad))
{
- LOGW ("failed to link deinterleave - selector\n");
+ LOGW("failed to link deinterleave - selector\n");
goto ERROR;
}
- gst_element_set_state (queue, GST_STATE_PAUSED);
+ gst_element_set_state(queue, GST_STATE_PAUSED);
player->audio_mode.total_track_num++;
ERROR:
if (srcpad)
{
- gst_object_unref ( GST_OBJECT(srcpad) );
+ gst_object_unref(GST_OBJECT(srcpad));
srcpad = NULL;
}
if (sinkpad)
{
- gst_object_unref ( GST_OBJECT(sinkpad) );
+ gst_object_unref(GST_OBJECT(sinkpad));
sinkpad = NULL;
}
}
static void
-__mmplayer_gst_deinterleave_no_more_pads (GstElement *elem, gpointer data)
+__mmplayer_gst_deinterleave_no_more_pads(GstElement *elem, gpointer data)
{
mm_player_t* player = NULL;
GstElement* selector = NULL;
gint audio_ch = default_audio_ch;
/*To get the new pad from the selector*/
- change_pad_name = g_strdup_printf ("sink%d", active_index);
+ change_pad_name = g_strdup_printf("sink%d", active_index);
if (change_pad_name != NULL)
{
- sinkpad = gst_element_get_static_pad (selector, change_pad_name);
+ sinkpad = gst_element_get_static_pad(selector, change_pad_name);
if (sinkpad != NULL)
{
- LOGD ("Set Active Pad - %s:%s\n", GST_DEBUG_PAD_NAME(sinkpad));
- g_object_set (selector, "active-pad", sinkpad, NULL);
+ LOGD("Set Active Pad - %s:%s\n", GST_DEBUG_PAD_NAME(sinkpad));
+ g_object_set(selector, "active-pad", sinkpad, NULL);
audio_ch = active_index;
caps = gst_pad_get_current_caps(sinkpad);
MMPLAYER_LOG_GST_CAPS_TYPE(caps);
- __mmplayer_set_audio_attrs (player, caps);
+ __mmplayer_set_audio_attrs(player, caps);
}
MMPLAYER_FREEIF(change_pad_name);
}
player->audio_mode.active_pad_index = audio_ch;
- LOGD("audio LR info (0:stereo) = %d\n", player->audio_mode.active_pad_index);
+ LOGD("audio LR info(0:stereo) = %d\n", player->audio_mode.active_pad_index);
}
ERROR:
if (sinkpad)
- gst_object_unref (sinkpad);
+ gst_object_unref(sinkpad);
MMPLAYER_FLEAVE();
return;
}
static void
-__mmplayer_gst_build_deinterleave_path (GstElement *elem, GstPad *pad, gpointer data)
+__mmplayer_gst_build_deinterleave_path(GstElement *elem, GstPad *pad, gpointer data)
{
mm_player_t* player = NULL;
MMPlayerGstElement *mainbin = NULL;
/* check handles */
player = (mm_player_t*) data;
- MMPLAYER_RETURN_IF_FAIL( elem && pad );
- MMPLAYER_RETURN_IF_FAIL( player && player->pipeline && player->pipeline->mainbin );
+ MMPLAYER_RETURN_IF_FAIL(elem && pad);
+ MMPLAYER_RETURN_IF_FAIL(player && player->pipeline && player->pipeline->mainbin);
mainbin = player->pipeline->mainbin;
/* tee */
if ((tee = __mmplayer_element_create_and_link(player, pad, "tee")) == NULL)
{
- LOGE ("ERROR : tee create error\n");
+ LOGE("ERROR : tee create error\n");
goto ERROR;
}
mainbin[MMPLAYER_M_A_TEE].id = MMPLAYER_M_A_TEE;
mainbin[MMPLAYER_M_A_TEE].gst = tee;
- gst_element_set_state (tee, GST_STATE_PAUSED);
+ gst_element_set_state(tee, GST_STATE_PAUSED);
/* queue */
- srcpad = gst_element_get_request_pad (tee, "src_%u");
+ srcpad = gst_element_get_request_pad(tee, "src_%u");
if ((stereo_queue = __mmplayer_element_create_and_link(player, srcpad, "queue")) == NULL)
{
- LOGE ("ERROR : stereo queue create error\n");
+ LOGE("ERROR : stereo queue create error\n");
goto ERROR;
}
if (srcpad)
{
- gst_object_unref (GST_OBJECT(srcpad));
+ gst_object_unref(GST_OBJECT(srcpad));
srcpad = NULL;
}
- srcpad = gst_element_get_request_pad (tee, "src_%u");
+ srcpad = gst_element_get_request_pad(tee, "src_%u");
if ((mono_queue = __mmplayer_element_create_and_link(player, srcpad, "queue")) == NULL)
{
- LOGE ("ERROR : mono queue create error\n");
+ LOGE("ERROR : mono queue create error\n");
goto ERROR;
}
player->pipeline->mainbin[MMPLAYER_M_A_Q2].id = MMPLAYER_M_A_Q2;
player->pipeline->mainbin[MMPLAYER_M_A_Q2].gst = mono_queue;
- gst_element_set_state (stereo_queue, GST_STATE_PAUSED);
- gst_element_set_state (mono_queue, GST_STATE_PAUSED);
+ gst_element_set_state(stereo_queue, GST_STATE_PAUSED);
+ gst_element_set_state(mono_queue, GST_STATE_PAUSED);
/* audioconvert */
- srcpad = gst_element_get_static_pad (mono_queue, "src");
+ srcpad = gst_element_get_static_pad(mono_queue, "src");
if ((conv = __mmplayer_element_create_and_link(player, srcpad, "audioconvert")) == NULL)
{
- LOGE ("ERROR : audioconvert create error\n");
+ LOGE("ERROR : audioconvert create error\n");
goto ERROR;
}
/* caps filter */
if (srcpad)
{
- gst_object_unref (GST_OBJECT(srcpad));
+ gst_object_unref(GST_OBJECT(srcpad));
srcpad = NULL;
}
- srcpad = gst_element_get_static_pad (conv, "src");
+ srcpad = gst_element_get_static_pad(conv, "src");
if ((filter = __mmplayer_element_create_and_link(player, srcpad, "capsfilter")) == NULL)
{
- LOGE ("ERROR : capsfilter create error\n");
+ LOGE("ERROR : capsfilter create error\n");
goto ERROR;
}
player->pipeline->mainbin[MMPLAYER_M_A_FILTER].id = MMPLAYER_M_A_FILTER;
player->pipeline->mainbin[MMPLAYER_M_A_FILTER].gst = filter;
- caps = gst_caps_from_string( "audio/x-raw-int, "
+ caps = gst_caps_from_string("audio/x-raw-int, "
"width = (int) 16, "
"depth = (int) 16, "
"channels = (int) 2");
- g_object_set (GST_ELEMENT(player->pipeline->mainbin[MMPLAYER_M_A_FILTER].gst), "caps", caps, NULL );
- gst_caps_unref( caps );
+ g_object_set(GST_ELEMENT(player->pipeline->mainbin[MMPLAYER_M_A_FILTER].gst), "caps", caps, NULL);
+ gst_caps_unref(caps);
- gst_element_set_state (conv, GST_STATE_PAUSED);
- gst_element_set_state (filter, GST_STATE_PAUSED);
+ gst_element_set_state(conv, GST_STATE_PAUSED);
+ gst_element_set_state(filter, GST_STATE_PAUSED);
/* deinterleave */
if (srcpad)
{
- gst_object_unref (GST_OBJECT(srcpad));
+ gst_object_unref(GST_OBJECT(srcpad));
srcpad = NULL;
}
- srcpad = gst_element_get_static_pad (filter, "src");
+ srcpad = gst_element_get_static_pad(filter, "src");
if ((deinterleave = __mmplayer_element_create_and_link(player, srcpad, "deinterleave")) == NULL)
{
- LOGE ("ERROR : deinterleave create error\n");
+ LOGE("ERROR : deinterleave create error\n");
goto ERROR;
}
- g_object_set (deinterleave, "keep-positions", TRUE, NULL);
+ g_object_set(deinterleave, "keep-positions", TRUE, NULL);
- MMPLAYER_SIGNAL_CONNECT (player, deinterleave, MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "pad-added",
- G_CALLBACK (__mmplayer_gst_deinterleave_pad_added), player);
+ MMPLAYER_SIGNAL_CONNECT(player, deinterleave, MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "pad-added",
+ G_CALLBACK(__mmplayer_gst_deinterleave_pad_added), player);
- MMPLAYER_SIGNAL_CONNECT (player, deinterleave, MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "no-more-pads",
- G_CALLBACK (__mmplayer_gst_deinterleave_no_more_pads), player);
+ MMPLAYER_SIGNAL_CONNECT(player, deinterleave, MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "no-more-pads",
+ G_CALLBACK(__mmplayer_gst_deinterleave_no_more_pads), player);
player->pipeline->mainbin[MMPLAYER_M_A_DEINTERLEAVE].id = MMPLAYER_M_A_DEINTERLEAVE;
player->pipeline->mainbin[MMPLAYER_M_A_DEINTERLEAVE].gst = deinterleave;
/* selector */
- selector = gst_element_factory_make ("input-selector", "audio-channel-selector");
+ selector = gst_element_factory_make("input-selector", "audio-channel-selector");
if (selector == NULL)
{
- LOGE ("ERROR : audio-selector create error\n");
+ LOGE("ERROR : audio-selector create error\n");
goto ERROR;
}
- g_object_set (selector, "sync-streams", TRUE, NULL);
- gst_bin_add (GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), selector);
+ g_object_set(selector, "sync-streams", TRUE, NULL);
+ gst_bin_add(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), selector);
player->pipeline->mainbin[MMPLAYER_M_A_SELECTOR].id = MMPLAYER_M_A_SELECTOR;
player->pipeline->mainbin[MMPLAYER_M_A_SELECTOR].gst = selector;
- selector_srcpad = gst_element_get_static_pad (selector, "src");
+ selector_srcpad = gst_element_get_static_pad(selector, "src");
- LOGD ("blocking %s:%s", GST_DEBUG_PAD_NAME(selector_srcpad));
+ LOGD("blocking %s:%s", GST_DEBUG_PAD_NAME(selector_srcpad));
block_id =
gst_pad_add_probe(selector_srcpad, GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM,
__mmplayer_gst_selector_blocked, NULL, NULL);
if (srcpad)
{
- gst_object_unref (GST_OBJECT(srcpad));
+ gst_object_unref(GST_OBJECT(srcpad));
srcpad = NULL;
}
srcpad = gst_element_get_static_pad(stereo_queue, "src");
- sinkpad = gst_element_get_request_pad (selector, "sink_%u");
+ sinkpad = gst_element_get_request_pad(selector, "sink_%u");
if (GST_PAD_LINK_OK != gst_pad_link(srcpad, sinkpad))
{
- LOGW ("failed to link queue_stereo - selector\n");
+ LOGW("failed to link queue_stereo - selector\n");
goto ERROR;
}
player->audio_mode.total_track_num++;
- g_object_set (selector, "active-pad", sinkpad, NULL);
- gst_element_set_state (deinterleave, GST_STATE_PAUSED);
- gst_element_set_state (selector, GST_STATE_PAUSED);
+ g_object_set(selector, "active-pad", sinkpad, NULL);
+ gst_element_set_state(deinterleave, GST_STATE_PAUSED);
+ gst_element_set_state(selector, GST_STATE_PAUSED);
- __mmplayer_gst_decode_callback (selector, selector_srcpad, player);
+ __mmplayer_gst_decode_callback(selector, selector_srcpad, player);
ERROR:
- LOGD ("unblocking %s:%s", GST_DEBUG_PAD_NAME(selector_srcpad));
+ LOGD("unblocking %s:%s", GST_DEBUG_PAD_NAME(selector_srcpad));
if (block_id != 0)
{
- gst_pad_remove_probe (selector_srcpad, block_id);
+ gst_pad_remove_probe(selector_srcpad, block_id);
block_id = 0;
}
if (sinkpad)
{
- gst_object_unref (GST_OBJECT(sinkpad));
+ gst_object_unref(GST_OBJECT(sinkpad));
sinkpad = NULL;
}
if (srcpad)
{
- gst_object_unref (GST_OBJECT(srcpad));
+ gst_object_unref(GST_OBJECT(srcpad));
srcpad = NULL;
}
if (selector_srcpad)
{
- gst_object_unref (GST_OBJECT(selector_srcpad));
+ gst_object_unref(GST_OBJECT(selector_srcpad));
selector_srcpad = NULL;
}
}
static void
-__mmplayer_gst_decode_no_more_pads (GstElement *elem, gpointer data)
+__mmplayer_gst_decode_no_more_pads(GstElement *elem, gpointer data)
{
mm_player_t* player = NULL;
GstPad* srcpad = NULL;
guint buffer_bytes = init_buffering_time * ESTIMATED_BUFFER_UNIT;
buffer_bytes = MAX(buffer_bytes, player->streamer->buffer_handle[BUFFER_TYPE_MUXED].buffering_bytes);
- LOGD("[Decodebin2] set use-buffering on Q2 (pre buffer time: %d sec, buffer size : %d)\n", (gint)init_buffering_time, buffer_bytes);
+ LOGD("[Decodebin2] set use-buffering on Q2(pre buffer time: %d sec, buffer size : %d)\n", (gint)init_buffering_time, buffer_bytes);
init_buffering_time = (init_buffering_time != 0)?(init_buffering_time):(player->ini.http_buffering_time);
- if ( !gst_element_query_duration(player->pipeline->mainbin[MMPLAYER_M_SRC].gst, GST_FORMAT_BYTES, &dur_bytes))
+ if (!gst_element_query_duration(player->pipeline->mainbin[MMPLAYER_M_SRC].gst, GST_FORMAT_BYTES, &dur_bytes))
LOGE("fail to get duration.\n");
- // enable use-buffering on queue2 instead of multiqueue (ex)audio only streaming
+ // enable use-buffering on queue2 instead of multiqueue(ex)audio only streaming
// use file information was already set on Q2 when it was created.
__mm_player_streaming_set_queue2(player->streamer,
player->pipeline->mainbin[MMPLAYER_M_MUXED_S_BUFFER].gst,
if (video_selector)
{
// [link] input-selector :: videobin
- srcpad = gst_element_get_static_pad (video_selector, "src");
+ srcpad = gst_element_get_static_pad(video_selector, "src");
if (!srcpad)
{
LOGE("failed to get srcpad from video selector\n");
goto ERROR;
}
- LOGD ("got pad %s:%s from video selector\n", GST_DEBUG_PAD_NAME(srcpad));
+ LOGD("got pad %s:%s from video selector\n", GST_DEBUG_PAD_NAME(srcpad));
if (!text_selector && !audio_selector)
player->no_more_pad = TRUE;
- __mmplayer_gst_decode_callback (video_selector, srcpad, player);
+ __mmplayer_gst_decode_callback(video_selector, srcpad, player);
- LOGD ("unblocking %s:%s", GST_DEBUG_PAD_NAME(srcpad));
+ LOGD("unblocking %s:%s", GST_DEBUG_PAD_NAME(srcpad));
if (player->selector[MM_PLAYER_TRACK_TYPE_VIDEO].block_id)
{
- gst_pad_remove_probe (srcpad, player->selector[MM_PLAYER_TRACK_TYPE_VIDEO].block_id);
+ gst_pad_remove_probe(srcpad, player->selector[MM_PLAYER_TRACK_TYPE_VIDEO].block_id);
player->selector[MM_PLAYER_TRACK_TYPE_VIDEO].block_id = 0;
}
}
}
// [link] input-selector :: audiobin
- srcpad = gst_element_get_static_pad (audio_selector, "src");
+ srcpad = gst_element_get_static_pad(audio_selector, "src");
if (!srcpad)
{
LOGE("failed to get srcpad from selector\n");
goto ERROR;
}
- LOGD ("got pad %s:%s from selector\n", GST_DEBUG_PAD_NAME(srcpad));
+ LOGD("got pad %s:%s from selector\n", GST_DEBUG_PAD_NAME(srcpad));
if (!text_selector)
player->no_more_pad = TRUE;
if ((player->use_deinterleave == TRUE) && (player->max_audio_channels >= 2))
{
- LOGD ("unblocking %s:%s", GST_DEBUG_PAD_NAME(srcpad));
+ LOGD("unblocking %s:%s", GST_DEBUG_PAD_NAME(srcpad));
if (player->selector[MM_PLAYER_TRACK_TYPE_AUDIO].block_id)
{
- gst_pad_remove_probe (srcpad, player->selector[MM_PLAYER_TRACK_TYPE_AUDIO].block_id);
+ gst_pad_remove_probe(srcpad, player->selector[MM_PLAYER_TRACK_TYPE_AUDIO].block_id);
player->selector[MM_PLAYER_TRACK_TYPE_AUDIO].block_id = 0;
}
}
else
{
- __mmplayer_gst_decode_callback (audio_selector, srcpad, player);
+ __mmplayer_gst_decode_callback(audio_selector, srcpad, player);
- LOGD ("unblocking %s:%s", GST_DEBUG_PAD_NAME(srcpad));
+ LOGD("unblocking %s:%s", GST_DEBUG_PAD_NAME(srcpad));
if (player->selector[MM_PLAYER_TRACK_TYPE_AUDIO].block_id)
{
- gst_pad_remove_probe (srcpad, player->selector[MM_PLAYER_TRACK_TYPE_AUDIO].block_id);
+ gst_pad_remove_probe(srcpad, player->selector[MM_PLAYER_TRACK_TYPE_AUDIO].block_id);
player->selector[MM_PLAYER_TRACK_TYPE_AUDIO].block_id = 0;
}
}
LOGD("Total audio tracks = %d \n", player->selector[MM_PLAYER_TRACK_TYPE_AUDIO].total_track_num);
attrs = MMPLAYER_GET_ATTRS(player);
- if ( attrs )
+ if (attrs)
{
- mm_attrs_set_int_by_name(attrs, "content_audio_track_num",(gint)player->selector[MM_PLAYER_TRACK_TYPE_AUDIO].total_track_num);
- if (mmf_attrs_commit (attrs))
+ mm_attrs_set_int_by_name(attrs, "content_audio_track_num", (gint)player->selector[MM_PLAYER_TRACK_TYPE_AUDIO].total_track_num);
+ if (mmf_attrs_commit(attrs))
LOGE("failed to commit.\n");
}
else
{
if ((player->pipeline->audiobin) && (player->pipeline->audiobin[MMPLAYER_A_BIN].gst))
{
- LOGD ("There is no audio track : remove audiobin");
+ LOGD("There is no audio track : remove audiobin");
- __mmplayer_release_signal_connection( player, MM_PLAYER_SIGNAL_TYPE_AUDIOBIN );
- __mmplayer_del_sink ( player, player->pipeline->audiobin[MMPLAYER_A_SINK].gst );
+ __mmplayer_release_signal_connection(player, MM_PLAYER_SIGNAL_TYPE_AUDIOBIN);
+ __mmplayer_del_sink(player, player->pipeline->audiobin[MMPLAYER_A_SINK].gst);
- MMPLAYER_RELEASE_ELEMENT ( player, player->pipeline->audiobin, MMPLAYER_A_BIN );
- MMPLAYER_FREEIF ( player->pipeline->audiobin )
+ MMPLAYER_RELEASE_ELEMENT(player, player->pipeline->audiobin, MMPLAYER_A_BIN);
+ MMPLAYER_FREEIF(player->pipeline->audiobin)
}
if (player->num_dynamic_pad == 0)
{
- __mmplayer_pipeline_complete (NULL, player);
+ __mmplayer_pipeline_complete(NULL, player);
}
}
ERROR:
if (srcpad)
{
- gst_object_unref ( GST_OBJECT(srcpad) );
+ gst_object_unref(GST_OBJECT(srcpad));
srcpad = NULL;
}
/* check handles */
player = (mm_player_t*) data;
- MMPLAYER_RETURN_IF_FAIL( elem && pad );
+ MMPLAYER_RETURN_IF_FAIL(elem && pad);
MMPLAYER_RETURN_IF_FAIL(player && player->pipeline && player->pipeline->mainbin);
pipeline = player->pipeline->mainbin[MMPLAYER_M_PIPE].gst;
attrs = MMPLAYER_GET_ATTRS(player);
- if ( !attrs )
+ if (!attrs)
{
LOGE("cannot get content attribute\n");
goto ERROR;
}
/* get mimetype from caps */
- caps = gst_pad_query_caps( pad, NULL );
- if ( !caps )
+ caps = gst_pad_query_caps(pad, NULL);
+ if (!caps)
{
LOGE("cannot get caps from pad.\n");
goto ERROR;
}
caps_str = gst_caps_to_string(caps);
- str = gst_caps_get_structure( caps, 0 );
- if ( ! str )
+ str = gst_caps_get_structure(caps, 0);
+ if (!str)
{
LOGE("cannot get structure from caps.\n");
goto ERROR;
}
name = gst_structure_get_name(str);
- if ( ! name )
+ if (!name)
{
LOGE("cannot get mimetype from structure.\n");
goto ERROR;
reusing = TRUE;
sinkbin = player->pipeline->audiobin[MMPLAYER_A_BIN].gst;
LOGD("reusing audiobin\n");
- _mmplayer_update_content_attrs( player, ATTR_AUDIO);
+ _mmplayer_update_content_attrs(player, ATTR_AUDIO);
}
if (player->selector[MM_PLAYER_TRACK_TYPE_AUDIO].total_track_num <= 0) // should not update if content have multi audio tracks
player->audiosink_linked = 1;
- sinkpad = gst_element_get_static_pad( GST_ELEMENT(sinkbin), "sink" );
- if ( !sinkpad )
+ sinkpad = gst_element_get_static_pad(GST_ELEMENT(sinkbin), "sink");
+ if (!sinkpad)
{
LOGE("failed to get pad from sinkbin\n");
goto ERROR;
/* get video surface type */
int surface_type = 0;
mm_attrs_get_int_by_name(player->attrs, "display_surface_type", &surface_type);
- LOGD("display_surface_type (%d)\n", surface_type);
+ LOGD("display_surface_type(%d)\n", surface_type);
if (surface_type == MM_DISPLAY_SURFACE_NULL) {
LOGD("not make videobin because it dose not want\n");
}
}
- if (MM_ERROR_NONE != __mmplayer_gst_create_video_pipeline(player, caps, surface_type) )
+ if (MM_ERROR_NONE != __mmplayer_gst_create_video_pipeline(player, caps, surface_type))
{
LOGE("failed to create videobin. continuing without video\n");
goto ERROR;
reusing = TRUE;
sinkbin = player->pipeline->videobin[MMPLAYER_V_BIN].gst;
LOGD("re-using videobin\n");
- _mmplayer_update_content_attrs( player, ATTR_VIDEO);
+ _mmplayer_update_content_attrs(player, ATTR_VIDEO);
}
/* FIXIT : track number shouldn't be hardcoded */
player->videosink_linked = 1;
/* NOTE : intermediate code before doing H/W subtitle compositon */
- if ( player->use_textoverlay && player->play_subtitle )
+ if (player->use_textoverlay && player->play_subtitle)
{
LOGD("using textoverlay for external subtitle");
/* check text bin has created well */
- if ( player->pipeline && player->pipeline->textbin )
+ if (player->pipeline && player->pipeline->textbin)
{
/* get sinkpad from textoverlay */
sinkpad = gst_element_get_static_pad(
GST_ELEMENT(player->pipeline->textbin[MMPLAYER_T_BIN].gst),
- "video_sink" );
- if ( ! sinkpad )
+ "video_sink");
+ if (!sinkpad)
{
LOGE("failed to get sink pad from textoverlay");
goto ERROR;
}
/* link new pad with textoverlay first */
- if ( GST_PAD_LINK_OK != GST_PAD_LINK(pad, sinkpad) )
+ if (GST_PAD_LINK_OK != GST_PAD_LINK(pad, sinkpad))
{
LOGE("failed to get pad from sinkbin\n");
goto ERROR;
/* alright, override pad to textbin.src for futher link */
pad = gst_element_get_static_pad(
GST_ELEMENT(player->pipeline->textbin[MMPLAYER_T_BIN].gst),
- "src" );
- if ( ! pad )
+ "src");
+ if (!pad)
{
LOGE("failed to get sink pad from textoverlay");
goto ERROR;
}
}
- sinkpad = gst_element_get_static_pad( GST_ELEMENT(sinkbin), "sink" );
- if ( !sinkpad )
+ sinkpad = gst_element_get_static_pad(GST_ELEMENT(sinkbin), "sink");
+ if (!sinkpad)
{
LOGE("failed to get pad from sinkbin\n");
goto ERROR;
player->textsink_linked = 1;
LOGI("player->textsink_linked set to 1\n");
- sinkpad = gst_element_get_static_pad( GST_ELEMENT(sinkbin), "text_sink" );
- if ( !sinkpad )
+ sinkpad = gst_element_get_static_pad(GST_ELEMENT(sinkbin), "text_sink");
+ if (!sinkpad)
{
LOGE("failed to get pad from sinkbin\n");
goto ERROR;
{
/* input selector */
text_selector = gst_element_factory_make("input-selector", "subtitle_inselector");
- if ( !text_selector )
+ if (!text_selector)
{
- LOGE ( "failed to create subtitle input selector element\n" );
+ LOGE("failed to create subtitle input selector element\n");
goto ERROR;
}
- g_object_set (text_selector, "sync-streams", TRUE, NULL);
+ g_object_set(text_selector, "sync-streams", TRUE, NULL);
mainbin[MMPLAYER_M_T_INPUT_SELECTOR].id = MMPLAYER_M_T_INPUT_SELECTOR;
mainbin[MMPLAYER_M_T_INPUT_SELECTOR].gst = text_selector;
/* warm up */
- if (GST_STATE_CHANGE_FAILURE == gst_element_set_state (text_selector, GST_STATE_READY))
+ if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(text_selector, GST_STATE_READY))
{
LOGE("failed to set state(READY) to sinkbin\n");
goto ERROR;
goto ERROR;
}
- LOGD ("created element input-selector");
+ LOGD("created element input-selector");
}
else
{
- LOGD ("already having subtitle input selector");
+ LOGD("already having subtitle input selector");
text_selector = mainbin[MMPLAYER_M_T_INPUT_SELECTOR].gst;
}
}
}
else
{
- LOGW("unknown type of elementary stream! ignoring it...\n");
+ LOGW("unknown type of elementary stream!ignoring it...\n");
goto ERROR;
}
- if ( sinkbin )
+ if (sinkbin)
{
- if(!reusing)
+ if (!reusing)
{
/* warm up */
- if ( GST_STATE_CHANGE_FAILURE == gst_element_set_state( sinkbin, GST_STATE_READY ) )
+ if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(sinkbin, GST_STATE_READY))
{
LOGE("failed to set state(READY) to sinkbin\n");
goto ERROR;
/* Added for multi audio support to avoid adding audio bin again*/
/* add */
- if ( FALSE == gst_bin_add( GST_BIN(pipeline), sinkbin ) )
+ if (FALSE == gst_bin_add(GST_BIN(pipeline), sinkbin))
{
LOGE("failed to add sinkbin to pipeline\n");
goto ERROR;
}
/* link */
- if (GST_PAD_LINK_OK != GST_PAD_LINK (pad, sinkpad))
+ if (GST_PAD_LINK_OK != GST_PAD_LINK(pad, sinkpad))
{
LOGE("failed to get pad from sinkbin\n");
goto ERROR;
if (!reusing)
{
/* run */
- if (GST_STATE_CHANGE_FAILURE == gst_element_set_state (sinkbin, GST_STATE_PAUSED))
+ if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(sinkbin, GST_STATE_PAUSED))
{
LOGE("failed to set state(PAUSED) to sinkbin\n");
goto ERROR;
if (text_selector)
{
- if (GST_STATE_CHANGE_FAILURE == gst_element_set_state (text_selector, GST_STATE_PAUSED))
+ if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(text_selector, GST_STATE_PAUSED))
{
LOGE("failed to set state(PAUSED) to sinkbin\n");
goto ERROR;
}
}
- gst_object_unref (sinkpad);
+ gst_object_unref(sinkpad);
sinkpad = NULL;
}
- LOGD ("linking sink bin success\n");
+ LOGD("linking sink bin success\n");
/* FIXIT : we cannot hold callback for 'no-more-pad' signal because signal was emitted in
* streaming task. if the task blocked, then buffer will not flow to the next element
- * ( autoplugging element ). so this is special hack for streaming. please try to remove it
+ *(autoplugging element). so this is special hack for streaming. please try to remove it
*/
/* dec stream count. we can remove fakesink if it's zero */
if (player->num_dynamic_pad)
player->num_dynamic_pad--;
- LOGD ("no more pads: %d stream count dec : %d (num of dynamic pad)\n", player->no_more_pad, player->num_dynamic_pad);
+ LOGD("no more pads: %d stream count dec : %d(num of dynamic pad)\n", player->no_more_pad, player->num_dynamic_pad);
if ((player->no_more_pad) && (player->num_dynamic_pad == 0))
{
- __mmplayer_pipeline_complete (NULL, player);
+ __mmplayer_pipeline_complete(NULL, player);
}
/* FIXIT : please leave a note why this code is needed */
- if(MMPLAYER_IS_WFD_STREAMING( player ))
+ if (MMPLAYER_IS_WFD_STREAMING(player))
{
player->no_more_pad = TRUE;
}
MMPLAYER_FREEIF(caps_str);
- if ( caps )
- gst_caps_unref( caps );
+ if (caps)
+ gst_caps_unref(caps);
- if ( sinkpad )
+ if (sinkpad)
gst_object_unref(GST_OBJECT(sinkpad));
/* flusing out new attributes */
- if ( mmf_attrs_commit ( attrs ) )
+ if ( mmf_attrs_commit(attrs))
{
LOGE("failed to comit attributes\n");
}
}
/* chech if supported or not */
- if ( dest_angle % 90 )
+ if (dest_angle % 90)
{
LOGD("not supported rotation angle = %d", rotation_angle);
return FALSE;
}
/*
- * xvimagesink only (A)
- * custom_convert - no xv (e.g. memsink, evasimagesink (B)
- * videoflip - avsysmemsink (C)
+ * xvimagesink only (A)
+ * custom_convert - no xv(e.g. memsink, evasimagesink (B)
+ * videoflip - avsysmemsink(C)
*/
if (player->set_mode.video_zc)
{
}
/* get property value for setting */
- switch(rotation_type)
+ switch (rotation_type)
{
case ROTATION_USING_SINK: // xvimagesink, pixmap
{
__mmplayer_video_param_check_video_sink_bin(mm_player_t* player)
{
/* check video sinkbin is created */
- MMPLAYER_RETURN_VAL_IF_FAIL ( player &&
+ MMPLAYER_RETURN_VAL_IF_FAIL(player &&
player->pipeline &&
player->pipeline->videobin &&
player->pipeline->videobin[MMPLAYER_V_BIN].gst &&
player->pipeline->videobin[MMPLAYER_V_SINK].gst,
- MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MM_ERROR_PLAYER_NOT_INITIALIZED);
return MM_ERROR_NONE;
}
MMPLAYER_FENTER();
/* check video sinkbin is created */
- if(MM_ERROR_NONE != __mmplayer_video_param_check_video_sink_bin(player))
+ if (MM_ERROR_NONE != __mmplayer_video_param_check_video_sink_bin(player))
return;
__mmplayer_get_video_angle(player, &user_angle, &org_angle);
MMPLAYER_FENTER();
/* check video sinkbin is created */
- if(MM_ERROR_NONE != __mmplayer_video_param_check_video_sink_bin(player))
+ if (MM_ERROR_NONE != __mmplayer_video_param_check_video_sink_bin(player))
return;
attrs = MMPLAYER_GET_ATTRS(player);
- MMPLAYER_RETURN_IF_FAIL (attrs);
+ MMPLAYER_RETURN_IF_FAIL(attrs);
mm_attrs_get_int_by_name(attrs, "display_visible", &visible);
g_object_set(player->pipeline->videobin[MMPLAYER_V_SINK].gst, "visible", visible, NULL);
MMPLAYER_FENTER();
/* check video sinkbin is created */
- if(MM_ERROR_NONE != __mmplayer_video_param_check_video_sink_bin(player))
+ if (MM_ERROR_NONE != __mmplayer_video_param_check_video_sink_bin(player))
return;
attrs = MMPLAYER_GET_ATTRS(player);
- MMPLAYER_RETURN_IF_FAIL (attrs);
+ MMPLAYER_RETURN_IF_FAIL(attrs);
mm_attrs_get_int_by_name(attrs, "display_method", &display_method);
g_object_set(player->pipeline->videobin[MMPLAYER_V_SINK].gst, "display-geometry-method", display_method, NULL);
MMPLAYER_FENTER();
/* check video sinkbin is created */
- if(MM_ERROR_NONE != __mmplayer_video_param_check_video_sink_bin(player))
+ if (MM_ERROR_NONE != __mmplayer_video_param_check_video_sink_bin(player))
return;
attrs = MMPLAYER_GET_ATTRS(player);
- MMPLAYER_RETURN_IF_FAIL (attrs);
+ MMPLAYER_RETURN_IF_FAIL(attrs);
mm_attrs_get_data_by_name(attrs, "display_overlay", &handle);
/* After setting window handle, set render rectangle */
gst_video_overlay_set_render_rectangle(
- GST_VIDEO_OVERLAY( player->pipeline->videobin[MMPLAYER_V_SINK].gst ),
+ GST_VIDEO_OVERLAY(player->pipeline->videobin[MMPLAYER_V_SINK].gst),
wl_window_x, wl_window_y, wl_window_width, wl_window_height);
LOGD("set video param : render rectangle : x(%d) y(%d) width(%d) height(%d)",
wl_window_x, wl_window_y, wl_window_width, wl_window_height);
GstContext *context = NULL;
/* check video sinkbin is created */
- if(MM_ERROR_NONE != __mmplayer_video_param_check_video_sink_bin(player))
+ if (MM_ERROR_NONE != __mmplayer_video_param_check_video_sink_bin(player))
return;
attrs = MMPLAYER_GET_ATTRS(player);
- MMPLAYER_RETURN_IF_FAIL (attrs);
+ MMPLAYER_RETURN_IF_FAIL(attrs);
/* common case if using overlay surface */
mm_attrs_get_data_by_name(attrs, "display_overlay", &handle);
wl_surface_id = *(int*)handle;
LOGD("set video param : wl_surface_id %d %p", wl_surface_id, *(int*)handle);
gst_video_overlay_set_wl_window_wl_surface_id(
- GST_VIDEO_OVERLAY( player->pipeline->videobin[MMPLAYER_V_SINK].gst ),
- *(int*)handle );
+ GST_VIDEO_OVERLAY(player->pipeline->videobin[MMPLAYER_V_SINK].gst),
+ *(int*)handle);
}
else if (handle && use_wl_surface) /* use wl_surface for legacy_player_test */
{
guintptr wl_surface = (guintptr)handle;
LOGD("[use wl_surface for legacy_player_test] set video param : wayland surface %p", handle);
gst_video_overlay_set_window_handle(
- GST_VIDEO_OVERLAY( player->pipeline->videobin[MMPLAYER_V_SINK].gst ),
- wl_surface );
+ GST_VIDEO_OVERLAY(player->pipeline->videobin[MMPLAYER_V_SINK].gst),
+ wl_surface);
}
else
{
MMPLAYER_FENTER();
/* check video sinkbin is created */
- if(MM_ERROR_NONE != __mmplayer_video_param_check_video_sink_bin(player))
+ if (MM_ERROR_NONE != __mmplayer_video_param_check_video_sink_bin(player))
return MM_ERROR_PLAYER_NOT_INITIALIZED;
if (strcmp(player->ini.videosink_element_overlay, "waylandsink"))
}
LOGD("param_name : %s", param_name);
- if(!g_strcmp0(param_name, "update_all_param"))
+ if (!g_strcmp0(param_name, "update_all_param"))
{
update_all_param = TRUE;
}
{
__mmplayer_video_param_set_display_overlay(player);
}
- if (update_all_param || !g_strcmp0(param_name, "wl_window_render_x") || !g_strcmp0(param_name, "display_overlay") )
+ if (update_all_param || !g_strcmp0(param_name, "wl_window_render_x") || !g_strcmp0(param_name, "display_overlay"))
{
__mmplayer_video_param_set_render_rectangle(player);
}
MMPLAYER_FENTER();
/* check video sinkbin is created */
- if(MM_ERROR_NONE != __mmplayer_video_param_check_video_sink_bin(player))
+ if (MM_ERROR_NONE != __mmplayer_video_param_check_video_sink_bin(player))
return MM_ERROR_PLAYER_NOT_INITIALIZED;
attrs = MMPLAYER_GET_ATTRS(player);
- MMPLAYER_RETURN_VAL_IF_FAIL (attrs, MM_ERROR_PLAYER_INTERNAL);
+ MMPLAYER_RETURN_VAL_IF_FAIL(attrs, MM_ERROR_PLAYER_INTERNAL);
__mmplayer_get_video_angle(player, &user_angle, &org_angle);
if (user_angle != 0)
{
mm_attrs_set_int_by_name(attrs, "display_rotation", MM_DISPLAY_ROTATION_NONE);
- if (mmf_attrs_commit (attrs)) /* return -1 if error */
+ if (mmf_attrs_commit(attrs)) /* return -1 if error */
LOGE("failed to commit\n");
LOGW("unsupported feature");
return MM_ERROR_NOT_SUPPORT_API;
MMPLAYER_FENTER();
/* check video sinkbin is created */
- if(MM_ERROR_NONE != __mmplayer_video_param_check_video_sink_bin(player))
+ if (MM_ERROR_NONE != __mmplayer_video_param_check_video_sink_bin(player))
return MM_ERROR_PLAYER_NOT_INITIALIZED;
attrs = MMPLAYER_GET_ATTRS(player);
- if ( !attrs )
+ if (!attrs)
{
LOGE("cannot get content attribute");
return MM_ERROR_PLAYER_INTERNAL;
LOGD("check display surface type attribute: %d", surface_type);
/* configuring display */
- switch ( surface_type )
+ switch (surface_type)
{
case MM_DISPLAY_SURFACE_OVERLAY:
{
prv_element = (MMPlayerGstElement*)bucket->data;
bucket = bucket->next;
- for ( ; bucket; bucket = bucket->next )
+ for (; bucket; bucket = bucket->next)
{
element = (MMPlayerGstElement*)bucket->data;
- if ( element && element->gst )
+ if (element && element->gst)
{
/* If next element is audio appsrc then make a separate audio pipeline */
if (!strcmp(GST_ELEMENT_NAME(GST_ELEMENT(element->gst)),"audio_appsrc") ||
}
if (prv_element && prv_element->gst) {
- if ( GST_ELEMENT_LINK(GST_ELEMENT(prv_element->gst), GST_ELEMENT(element->gst)) )
+ if (GST_ELEMENT_LINK(GST_ELEMENT(prv_element->gst), GST_ELEMENT(element->gst)))
{
LOGD("linking [%s] to [%s] success\n",
GST_ELEMENT_NAME(GST_ELEMENT(prv_element->gst)),
- GST_ELEMENT_NAME(GST_ELEMENT(element->gst)) );
+ GST_ELEMENT_NAME(GST_ELEMENT(element->gst)));
successful_link_count ++;
}
else
{
LOGD("linking [%s] to [%s] failed\n",
GST_ELEMENT_NAME(GST_ELEMENT(prv_element->gst)),
- GST_ELEMENT_NAME(GST_ELEMENT(element->gst)) );
+ GST_ELEMENT_NAME(GST_ELEMENT(element->gst)));
return -1;
}
}
MMPLAYER_RETURN_VAL_IF_FAIL(element_bucket, 0);
MMPLAYER_RETURN_VAL_IF_FAIL(bin, 0);
- for ( ; bucket; bucket = bucket->next )
+ for (; bucket; bucket = bucket->next)
{
element = (MMPlayerGstElement*)bucket->data;
- if ( element && element->gst )
+ if (element && element->gst)
{
- if( !gst_bin_add(bin, GST_ELEMENT(element->gst)) )
+ if (!gst_bin_add(bin, GST_ELEMENT(element->gst)))
{
LOGD("__mmplayer_gst_element_link_bucket : Adding element [%s] to bin [%s] failed\n",
GST_ELEMENT_NAME(GST_ELEMENT(element->gst)),
- GST_ELEMENT_NAME(GST_ELEMENT(bin) ) );
+ GST_ELEMENT_NAME(GST_ELEMENT(bin)));
return 0;
}
successful_add_count ++;
return successful_add_count;
}
-static void __mmplayer_gst_caps_notify_cb (GstPad * pad, GParamSpec * unused, gpointer data)
+static void __mmplayer_gst_caps_notify_cb(GstPad * pad, GParamSpec * unused, gpointer data)
{
mm_player_t* player = (mm_player_t*) data;
GstCaps *caps = NULL;
MMPLAYER_FENTER();
- MMPLAYER_RETURN_IF_FAIL ( pad )
- MMPLAYER_RETURN_IF_FAIL ( unused )
- MMPLAYER_RETURN_IF_FAIL ( data )
+ MMPLAYER_RETURN_IF_FAIL(pad)
+ MMPLAYER_RETURN_IF_FAIL(unused)
+ MMPLAYER_RETURN_IF_FAIL(data)
- caps = gst_pad_get_current_caps( pad );
- if ( !caps )
+ caps = gst_pad_get_current_caps(pad);
+ if (!caps)
{
return;
}
str = gst_caps_get_structure(caps, 0);
- if ( !str )
+ if (!str)
{
goto ERROR;
}
name = gst_structure_get_name(str);
- if ( !name )
+ if (!name)
{
goto ERROR;
}
if (strstr(name, "audio"))
{
- _mmplayer_update_content_attrs (player, ATTR_AUDIO);
+ _mmplayer_update_content_attrs(player, ATTR_AUDIO);
if (player->audio_stream_changed_cb)
{
}
else if (strstr(name, "video"))
{
- _mmplayer_update_content_attrs (player, ATTR_VIDEO);
+ _mmplayer_update_content_attrs(player, ATTR_VIDEO);
if (player->video_stream_changed_cb)
{
#define MMPLAYER_CREATEONLY_ELEMENT(x_bin, x_id, x_factory, x_name) \
x_bin[x_id].id = x_id;\
x_bin[x_id].gst = gst_element_factory_make(x_factory, x_name);\
-if ( ! x_bin[x_id].gst )\
+if (!x_bin[x_id].gst)\
{\
LOGE("failed to create %s \n", x_factory);\
goto ERROR;\
#define MMPLAYER_CREATE_ELEMENT_ADD_BIN(x_bin, x_id, x_factory, x_name, y_bin, x_player) \
x_bin[x_id].id = x_id;\
x_bin[x_id].gst = gst_element_factory_make(x_factory, x_name);\
-if ( ! x_bin[x_id].gst )\
+if (!x_bin[x_id].gst)\
{\
LOGE("failed to create %s \n", x_factory);\
goto ERROR;\
if (x_player->ini.set_dump_element_flag)\
__mmplayer_add_dump_buffer_probe(x_player, x_bin[x_id].gst);\
}\
-if( !gst_bin_add(GST_BIN(y_bin), GST_ELEMENT(x_bin[x_id].gst)))\
+if (!gst_bin_add(GST_BIN(y_bin), GST_ELEMENT(x_bin[x_id].gst)))\
{\
LOGD("__mmplayer_gst_element_link_bucket : Adding element [%s] to bin [%s] failed\n",\
GST_ELEMENT_NAME(GST_ELEMENT(x_bin[x_id].gst)),\
- GST_ELEMENT_NAME(GST_ELEMENT(y_bin) ) );\
+ GST_ELEMENT_NAME(GST_ELEMENT(y_bin)));\
goto ERROR;\
}\
{ \
x_bin[x_id].id = x_id;\
x_bin[x_id].gst = gst_element_factory_make(x_factory, x_name);\
- if ( ! x_bin[x_id].gst )\
+ if (!x_bin[x_id].gst)\
{\
LOGE("failed to create %s \n", x_factory);\
goto ERROR;\
if (x_player->ini.set_dump_element_flag)\
__mmplayer_add_dump_buffer_probe(x_player, x_bin[x_id].gst);\
}\
- if ( x_add_bucket )\
+ if (x_add_bucket)\
element_bucket = g_list_append(element_bucket, &x_bin[x_id]);\
-} while(0);
+} while (0);
static void
__mmplayer_audio_stream_clear_buffer(mm_player_t* player, gboolean send_all)
audio_stream.data_size = a_buffer->data_size;
audio_stream.data = a_buffer->pcm_data;
- LOGD ("[%lld] send data size:%d, %p", audio_stream.channel_mask, audio_stream.data_size, player->audio_stream_cb_user_param);
+ LOGD("[%lld] send data size:%d, %p", audio_stream.channel_mask, audio_stream.data_size, player->audio_stream_cb_user_param);
player->audio_stream_render_cb_ex(&audio_stream, player->audio_stream_cb_user_param);
MMPLAYER_FLEAVE();
a_data = mapinfo.data;
a_size = mapinfo.size;
- GstCaps *caps = gst_pad_get_current_caps( pad );
- GstStructure *structure = gst_caps_get_structure (caps, 0);
+ GstCaps *caps = gst_pad_get_current_caps(pad);
+ GstStructure *structure = gst_caps_get_structure(caps, 0);
MMPLAYER_LOG_GST_CAPS_TYPE(caps);
- gst_structure_get_int (structure, "rate", &rate);
- gst_structure_get_int (structure, "channels", &channel);
- gst_structure_get_int (structure, "depth", &depth);
- gst_structure_get_int (structure, "endianness", &endianness);
- gst_structure_get (structure, "channel-mask", GST_TYPE_BITMASK, &channel_mask, NULL);
+ gst_structure_get_int(structure, "rate", &rate);
+ gst_structure_get_int(structure, "channels", &channel);
+ gst_structure_get_int(structure, "depth", &depth);
+ gst_structure_get_int(structure, "endianness", &endianness);
+ gst_structure_get(structure, "channel-mask", GST_TYPE_BITMASK, &channel_mask, NULL);
gst_caps_unref(GST_CAPS(caps));
/* In case of the sync is false, use buffer list. *
}
memcpy(a_buffer->pcm_data, a_data, a_size);
LOGD("new [%lld] total:%d buff:%d", channel_mask, a_buffer->data_size, a_buffer->buff_size);
- player->audio_stream_buff_list = g_list_append (player->audio_stream_buff_list, a_buffer);
+ player->audio_stream_buff_list = g_list_append(player->audio_stream_buff_list, a_buffer);
} else {
/* If sync is TRUE, send data directly. */
a_buffer->pcm_data = a_data;
}
static void
-__mmplayer_gst_audio_deinterleave_pad_added (GstElement *elem, GstPad *pad, gpointer data)
+__mmplayer_gst_audio_deinterleave_pad_added(GstElement *elem, GstPad *pad, gpointer data)
{
mm_player_t* player = (mm_player_t*)data;
MMPlayerGstElement* audiobin = player->pipeline->audiobin;
GstElement *queue = NULL, *sink = NULL;
MMPLAYER_FENTER();
- MMPLAYER_RETURN_IF_FAIL (player && player->pipeline && player->pipeline->mainbin);
+ MMPLAYER_RETURN_IF_FAIL(player && player->pipeline && player->pipeline->mainbin);
- queue = gst_element_factory_make ("queue", NULL);
+ queue = gst_element_factory_make("queue", NULL);
if (queue == NULL)
{
- LOGD ("fail make queue\n");
+ LOGD("fail make queue\n");
goto ERROR;
}
- sink = gst_element_factory_make ("fakesink", NULL);
+ sink = gst_element_factory_make("fakesink", NULL);
if (sink == NULL)
{
- LOGD ("fail make fakesink\n");
+ LOGD("fail make fakesink\n");
goto ERROR;
}
- gst_bin_add_many (GST_BIN(audiobin[MMPLAYER_A_BIN].gst), queue, sink, NULL);
+ gst_bin_add_many(GST_BIN(audiobin[MMPLAYER_A_BIN].gst), queue, sink, NULL);
- if (!gst_element_link_pads_full (queue, "src", sink, "sink", GST_PAD_LINK_CHECK_NOTHING))
+ if (!gst_element_link_pads_full(queue, "src", sink, "sink", GST_PAD_LINK_CHECK_NOTHING))
{
LOGW("failed to link queue & sink\n");
goto ERROR;
}
- sinkpad = gst_element_get_static_pad (queue, "sink");
+ sinkpad = gst_element_get_static_pad(queue, "sink");
if (GST_PAD_LINK_OK != gst_pad_link(pad, sinkpad))
{
- LOGW ("failed to link [%s:%s] to queue\n", GST_DEBUG_PAD_NAME(pad));
+ LOGW("failed to link [%s:%s] to queue\n", GST_DEBUG_PAD_NAME(pad));
goto ERROR;
}
LOGE("player->audio_stream_sink_sync: %d\n", player->audio_stream_sink_sync);
- gst_object_unref (sinkpad);
- g_object_set (sink, "sync", player->audio_stream_sink_sync, NULL);
- g_object_set (sink, "signal-handoffs", TRUE, NULL);
+ gst_object_unref(sinkpad);
+ g_object_set(sink, "sync", player->audio_stream_sink_sync, NULL);
+ g_object_set(sink, "signal-handoffs", TRUE, NULL);
- gst_element_set_state (sink, GST_STATE_PAUSED);
- gst_element_set_state (queue, GST_STATE_PAUSED);
+ gst_element_set_state(sink, GST_STATE_PAUSED);
+ gst_element_set_state(queue, GST_STATE_PAUSED);
- MMPLAYER_SIGNAL_CONNECT( player,
+ MMPLAYER_SIGNAL_CONNECT(player,
G_OBJECT(sink),
MM_PLAYER_SIGNAL_TYPE_AUDIOBIN,
"handoff",
G_CALLBACK(__mmplayer_audio_stream_decoded_render_cb),
- (gpointer)player );
+ (gpointer)player);
MMPLAYER_FLEAVE();
return ;
}
if (sinkpad)
{
- gst_object_unref ( GST_OBJECT(sinkpad) );
+ gst_object_unref(GST_OBJECT(sinkpad));
sinkpad = NULL;
}
*/
MMPLAYER_FENTER();
mm_attrs_get_int_by_name(attrs, "sound_stream_index", &stream_id);
- mm_attrs_get_string_by_name (attrs, "sound_stream_type", &stream_type );
+ mm_attrs_get_string_by_name(attrs, "sound_stream_type", &stream_type);
if (!stream_type)
{
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL( player && player->pipeline, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline, MM_ERROR_PLAYER_NOT_INITIALIZED);
/* alloc handles */
audiobin = (MMPlayerGstElement*)g_malloc0(sizeof(MMPlayerGstElement) * MMPLAYER_A_NUM);
- if ( ! audiobin )
+ if (!audiobin)
{
LOGE("failed to allocate memory for audiobin\n");
return MM_ERROR_PLAYER_NO_FREE_SPACE;
/* create bin */
audiobin[MMPLAYER_A_BIN].id = MMPLAYER_A_BIN;
audiobin[MMPLAYER_A_BIN].gst = gst_bin_new("audiobin");
- if ( !audiobin[MMPLAYER_A_BIN].gst )
+ if (!audiobin[MMPLAYER_A_BIN].gst)
{
LOGE("failed to create audiobin\n");
goto ERROR;
if (player->set_mode.pcm_extraction) // pcm extraction only and no sound output
{
- if(player->audio_stream_render_cb_ex)
+ if (player->audio_stream_render_cb_ex)
{
char *caps_str = NULL;
GstCaps* caps = NULL;
/* capsfilter */
MMPLAYER_CREATE_ELEMENT(audiobin, MMPLAYER_A_CAPS_DEFAULT, "capsfilter", "audio capsfilter", TRUE, player);
- mm_attrs_get_string_by_name (player->attrs, "pcm_audioformat", &format );
+ mm_attrs_get_string_by_name(player->attrs, "pcm_audioformat", &format);
LOGD("contents : format: %s samplerate : %d pcm_channel: %d", format, player->pcm_samplerate, player->pcm_channel);
- caps = gst_caps_new_simple ("audio/x-raw",
+ caps = gst_caps_new_simple("audio/x-raw",
"format", G_TYPE_STRING, format,
"rate", G_TYPE_INT, player->pcm_samplerate,
"channels", G_TYPE_INT, player->pcm_channel,
caps_str = gst_caps_to_string(caps);
LOGD("new caps : %s\n", caps_str);
- g_object_set (GST_ELEMENT(audiobin[MMPLAYER_A_CAPS_DEFAULT].gst), "caps", caps, NULL );
+ g_object_set(GST_ELEMENT(audiobin[MMPLAYER_A_CAPS_DEFAULT].gst), "caps", caps, NULL);
/* clean */
- gst_caps_unref( caps );
- MMPLAYER_FREEIF( caps_str );
+ gst_caps_unref(caps);
+ MMPLAYER_FREEIF(caps_str);
MMPLAYER_CREATE_ELEMENT(audiobin, MMPLAYER_A_DEINTERLEAVE, "deinterleave", "deinterleave", TRUE, player);
- g_object_set (G_OBJECT (audiobin[MMPLAYER_A_DEINTERLEAVE].gst), "keep-positions", TRUE, NULL);
+ g_object_set(G_OBJECT(audiobin[MMPLAYER_A_DEINTERLEAVE].gst), "keep-positions", TRUE, NULL);
/* raw pad handling signal */
- MMPLAYER_SIGNAL_CONNECT( player,
+ MMPLAYER_SIGNAL_CONNECT(player,
(audiobin[MMPLAYER_A_DEINTERLEAVE].gst),
MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "pad-added",
G_CALLBACK(__mmplayer_gst_audio_deinterleave_pad_added), player);
/* capsfilter */
MMPLAYER_CREATE_ELEMENT(audiobin, MMPLAYER_A_CAPS_DEFAULT, "capsfilter", "audio capsfilter", TRUE, player);
- caps = gst_caps_new_simple ("audio/x-raw",
+ caps = gst_caps_new_simple("audio/x-raw",
"rate", G_TYPE_INT, dst_samplerate,
"channels", G_TYPE_INT, dst_channels,
"depth", G_TYPE_INT, dst_depth,
caps_str = gst_caps_to_string(caps);
LOGD("new caps : %s\n", caps_str);
- g_object_set (GST_ELEMENT(audiobin[MMPLAYER_A_CAPS_DEFAULT].gst), "caps", caps, NULL );
+ g_object_set(GST_ELEMENT(audiobin[MMPLAYER_A_CAPS_DEFAULT].gst), "caps", caps, NULL);
/* clean */
- gst_caps_unref( caps );
- MMPLAYER_FREEIF( caps_str );
+ gst_caps_unref(caps);
+ MMPLAYER_FREEIF(caps_str);
/* fake sink */
MMPLAYER_CREATE_ELEMENT(audiobin, MMPLAYER_A_SINK, "fakesink", "fakesink", TRUE, player);
/* set sync */
- g_object_set (G_OBJECT (audiobin[MMPLAYER_A_SINK].gst), "sync", FALSE, NULL);
+ g_object_set(G_OBJECT(audiobin[MMPLAYER_A_SINK].gst), "sync", FALSE, NULL);
}
}
else // normal playback
/* for logical volume control */
MMPLAYER_CREATE_ELEMENT(audiobin, MMPLAYER_A_VOL, "volume", "volume", TRUE, player);
- g_object_set(G_OBJECT (audiobin[MMPLAYER_A_VOL].gst), "volume", player->sound.volume, NULL);
+ g_object_set(G_OBJECT(audiobin[MMPLAYER_A_VOL].gst), "volume", player->sound.volume, NULL);
if (player->sound.mute)
{
LOGD("mute enabled\n");
- g_object_set(G_OBJECT (audiobin[MMPLAYER_A_VOL].gst), "mute", player->sound.mute, NULL);
+ g_object_set(G_OBJECT(audiobin[MMPLAYER_A_VOL].gst), "mute", player->sound.mute, NULL);
}
#if 0
/*capsfilter */
MMPLAYER_CREATE_ELEMENT(audiobin, MMPLAYER_A_CAPS_DEFAULT, "capsfilter", "audiocapsfilter", TRUE, player);
- caps = gst_caps_from_string( "audio/x-raw-int, "
+ caps = gst_caps_from_string("audio/x-raw-int, "
"endianness = (int) LITTLE_ENDIAN, "
"signed = (boolean) true, "
"width = (int) 16, "
- "depth = (int) 16" );
- g_object_set (GST_ELEMENT(audiobin[MMPLAYER_A_CAPS_DEFAULT].gst), "caps", caps, NULL );
- gst_caps_unref( caps );
+ "depth = (int) 16");
+ g_object_set(GST_ELEMENT(audiobin[MMPLAYER_A_CAPS_DEFAULT].gst), "caps", caps, NULL);
+ gst_caps_unref(caps);
#endif
/* chech if multi-chennels */
//MMPLAYER_LOG_GST_CAPS_TYPE(caps);
GstStructure *str = gst_caps_get_structure(caps, 0);
if (str)
- gst_structure_get_int (str, "channels", &channels);
+ gst_structure_get_int(str, "channels", &channels);
gst_caps_unref(caps);
}
gst_object_unref(srcpad);
}
/* audio effect element. if audio effect is enabled */
- if ( (strcmp(player->ini.audioeffect_element, ""))
+ if ((strcmp(player->ini.audioeffect_element, ""))
&& (channels <= 2)
&& (player->ini.use_audio_effect_preset || player->ini.use_audio_effect_custom))
{
LOGD("audio effect config. bypass = %d, effect type = %d", player->bypass_audio_effect, player->audio_effect_info.effect_type);
- if ( (!player->bypass_audio_effect)
- && (player->ini.use_audio_effect_preset || player->ini.use_audio_effect_custom) )
+ if ((!player->bypass_audio_effect)
+ && (player->ini.use_audio_effect_preset || player->ini.use_audio_effect_custom))
{
- if ( MM_AUDIO_EFFECT_TYPE_CUSTOM == player->audio_effect_info.effect_type )
+ if (MM_AUDIO_EFFECT_TYPE_CUSTOM == player->audio_effect_info.effect_type)
{
if (!_mmplayer_audio_effect_custom_apply(player))
{
}
}
- if ( (strcmp(player->ini.audioeffect_element_custom, ""))
- && (player->set_mode.rich_audio) )
+ if ((strcmp(player->ini.audioeffect_element_custom, ""))
+ && (player->set_mode.rich_audio))
{
MMPLAYER_CREATE_ELEMENT(audiobin, MMPLAYER_A_FILTER_SEC, player->ini.audioeffect_element_custom, "audio effect filter custom", TRUE, player);
}
MMPLAYER_CREATE_ELEMENT(audiobin, MMPLAYER_A_SINK, player->ini.audiosink_element, "audiosink", link_audio_sink_now, player);
/* qos on */
- g_object_set (G_OBJECT (audiobin[MMPLAYER_A_SINK].gst), "qos", TRUE, NULL); /* qos on */
- g_object_set (G_OBJECT (audiobin[MMPLAYER_A_SINK].gst), "slave-method", GST_AUDIO_BASE_SINK_SLAVE_NONE, NULL);
+ g_object_set(G_OBJECT(audiobin[MMPLAYER_A_SINK].gst), "qos", TRUE, NULL); /* qos on */
+ g_object_set(G_OBJECT(audiobin[MMPLAYER_A_SINK].gst), "slave-method", GST_AUDIO_BASE_SINK_SLAVE_NONE, NULL);
if (player->videodec_linked && player->ini.use_system_clock)
{
LOGD("system clock will be used.\n");
- g_object_set (G_OBJECT (audiobin[MMPLAYER_A_SINK].gst), "provide-clock", FALSE, NULL);
+ g_object_set(G_OBJECT(audiobin[MMPLAYER_A_SINK].gst), "provide-clock", FALSE, NULL);
}
if (g_strrstr(player->ini.audiosink_element, "pulsesink"))
{
GstPad *sink_pad = NULL;
sink_pad = gst_element_get_static_pad(audiobin[MMPLAYER_A_SINK].gst, "sink");
- MMPLAYER_SIGNAL_CONNECT (player, sink_pad, MM_PLAYER_SIGNAL_TYPE_AUDIOBIN,
+ MMPLAYER_SIGNAL_CONNECT(player, sink_pad, MM_PLAYER_SIGNAL_TYPE_AUDIOBIN,
"notify::caps", G_CALLBACK(__mmplayer_gst_caps_notify_cb), player);
- gst_object_unref (GST_OBJECT(sink_pad));
+ gst_object_unref(GST_OBJECT(sink_pad));
}
- __mmplayer_add_sink( player, audiobin[MMPLAYER_A_SINK].gst );
+ __mmplayer_add_sink(player, audiobin[MMPLAYER_A_SINK].gst);
/* adding created elements to bin */
LOGD("adding created elements to bin\n");
- if( !__mmplayer_gst_element_add_bucket_to_bin( GST_BIN(audiobin[MMPLAYER_A_BIN].gst), element_bucket ))
+ if (!__mmplayer_gst_element_add_bucket_to_bin(GST_BIN(audiobin[MMPLAYER_A_BIN].gst), element_bucket))
{
LOGE("failed to add elements\n");
goto ERROR;
/* linking elements in the bucket by added order. */
LOGD("Linking elements in the bucket by added order.\n");
- if ( __mmplayer_gst_element_link_bucket(element_bucket) == -1 )
+ if (__mmplayer_gst_element_link_bucket(element_bucket) == -1)
{
LOGE("failed to link elements\n");
goto ERROR;
}
pad = gst_element_get_static_pad(GST_ELEMENT(first_element->gst), "sink");
- if ( ! pad )
+ if (!pad)
{
LOGE("failed to get pad from first element of audiobin\n");
goto ERROR;
}
ghostpad = gst_ghost_pad_new("sink", pad);
- if ( ! ghostpad )
+ if (!ghostpad)
{
LOGE("failed to create ghostpad\n");
goto ERROR;
}
- if ( FALSE == gst_element_add_pad(audiobin[MMPLAYER_A_BIN].gst, ghostpad) )
+ if (FALSE == gst_element_add_pad(audiobin[MMPLAYER_A_BIN].gst, ghostpad))
{
LOGE("failed to add ghostpad to audiobin\n");
goto ERROR;
LOGD("ERROR : releasing audiobin\n");
- if ( pad )
+ if (pad)
gst_object_unref(GST_OBJECT(pad));
- if ( ghostpad )
+ if (ghostpad)
gst_object_unref(GST_OBJECT(ghostpad));
if (element_bucket)
- g_list_free( element_bucket );
+ g_list_free(element_bucket);
/* release element which are not added to bin */
- for ( i = 1; i < MMPLAYER_A_NUM; i++ ) /* NOTE : skip bin */
+ for (i = 1; i < MMPLAYER_A_NUM; i++) /* NOTE : skip bin */
{
- if ( audiobin[i].gst )
+ if (audiobin[i].gst)
{
GstObject* parent = NULL;
- parent = gst_element_get_parent( audiobin[i].gst );
+ parent = gst_element_get_parent(audiobin[i].gst);
- if ( !parent )
+ if (!parent)
{
gst_object_unref(GST_OBJECT(audiobin[i].gst));
audiobin[i].gst = NULL;
}
/* release audiobin with it's childs */
- if ( audiobin[MMPLAYER_A_BIN].gst )
+ if (audiobin[MMPLAYER_A_BIN].gst)
{
gst_object_unref(GST_OBJECT(audiobin[MMPLAYER_A_BIN].gst));
}
- MMPLAYER_FREEIF( audiobin );
+ MMPLAYER_FREEIF(audiobin);
player->pipeline->audiobin = NULL;
}
static GstPadProbeReturn
-__mmplayer_audio_stream_probe (GstPad *pad, GstPadProbeInfo *info, gpointer u_data)
+__mmplayer_audio_stream_probe(GstPad *pad, GstPadProbeInfo *info, gpointer u_data)
{
mm_player_t* player = (mm_player_t*) u_data;
GstBuffer *pad_buffer = gst_pad_probe_info_get_buffer(info);
if (player->video_bo_list) {
/* if bo list did not created all, try it again. */
idx = g_list_length(player->video_bo_list);
- LOGD("bo list exist (len: %d)", idx);
+ LOGD("bo list exist(len: %d)", idx);
}
for (; idx<player->ini.num_of_video_bo ; idx++) {
caps = gst_pad_get_current_caps(pad);
if (caps == NULL) {
- LOGE( "Caps is NULL." );
+ LOGE("Caps is NULL.");
return;
}
/* clear stream data structure */
memset(&stream, 0x0, sizeof(MMPlayerVideoStreamDataType));
- structure = gst_caps_get_structure( caps, 0 );
- gst_structure_get_int(structure, "width", &(stream.width));
- gst_structure_get_int(structure, "height", &(stream.height));
+ structure = gst_caps_get_structure(caps, 0);
+ gst_structure_get_int(structure, "width", & (stream.width));
+ gst_structure_get_int(structure, "height", & (stream.height));
string_format = gst_structure_get_string(structure, "format");
- if(string_format) {
+ if (string_format) {
fourcc = _mmplayer_convert_fourcc_string_to_value(string_format);
}
stream.format = util_get_pixtype(fourcc);
- gst_caps_unref( caps );
+ gst_caps_unref(caps);
caps = NULL;
/*
- LOGD( "Call video steramCb, data[%p], Width[%d],Height[%d], Format[%d]",
- GST_BUFFER_DATA(buffer), stream.width, stream.height, stream.format );
+ LOGD("Call video steramCb, data[%p], Width[%d],Height[%d], Format[%d]",
+ GST_BUFFER_DATA(buffer), stream.width, stream.height, stream.format);
*/
if (stream.width == 0 || stream.height == 0 || stream.format == MM_PIXEL_FORMAT_INVALID) {
stream.internal_buffer = buffer;
} else { /* sw codec */
tbm_bo_handle thandle;
- int stride = GST_ROUND_UP_4 (stream.width);
+ int stride = GST_ROUND_UP_4(stream.width);
int elevation = stream.height;
int size = 0;
stream.stride[0] = stride;
stream.elevation[0] = elevation;
if (stream.format == MM_PIXEL_FORMAT_I420) {
- stream.stride[1] = stream.stride[2] = GST_ROUND_UP_4 (GST_ROUND_UP_2 (stream.width) / 2);
+ stream.stride[1] = stream.stride[2] = GST_ROUND_UP_4(GST_ROUND_UP_2(stream.width) / 2);
stream.elevation[1] = stream.elevation[2] = elevation / 2;
} else {
LOGE("Not support format %d", stream.format);
size = (stream.stride[0] + stream.stride[1]) * elevation;
stream.bo[0] = __mmplayer_video_stream_get_bo(player, size);
- if(!stream.bo[0]) {
+ if (!stream.bo[0]) {
LOGE("Fail to tbm_bo_alloc!!");
gst_memory_unmap(dataBlock, &mapinfo);
return;
}
thandle = tbm_bo_map(stream.bo[0], TBM_DEVICE_CPU, TBM_OPTION_WRITE);
- if(thandle.ptr && mapinfo.data)
+ if (thandle.ptr && mapinfo.data)
memcpy(thandle.ptr, mapinfo.data, size);
else
LOGE("data pointer is wrong. dest : %p, src : %p",
MMPLAYER_FENTER();
- mm_attrs_get_int_by_name (player->attrs, "display_surface_type", (int *)&surface_type);
+ mm_attrs_get_int_by_name(player->attrs, "display_surface_type", (int *)&surface_type);
if (player->set_mode.video_zc) /* ST12 or SN12 , if player use omx, evasimagesink doesn't use videoconvert */
{
- if ( (surface_type == MM_DISPLAY_SURFACE_EVAS) && ( !strcmp(player->ini.videosink_element_evas, "evasimagesink")) )
+ if ((surface_type == MM_DISPLAY_SURFACE_EVAS) && (!strcmp(player->ini.videosink_element_evas, "evasimagesink")))
{
video_csc = player->ini.videoconverter_element;
}
}
/* set video rotator */
- if ( !player->set_mode.video_zc )
+ if (!player->set_mode.video_zc)
MMPLAYER_CREATE_ELEMENT(player->pipeline->videobin, MMPLAYER_V_FLIP, "videoflip", "video rotator", TRUE, player);
/* videoscaler */
*/
/**
* VIDEO PIPELINE
- * - video overlay surface (arm/x86) : waylandsink
- * - evas surface (arm) : evaspixmapsink
- * fimcconvert ! evasimagesink
- * - evas surface (x86) : videoconvertor ! videoflip ! evasimagesink
+ * - video overlay surface(arm/x86) : waylandsink
+ * - evas surface (arm) : evaspixmapsink
+ * fimcconvert !evasimagesink
+ * - evas surface (x86) : videoconvertor !videoflip !evasimagesink
*/
static int
__mmplayer_gst_create_video_pipeline(mm_player_t* player, GstCaps* caps, MMDisplaySurfaceType surface_type)
/* alloc handles */
videobin = (MMPlayerGstElement*)g_malloc0(sizeof(MMPlayerGstElement) * MMPLAYER_V_NUM);
- if ( !videobin )
+ if (!videobin)
{
return MM_ERROR_PLAYER_NO_FREE_SPACE;
}
player->pipeline->videobin = videobin;
attrs = MMPLAYER_GET_ATTRS(player);
- if ( !attrs )
+ if (!attrs)
{
LOGE("cannot get content attribute");
return MM_ERROR_PLAYER_INTERNAL;
/* create bin */
videobin[MMPLAYER_V_BIN].id = MMPLAYER_V_BIN;
videobin[MMPLAYER_V_BIN].gst = gst_bin_new("videobin");
- if ( !videobin[MMPLAYER_V_BIN].gst )
+ if (!videobin[MMPLAYER_V_BIN].gst)
{
LOGE("failed to create videobin");
goto ERROR;
LOGD("selected videosink name: %s", videosink_element);
/* support shard memory with S/W codec on HawkP */
- if(strncmp(videosink_element, "waylandsink", strlen(videosink_element)) == 0)
+ if (strncmp(videosink_element, "waylandsink", strlen(videosink_element)) == 0)
{
g_object_set(player->pipeline->videobin[MMPLAYER_V_SINK].gst,
"use-tbm", use_tbm, NULL);
{
int gapless = 0;
- mm_attrs_get_int_by_name (attrs, "gapless_mode", &gapless);
+ mm_attrs_get_int_by_name(attrs, "gapless_mode", &gapless);
if (gapless > 0) {
LOGD("disable last-sample");
sink_pad = gst_element_get_static_pad(videobin[MMPLAYER_V_SINK].gst, "sink");
if (sink_pad)
{
- MMPLAYER_SIGNAL_CONNECT (player, sink_pad, MM_PLAYER_SIGNAL_TYPE_VIDEOBIN,
+ MMPLAYER_SIGNAL_CONNECT(player, sink_pad, MM_PLAYER_SIGNAL_TYPE_VIDEOBIN,
"notify::caps", G_CALLBACK(__mmplayer_gst_caps_notify_cb), player);
- gst_object_unref (GST_OBJECT(sink_pad));
+ gst_object_unref(GST_OBJECT(sink_pad));
}
else
{
}
/* store it as it's sink element */
- __mmplayer_add_sink( player, videobin[MMPLAYER_V_SINK].gst );
+ __mmplayer_add_sink(player, videobin[MMPLAYER_V_SINK].gst);
/* adding created elements to bin */
- if( ! __mmplayer_gst_element_add_bucket_to_bin(GST_BIN(videobin[MMPLAYER_V_BIN].gst), element_bucket) )
+ if (!__mmplayer_gst_element_add_bucket_to_bin(GST_BIN(videobin[MMPLAYER_V_BIN].gst), element_bucket))
{
LOGE("failed to add elements\n");
goto ERROR;
}
/* Linking elements in the bucket by added order */
- if ( __mmplayer_gst_element_link_bucket(element_bucket) == -1 )
+ if (__mmplayer_gst_element_link_bucket(element_bucket) == -1)
{
LOGE("failed to link elements\n");
goto ERROR;
/* get first element's sinkpad for creating ghostpad */
if (element_bucket)
first_element = (MMPlayerGstElement *)element_bucket->data;
- if ( !first_element )
+ if (!first_element)
{
LOGE("failed to get first element from bucket\n");
goto ERROR;
}
pad = gst_element_get_static_pad(GST_ELEMENT(first_element->gst), "sink");
- if ( !pad )
+ if (!pad)
{
LOGE("failed to get pad from first element\n");
goto ERROR;
/* create ghostpad */
player->ghost_pad_for_videobin = gst_ghost_pad_new("sink", pad);
- if ( FALSE == gst_element_add_pad(videobin[MMPLAYER_V_BIN].gst, player->ghost_pad_for_videobin) )
+ if (FALSE == gst_element_add_pad(videobin[MMPLAYER_V_BIN].gst, player->ghost_pad_for_videobin))
{
LOGE("failed to add ghostpad to videobin\n");
goto ERROR;
ERROR:
LOGE("ERROR : releasing videobin\n");
- g_list_free( element_bucket );
+ g_list_free(element_bucket);
if (pad)
gst_object_unref(GST_OBJECT(pad));
/* release videobin with it's childs */
- if ( videobin[MMPLAYER_V_BIN].gst )
+ if (videobin[MMPLAYER_V_BIN].gst)
{
gst_object_unref(GST_OBJECT(videobin[MMPLAYER_V_BIN].gst));
}
- MMPLAYER_FREEIF( videobin );
+ MMPLAYER_FREEIF(videobin);
player->pipeline->videobin = NULL;
MMPLAYER_CREATE_ELEMENT(textbin, MMPLAYER_T_QUEUE, "queue", "text_queue", TRUE, player);
MMPLAYER_CREATE_ELEMENT(textbin, MMPLAYER_T_IDENTITY, "identity", "text_identity", TRUE, player);
- g_object_set (G_OBJECT (textbin[MMPLAYER_T_IDENTITY].gst),
+ g_object_set(G_OBJECT(textbin[MMPLAYER_T_IDENTITY].gst),
"signal-handoffs", FALSE,
NULL);
MMPLAYER_CREATE_ELEMENT(textbin, MMPLAYER_T_FAKE_SINK, "fakesink", "text_fakesink", TRUE, player);
- MMPLAYER_SIGNAL_CONNECT( player,
+ MMPLAYER_SIGNAL_CONNECT(player,
G_OBJECT(textbin[MMPLAYER_T_FAKE_SINK].gst),
MM_PLAYER_SIGNAL_TYPE_TEXTBIN,
"handoff",
G_CALLBACK(__mmplayer_update_subtitle),
- (gpointer)player );
+ (gpointer)player);
- g_object_set (G_OBJECT (textbin[MMPLAYER_T_FAKE_SINK].gst), "async", TRUE, NULL);
- g_object_set (G_OBJECT (textbin[MMPLAYER_T_FAKE_SINK].gst), "sync", TRUE, NULL);
- g_object_set (G_OBJECT (textbin[MMPLAYER_T_FAKE_SINK].gst), "signal-handoffs", TRUE, NULL);
+ g_object_set(G_OBJECT(textbin[MMPLAYER_T_FAKE_SINK].gst), "async", TRUE, NULL);
+ g_object_set(G_OBJECT(textbin[MMPLAYER_T_FAKE_SINK].gst), "sync", TRUE, NULL);
+ g_object_set(G_OBJECT(textbin[MMPLAYER_T_FAKE_SINK].gst), "signal-handoffs", TRUE, NULL);
if (!player->play_subtitle)
{
- LOGD ("add textbin sink as sink element of whole pipeline.\n");
- __mmplayer_add_sink (player, GST_ELEMENT(textbin[MMPLAYER_T_FAKE_SINK].gst));
+ LOGD("add textbin sink as sink element of whole pipeline.\n");
+ __mmplayer_add_sink(player, GST_ELEMENT(textbin[MMPLAYER_T_FAKE_SINK].gst));
}
/* adding created elements to bin */
LOGD("adding created elements to bin\n");
- if( !__mmplayer_gst_element_add_bucket_to_bin( GST_BIN(textbin[MMPLAYER_T_BIN].gst), element_bucket ))
+ if (!__mmplayer_gst_element_add_bucket_to_bin(GST_BIN(textbin[MMPLAYER_T_BIN].gst), element_bucket))
{
LOGE("failed to add elements\n");
goto ERROR;
}
/* unset sink flag from textbin. not to hold eos when video data is shorter than subtitle */
- GST_OBJECT_FLAG_UNSET (textbin[MMPLAYER_T_BIN].gst, GST_ELEMENT_FLAG_SINK);
- GST_OBJECT_FLAG_UNSET (textbin[MMPLAYER_T_FAKE_SINK].gst, GST_ELEMENT_FLAG_SINK);
+ GST_OBJECT_FLAG_UNSET(textbin[MMPLAYER_T_BIN].gst, GST_ELEMENT_FLAG_SINK);
+ GST_OBJECT_FLAG_UNSET(textbin[MMPLAYER_T_FAKE_SINK].gst, GST_ELEMENT_FLAG_SINK);
/* linking elements in the bucket by added order. */
LOGD("Linking elements in the bucket by added order.\n");
- if ( __mmplayer_gst_element_link_bucket(element_bucket) == -1 )
+ if (__mmplayer_gst_element_link_bucket(element_bucket) == -1)
{
LOGE("failed to link elements\n");
goto ERROR;
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL( player && player->pipeline, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline, MM_ERROR_PLAYER_NOT_INITIALIZED);
/* alloc handles */
textbin = (MMPlayerGstElement*)g_malloc0(sizeof(MMPlayerGstElement) * MMPLAYER_T_NUM);
- if ( ! textbin )
+ if (!textbin)
{
LOGE("failed to allocate memory for textbin\n");
return MM_ERROR_PLAYER_NO_FREE_SPACE;
/* create bin */
textbin[MMPLAYER_T_BIN].id = MMPLAYER_T_BIN;
textbin[MMPLAYER_T_BIN].gst = gst_bin_new("textbin");
- if ( !textbin[MMPLAYER_T_BIN].gst )
+ if (!textbin[MMPLAYER_T_BIN].gst)
{
LOGE("failed to create textbin\n");
goto ERROR;
/* fakesink */
if (player->use_textoverlay)
{
- LOGD ("use textoverlay for displaying \n");
+ LOGD("use textoverlay for displaying \n");
MMPLAYER_CREATE_ELEMENT_ADD_BIN(textbin, MMPLAYER_T_QUEUE, "queue", "text_t_queue", textbin[MMPLAYER_T_BIN].gst, player);
MMPLAYER_CREATE_ELEMENT_ADD_BIN(textbin, MMPLAYER_T_OVERLAY, "textoverlay", "text_overlay", textbin[MMPLAYER_T_BIN].gst, player);
- if (!gst_element_link_pads (textbin[MMPLAYER_T_VIDEO_QUEUE].gst, "src", textbin[MMPLAYER_T_VIDEO_CONVERTER].gst, "sink"))
+ if (!gst_element_link_pads(textbin[MMPLAYER_T_VIDEO_QUEUE].gst, "src", textbin[MMPLAYER_T_VIDEO_CONVERTER].gst, "sink"))
{
LOGE("failed to link queue and converter\n");
goto ERROR;
}
- if (!gst_element_link_pads (textbin[MMPLAYER_T_VIDEO_CONVERTER].gst, "src", textbin[MMPLAYER_T_OVERLAY].gst, "video_sink"))
+ if (!gst_element_link_pads(textbin[MMPLAYER_T_VIDEO_CONVERTER].gst, "src", textbin[MMPLAYER_T_OVERLAY].gst, "video_sink"))
{
LOGE("failed to link queue and textoverlay\n");
goto ERROR;
}
- if (!gst_element_link_pads (textbin[MMPLAYER_T_QUEUE].gst, "src", textbin[MMPLAYER_T_OVERLAY].gst, "text_sink"))
+ if (!gst_element_link_pads(textbin[MMPLAYER_T_QUEUE].gst, "src", textbin[MMPLAYER_T_OVERLAY].gst, "text_sink"))
{
LOGE("failed to link queue and textoverlay\n");
goto ERROR;
{
int surface_type = 0;
- LOGD ("use subtitle message for displaying \n");
+ LOGD("use subtitle message for displaying \n");
- mm_attrs_get_int_by_name (player->attrs, "display_surface_type", &surface_type);
+ mm_attrs_get_int_by_name(player->attrs, "display_surface_type", &surface_type);
- switch(surface_type)
+ switch (surface_type)
{
case MM_DISPLAY_SURFACE_OVERLAY:
case MM_DISPLAY_SURFACE_EVAS:
LOGD("ERROR : releasing textbin\n");
- g_list_free( element_bucket );
+ g_list_free(element_bucket);
/* release element which are not added to bin */
- for ( i = 1; i < MMPLAYER_T_NUM; i++ ) /* NOTE : skip bin */
+ for (i = 1; i < MMPLAYER_T_NUM; i++) /* NOTE : skip bin */
{
- if ( textbin[i].gst )
+ if (textbin[i].gst)
{
GstObject* parent = NULL;
- parent = gst_element_get_parent( textbin[i].gst );
+ parent = gst_element_get_parent(textbin[i].gst);
- if ( !parent )
+ if (!parent)
{
gst_object_unref(GST_OBJECT(textbin[i].gst));
textbin[i].gst = NULL;
}
/* release textbin with it's childs */
- if ( textbin[MMPLAYER_T_BIN].gst )
+ if (textbin[MMPLAYER_T_BIN].gst)
{
gst_object_unref(GST_OBJECT(textbin[MMPLAYER_T_BIN].gst));
}
- MMPLAYER_FREEIF( textbin );
+ MMPLAYER_FREEIF(textbin);
player->pipeline->textbin = NULL;
MMPLAYER_FENTER();
/* get mainbin */
- MMPLAYER_RETURN_VAL_IF_FAIL ( player && player->pipeline, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline, MM_ERROR_PLAYER_NOT_INITIALIZED);
mainbin = player->pipeline->mainbin;
attrs = MMPLAYER_GET_ATTRS(player);
- if ( !attrs )
+ if (!attrs)
{
LOGE("cannot get content attribute\n");
return MM_ERROR_PLAYER_INTERNAL;
}
- mm_attrs_get_string_by_name ( attrs, "subtitle_uri", &subtitle_uri );
- if ( !subtitle_uri || strlen(subtitle_uri) < 1)
+ mm_attrs_get_string_by_name(attrs, "subtitle_uri", &subtitle_uri);
+ if (!subtitle_uri || strlen(subtitle_uri) < 1)
{
LOGE("subtitle uri is not proper filepath.\n");
return MM_ERROR_PLAYER_INVALID_URI;
/* create the subtitle source */
subsrc = gst_element_factory_make("filesrc", "subtitle_source");
- if ( !subsrc )
+ if (!subsrc)
{
- LOGE ( "failed to create filesrc element\n" );
+ LOGE("failed to create filesrc element\n");
goto ERROR;
}
- g_object_set(G_OBJECT (subsrc), "location", subtitle_uri, NULL);
+ g_object_set(G_OBJECT(subsrc), "location", subtitle_uri, NULL);
mainbin[MMPLAYER_M_SUBSRC].id = MMPLAYER_M_SUBSRC;
mainbin[MMPLAYER_M_SUBSRC].gst = subsrc;
/* subparse */
subparse = gst_element_factory_make("subparse", "subtitle_parser");
- if ( !subparse )
+ if (!subparse)
{
- LOGE ( "failed to create subparse element\n" );
+ LOGE("failed to create subparse element\n");
goto ERROR;
}
charset = util_get_charset(subtitle_uri);
if (charset)
{
- LOGD ("detected charset is %s\n", charset );
- g_object_set (G_OBJECT (subparse), "subtitle-encoding", charset, NULL);
+ LOGD("detected charset is %s\n", charset);
+ g_object_set(G_OBJECT(subparse), "subtitle-encoding", charset, NULL);
}
mainbin[MMPLAYER_M_SUBPARSE].id = MMPLAYER_M_SUBPARSE;
goto ERROR;
}
- if (!gst_element_link_pads (subsrc, "src", subparse, "sink"))
+ if (!gst_element_link_pads(subsrc, "src", subparse, "sink"))
{
LOGW("failed to link subsrc and subparse\n");
goto ERROR;
player->play_subtitle = TRUE;
player->adjust_subtitle_pos = 0;
- LOGD ("play subtitle using subtitle file\n");
+ LOGD("play subtitle using subtitle file\n");
if (player->pipeline->textbin == NULL)
{
goto ERROR;
}
- LOGD ("link text input selector and textbin ghost pad");
+ LOGD("link text input selector and textbin ghost pad");
player->textsink_linked = 1;
player->external_text_idx = 0;
player->external_text_idx = 1;
}
- if (!gst_element_link_pads (subparse, "src", player->pipeline->textbin[MMPLAYER_T_BIN].gst, "text_sink"))
+ if (!gst_element_link_pads(subparse, "src", player->pipeline->textbin[MMPLAYER_T_BIN].gst, "text_sink"))
{
LOGW("failed to link subparse and textbin\n");
goto ERROR;
}
- pad = gst_element_get_static_pad (player->pipeline->textbin[MMPLAYER_T_FAKE_SINK].gst, "sink");
+ pad = gst_element_get_static_pad(player->pipeline->textbin[MMPLAYER_T_FAKE_SINK].gst, "sink");
if (!pad)
{
return MM_ERROR_PLAYER_INTERNAL;
}
- gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_BUFFER,
+ gst_pad_add_probe(pad, GST_PAD_PROBE_TYPE_BUFFER,
__mmplayer_subtitle_adjust_position_probe, player, NULL);
gst_object_unref(pad);
pad=NULL;
/* create dot. for debugging */
- MMPLAYER_GENERATE_DOT_IF_ENABLED ( player, "pipeline-with-subtitle" );
+ MMPLAYER_GENERATE_DOT_IF_ENABLED(player, "pipeline-with-subtitle");
MMPLAYER_FLEAVE();
return MM_ERROR_NONE;
}
gboolean
-__mmplayer_update_subtitle( GstElement* object, GstBuffer *buffer, GstPad *pad, gpointer data)
+__mmplayer_update_subtitle(GstElement* object, GstBuffer *buffer, GstPad *pad, gpointer data)
{
mm_player_t* player = (mm_player_t*) data;
MMMessageParamType msg = {0, };
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, FALSE );
- MMPLAYER_RETURN_VAL_IF_FAIL ( buffer, FALSE );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
+ MMPLAYER_RETURN_VAL_IF_FAIL(buffer, FALSE);
gst_buffer_map(buffer, &mapinfo, GST_MAP_READ);
text = mapinfo.data;
text_size = mapinfo.size;
duration = GST_BUFFER_DURATION(buffer);
- if ( player->set_mode.subtitle_off )
+ if (player->set_mode.subtitle_off)
{
- LOGD("subtitle is OFF.\n" );
+ LOGD("subtitle is OFF.\n");
return TRUE;
}
- if ( !text || (text_size == 0))
+ if (!text || (text_size == 0))
{
- LOGD("There is no subtitle to be displayed.\n" );
+ LOGD("There is no subtitle to be displayed.\n");
return TRUE;
}
msg.data = (void *) text;
msg.subtitle.duration = GST_TIME_AS_MSECONDS(duration);
- LOGD("update subtitle : [%ld msec] %s\n'", msg.subtitle.duration, (char*)msg.data );
+ LOGD("update subtitle : [%ld msec] %s\n'", msg.subtitle.duration, (char*)msg.data);
- MMPLAYER_POST_MSG( player, MM_MESSAGE_UPDATE_SUBTITLE, &msg );
+ MMPLAYER_POST_MSG(player, MM_MESSAGE_UPDATE_SUBTITLE, &msg);
gst_buffer_unmap(buffer, &mapinfo);
MMPLAYER_FLEAVE();
}
static GstPadProbeReturn
-__mmplayer_subtitle_adjust_position_probe (GstPad *pad, GstPadProbeInfo *info, gpointer u_data)
+__mmplayer_subtitle_adjust_position_probe(GstPad *pad, GstPadProbeInfo *info, gpointer u_data)
{
mm_player_t *player = (mm_player_t *) u_data;
gint64 adjusted_timestamp = 0;
GstBuffer *buffer = gst_pad_probe_info_get_buffer(info);
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, FALSE );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
- if ( player->set_mode.subtitle_off )
+ if (player->set_mode.subtitle_off)
{
- LOGD("subtitle is OFF.\n" );
+ LOGD("subtitle is OFF.\n");
return TRUE;
}
- if (player->adjust_subtitle_pos == 0 )
+ if (player->adjust_subtitle_pos == 0)
{
LOGD("nothing to do");
return TRUE;
}
cur_timestamp = GST_BUFFER_TIMESTAMP(buffer);
- adjusted_timestamp = (gint64) cur_timestamp + ((gint64) player->adjust_subtitle_pos * G_GINT64_CONSTANT(1000000));
+ adjusted_timestamp = (gint64) cur_timestamp +((gint64) player->adjust_subtitle_pos * G_GINT64_CONSTANT(1000000));
- if ( adjusted_timestamp < 0)
+ if (adjusted_timestamp < 0)
{
LOGD("adjusted_timestamp under zero");
MMPLAYER_FLEAVE();
MMPLAYER_FENTER();
/* check player and subtitlebin are created */
- MMPLAYER_RETURN_VAL_IF_FAIL ( player && player->pipeline, MM_ERROR_PLAYER_NOT_INITIALIZED );
- MMPLAYER_RETURN_VAL_IF_FAIL ( player->play_subtitle, MM_ERROR_NOT_SUPPORT_API );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ MMPLAYER_RETURN_VAL_IF_FAIL(player->play_subtitle, MM_ERROR_NOT_SUPPORT_API);
if (position == 0)
{
- LOGD ("nothing to do\n");
+ LOGD("nothing to do\n");
MMPLAYER_FLEAVE();
return MM_ERROR_NONE;
}
LOGD("adjusting video_pos in player") ;
int current_pos = 0;
/* check player and videobin are created */
- MMPLAYER_RETURN_VAL_IF_FAIL ( player && player->pipeline, MM_ERROR_PLAYER_NOT_INITIALIZED );
- if ( !player->pipeline->videobin ||
- !player->pipeline->videobin[MMPLAYER_V_SINK].gst )
+ MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ if (!player->pipeline->videobin ||
+ !player->pipeline->videobin[MMPLAYER_V_SINK].gst)
{
LOGD("no video pipeline or sink is there");
return MM_ERROR_PLAYER_INVALID_STATE ;
}
if (offset == 0)
{
- LOGD ("nothing to do\n");
+ LOGD("nothing to do\n");
MMPLAYER_FLEAVE();
return MM_ERROR_NONE;
}
- if(__gst_get_position ( player, MM_PLAYER_POS_FORMAT_TIME, (unsigned long*)¤t_pos ) != MM_ERROR_NONE )
+ if (__gst_get_position(player, MM_PLAYER_POS_FORMAT_TIME, (unsigned long*)¤t_pos) != MM_ERROR_NONE)
{
LOGD("failed to get current position");
return MM_ERROR_PLAYER_INTERNAL;
}
- if ( (current_pos - offset ) < GST_TIME_AS_MSECONDS(player->duration) )
+ if ((current_pos - offset) < GST_TIME_AS_MSECONDS(player->duration))
{
LOGD("enter video delay is valid");
}
LOGD("enter video delay is crossing content boundary");
return MM_ERROR_INVALID_ARGUMENT ;
}
- g_object_set (G_OBJECT (player->pipeline->videobin[MMPLAYER_V_SINK].gst),"ts-offset",((gint64) offset * G_GINT64_CONSTANT(1000000)),NULL);
+ g_object_set(G_OBJECT(player->pipeline->videobin[MMPLAYER_V_SINK].gst),"ts-offset", ((gint64) offset * G_GINT64_CONSTANT(1000000)),NULL);
LOGD("video delay has been done");
MMPLAYER_FLEAVE();
GstFlowReturn ret = GST_FLOW_OK;
gint len = size;
- MMPLAYER_RETURN_IF_FAIL ( element );
- MMPLAYER_RETURN_IF_FAIL ( buf );
+ MMPLAYER_RETURN_IF_FAIL(element);
+ MMPLAYER_RETURN_IF_FAIL(buf);
- buffer = gst_buffer_new ();
+ buffer = gst_buffer_new();
if (buf->offset >= buf->len)
{
LOGD("call eos appsrc\n");
- g_signal_emit_by_name (appsrc, "end-of-stream", &ret);
+ g_signal_emit_by_name(appsrc, "end-of-stream", &ret);
return;
}
- if ( buf->len - buf->offset < size)
+ if (buf->len - buf->offset < size)
{
len = buf->len - buf->offset + buf->offset;
}
GST_BUFFER_OFFSET_END(buffer) = (guint64)(buf->offset + len);
//LOGD("feed buffer %p, offset %u-%u length %u\n", buffer, buf->offset, buf->len,len);
- g_signal_emit_by_name (appsrc, "push-buffer", buffer, &ret);
+ g_signal_emit_by_name(appsrc, "push-buffer", buffer, &ret);
buf->offset += len;
}
{
tBuffer *buf = (tBuffer *)user_data;
- MMPLAYER_RETURN_VAL_IF_FAIL ( buf, FALSE );
+ MMPLAYER_RETURN_VAL_IF_FAIL(buf, FALSE);
buf->offset = (int)size;
mm_player_t *player = (mm_player_t*)user_data;
MMPlayerStreamType type = MM_PLAYER_STREAM_TYPE_DEFAULT;
guint64 current_level_bytes=0;
- MMPLAYER_RETURN_IF_FAIL ( player );
+ MMPLAYER_RETURN_IF_FAIL(player);
LOGI("app-src: feed data\n");
mm_player_t *player = (mm_player_t*)user_data;
MMPlayerStreamType type = MM_PLAYER_STREAM_TYPE_DEFAULT;
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, FALSE );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
LOGI("app-src: seek data, offset: %llu\n", offset);
- if(player->media_stream_seek_data_cb[type])
+ if (player->media_stream_seek_data_cb[type])
player->media_stream_seek_data_cb[type](type, offset, player->buffer_cb_user_param);
return TRUE;
MMPlayerStreamType type = MM_PLAYER_STREAM_TYPE_DEFAULT;
guint64 current_level_bytes=0;
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, FALSE );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
LOGI("app-src: enough data:%p\n", player->media_stream_buffer_status_cb[type]);
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
/* check current state */
-// MMPLAYER_CHECK_STATE( player, MMPLAYER_COMMAND_START );
+// MMPLAYER_CHECK_STATE(player, MMPLAYER_COMMAND_START);
/* NOTE : we should check and create pipeline again if not created as we destroy
* whole pipeline when stopping in streamming playback
*/
- if ( ! player->pipeline )
+ if (!player->pipeline)
{
- if ( MM_ERROR_NONE != __gst_realize( player ) )
+ if (MM_ERROR_NONE != __gst_realize(player))
{
LOGE("failed to realize before starting. only in streamming\n");
return MM_ERROR_PLAYER_INTERNAL;
LOGI("app-src: pushing data\n");
- if ( buf == NULL )
+ if (buf == NULL)
{
LOGE("buf is null\n");
return MM_ERROR_NONE;
}
- buffer = gst_buffer_new ();
+ buffer = gst_buffer_new();
if (size <= 0)
{
LOGD("call eos appsrc\n");
- g_signal_emit_by_name (player->pipeline->mainbin[MMPLAYER_M_SRC].gst, "end-of-stream", &gst_ret);
+ g_signal_emit_by_name(player->pipeline->mainbin[MMPLAYER_M_SRC].gst, "end-of-stream", &gst_ret);
return MM_ERROR_NONE;
}
//gst_buffer_insert_memory(buffer, -1, gst_memory_new_wrapped(0, (guint8 *)(buf->buf + buf->offset), len, 0, len, (guint8*)(buf->buf + buf->offset), g_free));
LOGD("feed buffer %p, length %u\n", buf, size);
- g_signal_emit_by_name (player->pipeline->mainbin[MMPLAYER_M_SRC].gst, "push-buffer", buffer, &gst_ret);
+ g_signal_emit_by_name(player->pipeline->mainbin[MMPLAYER_M_SRC].gst, "push-buffer", buffer, &gst_ret);
MMPLAYER_FLEAVE();
}
static GstBusSyncReply
-__mmplayer_bus_sync_callback (GstBus * bus, GstMessage * message, gpointer data)
+__mmplayer_bus_sync_callback(GstBus * bus, GstMessage * message, gpointer data)
{
mm_player_t *player = (mm_player_t *)data;
GstBusSyncReply reply = GST_BUS_DROP;
- if ( ! ( player->pipeline && player->pipeline->mainbin ) )
+ if (!(player->pipeline && player->pipeline->mainbin))
{
LOGE("player pipeline handle is null");
return GST_BUS_PASS;
if (!__mmplayer_check_useful_message(player, message))
{
- gst_message_unref (message);
+ gst_message_unref(message);
return GST_BUS_DROP;
}
- switch (GST_MESSAGE_TYPE (message))
+ switch (GST_MESSAGE_TYPE(message))
{
case GST_MESSAGE_STATE_CHANGED:
/* post directly for fast launch */
{
GstTagList *tags = NULL;
- gst_message_parse_tag (message, &tags);
+ gst_message_parse_tag(message, &tags);
if (tags) {
LOGE("TAGS received from element \"%s\".\n",
- GST_STR_NULL (GST_ELEMENT_NAME (GST_MESSAGE_SRC (message))));
+ GST_STR_NULL(GST_ELEMENT_NAME(GST_MESSAGE_SRC(message))));
- gst_tag_list_foreach (tags, print_tag, NULL);
- gst_tag_list_free (tags);
+ gst_tag_list_foreach(tags, print_tag, NULL);
+ gst_tag_list_free(tags);
tags = NULL;
}
break;
}
if (reply == GST_BUS_DROP)
- gst_message_unref (message);
+ gst_message_unref(message);
return reply;
}
static gboolean
-__mmplayer_gst_create_decoder ( mm_player_t *player,
+__mmplayer_gst_create_decoder(mm_player_t *player,
MMPlayerTrackType track,
GstPad* srcpad,
enum MainElementID elemId,
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL( player &&
+ MMPLAYER_RETURN_VAL_IF_FAIL(player &&
player->pipeline &&
player->pipeline->mainbin, FALSE);
MMPLAYER_RETURN_VAL_IF_FAIL((track == MM_PLAYER_TRACK_TYPE_AUDIO || track == MM_PLAYER_TRACK_TYPE_VIDEO), FALSE);
}
/* raw pad handling signal */
- MMPLAYER_SIGNAL_CONNECT( player, G_OBJECT(decodebin), MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "pad-added",
+ MMPLAYER_SIGNAL_CONNECT(player, G_OBJECT(decodebin), MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "pad-added",
G_CALLBACK(__mmplayer_gst_decode_pad_added), player);
/* This signal is emitted whenever decodebin finds a new stream. It is emitted
before looking for any elements that can handle that stream.*/
- MMPLAYER_SIGNAL_CONNECT( player, G_OBJECT(decodebin), MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "autoplug-select",
+ MMPLAYER_SIGNAL_CONNECT(player, G_OBJECT(decodebin), MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "autoplug-select",
G_CALLBACK(__mmplayer_gst_decode_autoplug_select), player);
/* This signal is emitted when a element is added to the bin.*/
- MMPLAYER_SIGNAL_CONNECT( player, G_OBJECT(decodebin), MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "element-added",
+ MMPLAYER_SIGNAL_CONNECT(player, G_OBJECT(decodebin), MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "element-added",
G_CALLBACK(__mmplayer_gst_element_added), player);
if (!gst_bin_add(GST_BIN(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst), decodebin))
goto ERROR;
}
- dec_caps = gst_pad_query_caps (srcpad, NULL);
+ dec_caps = gst_pad_query_caps(srcpad, NULL);
if (dec_caps)
{
- //LOGD ("got pad %s:%s , dec_caps %" GST_PTR_FORMAT, GST_DEBUG_PAD_NAME(srcpad), dec_caps);
+ //LOGD("got pad %s:%s , dec_caps %" GST_PTR_FORMAT, GST_DEBUG_PAD_NAME(srcpad), dec_caps);
g_object_set(G_OBJECT(decodebin), "sink-caps", dec_caps, NULL);
gst_caps_unref(dec_caps);
}
player->pipeline->mainbin[elemId].id = elemId;
player->pipeline->mainbin[elemId].gst = decodebin;
- sinkpad = gst_element_get_static_pad (decodebin, "sink");
+ sinkpad = gst_element_get_static_pad(decodebin, "sink");
if (GST_PAD_LINK_OK != gst_pad_link(srcpad, sinkpad))
{
- LOGW ("failed to link [%s:%s] to decoder\n", GST_DEBUG_PAD_NAME(srcpad));
- gst_object_unref (GST_OBJECT(decodebin));
+ LOGW("failed to link [%s:%s] to decoder\n", GST_DEBUG_PAD_NAME(srcpad));
+ gst_object_unref(GST_OBJECT(decodebin));
}
- if (GST_STATE_CHANGE_FAILURE == gst_element_sync_state_with_parent (decodebin))
+ if (GST_STATE_CHANGE_FAILURE == gst_element_sync_state_with_parent(decodebin))
{
LOGE("failed to sync second level decodebin state with parent\n");
}
ERROR:
if (sinkpad)
{
- gst_object_unref ( GST_OBJECT(sinkpad) );
+ gst_object_unref(GST_OBJECT(sinkpad));
sinkpad = NULL;
}
MMPLAYER_FLEAVE();
/* get profile attribute */
attrs = MMPLAYER_GET_ATTRS(player);
- if ( !attrs )
+ if (!attrs)
{
LOGE("cannot get content attribute\n");
goto INIT_ERROR;
}
/* create pipeline handles */
- if ( player->pipeline )
+ if (player->pipeline)
{
LOGW("pipeline should be released before create new one\n");
goto INIT_ERROR;
}
- player->pipeline = (MMPlayerGstPipelineInfo*) g_malloc0( sizeof(MMPlayerGstPipelineInfo) );
+ player->pipeline = (MMPlayerGstPipelineInfo*) g_malloc0(sizeof(MMPlayerGstPipelineInfo));
if (player->pipeline == NULL)
goto INIT_ERROR;
- memset( player->pipeline, 0, sizeof(MMPlayerGstPipelineInfo) );
+ memset(player->pipeline, 0, sizeof(MMPlayerGstPipelineInfo));
/* create mainbin */
- mainbin = (MMPlayerGstElement*) g_malloc0( sizeof(MMPlayerGstElement) * MMPLAYER_M_NUM );
+ mainbin = (MMPlayerGstElement*) g_malloc0(sizeof(MMPlayerGstElement) * MMPLAYER_M_NUM);
if (mainbin == NULL)
goto INIT_ERROR;
- memset( mainbin, 0, sizeof(MMPlayerGstElement) * MMPLAYER_M_NUM);
+ memset(mainbin, 0, sizeof(MMPlayerGstElement) * MMPLAYER_M_NUM);
/* create pipeline */
mainbin[MMPLAYER_M_PIPE].id = MMPLAYER_M_PIPE;
mainbin[MMPLAYER_M_PIPE].gst = gst_pipeline_new("player");
- if ( ! mainbin[MMPLAYER_M_PIPE].gst )
+ if (!mainbin[MMPLAYER_M_PIPE].gst)
{
LOGE("failed to create pipeline\n");
goto INIT_ERROR;
_mmplayer_track_initialize(player);
/* create source element */
- switch ( player->profile.uri_type )
+ switch (player->profile.uri_type)
{
/* rtsp streamming */
case MM_PLAYER_URI_TYPE_URL_RTSP:
element = gst_element_factory_make("rtspsrc", "rtsp source");
- if ( !element )
+ if (!element)
{
LOGE("failed to create streaming source element\n");
break;
user_agent = wap_profile = NULL;
/* get attribute */
- mm_attrs_get_string_by_name ( attrs, "streaming_user_agent", &user_agent );
- mm_attrs_get_string_by_name ( attrs,"streaming_wap_profile", &wap_profile );
- mm_attrs_get_int_by_name ( attrs, "streaming_network_bandwidth", &network_bandwidth );
+ mm_attrs_get_string_by_name(attrs, "streaming_user_agent", &user_agent);
+ mm_attrs_get_string_by_name(attrs,"streaming_wap_profile", &wap_profile);
+ mm_attrs_get_int_by_name(attrs, "streaming_network_bandwidth", &network_bandwidth);
SECURE_LOGD("user_agent : %s\n", user_agent);
SECURE_LOGD("wap_profile : %s\n", wap_profile);
/* setting property to streaming source */
g_object_set(G_OBJECT(element), "location", player->profile.uri, NULL);
- if ( user_agent )
+ if (user_agent)
g_object_set(G_OBJECT(element), "user-agent", user_agent, NULL);
- if ( wap_profile )
+ if (wap_profile)
g_object_set(G_OBJECT(element), "wap_profile", wap_profile, NULL);
- MMPLAYER_SIGNAL_CONNECT ( player, G_OBJECT(element), MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "pad-added",
- G_CALLBACK (__mmplayer_gst_rtp_dynamic_pad), player );
- MMPLAYER_SIGNAL_CONNECT ( player, G_OBJECT(element), MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "no-more-pads",
- G_CALLBACK (__mmplayer_gst_rtp_no_more_pads), player );
+ MMPLAYER_SIGNAL_CONNECT(player, G_OBJECT(element), MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "pad-added",
+ G_CALLBACK(__mmplayer_gst_rtp_dynamic_pad), player);
+ MMPLAYER_SIGNAL_CONNECT(player, G_OBJECT(element), MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "no-more-pads",
+ G_CALLBACK(__mmplayer_gst_rtp_no_more_pads), player);
player->use_decodebin = FALSE;
}
cookie_list = NULL;
gint mode = MM_PLAYER_PD_MODE_NONE;
- mm_attrs_get_int_by_name ( attrs, "pd_mode", &mode );
+ mm_attrs_get_int_by_name(attrs, "pd_mode", &mode);
player->pd_mode = mode;
LOGD("http playback, PD mode : %d\n", player->pd_mode);
- if ( ! MMPLAYER_IS_HTTP_PD(player) )
+ if (!MMPLAYER_IS_HTTP_PD(player))
{
element = gst_element_factory_make(player->ini.httpsrc_element, "http_streaming_source");
- if ( !element )
+ if (!element)
{
LOGE("failed to create http streaming source element[%s].\n", player->ini.httpsrc_element);
break;
LOGD("using http streamming source [%s].\n", player->ini.httpsrc_element);
/* get attribute */
- mm_attrs_get_string_by_name ( attrs, "streaming_cookie", &cookies );
- mm_attrs_get_string_by_name ( attrs, "streaming_user_agent", &user_agent );
- mm_attrs_get_string_by_name ( attrs, "streaming_proxy", &proxy );
- mm_attrs_get_int_by_name ( attrs, "streaming_timeout", &http_timeout );
+ mm_attrs_get_string_by_name(attrs, "streaming_cookie", &cookies);
+ mm_attrs_get_string_by_name(attrs, "streaming_user_agent", &user_agent);
+ mm_attrs_get_string_by_name(attrs, "streaming_proxy", &proxy);
+ mm_attrs_get_int_by_name(attrs, "streaming_timeout", &http_timeout);
if ((http_timeout == DEFAULT_HTTP_TIMEOUT) &&
(player->ini.http_timeout != DEFAULT_HTTP_TIMEOUT))
g_object_set(G_OBJECT(element), "blocksize", (unsigned long)(64*1024), NULL);
/* check if prosy is vailid or not */
- if ( util_check_valid_url ( proxy ) )
+ if (util_check_valid_url(proxy))
g_object_set(G_OBJECT(element), "proxy", proxy, NULL);
/* parsing cookies */
- if ( ( cookie_list = util_get_cookie_list ((const char*)cookies) ) )
+ if ((cookie_list = util_get_cookie_list((const char*)cookies)))
g_object_set(G_OBJECT(element), "cookies", cookie_list, NULL);
- if ( user_agent )
+ if (user_agent)
g_object_set(G_OBJECT(element), "user-agent", user_agent, NULL);
- if ( MMPLAYER_URL_HAS_DASH_SUFFIX(player) )
+ if (MMPLAYER_URL_HAS_DASH_SUFFIX(player))
{
LOGW("it's dash. and it's still experimental feature.");
}
{
gchar *path = NULL;
- mm_attrs_get_string_by_name ( attrs, "pd_location", &path );
+ mm_attrs_get_string_by_name(attrs, "pd_location", &path);
MMPLAYER_FREEIF(player->pd_file_save_path);
LOGD("PD Location : %s\n", path);
- if ( path )
+ if (path)
{
player->pd_file_save_path = g_strdup(path);
}
}
element = gst_element_factory_make("pdpushsrc", "PD pushsrc");
- if ( !element )
+ if (!element)
{
LOGE("failed to create PD push source element[%s].\n", "pdpushsrc");
break;
g_object_get(element, "location", &location, NULL);
LOGD("PD_LOCATION [%s].\n", location);
if (location)
- g_free (location);
+ g_free(location);
}
}
break;
element = gst_element_factory_make("filesrc", "source");
- if ( !element )
+ if (!element)
{
LOGE("failed to create filesrc\n");
break;
{
gint http_timeout = DEFAULT_HTTP_TIMEOUT;
element = gst_element_factory_make("souphttpsrc", "http streaming source");
- if ( !element )
+ if (!element)
{
LOGE("failed to create http streaming source element[%s]", player->ini.httpsrc_element);
break;
}
- mm_attrs_get_int_by_name ( attrs, "streaming_timeout", &http_timeout );
+ mm_attrs_get_int_by_name(attrs, "streaming_timeout", &http_timeout);
if ((http_timeout == DEFAULT_HTTP_TIMEOUT) &&
(player->ini.http_timeout != DEFAULT_HTTP_TIMEOUT))
LOGD("mem src is selected\n");
element = gst_element_factory_make("appsrc", "buff-source");
- if ( !element )
+ if (!element)
{
LOGE("failed to create appsrc element\n");
break;
}
- g_object_set( element, "stream-type", stream_type, NULL );
- //g_object_set( element, "size", player->mem_buf.len, NULL );
- //g_object_set( element, "blocksize", (guint64)20480, NULL );
+ g_object_set(element, "stream-type", stream_type, NULL);
+ //g_object_set(element, "size", player->mem_buf.len, NULL);
+ //g_object_set(element, "blocksize", (guint64)20480, NULL);
- MMPLAYER_SIGNAL_CONNECT( player, element, MM_PLAYER_SIGNAL_TYPE_OTHERS, "seek-data",
+ MMPLAYER_SIGNAL_CONNECT(player, element, MM_PLAYER_SIGNAL_TYPE_OTHERS, "seek-data",
G_CALLBACK(__gst_appsrc_seek_data), player);
- MMPLAYER_SIGNAL_CONNECT( player, element, MM_PLAYER_SIGNAL_TYPE_OTHERS, "need-data",
+ MMPLAYER_SIGNAL_CONNECT(player, element, MM_PLAYER_SIGNAL_TYPE_OTHERS, "need-data",
G_CALLBACK(__gst_appsrc_feed_data), player);
- MMPLAYER_SIGNAL_CONNECT( player, element, MM_PLAYER_SIGNAL_TYPE_OTHERS, "enough-data",
+ MMPLAYER_SIGNAL_CONNECT(player, element, MM_PLAYER_SIGNAL_TYPE_OTHERS, "enough-data",
G_CALLBACK(__gst_appsrc_enough_data), player);
}
break;
if (player->v_stream_caps)
{
element = gst_element_factory_make("appsrc", "video_appsrc");
- if ( !element )
+ if (!element)
{
- LOGF("failed to create video app source element[appsrc].\n" );
+ LOGF("failed to create video app source element[appsrc].\n");
break;
}
- if ( player->a_stream_caps )
+ if (player->a_stream_caps)
{
elem_src_audio = gst_element_factory_make("appsrc", "audio_appsrc");
- if ( !elem_src_audio )
+ if (!elem_src_audio)
{
- LOGF("failed to create audio app source element[appsrc].\n" );
+ LOGF("failed to create audio app source element[appsrc].\n");
break;
}
}
}
- else if ( player->a_stream_caps )
+ else if (player->a_stream_caps)
{
/* no video, only audio pipeline*/
element = gst_element_factory_make("appsrc", "audio_appsrc");
- if ( !element )
+ if (!element)
{
- LOGF("failed to create audio app source element[appsrc].\n" );
+ LOGF("failed to create audio app source element[appsrc].\n");
break;
}
}
- if ( player->s_stream_caps )
+ if (player->s_stream_caps)
{
elem_src_subtitle = gst_element_factory_make("appsrc", "subtitle_appsrc");
- if ( !elem_src_subtitle )
+ if (!elem_src_subtitle)
{
- LOGF("failed to create subtitle app source element[appsrc].\n" );
+ LOGF("failed to create subtitle app source element[appsrc].\n");
break;
}
}
LOGD("setting app sources properties.\n");
LOGD("location : %s\n", player->profile.uri);
- if ( player->v_stream_caps && element )
+ if (player->v_stream_caps && element)
{
g_object_set(G_OBJECT(element), "format", GST_FORMAT_TIME,
"blocksize", (guint)1048576, /* size of many video frames are larger than default blocksize as 4096 */
"caps", player->v_stream_caps, NULL);
- if ( player->media_stream_buffer_max_size[MM_PLAYER_STREAM_TYPE_VIDEO] > 0)
+ if (player->media_stream_buffer_max_size[MM_PLAYER_STREAM_TYPE_VIDEO] > 0)
g_object_set(G_OBJECT(element), "max-bytes", player->media_stream_buffer_max_size[MM_PLAYER_STREAM_TYPE_VIDEO], NULL);
- if ( player->media_stream_buffer_min_percent[MM_PLAYER_STREAM_TYPE_VIDEO] > 0)
+ if (player->media_stream_buffer_min_percent[MM_PLAYER_STREAM_TYPE_VIDEO] > 0)
g_object_set(G_OBJECT(element), "min-percent", player->media_stream_buffer_min_percent[MM_PLAYER_STREAM_TYPE_VIDEO], NULL);
/*Fix Seek External Demuxer: set audio and video appsrc as seekable */
gst_app_src_set_stream_type((GstAppSrc*)G_OBJECT(element), GST_APP_STREAM_TYPE_SEEKABLE);
- MMPLAYER_SIGNAL_CONNECT( player, element, MM_PLAYER_SIGNAL_TYPE_OTHERS, "seek-data",
+ MMPLAYER_SIGNAL_CONNECT(player, element, MM_PLAYER_SIGNAL_TYPE_OTHERS, "seek-data",
G_CALLBACK(__gst_seek_video_data), player);
if (player->a_stream_caps && elem_src_audio)
g_object_set(G_OBJECT(elem_src_audio), "format", GST_FORMAT_TIME,
"caps", player->a_stream_caps, NULL);
- if ( player->media_stream_buffer_max_size[MM_PLAYER_STREAM_TYPE_AUDIO] > 0)
+ if (player->media_stream_buffer_max_size[MM_PLAYER_STREAM_TYPE_AUDIO] > 0)
g_object_set(G_OBJECT(elem_src_audio), "max-bytes", player->media_stream_buffer_max_size[MM_PLAYER_STREAM_TYPE_AUDIO], NULL);
- if ( player->media_stream_buffer_min_percent[MM_PLAYER_STREAM_TYPE_AUDIO] > 0)
+ if (player->media_stream_buffer_min_percent[MM_PLAYER_STREAM_TYPE_AUDIO] > 0)
g_object_set(G_OBJECT(elem_src_audio), "min-percent", player->media_stream_buffer_min_percent[MM_PLAYER_STREAM_TYPE_AUDIO], NULL);
/*Fix Seek External Demuxer: set audio and video appsrc as seekable */
gst_app_src_set_stream_type((GstAppSrc*)G_OBJECT(elem_src_audio), GST_APP_STREAM_TYPE_SEEKABLE);
- MMPLAYER_SIGNAL_CONNECT( player, elem_src_audio, MM_PLAYER_SIGNAL_TYPE_OTHERS, "seek-data",
+ MMPLAYER_SIGNAL_CONNECT(player, elem_src_audio, MM_PLAYER_SIGNAL_TYPE_OTHERS, "seek-data",
G_CALLBACK(__gst_seek_audio_data), player);
}
}
g_object_set(G_OBJECT(element), "format", GST_FORMAT_TIME,
"caps", player->a_stream_caps, NULL);
- if ( player->media_stream_buffer_max_size[MM_PLAYER_STREAM_TYPE_AUDIO] > 0)
+ if (player->media_stream_buffer_max_size[MM_PLAYER_STREAM_TYPE_AUDIO] > 0)
g_object_set(G_OBJECT(element), "max-bytes", player->media_stream_buffer_max_size[MM_PLAYER_STREAM_TYPE_AUDIO], NULL);
- if ( player->media_stream_buffer_min_percent[MM_PLAYER_STREAM_TYPE_AUDIO] > 0)
+ if (player->media_stream_buffer_min_percent[MM_PLAYER_STREAM_TYPE_AUDIO] > 0)
g_object_set(G_OBJECT(element), "min-percent", player->media_stream_buffer_min_percent[MM_PLAYER_STREAM_TYPE_AUDIO], NULL);
/*Fix Seek External Demuxer: set audio and video appsrc as seekable */
gst_app_src_set_stream_type((GstAppSrc*)G_OBJECT(element), GST_APP_STREAM_TYPE_SEEKABLE);
- MMPLAYER_SIGNAL_CONNECT( player, element, MM_PLAYER_SIGNAL_TYPE_OTHERS, "seek-data",
+ MMPLAYER_SIGNAL_CONNECT(player, element, MM_PLAYER_SIGNAL_TYPE_OTHERS, "seek-data",
G_CALLBACK(__gst_seek_audio_data), player);
}
g_object_set(G_OBJECT(elem_src_subtitle), "format", GST_FORMAT_TIME,
"caps", player->s_stream_caps, NULL);
- if ( player->media_stream_buffer_max_size[MM_PLAYER_STREAM_TYPE_TEXT] > 0)
+ if (player->media_stream_buffer_max_size[MM_PLAYER_STREAM_TYPE_TEXT] > 0)
g_object_set(G_OBJECT(elem_src_subtitle), "max-bytes", player->media_stream_buffer_max_size[MM_PLAYER_STREAM_TYPE_TEXT], NULL);
- if ( player->media_stream_buffer_min_percent[MM_PLAYER_STREAM_TYPE_TEXT] > 0)
+ if (player->media_stream_buffer_min_percent[MM_PLAYER_STREAM_TYPE_TEXT] > 0)
g_object_set(G_OBJECT(elem_src_subtitle), "min-percent", player->media_stream_buffer_min_percent[MM_PLAYER_STREAM_TYPE_TEXT], NULL);
gst_app_src_set_stream_type((GstAppSrc*)G_OBJECT(elem_src_subtitle), GST_APP_STREAM_TYPE_SEEKABLE);
- MMPLAYER_SIGNAL_CONNECT( player, elem_src_subtitle, MM_PLAYER_SIGNAL_TYPE_OTHERS, "seek-data",
+ MMPLAYER_SIGNAL_CONNECT(player, elem_src_subtitle, MM_PLAYER_SIGNAL_TYPE_OTHERS, "seek-data",
G_CALLBACK(__gst_seek_subtitle_data), player);
}
if (player->v_stream_caps && element)
{
- MMPLAYER_SIGNAL_CONNECT( player, element, MM_PLAYER_SIGNAL_TYPE_OTHERS, "need-data",
+ MMPLAYER_SIGNAL_CONNECT(player, element, MM_PLAYER_SIGNAL_TYPE_OTHERS, "need-data",
G_CALLBACK(__gst_appsrc_feed_video_data), player);
- MMPLAYER_SIGNAL_CONNECT( player, element, MM_PLAYER_SIGNAL_TYPE_OTHERS, "enough-data",
+ MMPLAYER_SIGNAL_CONNECT(player, element, MM_PLAYER_SIGNAL_TYPE_OTHERS, "enough-data",
G_CALLBACK(__gst_appsrc_enough_video_data), player);
if (player->a_stream_caps && elem_src_audio)
{
- MMPLAYER_SIGNAL_CONNECT( player, elem_src_audio, MM_PLAYER_SIGNAL_TYPE_OTHERS, "need-data",
+ MMPLAYER_SIGNAL_CONNECT(player, elem_src_audio, MM_PLAYER_SIGNAL_TYPE_OTHERS, "need-data",
G_CALLBACK(__gst_appsrc_feed_audio_data), player);
- MMPLAYER_SIGNAL_CONNECT( player, elem_src_audio, MM_PLAYER_SIGNAL_TYPE_OTHERS, "enough-data",
+ MMPLAYER_SIGNAL_CONNECT(player, elem_src_audio, MM_PLAYER_SIGNAL_TYPE_OTHERS, "enough-data",
G_CALLBACK(__gst_appsrc_enough_audio_data), player);
}
}
else if (player->a_stream_caps && element)
{
- MMPLAYER_SIGNAL_CONNECT( player, element, MM_PLAYER_SIGNAL_TYPE_OTHERS, "need-data",
+ MMPLAYER_SIGNAL_CONNECT(player, element, MM_PLAYER_SIGNAL_TYPE_OTHERS, "need-data",
G_CALLBACK(__gst_appsrc_feed_audio_data), player);
- MMPLAYER_SIGNAL_CONNECT( player, element, MM_PLAYER_SIGNAL_TYPE_OTHERS, "enough-data",
+ MMPLAYER_SIGNAL_CONNECT(player, element, MM_PLAYER_SIGNAL_TYPE_OTHERS, "enough-data",
G_CALLBACK(__gst_appsrc_enough_audio_data), player);
}
if (player->s_stream_caps && elem_src_subtitle)
{
- MMPLAYER_SIGNAL_CONNECT( player, elem_src_subtitle, MM_PLAYER_SIGNAL_TYPE_OTHERS, "need-data",
+ MMPLAYER_SIGNAL_CONNECT(player, elem_src_subtitle, MM_PLAYER_SIGNAL_TYPE_OTHERS, "need-data",
G_CALLBACK(__gst_appsrc_feed_subtitle_data), player);
}
need_state_holder = FALSE;
- mm_attrs_set_int_by_name ( attrs, "profile_prepare_async", TRUE );
- if ( mmf_attrs_commit ( attrs ) ) /* return -1 if error */
+ mm_attrs_set_int_by_name(attrs, "profile_prepare_async", TRUE);
+ if (mmf_attrs_commit(attrs)) /* return -1 if error */
LOGE("failed to commit\n");
}
break;
LOGD("mem src is selected\n");
element = gst_element_factory_make("appsrc", "mem-source");
- if ( !element )
+ if (!element)
{
LOGE("failed to create appsrc element\n");
break;
}
- g_object_set( element, "stream-type", stream_type, NULL );
- g_object_set( element, "size", player->mem_buf.len, NULL );
- g_object_set( element, "blocksize", (guint64)20480, NULL );
+ g_object_set(element, "stream-type", stream_type, NULL);
+ g_object_set(element, "size", player->mem_buf.len, NULL);
+ g_object_set(element, "blocksize", (guint64)20480, NULL);
- MMPLAYER_SIGNAL_CONNECT( player, element, MM_PLAYER_SIGNAL_TYPE_OTHERS, "seek-data",
- G_CALLBACK(__gst_appsrc_seek_data_mem), &player->mem_buf );
- MMPLAYER_SIGNAL_CONNECT( player, element, MM_PLAYER_SIGNAL_TYPE_OTHERS, "need-data",
- G_CALLBACK(__gst_appsrc_feed_data_mem), &player->mem_buf );
+ MMPLAYER_SIGNAL_CONNECT(player, element, MM_PLAYER_SIGNAL_TYPE_OTHERS, "seek-data",
+ G_CALLBACK(__gst_appsrc_seek_data_mem), &player->mem_buf);
+ MMPLAYER_SIGNAL_CONNECT(player, element, MM_PLAYER_SIGNAL_TYPE_OTHERS, "need-data",
+ G_CALLBACK(__gst_appsrc_feed_data_mem), &player->mem_buf);
}
break;
case MM_PLAYER_URI_TYPE_URL:
}
/* check source element is OK */
- if ( ! element )
+ if (!element)
{
LOGE("no source element was created.\n");
goto INIT_ERROR;
__mm_player_streaming_initialize(player->streamer);
}
- if ( MMPLAYER_IS_HTTP_PD(player) )
+ if (MMPLAYER_IS_HTTP_PD(player))
{
gdouble pre_buffering_time = (gdouble)player->streamer->buffering_req.initial_second;
- LOGD ("Picked queue2 element(pre buffer : %d sec)....\n", pre_buffering_time);
+ LOGD("Picked queue2 element(pre buffer : %d sec)....\n", pre_buffering_time);
element = gst_element_factory_make("queue2", "queue2");
- if ( !element )
+ if (!element)
{
- LOGE ( "failed to create http streaming buffer element\n" );
+ LOGE("failed to create http streaming buffer element\n");
goto INIT_ERROR;
}
es_video_queue = gst_element_factory_make("queue2", "video_queue");
if (!es_video_queue)
{
- LOGE ("create es_video_queue for es player failed\n");
+ LOGE("create es_video_queue for es player failed\n");
goto INIT_ERROR;
}
g_object_set(G_OBJECT(es_video_queue), "max-size-buffers", 2, NULL);
es_audio_queue = gst_element_factory_make("queue2", "audio_queue");
if (!es_audio_queue)
{
- LOGE ("create es_audio_queue for es player failed\n");
+ LOGE("create es_audio_queue for es player failed\n");
goto INIT_ERROR;
}
g_object_set(G_OBJECT(es_audio_queue), "max-size-buffers", 2, NULL);
es_audio_queue = gst_element_factory_make("queue2", "audio_queue");
if (!es_audio_queue)
{
- LOGE ("create es_audio_queue for es player failed\n");
+ LOGE("create es_audio_queue for es player failed\n");
goto INIT_ERROR;
}
mainbin[MMPLAYER_M_A_BUFFER].id = MMPLAYER_M_A_BUFFER;
es_subtitle_queue = gst_element_factory_make("queue2", "subtitle_queue");
if (!es_subtitle_queue)
{
- LOGE ("create es_subtitle_queue for es player failed\n");
+ LOGE("create es_subtitle_queue for es player failed\n");
goto INIT_ERROR;
}
mainbin[MMPLAYER_M_S_BUFFER].id = MMPLAYER_M_V_BUFFER;
if ((player->use_decodebin) &&
((MMPLAYER_IS_HTTP_PD(player)) ||
- (!MMPLAYER_IS_HTTP_STREAMING(player))))
+ (!MMPLAYER_IS_HTTP_STREAMING(player))))
{
elemId = MMPLAYER_M_AUTOPLUG;
element = __mmplayer_create_decodebin(player);
{
elemId = MMPLAYER_M_TYPEFIND;
element = gst_element_factory_make("typefind", "typefinder");
- MMPLAYER_SIGNAL_CONNECT( player, element, MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "have-type",
- G_CALLBACK(__mmplayer_typefind_have_type), (gpointer)player );
+ MMPLAYER_SIGNAL_CONNECT(player, element, MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "have-type",
+ G_CALLBACK(__mmplayer_typefind_have_type), (gpointer)player);
}
/* check autoplug element is OK */
- if ( ! element )
+ if (!element)
{
- LOGE("can not create element (%d)\n", elemId);
+ LOGE("can not create element(%d)\n", elemId);
goto INIT_ERROR;
}
}
/* add elements to pipeline */
- if( !__mmplayer_gst_element_add_bucket_to_bin(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), element_bucket))
+ if (!__mmplayer_gst_element_add_bucket_to_bin(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), element_bucket))
{
LOGE("Failed to add elements to pipeline\n");
goto INIT_ERROR;
/* linking elements in the bucket by added order. */
- if ( __mmplayer_gst_element_link_bucket(element_bucket) == -1 )
+ if (__mmplayer_gst_element_link_bucket(element_bucket) == -1)
{
LOGE("Failed to link some elements\n");
goto INIT_ERROR;
/* create fakesink element for keeping the pipeline state PAUSED. if needed */
- if ( need_state_holder )
+ if (need_state_holder)
{
/* create */
mainbin[MMPLAYER_M_SRC_FAKESINK].id = MMPLAYER_M_SRC_FAKESINK;
- mainbin[MMPLAYER_M_SRC_FAKESINK].gst = gst_element_factory_make ("fakesink", "state-holder");
+ mainbin[MMPLAYER_M_SRC_FAKESINK].gst = gst_element_factory_make("fakesink", "state-holder");
if (!mainbin[MMPLAYER_M_SRC_FAKESINK].gst)
{
- LOGE ("fakesink element could not be created\n");
+ LOGE("fakesink element could not be created\n");
goto INIT_ERROR;
}
- GST_OBJECT_FLAG_UNSET (mainbin[MMPLAYER_M_SRC_FAKESINK].gst, GST_ELEMENT_FLAG_SINK);
+ GST_OBJECT_FLAG_UNSET(mainbin[MMPLAYER_M_SRC_FAKESINK].gst, GST_ELEMENT_FLAG_SINK);
/* take ownership of fakesink. we are reusing it */
- gst_object_ref( mainbin[MMPLAYER_M_SRC_FAKESINK].gst );
+ gst_object_ref(mainbin[MMPLAYER_M_SRC_FAKESINK].gst);
/* add */
- if ( FALSE == gst_bin_add(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst),
- mainbin[MMPLAYER_M_SRC_FAKESINK].gst) )
+ if (FALSE == gst_bin_add(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst),
+ mainbin[MMPLAYER_M_SRC_FAKESINK].gst))
{
LOGE("failed to add fakesink to bin\n");
goto INIT_ERROR;
srcpad = gst_element_get_static_pad(mainbin[MMPLAYER_M_V_BUFFER].gst, "src");
if (srcpad)
{
- __mmplayer_gst_create_decoder ( player,
+ __mmplayer_gst_create_decoder(player,
MM_PLAYER_TRACK_TYPE_VIDEO,
srcpad,
MMPLAYER_M_AUTOPLUG_V_DEC,
"video_decodebin");
- gst_object_unref ( GST_OBJECT(srcpad) );
+ gst_object_unref(GST_OBJECT(srcpad));
srcpad = NULL;
}
}
srcpad = gst_element_get_static_pad(mainbin[MMPLAYER_M_A_BUFFER].gst, "src");
if (srcpad)
{
- __mmplayer_gst_create_decoder ( player,
+ __mmplayer_gst_create_decoder(player,
MM_PLAYER_TRACK_TYPE_AUDIO,
srcpad,
MMPLAYER_M_AUTOPLUG_A_DEC,
"audio_decodebin");
- gst_object_unref ( GST_OBJECT(srcpad) );
+ gst_object_unref(GST_OBJECT(srcpad));
srcpad = NULL;
} // else error
} // else error
/* connect bus callback */
bus = gst_pipeline_get_bus(GST_PIPELINE(mainbin[MMPLAYER_M_PIPE].gst));
- if ( !bus )
+ if (!bus)
{
- LOGE ("cannot get bus from pipeline.\n");
+ LOGE("cannot get bus from pipeline.\n");
goto INIT_ERROR;
}
LOGW("bus watcher thread context = %p, watcher : %d", player->context.thread_default, player->bus_watcher);
/* Note : check whether subtitle atrribute uri is set. If uri is set, then try to play subtitle file */
- if ( __mmplayer_check_subtitle ( player ) )
+ if (__mmplayer_check_subtitle(player))
{
- if ( MM_ERROR_NONE != __mmplayer_gst_create_subtitle_src(player) )
+ if (MM_ERROR_NONE != __mmplayer_gst_create_subtitle_src(player))
LOGE("fail to create subtitle src\n");
}
if (mainbin)
{
/* release element which are not added to bin */
- for ( i = 1; i < MMPLAYER_M_NUM; i++ ) /* NOTE : skip pipeline */
+ for (i = 1; i < MMPLAYER_M_NUM; i++) /* NOTE : skip pipeline */
{
- if ( mainbin[i].gst )
+ if (mainbin[i].gst)
{
GstObject* parent = NULL;
- parent = gst_element_get_parent( mainbin[i].gst );
+ parent = gst_element_get_parent(mainbin[i].gst);
- if ( !parent )
+ if (!parent)
{
gst_object_unref(GST_OBJECT(mainbin[i].gst));
mainbin[i].gst = NULL;
}
/* release pipeline with it's childs */
- if ( mainbin[MMPLAYER_M_PIPE].gst )
+ if (mainbin[MMPLAYER_M_PIPE].gst)
{
gst_object_unref(GST_OBJECT(mainbin[MMPLAYER_M_PIPE].gst));
}
- MMPLAYER_FREEIF( mainbin );
+ MMPLAYER_FREEIF(mainbin);
}
- MMPLAYER_FREEIF( player->pipeline );
+ MMPLAYER_FREEIF(player->pipeline);
return MM_ERROR_PLAYER_INTERNAL;
}
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, MM_ERROR_INVALID_HANDLE );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_INVALID_HANDLE);
/* cleanup stuffs */
MMPLAYER_FREEIF(player->type);
if (player->streamer)
{
- __mm_player_streaming_deinitialize (player->streamer);
+ __mm_player_streaming_deinitialize(player->streamer);
__mm_player_streaming_destroy(player->streamer);
player->streamer = NULL;
}
MMPLAYER_FREEIF(player->unlinked_demuxer_mime);
/* cleanup running stuffs */
- __mmplayer_cancel_eos_timer( player );
+ __mmplayer_cancel_eos_timer(player);
/* cleanup gst stuffs */
- if ( player->pipeline )
+ if (player->pipeline)
{
MMPlayerGstElement* mainbin = player->pipeline->mainbin;
GstTagList* tag_list = player->pipeline->tag_list;
/* first we need to disconnect all signal hander */
- __mmplayer_release_signal_connection( player, MM_PLAYER_SIGNAL_TYPE_ALL );
+ __mmplayer_release_signal_connection(player, MM_PLAYER_SIGNAL_TYPE_ALL);
/* disconnecting bus watch */
- if ( player->bus_watcher )
+ if (player->bus_watcher)
__mmplayer_remove_g_source_from_context(player->context.thread_default, player->bus_watcher);
player->bus_watcher = 0;
- if ( mainbin )
+ if (mainbin)
{
MMPlayerGstElement* audiobin = player->pipeline->audiobin;
MMPlayerGstElement* videobin = player->pipeline->videobin;
MMPlayerGstElement* textbin = player->pipeline->textbin;
- GstBus *bus = gst_pipeline_get_bus (GST_PIPELINE (mainbin[MMPLAYER_M_PIPE].gst));
- gst_bus_set_sync_handler (bus, NULL, NULL, NULL);
+ GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(mainbin[MMPLAYER_M_PIPE].gst));
+ gst_bus_set_sync_handler(bus, NULL, NULL, NULL);
gst_object_unref(bus);
timeout = MMPLAYER_STATE_CHANGE_TIMEOUT(player);
- ret = __mmplayer_gst_set_state ( player, mainbin[MMPLAYER_M_PIPE].gst, GST_STATE_NULL, FALSE, timeout );
- if ( ret != MM_ERROR_NONE )
+ ret = __mmplayer_gst_set_state(player, mainbin[MMPLAYER_M_PIPE].gst, GST_STATE_NULL, FALSE, timeout);
+ if (ret != MM_ERROR_NONE)
{
LOGE("fail to change state to NULL\n");
return MM_ERROR_PLAYER_INTERNAL;
gst_object_unref(GST_OBJECT(mainbin[MMPLAYER_M_PIPE].gst));
/* free fakesink */
- if ( mainbin[MMPLAYER_M_SRC_FAKESINK].gst )
+ if (mainbin[MMPLAYER_M_SRC_FAKESINK].gst)
gst_object_unref(GST_OBJECT(mainbin[MMPLAYER_M_SRC_FAKESINK].gst));
/* free avsysaudiosink
avsysaudiosink should be unref when destory pipeline just after start play with BT.
Because audiosink is created but never added to bin, and therefore it will not be unref when pipeline is destroyed.
*/
- MMPLAYER_FREEIF( audiobin );
- MMPLAYER_FREEIF( videobin );
- MMPLAYER_FREEIF( textbin );
- MMPLAYER_FREEIF( mainbin );
+ MMPLAYER_FREEIF(audiobin);
+ MMPLAYER_FREEIF(videobin);
+ MMPLAYER_FREEIF(textbin);
+ MMPLAYER_FREEIF(mainbin);
}
- if ( tag_list )
+ if (tag_list)
gst_tag_list_free(tag_list);
- MMPLAYER_FREEIF( player->pipeline );
+ MMPLAYER_FREEIF(player->pipeline);
}
MMPLAYER_FREEIF(player->album_art);
_mmplayer_track_destroy(player);
if (player->sink_elements)
- g_list_free ( player->sink_elements );
+ g_list_free(player->sink_elements);
player->sink_elements = NULL;
if (player->bufmgr) {
- tbm_bufmgr_deinit ( player->bufmgr );
+ tbm_bufmgr_deinit(player->bufmgr);
player->bufmgr = NULL;
}
MMPLAYER_PENDING_STATE(player) = MM_PLAYER_STATE_READY;
ret = __mmplayer_gst_create_pipeline(player);
- if ( ret )
+ if (ret)
{
LOGE("failed to create pipeline\n");
return ret;
ret = __mmplayer_gst_set_state(player,
player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_STATE_READY, FALSE, timeout);
- if ( ret != MM_ERROR_NONE )
+ if (ret != MM_ERROR_NONE)
{
/* return error if failed to set state */
LOGE("failed to set READY state");
}
else
{
- MMPLAYER_SET_STATE ( player, MM_PLAYER_STATE_READY );
+ MMPLAYER_SET_STATE(player, MM_PLAYER_STATE_READY);
}
/* create dot before error-return. for debugging */
- MMPLAYER_GENERATE_DOT_IF_ENABLED ( player, "pipeline-status-realize" );
+ MMPLAYER_GENERATE_DOT_IF_ENABLED(player, "pipeline-status-realize");
MMPLAYER_FLEAVE();
MMPLAYER_PRINT_STATE(player);
/* release miscellaneous information */
- __mmplayer_release_misc( player );
+ __mmplayer_release_misc(player);
/* destroy pipeline */
- ret = __mmplayer_gst_destroy_pipeline( player );
- if ( ret != MM_ERROR_NONE )
+ ret = __mmplayer_gst_destroy_pipeline(player);
+ if (ret != MM_ERROR_NONE)
{
LOGE("failed to destory pipeline\n");
return ret;
/* release miscellaneous information.
these info needs to be released after pipeline is destroyed. */
- __mmplayer_release_misc_post( player );
+ __mmplayer_release_misc_post(player);
- MMPLAYER_SET_STATE ( player, MM_PLAYER_STATE_NULL );
+ MMPLAYER_SET_STATE(player, MM_PLAYER_STATE_NULL);
MMPLAYER_FLEAVE();
return ret;
}
-static int __gst_pending_seek ( mm_player_t* player )
+static int __gst_pending_seek(mm_player_t* player)
{
MMPlayerStateType current_state = MM_PLAYER_STATE_NONE;
int ret = MM_ERROR_NONE;
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL ( player && player->pipeline, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline, MM_ERROR_PLAYER_NOT_INITIALIZED);
- if ( !player->pending_seek.is_pending )
+ if (!player->pending_seek.is_pending)
{
- LOGD("pending seek is not reserved. nothing to do.\n" );
+ LOGD("pending seek is not reserved. nothing to do.\n");
return ret;
}
/* check player state if player could pending seek or not. */
current_state = MMPLAYER_CURRENT_STATE(player);
- if ( current_state != MM_PLAYER_STATE_PAUSED && current_state != MM_PLAYER_STATE_PLAYING )
+ if (current_state != MM_PLAYER_STATE_PAUSED && current_state != MM_PLAYER_STATE_PLAYING )
{
LOGW("try to pending seek in %s state, try next time. \n",
MMPLAYER_STATE_GET_NAME(current_state));
return ret;
}
- LOGD("trying to play from (%lu) pending position\n", player->pending_seek.pos);
+ LOGD("trying to play from(%lu) pending position\n", player->pending_seek.pos);
- ret = __gst_set_position ( player, player->pending_seek.format, player->pending_seek.pos, FALSE );
+ ret = __gst_set_position(player, player->pending_seek.format, player->pending_seek.pos, FALSE);
- if ( MM_ERROR_NONE != ret )
+ if (MM_ERROR_NONE != ret)
LOGE("failed to seek pending postion. just keep staying current position.\n");
player->pending_seek.is_pending = FALSE;
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL ( player && player->pipeline, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline, MM_ERROR_PLAYER_NOT_INITIALIZED);
/* get sound_extraction property */
mm_attrs_get_int_by_name(player->attrs, "pcm_extraction", &sound_extraction);
/* NOTE : if SetPosition was called before Start. do it now */
/* streaming doesn't support it. so it should be always sync */
- /* !! create one more api to check if there is pending seek rather than checking variables */
- if ( (player->pending_seek.is_pending || sound_extraction) && !MMPLAYER_IS_STREAMING(player))
+ /* !!create one more api to check if there is pending seek rather than checking variables */
+ if ((player->pending_seek.is_pending || sound_extraction) && !MMPLAYER_IS_STREAMING(player))
{
MMPLAYER_TARGET_STATE(player) = MM_PLAYER_STATE_PAUSED;
ret = __gst_pause(player, FALSE);
- if ( ret != MM_ERROR_NONE )
+ if (ret != MM_ERROR_NONE)
{
LOGE("failed to set state to PAUSED for pending seek\n");
return ret;
MMPLAYER_TARGET_STATE(player) = MM_PLAYER_STATE_PLAYING;
- if ( sound_extraction )
+ if (sound_extraction)
{
LOGD("setting pcm extraction\n");
ret = __mmplayer_set_pcm_extraction(player);
- if ( MM_ERROR_NONE != ret )
+ if (MM_ERROR_NONE != ret)
{
LOGW("failed to set pcm extraction\n");
return ret;
}
else
{
- if ( MM_ERROR_NONE != __gst_pending_seek(player) )
+ if (MM_ERROR_NONE != __gst_pending_seek(player))
{
LOGW("failed to seek pending postion. starting from the begin of content.\n");
}
}
/* set pipeline state to PLAYING */
ret = __mmplayer_gst_set_state(player,
- player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_STATE_PLAYING, async, MMPLAYER_STATE_CHANGE_TIMEOUT(player) );
+ player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_STATE_PLAYING, async, MMPLAYER_STATE_CHANGE_TIMEOUT(player));
if (ret == MM_ERROR_NONE)
{
}
/* generating debug info before returning error */
- MMPLAYER_GENERATE_DOT_IF_ENABLED ( player, "pipeline-status-start" );
+ MMPLAYER_GENERATE_DOT_IF_ENABLED(player, "pipeline-status-start");
MMPLAYER_FLEAVE();
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL ( player && player->pipeline, MM_ERROR_PLAYER_NOT_INITIALIZED);
- MMPLAYER_RETURN_VAL_IF_FAIL ( player->pipeline->mainbin, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ MMPLAYER_RETURN_VAL_IF_FAIL(player->pipeline->mainbin, MM_ERROR_PLAYER_NOT_INITIALIZED);
LOGD("current state before doing transition");
MMPLAYER_PENDING_STATE(player) = MM_PLAYER_STATE_READY;
MMPLAYER_PRINT_STATE(player);
attrs = MMPLAYER_GET_ATTRS(player);
- if ( !attrs )
+ if (!attrs)
{
LOGE("cannot get content attribute\n");
return MM_ERROR_PLAYER_INTERNAL;
__mmplayer_do_sound_fadedown(player, MM_PLAYER_FADEOUT_TIME_DEFAULT);
/* Just set state to PAUESED and the rewind. it's usual player behavior. */
- timeout = MMPLAYER_STATE_CHANGE_TIMEOUT ( player );
+ timeout = MMPLAYER_STATE_CHANGE_TIMEOUT(player);
if (player->profile.uri_type == MM_PLAYER_URI_TYPE_BUFF ||
player->profile.uri_type == MM_PLAYER_URI_TYPE_HLS)
{
state = GST_STATE_PAUSED;
- if ( ! MMPLAYER_IS_STREAMING(player) ||
+ if (!MMPLAYER_IS_STREAMING(player) ||
(player->streaming_type == STREAMING_SERVICE_VOD && player->videodec_linked)) {
rewind = TRUE;
}
async = TRUE;
}
/* set gst state */
- ret = __mmplayer_gst_set_state( player, player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, state, async, timeout );
+ ret = __mmplayer_gst_set_state(player, player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, state, async, timeout);
/* disable fadeout */
if (fadedown || player->sound_focus.by_asm_cb)
__mmplayer_undo_sound_fadedown(player);
/* return if set_state has failed */
- if ( ret != MM_ERROR_NONE )
+ if (ret != MM_ERROR_NONE)
{
LOGE("failed to set state.\n");
return ret;
}
/* rewind */
- if ( rewind )
+ if (rewind)
{
- if ( ! __gst_seek( player, player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, player->playback_rate,
+ if (!__gst_seek(player, player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, player->playback_rate,
GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH, GST_SEEK_TYPE_SET, 0,
- GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE) )
+ GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE))
{
LOGW("failed to rewind\n");
ret = MM_ERROR_PLAYER_SEEK;
}
/* wait for seek to complete */
- change_ret = gst_element_get_state (player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, NULL, NULL, timeout * GST_SECOND);
- if ( change_ret == GST_STATE_CHANGE_SUCCESS || change_ret == GST_STATE_CHANGE_NO_PREROLL )
+ change_ret = gst_element_get_state(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, NULL, NULL, timeout * GST_SECOND);
+ if (change_ret == GST_STATE_CHANGE_SUCCESS || change_ret == GST_STATE_CHANGE_NO_PREROLL)
{
- MMPLAYER_SET_STATE ( player, MM_PLAYER_STATE_READY );
+ MMPLAYER_SET_STATE(player, MM_PLAYER_STATE_READY);
}
else
{
}
/* generate dot file if enabled */
- MMPLAYER_GENERATE_DOT_IF_ENABLED ( player, "pipeline-status-stop" );
+ MMPLAYER_GENERATE_DOT_IF_ENABLED(player, "pipeline-status-stop");
MMPLAYER_FLEAVE();
player->ignore_asyncdone = FALSE;
- if ( FALSE == async )
+ if (FALSE == async)
{
- if ( ret != MM_ERROR_NONE )
+ if (ret != MM_ERROR_NONE)
{
GstMessage *msg = NULL;
GTimer *timer = NULL;
timer = g_timer_new();
g_timer_start(timer);
- GstBus *bus = gst_pipeline_get_bus (GST_PIPELINE(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst));
+ GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst));
gboolean got_msg = FALSE;
/* check if gst error posted or not */
do
/* parse error code */
gst_message_parse_error(msg, &error, NULL);
- if ( gst_structure_has_name ( gst_message_get_structure(msg), "streaming_error" ) )
+ if (gst_structure_has_name(gst_message_get_structure(msg), "streaming_error"))
{
/* Note : the streaming error from the streaming source is handled
* using __mmplayer_handle_streaming_error.
*/
- __mmplayer_handle_streaming_error ( player, msg );
+ __mmplayer_handle_streaming_error(player, msg);
}
else if (error)
if (error->domain == GST_STREAM_ERROR)
{
- ret = __gst_handle_stream_error( player, error, msg );
+ ret = __gst_handle_stream_error(player, error, msg);
}
else if (error->domain == GST_RESOURCE_ERROR)
{
- ret = __gst_handle_resource_error( player, error->code );
+ ret = __gst_handle_resource_error(player, error->code);
}
else if (error->domain == GST_LIBRARY_ERROR)
{
- ret = __gst_handle_library_error( player, error->code );
+ ret = __gst_handle_library_error(player, error->code);
}
else if (error->domain == GST_CORE_ERROR)
{
- ret = __gst_handle_core_error( player, error->code );
+ ret = __gst_handle_core_error(player, error->code);
}
}
} while (!got_msg && (g_timer_elapsed(timer, NULL) < MAX_TIMEOUT_SEC));
/* clean */
gst_object_unref(bus);
- g_timer_stop (timer);
- g_timer_destroy (timer);
+ g_timer_stop(timer);
+ g_timer_destroy(timer);
return ret;
}
- else if ( !player->video_stream_cb && (!player->pipeline->videobin) && (!player->pipeline->audiobin) )
+ else if (!player->video_stream_cb && (!player->pipeline->videobin) && (!player->pipeline->audiobin))
{
if (MMPLAYER_IS_RTSP_STREAMING(player))
return ret;
return MM_ERROR_PLAYER_CODEC_NOT_FOUND;
}
- else if ( ret== MM_ERROR_NONE)
+ else if (ret== MM_ERROR_NONE)
{
- MMPLAYER_SET_STATE ( player, MM_PLAYER_STATE_PAUSED );
+ MMPLAYER_SET_STATE(player, MM_PLAYER_STATE_PAUSED);
}
}
/* generate dot file before returning error */
- MMPLAYER_GENERATE_DOT_IF_ENABLED ( player, "pipeline-status-pause" );
+ MMPLAYER_GENERATE_DOT_IF_ENABLED(player, "pipeline-status-pause");
MMPLAYER_FLEAVE();
MMPLAYER_PRINT_STATE(player);
/* generate dot file before returning error */
- MMPLAYER_GENERATE_DOT_IF_ENABLED ( player, "pipeline-status-resume" );
+ MMPLAYER_GENERATE_DOT_IF_ENABLED(player, "pipeline-status-resume");
- if ( async )
+ if (async)
LOGD("do async state transition to PLAYING.\n");
/* set pipeline state to PLAYING */
timeout = MMPLAYER_STATE_CHANGE_TIMEOUT(player);
ret = __mmplayer_gst_set_state(player,
- player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_STATE_PLAYING, async, timeout );
+ player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_STATE_PLAYING, async, timeout);
if (ret != MM_ERROR_NONE)
{
LOGE("failed to set state to PLAYING\n");
{
if (async == FALSE)
{
- // MMPLAYER_SET_STATE ( player, MM_PLAYER_STATE_PLAYING );
+ // MMPLAYER_SET_STATE(player, MM_PLAYER_STATE_PLAYING);
LOGD("update state machine to %d\n", MM_PLAYER_STATE_PLAYING);
ret = __mmplayer_set_state(player, MM_PLAYER_STATE_PLAYING);
}
}
/* generate dot file before returning error */
- MMPLAYER_GENERATE_DOT_IF_ENABLED ( player, "pipeline-status-resume" );
+ MMPLAYER_GENERATE_DOT_IF_ENABLED(player, "pipeline-status-resume");
MMPLAYER_FLEAVE();
GstSeekFlags seek_flags = GST_SEEK_FLAG_FLUSH;
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL ( player && player->pipeline, MM_ERROR_PLAYER_NOT_INITIALIZED );
- MMPLAYER_RETURN_VAL_IF_FAIL ( !MMPLAYER_IS_LIVE_STREAMING(player), MM_ERROR_PLAYER_NO_OP );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ MMPLAYER_RETURN_VAL_IF_FAIL(!MMPLAYER_IS_LIVE_STREAMING(player), MM_ERROR_PLAYER_NO_OP);
- if ( MMPLAYER_CURRENT_STATE(player) != MM_PLAYER_STATE_PLAYING
- && MMPLAYER_CURRENT_STATE(player) != MM_PLAYER_STATE_PAUSED )
+ if (MMPLAYER_CURRENT_STATE(player) != MM_PLAYER_STATE_PLAYING
+ && MMPLAYER_CURRENT_STATE(player) != MM_PLAYER_STATE_PAUSED)
goto PENDING;
- if( !MMPLAYER_IS_MS_BUFF_SRC(player) )
+ if (!MMPLAYER_IS_MS_BUFF_SRC(player))
{
/* check duration */
/* NOTE : duration cannot be zero except live streaming.
* Since some element could have some timing problemn with quering duration, try again.
*/
- if ( !player->duration )
+ if (!player->duration)
{
- if ( !gst_element_query_duration( player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &dur_nsec ))
+ if (!gst_element_query_duration(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &dur_nsec))
{
goto SEEK_ERROR;
}
player->duration = dur_nsec;
}
- if ( player->duration )
+ if (player->duration)
{
dur_msec = GST_TIME_AS_MSECONDS(player->duration);
}
}
/* do seek */
- switch ( format )
+ switch (format)
{
case MM_PLAYER_POS_FORMAT_TIME:
{
- if( !MMPLAYER_IS_MS_BUFF_SRC(player) )
+ if (!MMPLAYER_IS_MS_BUFF_SRC(player))
{
/* check position is valid or not */
- if ( position > dur_msec )
+ if (position > dur_msec)
goto INVALID_ARGS;
- LOGD("seeking to (%lu) msec, duration is %d msec\n", position, dur_msec);
+ LOGD("seeking to(%lu) msec, duration is %d msec\n", position, dur_msec);
- if ( player->doing_seek )
+ if (player->doing_seek)
{
LOGD("not completed seek");
return MM_ERROR_PLAYER_DOING_SEEK;
}
}
- if ( !internal_called )
+ if (!internal_called)
player->doing_seek = TRUE;
pos_nsec = position * G_GINT64_CONSTANT(1000000);
gst_element_query_position(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &cur_time);
/* flush */
- GstEvent *event = gst_event_new_seek (1.0,
+ GstEvent *event = gst_event_new_seek(1.0,
GST_FORMAT_TIME,
(GstSeekFlags)GST_SEEK_FLAG_FLUSH,
GST_SEEK_TYPE_SET, cur_time,
GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE);
- if(event) {
+ if (event) {
__gst_send_event_to_sink(player, event);
}
- __gst_pause( player, FALSE );
+ __gst_pause(player, FALSE);
}
- ret = __gst_seek ( player, player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, player->playback_rate,
+ ret = __gst_seek(player, player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, player->playback_rate,
GST_FORMAT_TIME, seek_flags,
- GST_SEEK_TYPE_SET, pos_nsec, GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE );
- if ( !ret )
+ GST_SEEK_TYPE_SET, pos_nsec, GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE);
+ if (!ret )
{
LOGE("failed to set position. dur[%lu] pos[%lu] pos_msec[%llu]\n", dur_msec, position, pos_nsec);
goto SEEK_ERROR;
case MM_PLAYER_POS_FORMAT_PERCENT:
{
- LOGD("seeking to (%lu)%% \n", position);
+ LOGD("seeking to(%lu)%% \n", position);
if (player->doing_seek)
{
return MM_ERROR_PLAYER_DOING_SEEK;
}
- if ( !internal_called)
+ if (!internal_called)
player->doing_seek = TRUE;
/* FIXIT : why don't we use 'GST_FORMAT_PERCENT' */
- pos_nsec = (gint64) ( ( position * player->duration ) / 100 );
- ret = __gst_seek ( player, player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, player->playback_rate,
+ pos_nsec = (gint64)((position * player->duration) / 100);
+ ret = __gst_seek(player, player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, player->playback_rate,
GST_FORMAT_TIME, seek_flags,
- GST_SEEK_TYPE_SET, pos_nsec, GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE );
- if ( !ret )
+ GST_SEEK_TYPE_SET, pos_nsec, GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE);
+ if (!ret )
{
LOGE("failed to set position. dur[%lud] pos[%lud] pos_msec[%"G_GUINT64_FORMAT"]\n", dur_msec, position, pos_nsec);
goto SEEK_ERROR;
}
/* NOTE : store last seeking point to overcome some bad operation
- * ( returning zero when getting current position ) of some elements
+ * (returning zero when getting current position) of some elements
*/
player->last_position = pos_nsec;
/* MSL should guarante playback rate when seek is selected during trick play of fast forward. */
- if ( player->playback_rate > 1.0 )
- _mmplayer_set_playspeed ((MMHandleType)player, player->playback_rate, FALSE);
+ if (player->playback_rate > 1.0)
+ _mmplayer_set_playspeed((MMHandleType)player, player->playback_rate, FALSE);
MMPLAYER_FLEAVE();
return MM_ERROR_NONE;
gint64 pos_msec = 0;
gboolean ret = TRUE;
- MMPLAYER_RETURN_VAL_IF_FAIL( player && position && player->pipeline && player->pipeline->mainbin,
- MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player && position && player->pipeline && player->pipeline->mainbin,
+ MM_ERROR_PLAYER_NOT_INITIALIZED);
current_state = MMPLAYER_CURRENT_STATE(player);
/* NOTE : query position except paused state to overcome some bad operation
* please refer to below comments in details
*/
- if ( current_state != MM_PLAYER_STATE_PAUSED )
+ if (current_state != MM_PLAYER_STATE_PAUSED)
{
ret = gst_element_query_position(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &pos_msec);
}
/* NOTE : get last point to overcome some bad operation of some elements
- * ( returning zero when getting current position in paused state
+ *(returning zero when getting current position in paused state
* and when failed to get postion during seeking
*/
- if ( ( current_state == MM_PLAYER_STATE_PAUSED )
- || ( ! ret ))
- //|| ( player->last_position != 0 && pos_msec == 0 ) )
+ if ((current_state == MM_PLAYER_STATE_PAUSED)
+ || (!ret))
+ //|| (player->last_position != 0 && pos_msec == 0))
{
- LOGD ("pos_msec = %"GST_TIME_FORMAT" and ret = %d and state = %d", GST_TIME_ARGS (pos_msec), ret, current_state);
+ LOGD("pos_msec = %"GST_TIME_FORMAT" and ret = %d and state = %d", GST_TIME_ARGS(pos_msec), ret, current_state);
- if(player->playback_rate < 0.0)
+ if (player->playback_rate < 0.0)
pos_msec = player->last_position - TRICKPLAY_OFFSET;
else
pos_msec = player->last_position;
dur = player->duration / GST_SECOND;
if (dur <= 0)
{
- LOGD ("duration is [%d], so returning position 0\n",dur);
+ LOGD("duration is [%d], so returning position 0\n",dur);
*position = 0;
}
else
#define STREAMING_IS_FINISHED 0
#define BUFFERING_MAX_PER 100
#define DEFAULT_PER_VALUE -1
-#define CHECK_PERCENT_VALUE(a,min,max) (((a)>(min))?(((a)<(max))?(a):(max)):(min))
+#define CHECK_PERCENT_VALUE(a,min,max)(((a)>(min))?(((a)<(max))?(a):(max)):(min))
MMPlayerGstElement *mainbin = NULL;
gint start_per = DEFAULT_PER_VALUE, stop_per = DEFAULT_PER_VALUE;
gint64 content_size_time = player->duration;
guint64 content_size_bytes = player->http_content_size;
- MMPLAYER_RETURN_VAL_IF_FAIL( player &&
+ MMPLAYER_RETURN_VAL_IF_FAIL(player &&
player->pipeline &&
player->pipeline->mainbin,
- MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MM_ERROR_PLAYER_NOT_INITIALIZED);
- MMPLAYER_RETURN_VAL_IF_FAIL( start_pos && stop_pos, MM_ERROR_INVALID_ARGUMENT );
+ MMPLAYER_RETURN_VAL_IF_FAIL(start_pos && stop_pos, MM_ERROR_INVALID_ARGUMENT);
*start_pos = 0;
*stop_pos = 0;
- if (!MMPLAYER_IS_HTTP_STREAMING ( player ))
+ if (!MMPLAYER_IS_HTTP_STREAMING(player))
{
/* and rtsp is not ready yet. */
- LOGW ("it's only used for http streaming case.\n");
+ LOGW("it's only used for http streaming case.\n");
return MM_ERROR_PLAYER_NO_OP;
}
if (format != MM_PLAYER_POS_FORMAT_PERCENT)
{
- LOGW ("Time format is not supported yet.\n");
+ LOGW("Time format is not supported yet.\n");
return MM_ERROR_INVALID_ARGUMENT;
}
if (content_size_time <= 0 || content_size_bytes <= 0)
{
- LOGW ("there is no content size.");
+ LOGW("there is no content size.");
return MM_ERROR_NONE;
}
- if (__gst_get_position (player, MM_PLAYER_POS_FORMAT_TIME, &position) != MM_ERROR_NONE)
+ if (__gst_get_position(player, MM_PLAYER_POS_FORMAT_TIME, &position) != MM_ERROR_NONE)
{
- LOGW ("fail to get current position.");
+ LOGW("fail to get current position.");
return MM_ERROR_NONE;
}
- LOGD ("pos %d ms, dur %d sec, len %"G_GUINT64_FORMAT" bytes",
+ LOGD("pos %d ms, dur %d sec, len %"G_GUINT64_FORMAT" bytes",
position, (guint)(content_size_time/GST_SECOND), content_size_bytes);
mainbin = player->pipeline->mainbin;
- start_per = ceil(100 * (position*GST_MSECOND) / content_size_time);
+ start_per = ceil(100 *(position*GST_MSECOND) / content_size_time);
if (mainbin[MMPLAYER_M_MUXED_S_BUFFER].gst)
{
gint byte_in_rate = 0, byte_out_rate = 0;
gint64 estimated_total = 0;
- query = gst_query_new_buffering ( GST_FORMAT_BYTES );
+ query = gst_query_new_buffering(GST_FORMAT_BYTES);
if (!query || !gst_element_query(mainbin[MMPLAYER_M_MUXED_S_BUFFER].gst, query))
{
- LOGW ("fail to get buffering query from queue2");
+ LOGW("fail to get buffering query from queue2");
if (query)
- gst_query_unref (query);
+ gst_query_unref(query);
return MM_ERROR_NONE;
}
gst_query_parse_buffering_stats(query, &mode, &byte_in_rate, &byte_out_rate, NULL);
- LOGD ("mode %d, in_rate %d, out_rate %d", mode, byte_in_rate, byte_out_rate);
+ LOGD("mode %d, in_rate %d, out_rate %d", mode, byte_in_rate, byte_out_rate);
- if (mode == GST_BUFFERING_STREAM) /* using only queue in case of push mode (ts / mp3) */
+ if (mode == GST_BUFFERING_STREAM) /* using only queue in case of push mode(ts / mp3) */
{
if (gst_element_query_position(mainbin[MMPLAYER_M_SRC].gst,
GST_FORMAT_BYTES, &buffered_total))
{
- LOGD ("buffered_total %"G_GINT64_FORMAT, buffered_total);
+ LOGD("buffered_total %"G_GINT64_FORMAT, buffered_total);
stop_per = 100 * buffered_total / content_size_bytes;
}
}
{
/* buffered size info from queue2 */
num_of_ranges = gst_query_get_n_buffering_ranges(query);
- for ( idx=0 ; idx<num_of_ranges ; idx++ )
+ for (idx=0 ; idx<num_of_ranges ; idx++)
{
- gst_query_parse_nth_buffering_range (query, idx, &start_byte, &stop_byte);
- LOGD ("range %d, %"G_GINT64_FORMAT" ~ %"G_GUINT64_FORMAT, idx, start_byte, stop_byte);
+ gst_query_parse_nth_buffering_range(query, idx, &start_byte, &stop_byte);
+ LOGD("range %d, %"G_GINT64_FORMAT" ~ %"G_GUINT64_FORMAT, idx, start_byte, stop_byte);
buffered_total += (stop_byte - start_byte);
}
stop_per = BUFFERING_MAX_PER;
}
}
- gst_query_unref (query);
+ gst_query_unref(query);
}
if (stop_per == DEFAULT_PER_VALUE)
guint curr_size_bytes = 0;
g_object_get(G_OBJECT(mainbin[MMPLAYER_M_DEMUXED_S_BUFFER].gst),
"curr-size-bytes", &curr_size_bytes, NULL);
- LOGD ("curr_size_bytes of multiqueue = %d", curr_size_bytes);
+ LOGD("curr_size_bytes of multiqueue = %d", curr_size_bytes);
buffered_total += curr_size_bytes;
}
buffered_sec = (gint)(ceil((gdouble)GET_BIT_FROM_BYTE(buffered_total)/(gdouble)player->total_bitrate));
if (buffered_sec >= 0)
- stop_per = start_per + (gint)(ceil)(100*(gdouble)buffered_sec/(gdouble)dur_sec);
+ stop_per = start_per +(gint)(ceil)(100*(gdouble)buffered_sec/(gdouble)dur_sec);
}
}
*start_pos = CHECK_PERCENT_VALUE(start_per, 0, 100);
*stop_pos = CHECK_PERCENT_VALUE(stop_per, *start_pos, 100);
- LOGD ("buffered info: %"G_GINT64_FORMAT" bytes, %d sec, per %lu~%lu\n",
+ LOGD("buffered info: %"G_GINT64_FORMAT" bytes, %d sec, per %lu~%lu\n",
buffered_total, buffered_sec, *start_pos, *stop_pos);
return MM_ERROR_NONE;
{
MMPLAYER_FENTER();
- if ( !player )
+ if (!player)
{
LOGW("set_message_callback is called with invalid player handle\n");
return MM_ERROR_PLAYER_NOT_INITIALIZED;
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL ( uri , FALSE);
- MMPLAYER_RETURN_VAL_IF_FAIL ( data , FALSE);
- MMPLAYER_RETURN_VAL_IF_FAIL ( ( strlen(uri) <= MM_MAX_URL_LEN ), FALSE );
+ MMPLAYER_RETURN_VAL_IF_FAIL(uri , FALSE);
+ MMPLAYER_RETURN_VAL_IF_FAIL(data , FALSE);
+ MMPLAYER_RETURN_VAL_IF_FAIL((strlen(uri) <= MM_MAX_URL_LEN), FALSE);
memset(data, 0, sizeof(MMPlayerParseProfile));
else if ((path = strstr(uri, "rtsp://")))
{
if (strlen(path)) {
- if((path = strstr(uri, "/wfd1.0/"))) {
+ if ((path = strstr(uri, "/wfd1.0/"))) {
strncpy(data->uri, uri, MM_MAX_URL_LEN-1);
data->uri_type = MM_PLAYER_URI_TYPE_URL_WFD;
ret = MM_ERROR_NONE;
if (strlen(path)) {
strncpy(data->uri, uri, MM_MAX_URL_LEN-1);
- if (g_str_has_suffix (g_ascii_strdown(uri, strlen(uri)), ".ism/manifest") ||
- g_str_has_suffix (g_ascii_strdown(uri, strlen(uri)), ".isml/manifest"))
+ if (g_str_has_suffix(g_ascii_strdown(uri, strlen(uri)), ".ism/manifest") ||
+ g_str_has_suffix(g_ascii_strdown(uri, strlen(uri)), ".isml/manifest"))
{
data->uri_type = MM_PLAYER_URI_TYPE_SS;
}
if (strlen(path)) {
strncpy(data->uri, uri, MM_MAX_URL_LEN-1);
- if (g_str_has_suffix (g_ascii_strdown(uri, strlen(uri)), ".ism/manifest") ||
- g_str_has_suffix (g_ascii_strdown(uri, strlen(uri)), ".isml/manifest"))
+ if (g_str_has_suffix(g_ascii_strdown(uri, strlen(uri)), ".ism/manifest") ||
+ g_str_has_suffix(g_ascii_strdown(uri, strlen(uri)), ".isml/manifest"))
{
data->uri_type = MM_PLAYER_URI_TYPE_SS;
}
}
LOGD("ext: %s, mem_size: %d, mmap(param): %p\n", ext, mem_size, param);
- if ( mem_size && param)
+ if (mem_size && param)
{
data->mem = param;
data->mem_size = mem_size;
if ((path = strstr(uri, "file://"))) {
- location = g_filename_from_uri (uri, NULL, &err);
+ location = g_filename_from_uri(uri, NULL, &err);
if (!location || (err != NULL)) {
- LOGE ("Invalid URI '%s' for filesrc: %s", path,
- (err != NULL) ? err->message : "unknown error");
+ LOGE("Invalid URI '%s' for filesrc: %s", path,
+ (err != NULL) ? err->message : "unknown error");
- if (err) g_error_free (err);
- if (location) g_free (location);
+ if (err) g_error_free(err);
+ if (location) g_free(location);
data->uri_type = MM_PLAYER_URI_TYPE_NONE;
goto exit;
}
- LOGD ("path from uri: %s", location);
+ LOGD("path from uri: %s", location);
}
path = (location != NULL)?(location):((char*)uri);
}
else
{
- LOGE ("invalid uri, could not play..\n");
+ LOGE("invalid uri, could not play..\n");
data->uri_type = MM_PLAYER_URI_TYPE_NONE;
}
- if (location) g_free (location);
+ if (location) g_free(location);
}
exit:
MMMessageParamType msg = {0, };
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, FALSE );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
LOGW("get notified");
if ((player->cmd == MMPLAYER_COMMAND_DESTROY) ||
msg.union_type = MM_MSG_UNION_CODE;
msg.code = player->sound_focus.focus_changed_msg;
- MMPLAYER_POST_MSG( player, MM_MESSAGE_READY_TO_RESUME, &msg);
+ MMPLAYER_POST_MSG(player, MM_MESSAGE_READY_TO_RESUME, &msg);
player->resume_event_id = 0;
LOGW("dispatched");
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, FALSE );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
if (MMPLAYER_CURRENT_STATE(player) == MM_PLAYER_STATE_PLAYING)
{
- LOGD ("Ready to proceed lazy pause\n");
+ LOGD("Ready to proceed lazy pause\n");
ret = _mmplayer_pause((MMHandleType)player);
- if(MM_ERROR_NONE != ret)
+ if (MM_ERROR_NONE != ret)
{
LOGE("MMPlayer pause failed in ASM callback lazy pause\n");
}
}
else
{
- LOGD ("Invalid state to proceed lazy pause\n");
+ LOGD("Invalid state to proceed lazy pause\n");
}
/* unset mute */
if (player->doing_seek)
{
MMMessageParamType msg_param;
- memset (&msg_param, 0, sizeof(MMMessageParamType));
+ memset(&msg_param, 0, sizeof(MMMessageParamType));
msg_param.code = MM_ERROR_PLAYER_SEEK;
player->doing_seek = FALSE;
MMPLAYER_POST_MSG(player, MM_MESSAGE_ERROR, &msg_param);
if (!MMPLAYER_IS_RTSP_STREAMING(player))
{
// hold 0.7 second to excute "fadedown mute" effect
- LOGW ("do fade down->pause->undo fade down");
+ LOGW("do fade down->pause->undo fade down");
__mmplayer_do_sound_fadedown(player, MM_PLAYER_FADEOUT_TIME_DEFAULT);
}
else
{
- LOGW ("pause immediately");
+ LOGW("pause immediately");
result = _mmplayer_pause((MMHandleType)player);
if (result != MM_ERROR_NONE)
{
player->sound_focus.cb_pending = FALSE;
EXIT:
- MMPLAYER_CMD_UNLOCK( player );
+ MMPLAYER_CMD_UNLOCK(player);
LOGW("dispatched");
return;
if (!MMPLAYER_IS_RTSP_STREAMING(player))
{
//hold 0.7 second to excute "fadedown mute" effect
- LOGW ("do fade down->pause->undo fade down");
+ LOGW("do fade down->pause->undo fade down");
__mmplayer_do_sound_fadedown(player, MM_PLAYER_FADEOUT_TIME_DEFAULT);
}
else
{
- LOGW ("pause immediately");
+ LOGW("pause immediately");
result = _mmplayer_pause((MMHandleType)player);
if (result != MM_ERROR_NONE)
{
}
DONE:
- if ( !lazy_pause )
+ if (!lazy_pause)
{
player->sound_focus.by_asm_cb = FALSE;
}
player->sound_focus.cb_pending = FALSE;
EXIT:
- MMPLAYER_CMD_UNLOCK( player );
+ MMPLAYER_CMD_UNLOCK(player);
LOGW("dispatched");
return;
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
/* initialize player state */
MMPLAYER_CURRENT_STATE(player) = MM_PLAYER_STATE_NONE;
MMPLAYER_TARGET_STATE(player) = MM_PLAYER_STATE_NONE;
/* check current state */
- MMPLAYER_CHECK_STATE ( player, MMPLAYER_COMMAND_CREATE );
+ MMPLAYER_CHECK_STATE(player, MMPLAYER_COMMAND_CREATE);
/* construct attributes */
player->attrs = _mmplayer_construct_attribute(handle);
- if ( !player->attrs )
+ if (!player->attrs)
{
LOGE("Failed to construct attributes\n");
return ret;
}
/* initialize gstreamer with configured parameter */
- if ( ! __mmplayer_init_gstreamer(player) )
+ if (!__mmplayer_init_gstreamer(player))
{
LOGE("Initializing gstreamer failed\n");
_mmplayer_deconstruct_attribute(handle);
}
/* initialize factories if not using decodebin */
- if( player->factories == NULL )
+ if (player->factories == NULL)
__mmplayer_init_factories(player);
/* create lock. note that g_tread_init() has already called in gst_init() */
/* create repeat thread */
player->repeat_thread =
- g_thread_try_new ("repeat_thread", __mmplayer_repeat_thread, (gpointer)player, NULL);
+ g_thread_try_new("repeat_thread", __mmplayer_repeat_thread, (gpointer)player, NULL);
if (!player->repeat_thread)
{
LOGE("failed to create repeat_thread(%s)");
/* create next play thread */
player->next_play_thread =
- g_thread_try_new ("next_play_thread", __mmplayer_next_play_thread, (gpointer)player, NULL);
+ g_thread_try_new("next_play_thread", __mmplayer_next_play_thread, (gpointer)player, NULL);
if (!player->next_play_thread)
{
LOGE("failed to create next play thread");
}
/* initialize resource manager */
- if ( MM_ERROR_NONE != _mmplayer_resource_manager_init(&player->resource_manager, player))
+ if (MM_ERROR_NONE != _mmplayer_resource_manager_init(&player->resource_manager, player))
{
LOGE("failed to initialize resource manager\n");
goto ERROR;
/* set player state to null */
MMPLAYER_STATE_CHANGE_TIMEOUT(player) = player->ini.localplayback_state_change_timeout;
- MMPLAYER_SET_STATE ( player, MM_PLAYER_STATE_NULL );
+ MMPLAYER_SET_STATE(player, MM_PLAYER_STATE_NULL);
return MM_ERROR_NONE;
ERROR:
/* free lock */
- g_mutex_clear(&player->fsink_lock );
+ g_mutex_clear(&player->fsink_lock);
/* free thread */
- if ( player->repeat_thread )
+ if (player->repeat_thread)
{
player->repeat_thread_exit = TRUE;
- g_cond_signal( &player->repeat_thread_cond );
+ g_cond_signal(&player->repeat_thread_cond);
- g_thread_join( player->repeat_thread );
+ g_thread_join(player->repeat_thread);
player->repeat_thread = NULL;
g_mutex_clear(&player->repeat_thread_mutex);
int i = 0;
int arg_count = 0;
- if ( initialized )
+ if (initialized)
{
LOGD("gstreamer already initialized.\n");
return TRUE;
}
/* alloc */
- argc = malloc( sizeof(int) );
- argv = malloc( sizeof(gchar*) * max_argc );
- argv2 = malloc( sizeof(gchar*) * max_argc );
+ argc = malloc(sizeof(int));
+ argv = malloc(sizeof(gchar*) * max_argc);
+ argv2 = malloc(sizeof(gchar*) * max_argc);
- if ( !argc || !argv || !argv2)
+ if (!argc || !argv || !argv2)
goto ERROR;
- memset( argv, 0, sizeof(gchar*) * max_argc );
- memset( argv2, 0, sizeof(gchar*) * max_argc );
+ memset(argv, 0, sizeof(gchar*) * max_argc);
+ memset(argv2, 0, sizeof(gchar*) * max_argc);
/* add initial */
*argc = 1;
- argv[0] = g_strdup( "mmplayer" );
+ argv[0] = g_strdup("mmplayer");
/* add gst_param */
- for ( i = 0; i < 5; i++ ) /* FIXIT : num of param is now fixed to 5. make it dynamic */
+ for (i = 0; i < 5; i++) /* FIXIT : num of param is now fixed to 5. make it dynamic */
{
- if ( strlen( player->ini.gst_param[i] ) > 0 )
+ if (strlen(player->ini.gst_param[i]) > 0)
{
- argv[*argc] = g_strdup( player->ini.gst_param[i] );
+ argv[*argc] = g_strdup(player->ini.gst_param[i]);
(*argc)++;
}
}
(*argc)++;
/* check disable registry scan */
- if ( player->ini.skip_rescan )
+ if (player->ini.skip_rescan)
{
argv[*argc] = g_strdup("--gst-disable-registry-update");
(*argc)++;
}
/* check disable segtrap */
- if ( player->ini.disable_segtrap )
+ if (player->ini.disable_segtrap)
{
argv[*argc] = g_strdup("--gst-disable-segtrap");
(*argc)++;
LOGD("argc : %d\n", *argc);
arg_count = *argc;
- for ( i = 0; i < arg_count; i++ )
+ for (i = 0; i < arg_count; i++)
{
argv2[i] = argv[i];
LOGD("argv[%d] : %s\n", i, argv2[i]);
/* initializing gstreamer */
- if ( ! gst_init_check (argc, &argv, &err))
+ if (!gst_init_check(argc, &argv, &err))
{
LOGE("Could not initialize GStreamer: %s\n", err ? err->message : "unknown error occurred");
if (err)
{
- g_error_free (err);
+ g_error_free(err);
}
goto ERROR;
}
/* release */
- for ( i = 0; i < arg_count; i++ )
+ for (i = 0; i < arg_count; i++)
{
//LOGD("release - argv[%d] : %s\n", i, argv2[i]);
- MMPLAYER_FREEIF( argv2[i] );
+ MMPLAYER_FREEIF(argv2[i]);
}
- MMPLAYER_FREEIF( argv );
- MMPLAYER_FREEIF( argv2 );
- MMPLAYER_FREEIF( argc );
+ MMPLAYER_FREEIF(argv);
+ MMPLAYER_FREEIF(argv2);
+ MMPLAYER_FREEIF(argc);
/* done */
initialized = TRUE;
ERROR:
/* release */
- for ( i = 0; i < arg_count; i++ )
+ for (i = 0; i < arg_count; i++)
{
LOGD("free[%d] : %s\n", i, argv2[i]);
- MMPLAYER_FREEIF( argv2[i] );
+ MMPLAYER_FREEIF(argv2[i]);
}
- MMPLAYER_FREEIF( argv );
- MMPLAYER_FREEIF( argv2 );
- MMPLAYER_FREEIF( argc );
+ MMPLAYER_FREEIF(argv);
+ MMPLAYER_FREEIF(argv2);
+ MMPLAYER_FREEIF(argc);
return FALSE;
}
int
__mmplayer_destroy_streaming_ext(mm_player_t* player)
{
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
if (player->pd_downloader)
{
MMPLAYER_FENTER();
/* check player handle */
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
/* destroy can called at anytime */
- MMPLAYER_CHECK_STATE ( player, MMPLAYER_COMMAND_DESTROY );
+ MMPLAYER_CHECK_STATE(player, MMPLAYER_COMMAND_DESTROY);
__mmplayer_destroy_streaming_ext(player);
/* release repeat thread */
- if ( player->repeat_thread )
+ if (player->repeat_thread)
{
player->repeat_thread_exit = TRUE;
- g_cond_signal( &player->repeat_thread_cond );
+ g_cond_signal(&player->repeat_thread_cond);
LOGD("waitting for repeat thread exit\n");
g_thread_join(player->repeat_thread);
}
/* release next play thread */
- if ( player->next_play_thread )
+ if (player->next_play_thread)
{
player->next_play_thread_exit = TRUE;
- g_cond_signal( &player->next_play_thread_cond );
+ g_cond_signal(&player->next_play_thread_cond);
LOGD("waitting for next play thread exit\n");
- g_thread_join ( player->next_play_thread );
- g_mutex_clear(&player->next_play_thread_mutex );
- g_cond_clear(&player->next_play_thread_cond );
+ g_thread_join(player->next_play_thread);
+ g_mutex_clear(&player->next_play_thread_mutex);
+ g_cond_clear(&player->next_play_thread_cond);
LOGD("next play thread released\n");
}
}
/* withdraw asm */
- if ( MM_ERROR_NONE != _mmplayer_sound_unregister(&player->sound_focus) )
+ if (MM_ERROR_NONE != _mmplayer_sound_unregister(&player->sound_focus))
{
LOGE("failed to deregister asm server\n");
}
/* de-initialize resource manager */
- if ( MM_ERROR_NONE != _mmplayer_resource_manager_deinit(&player->resource_manager))
+ if (MM_ERROR_NONE != _mmplayer_resource_manager_deinit(&player->resource_manager))
{
LOGE("failed to deinitialize resource manager\n");
}
if (player->resume_event_id)
{
- g_source_remove (player->resume_event_id);
+ g_source_remove(player->resume_event_id);
player->resume_event_id = 0;
}
if (player->resumable_cancel_id)
{
- g_source_remove (player->resumable_cancel_id);
+ g_source_remove(player->resumable_cancel_id);
player->resumable_cancel_id = 0;
}
/* release pipeline */
- if ( MM_ERROR_NONE != __mmplayer_gst_destroy_pipeline( player ) )
+ if (MM_ERROR_NONE != __mmplayer_gst_destroy_pipeline(player))
{
LOGE("failed to destory pipeline\n");
return MM_ERROR_PLAYER_INTERNAL;
if (player->is_external_subtitle_present && player->subtitle_language_list)
{
- g_list_free (player->subtitle_language_list);
+ g_list_free(player->subtitle_language_list);
player->subtitle_language_list = NULL;
}
- __mmplayer_release_dump_list (player->dump_list);
+ __mmplayer_release_dump_list(player->dump_list);
/* release miscellaneous information.
these info needs to be released after pipeline is destroyed. */
- __mmplayer_release_misc_post( player );
+ __mmplayer_release_misc_post(player);
/* release attributes */
- _mmplayer_deconstruct_attribute( handle );
+ _mmplayer_deconstruct_attribute(handle);
/* release factories */
- __mmplayer_release_factories( player );
+ __mmplayer_release_factories(player);
/* release lock */
- g_mutex_clear(&player->fsink_lock );
+ g_mutex_clear(&player->fsink_lock);
/* release video bo lock and cond */
g_mutex_clear(&player->video_bo_mutex);
int ret = MM_ERROR_NONE;
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
if (MMPLAYER_IS_HTTP_PD(player))
{
gboolean bret = FALSE;
player->pd_downloader = _mmplayer_create_pd_downloader();
- if ( !player->pd_downloader )
+ if (!player->pd_downloader)
{
- LOGE ("Unable to create PD Downloader...");
+ LOGE("Unable to create PD Downloader...");
ret = MM_ERROR_PLAYER_NO_FREE_SPACE;
}
if (FALSE == bret)
{
- LOGE ("Unable to create PD Downloader...");
+ LOGE("Unable to create PD Downloader...");
ret = MM_ERROR_PLAYER_NOT_INITIALIZED;
}
}
int
_mmplayer_sound_register_with_pid(MMHandleType hplayer, int pid) // @
{
- mm_player_t* player = (mm_player_t*)hplayer;
+ mm_player_t* player = (mm_player_t*)hplayer;
MMHandleType attrs = 0;
int ret = MM_ERROR_NONE;
attrs = MMPLAYER_GET_ATTRS(player);
- if ( !attrs )
+ if (!attrs)
{
LOGE("fail to get attributes.\n");
return MM_ERROR_PLAYER_INTERNAL;
player->sound_focus.pid = pid;
/* register to asm */
- if ( MM_ERROR_NONE != _mmplayer_sound_register(&player->sound_focus,
+ if (MM_ERROR_NONE != _mmplayer_sound_register(&player->sound_focus,
(mm_sound_focus_changed_cb)__mmplayer_sound_focus_callback,
(mm_sound_focus_changed_watch_cb)__mmplayer_sound_focus_watch_callback,
- (void*)player) )
+ (void*)player))
{
/* NOTE : we are dealing it as an error since we cannot expect it's behavior */
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
*pid = player->sound_focus.pid;
int
_mmplayer_realize(MMHandleType hplayer) // @
{
- mm_player_t* player = (mm_player_t*)hplayer;
+ mm_player_t* player = (mm_player_t*)hplayer;
char *uri =NULL;
void *param = NULL;
gboolean update_registry = FALSE;
MMPLAYER_FENTER();
/* check player handle */
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, MM_ERROR_PLAYER_NOT_INITIALIZED )
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED)
/* check current state */
- MMPLAYER_CHECK_STATE( player, MMPLAYER_COMMAND_REALIZE );
+ MMPLAYER_CHECK_STATE(player, MMPLAYER_COMMAND_REALIZE);
attrs = MMPLAYER_GET_ATTRS(player);
- if ( !attrs )
+ if (!attrs)
{
LOGE("fail to get attributes.\n");
return MM_ERROR_PLAYER_INTERNAL;
/* registry should be updated for downloadable codec */
mm_attrs_get_int_by_name(attrs, "profile_update_registry", &update_registry);
- if ( update_registry )
+ if (update_registry)
{
LOGD("updating registry...\n");
gst_update_registry();
/* then we have to rebuild factories */
- __mmplayer_release_factories( player );
+ __mmplayer_release_factories(player);
__mmplayer_init_factories(player);
}
/* realize pipeline */
- ret = __gst_realize( player );
- if ( ret != MM_ERROR_NONE )
+ ret = __gst_realize(player);
+ if (ret != MM_ERROR_NONE)
{
LOGE("fail to realize the player.\n");
}
__mmplayer_unrealize_streaming_ext(mm_player_t *player)
{
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
/* destroy can called at anytime */
if (player->pd_downloader && MMPLAYER_IS_HTTP_PD(player))
{
- _mmplayer_unrealize_pd_downloader ((MMHandleType)player);
+ _mmplayer_unrealize_pd_downloader((MMHandleType)player);
MMPLAYER_FREEIF(player->pd_downloader);
}
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, MM_ERROR_PLAYER_NOT_INITIALIZED )
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED)
/* check current state */
- MMPLAYER_CHECK_STATE( player, MMPLAYER_COMMAND_UNREALIZE );
+ MMPLAYER_CHECK_STATE(player, MMPLAYER_COMMAND_UNREALIZE);
__mmplayer_unrealize_streaming_ext(player);
/* unrealize pipeline */
- ret = __gst_unrealize( player );
+ ret = __gst_unrealize(player);
/* set asm stop if success */
if (MM_ERROR_NONE == ret)
{
ret = _mmplayer_sound_release_focus(&player->sound_focus);
- if ( ret != MM_ERROR_NONE )
+ if (ret != MM_ERROR_NONE)
{
LOGE("failed to release sound focus, ret(0x%x)\n", ret);
}
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
LOGD("volume [L]=%f:[R]=%f\n",
volume.level[MM_VOLUME_CHANNEL_LEFT], volume.level[MM_VOLUME_CHANNEL_RIGHT]);
/* invalid factor range or not */
- for ( i = 0; i < MM_VOLUME_CHANNEL_NUM; i++ )
+ for (i = 0; i < MM_VOLUME_CHANNEL_NUM; i++)
{
if (volume.level[i] < MM_VOLUME_FACTOR_MIN || volume.level[i] > MM_VOLUME_FACTOR_MAX) {
- LOGE("Invalid factor! (valid factor:0~1.0)\n");
+ LOGE("Invalid factor!(valid factor:0~1.0)\n");
return MM_ERROR_INVALID_ARGUMENT;
}
}
player->sound.volume = volume.level[MM_VOLUME_CHANNEL_LEFT];
/* check pipeline handle */
- if ( ! player->pipeline || ! player->pipeline->audiobin )
+ if (!player->pipeline || !player->pipeline->audiobin)
{
LOGD("audiobin is not created yet\n");
LOGD("but, current stored volume will be set when it's created.\n");
/* setting volume to volume element */
vol_element = player->pipeline->audiobin[MMPLAYER_A_VOL].gst;
- if ( vol_element )
+ if (vol_element)
{
LOGD("volume is set [%f]\n", player->sound.volume);
g_object_set(vol_element, "volume", player->sound.volume, NULL);
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
- MMPLAYER_RETURN_VAL_IF_FAIL( volume, MM_ERROR_INVALID_ARGUMENT );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ MMPLAYER_RETURN_VAL_IF_FAIL(volume, MM_ERROR_INVALID_ARGUMENT);
/* returning stored volume */
for (i = 0; i < MM_VOLUME_CHANNEL_NUM; i++)
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
/* mute value shoud 0 or 1 */
- if ( mute != 0 && mute != 1 )
+ if (mute != 0 && mute != 1)
{
LOGE("bad mute value\n");
player->sound.mute = mute;
/* just hold mute value if pipeline is not ready */
- if ( !player->pipeline || !player->pipeline->audiobin )
+ if (!player->pipeline || !player->pipeline->audiobin)
{
LOGD("pipeline is not ready. holding mute value\n");
return MM_ERROR_NONE;
vol_element = player->pipeline->audiobin[MMPLAYER_A_SINK].gst;
/* NOTE : volume will only created when the bt is enabled */
- if ( vol_element )
+ if (vol_element)
{
LOGD("mute : %d\n", mute);
g_object_set(vol_element, "mute", mute, NULL);
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
- MMPLAYER_RETURN_VAL_IF_FAIL ( pmute, MM_ERROR_INVALID_ARGUMENT );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ MMPLAYER_RETURN_VAL_IF_FAIL(pmute, MM_ERROR_INVALID_ARGUMENT);
/* just hold mute value if pipeline is not ready */
- if ( !player->pipeline || !player->pipeline->audiobin )
+ if (!player->pipeline || !player->pipeline->audiobin)
{
LOGD("pipeline is not ready. returning stored value\n");
*pmute = player->sound.mute;
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
player->video_stream_changed_cb = callback;
player->video_stream_changed_cb_user_param = user_param;
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
player->audio_stream_changed_cb = callback;
player->audio_stream_changed_cb_user_param = user_param;
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
player->audio_stream_render_cb_ex = callback;
player->audio_stream_cb_user_param = user_param;
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
if (callback && !player->bufmgr)
player->bufmgr = tbm_bufmgr_init(-1);
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
player->audio_stream_cb = callback;
player->audio_stream_cb_user_param = user_param;
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
if (MMPLAYER_CURRENT_STATE(player) != MM_PLAYER_STATE_NULL)
return MM_ERROR_PLAYER_INVALID_STATE;
LOGD("pre buffer size : %d sec\n", second);
- if ( second <= 0 )
+ if (second <= 0)
{
LOGE("bad size value\n");
return MM_ERROR_INVALID_ARGUMENT;
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL (player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
LOGD("mode %d\n", mode);
if ((second > 0) &&
((mode == MM_PLAYER_BUFFERING_MODE_FIXED) ||
- (mode == MM_PLAYER_BUFFERING_MODE_ADAPTIVE)))
+ (mode == MM_PLAYER_BUFFERING_MODE_ADAPTIVE)))
player->streamer->buffering_req.runtime_second = second;
MMPLAYER_FLEAVE();
gint ret = MM_ERROR_NONE;
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
if (MMPLAYER_IS_HTTP_PD(player))
{
- if ( !player->pd_downloader )
+ if (!player->pd_downloader)
{
ret = __mmplayer_realize_streaming_ext(player);
- if ( ret != MM_ERROR_NONE)
+ if (ret != MM_ERROR_NONE)
{
- LOGE ("failed to realize streaming ext\n");
+ LOGE("failed to realize streaming ext\n");
return ret;
}
}
if (player->pd_downloader && player->pd_mode == MM_PLAYER_PD_MODE_URI)
{
- ret = _mmplayer_start_pd_downloader ((MMHandleType)player);
- if ( !ret )
+ ret = _mmplayer_start_pd_downloader((MMHandleType)player);
+ if (!ret)
{
- LOGE ("ERROR while starting PD...\n");
+ LOGE("ERROR while starting PD...\n");
return MM_ERROR_PLAYER_NOT_INITIALIZED;
}
ret = MM_ERROR_NONE;
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
/* check current state */
- MMPLAYER_CHECK_STATE( player, MMPLAYER_COMMAND_START );
+ MMPLAYER_CHECK_STATE(player, MMPLAYER_COMMAND_START);
ret = _mmplayer_sound_acquire_focus(&player->sound_focus);
- if ( ret != MM_ERROR_NONE )
+ if (ret != MM_ERROR_NONE)
{
LOGE("failed to acquire sound focus.\n");
return ret;
/* NOTE : we should check and create pipeline again if not created as we destroy
* whole pipeline when stopping in streamming playback
*/
- if ( ! player->pipeline )
+ if (!player->pipeline)
{
- ret = __gst_realize( player );
- if ( MM_ERROR_NONE != ret )
+ ret = __gst_realize(player);
+ if (MM_ERROR_NONE != ret)
{
LOGE("failed to realize before starting. only in streamming\n");
/* unlock */
}
ret = __mmplayer_start_streaming_ext(player);
- if ( ret != MM_ERROR_NONE )
+ if (ret != MM_ERROR_NONE)
{
LOGE("failed to start streaming ext \n");
}
/* start pipeline */
- ret = __gst_start( player );
- if ( ret != MM_ERROR_NONE )
+ ret = __gst_start(player);
+ if (ret != MM_ERROR_NONE)
{
LOGE("failed to start player.\n");
}
__mmplayer_handle_missed_plugin(mm_player_t* player)
{
MMMessageParamType msg_param;
- memset (&msg_param, 0, sizeof(MMMessageParamType));
+ memset(&msg_param, 0, sizeof(MMMessageParamType));
gboolean post_msg_direct = FALSE;
MMPLAYER_FENTER();
LOGD("not_supported_codec = 0x%02x, can_support_codec = 0x%02x\n",
player->not_supported_codec, player->can_support_codec);
- if( player->not_found_demuxer )
+ if (player->not_found_demuxer)
{
msg_param.code = MM_ERROR_PLAYER_CODEC_NOT_FOUND;
msg_param.data = g_strdup_printf("%s", player->unlinked_demuxer_mime);
- MMPLAYER_POST_MSG( player, MM_MESSAGE_ERROR, &msg_param );
+ MMPLAYER_POST_MSG(player, MM_MESSAGE_ERROR, &msg_param);
MMPLAYER_FREEIF(msg_param.data);
return MM_ERROR_NONE;
if (player->not_supported_codec)
{
- if ( player->can_support_codec ) // There is one codec to play
+ if (player->can_support_codec) // There is one codec to play
{
post_msg_direct = TRUE;
}
else
{
- if ( player->pipeline->audiobin ) // Some content has only PCM data in container.
+ if (player->pipeline->audiobin) // Some content has only PCM data in container.
post_msg_direct = TRUE;
}
- if ( post_msg_direct )
+ if (post_msg_direct)
{
MMMessageParamType msg_param;
- memset (&msg_param, 0, sizeof(MMMessageParamType));
+ memset(&msg_param, 0, sizeof(MMMessageParamType));
- if ( player->not_supported_codec == MISSING_PLUGIN_AUDIO )
+ if (player->not_supported_codec == MISSING_PLUGIN_AUDIO)
{
LOGW("not found AUDIO codec, posting error code to application.\n");
msg_param.code = MM_ERROR_PLAYER_AUDIO_CODEC_NOT_FOUND;
msg_param.data = g_strdup_printf("%s", player->unlinked_audio_mime);
}
- else if ( player->not_supported_codec == MISSING_PLUGIN_VIDEO )
+ else if (player->not_supported_codec == MISSING_PLUGIN_VIDEO)
{
LOGW("not found VIDEO codec, posting error code to application.\n");
msg_param.data = g_strdup_printf("%s", player->unlinked_video_mime);
}
- MMPLAYER_POST_MSG( player, MM_MESSAGE_ERROR, &msg_param );
+ MMPLAYER_POST_MSG(player, MM_MESSAGE_ERROR, &msg_param);
MMPLAYER_FREEIF(msg_param.data);
{
LOGW("not found any codec, posting error code to application.\n");
- if ( player->not_supported_codec == MISSING_PLUGIN_AUDIO )
+ if (player->not_supported_codec == MISSING_PLUGIN_AUDIO)
{
msg_param.code = MM_ERROR_PLAYER_AUDIO_CODEC_NOT_FOUND;
msg_param.data = g_strdup_printf("%s", player->unlinked_audio_mime);
msg_param.data = g_strdup_printf("%s, %s", player->unlinked_video_mime, player->unlinked_audio_mime);
}
- MMPLAYER_POST_MSG( player, MM_MESSAGE_ERROR, &msg_param );
+ MMPLAYER_POST_MSG(player, MM_MESSAGE_ERROR, &msg_param);
MMPLAYER_FREEIF(msg_param.data);
}
MMPLAYER_PLAYBACK_LOCK(player);
MMPLAYER_PLAYBACK_UNLOCK(player);
- timeout = MMPLAYER_STATE_CHANGE_TIMEOUT ( player );
+ timeout = MMPLAYER_STATE_CHANGE_TIMEOUT(player);
/* wait for state transition */
- ret = gst_element_get_state( player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, &element_state, &element_pending_state, timeout * GST_SECOND );
+ ret = gst_element_get_state(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, &element_state, &element_pending_state, timeout * GST_SECOND);
- if ( ret == GST_STATE_CHANGE_FAILURE )
+ if (ret == GST_STATE_CHANGE_FAILURE)
{
- LOGE("failed to change pipeline state within %d sec\n", timeout );
+ LOGE("failed to change pipeline state within %d sec\n", timeout);
}
}
}
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
/* check current state */
- MMPLAYER_CHECK_STATE( player, MMPLAYER_COMMAND_STOP );
+ MMPLAYER_CHECK_STATE(player, MMPLAYER_COMMAND_STOP);
/* check pipline building state */
__mmplayer_check_pipeline(player);
__mmplayer_reset_gapless_state(player);
/* NOTE : application should not wait for EOS after calling STOP */
- __mmplayer_cancel_eos_timer( player );
+ __mmplayer_cancel_eos_timer(player);
__mmplayer_unrealize_streaming_ext(player);
player->doing_seek = FALSE;
/* stop pipeline */
- ret = __gst_stop( player );
+ ret = __gst_stop(player);
- if ( ret != MM_ERROR_NONE )
+ if (ret != MM_ERROR_NONE)
{
LOGE("failed to stop player.\n");
}
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
/* check current state */
- MMPLAYER_CHECK_STATE( player, MMPLAYER_COMMAND_PAUSE );
+ MMPLAYER_CHECK_STATE(player, MMPLAYER_COMMAND_PAUSE);
/* check pipline building state */
__mmplayer_check_pipeline(player);
case MM_PLAYER_STATE_PLAYING:
{
/* NOTE : store current point to overcome some bad operation
- * ( returning zero when getting current position in paused state) of some
+ *(returning zero when getting current position in paused state) of some
* elements
*/
- if ( !gst_element_query_position(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &pos_msec))
+ if (!gst_element_query_position(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &pos_msec))
LOGW("getting current position failed in paused\n");
player->last_position = pos_msec;
}
/* pause pipeline */
- ret = __gst_pause( player, async );
+ ret = __gst_pause(player, async);
- if ( ret != MM_ERROR_NONE )
+ if (ret != MM_ERROR_NONE)
{
LOGE("failed to pause player. ret : 0x%x\n", ret);
}
if (MMPLAYER_PREV_STATE(player) == MM_PLAYER_STATE_READY && MMPLAYER_CURRENT_STATE(player) == MM_PLAYER_STATE_PAUSED)
{
- if ( MM_ERROR_NONE != _mmplayer_update_video_param( player, "display_rotation"))
+ if (MM_ERROR_NONE != _mmplayer_update_video_param(player, "display_rotation"))
{
LOGE("failed to update display_rotation");
}
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
ret = _mmplayer_sound_acquire_focus(&player->sound_focus);
- if ( ret != MM_ERROR_NONE )
+ if (ret != MM_ERROR_NONE)
{
LOGE("failed to acquire sound focus.\n");
return ret;
}
/* check current state */
- MMPLAYER_CHECK_STATE( player, MMPLAYER_COMMAND_RESUME );
+ MMPLAYER_CHECK_STATE(player, MMPLAYER_COMMAND_RESUME);
- ret = __gst_resume( player, async );
+ ret = __gst_resume(player, async);
- if ( ret != MM_ERROR_NONE )
+ if (ret != MM_ERROR_NONE)
{
LOGE("failed to resume player.\n");
}
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
attrs = MMPLAYER_GET_ATTRS(player);
- if ( !attrs )
+ if (!attrs)
{
LOGE("fail to get attributes.\n");
return MM_ERROR_PLAYER_INTERNAL;
}
mm_attrs_set_int_by_name(attrs, "profile_play_count", count);
- if ( mmf_attrs_commit ( attrs ) ) /* return -1 if error */
+ if (mmf_attrs_commit(attrs)) /* return -1 if error */
LOGE("failed to commit\n");
MMPLAYER_FLEAVE();
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
- MMPLAYER_RETURN_VAL_IF_FAIL ( end <= GST_TIME_AS_MSECONDS(player->duration), MM_ERROR_INVALID_ARGUMENT );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ MMPLAYER_RETURN_VAL_IF_FAIL(end <= GST_TIME_AS_MSECONDS(player->duration), MM_ERROR_INVALID_ARGUMENT);
player->section_repeat = TRUE;
player->section_repeat_start = start;
start_pos = player->section_repeat_start * G_GINT64_CONSTANT(1000000);
end_pos = player->section_repeat_end * G_GINT64_CONSTANT(1000000);
- __mmplayer_set_play_count( player, infinity );
+ __mmplayer_set_play_count(player, infinity);
- if ( (!__gst_seek( player, player->pipeline->mainbin[MMPLAYER_M_PIPE].gst,
+ if ((!__gst_seek(player, player->pipeline->mainbin[MMPLAYER_M_PIPE].gst,
player->playback_rate,
GST_FORMAT_TIME,
- ( GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE ),
+ (GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE),
GST_SEEK_TYPE_SET, start_pos,
GST_SEEK_TYPE_SET, end_pos)))
{
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL( player, FALSE );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
mm_attrs_multiple_get(player->attrs,
NULL,
"pcm_extraction_end_msec", &required_end,
NULL);
- LOGD("pcm extraction required position is from [%d] to [%d] (msec)\n", required_start, required_end);
+ LOGD("pcm extraction required position is from [%d] to [%d](msec)\n", required_start, required_end);
if (required_start == 0 && required_end == 0)
{
LOGD("extracting entire stream");
return MM_ERROR_NONE;
}
- else if (required_start < 0 || required_start > required_end || required_end < 0 )
+ else if (required_start < 0 || required_start > required_end || required_end < 0)
{
LOGD("invalid range for pcm extraction");
return MM_ERROR_INVALID_ARGUMENT;
/* get duration */
ret = gst_element_query_duration(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &dur_nsec);
- if ( !ret )
+ if (!ret)
{
LOGE("failed to get duration");
return MM_ERROR_PLAYER_INTERNAL;
start_nsec = required_start * G_GINT64_CONSTANT(1000000);
end_nsec = required_end * G_GINT64_CONSTANT(1000000);
- if ( (!__gst_seek( player, player->pipeline->mainbin[MMPLAYER_M_PIPE].gst,
+ if ((!__gst_seek(player, player->pipeline->mainbin[MMPLAYER_M_PIPE].gst,
1.0,
GST_FORMAT_TIME,
- ( GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE ),
+ (GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE),
GST_SEEK_TYPE_SET, start_nsec,
GST_SEEK_TYPE_SET, end_nsec)))
{
return MM_ERROR_PLAYER_SEEK;
}
- LOGD("succeeded to set up segment extraction from [%llu] to [%llu] (nsec)\n", start_nsec, end_nsec);
+ LOGD("succeeded to set up segment extraction from [%llu] to [%llu](nsec)\n", start_nsec, end_nsec);
MMPLAYER_FLEAVE();
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
player->section_repeat = FALSE;
- __mmplayer_set_play_count( player, onetime );
+ __mmplayer_set_play_count(player, onetime);
gst_element_query_position(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &cur_pos);
- if ( (!__gst_seek( player, player->pipeline->mainbin[MMPLAYER_M_PIPE].gst,
+ if ((!__gst_seek(player, player->pipeline->mainbin[MMPLAYER_M_PIPE].gst,
1.0,
GST_FORMAT_TIME,
- ( GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE ),
+ (GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE),
GST_SEEK_TYPE_SET, cur_pos,
- GST_SEEK_TYPE_SET, player->duration )))
+ GST_SEEK_TYPE_SET, player->duration)))
{
LOGE("failed to deactivate section repeat\n");
MMPlayerStateType current_state = MM_PLAYER_STATE_NONE;
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL ( player && player->pipeline, MM_ERROR_PLAYER_NOT_INITIALIZED );
- MMPLAYER_RETURN_VAL_IF_FAIL ( streaming || !MMPLAYER_IS_STREAMING(player), MM_ERROR_NOT_SUPPORT_API );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ MMPLAYER_RETURN_VAL_IF_FAIL(streaming || !MMPLAYER_IS_STREAMING(player), MM_ERROR_NOT_SUPPORT_API);
/* The sound of video is not supported under 0.0 and over 2.0. */
- if(rate >= TRICK_PLAY_MUTE_THRESHOLD_MAX || rate < TRICK_PLAY_MUTE_THRESHOLD_MIN)
+ if (rate >= TRICK_PLAY_MUTE_THRESHOLD_MAX || rate < TRICK_PLAY_MUTE_THRESHOLD_MIN)
{
if (player->can_support_codec & FOUND_PLUGIN_VIDEO)
mute = TRUE;
current_state = MMPLAYER_CURRENT_STATE(player);
- if ( current_state != MM_PLAYER_STATE_PAUSED )
+ if (current_state != MM_PLAYER_STATE_PAUSED)
ret = gst_element_query_position(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &pos_msec);
- LOGD ("pos_msec = %"GST_TIME_FORMAT" and ret = %d and state = %d", GST_TIME_ARGS (pos_msec), ret, current_state);
+ LOGD("pos_msec = %"GST_TIME_FORMAT" and ret = %d and state = %d", GST_TIME_ARGS(pos_msec), ret, current_state);
- if ( ( current_state == MM_PLAYER_STATE_PAUSED )
- || ( ! ret ))
- //|| ( player->last_position != 0 && pos_msec == 0 ) )
+ if ((current_state == MM_PLAYER_STATE_PAUSED)
+ || (!ret))
+ //|| (player->last_position != 0 && pos_msec == 0))
{
- LOGW("returning last point : %lld\n", player->last_position );
+ LOGW("returning last point : %lld\n", player->last_position);
pos_msec = player->last_position;
}
- if(rate >= 0)
+ if (rate >= 0)
{
start = pos_msec;
stop = GST_CLOCK_TIME_NONE;
start = GST_CLOCK_TIME_NONE;
stop = pos_msec;
}
- if ((!gst_element_seek (player->pipeline->mainbin[MMPLAYER_M_PIPE].gst,
+ if ((!gst_element_seek(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst,
rate,
GST_FORMAT_TIME,
- ( GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE ),
+ (GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE),
GST_SEEK_TYPE_SET, start,
GST_SEEK_TYPE_SET, stop)))
{
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
/* check pipline building state */
__mmplayer_check_pipeline(player);
- ret = __gst_set_position ( player, format, (unsigned long)position, FALSE );
+ ret = __gst_set_position(player, format, (unsigned long)position, FALSE);
MMPLAYER_FLEAVE();
mm_player_t* player = (mm_player_t*)hplayer;
int ret = MM_ERROR_NONE;
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
- ret = __gst_get_position ( player, format, position );
+ ret = __gst_get_position(player, format, position);
return ret;
}
mm_player_t* player = (mm_player_t*)hplayer;
int ret = MM_ERROR_NONE;
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
- ret = __gst_get_buffer_position ( player, format, start_pos, stop_pos );
+ ret = __gst_get_buffer_position(player, format, start_pos, stop_pos);
return ret;
}
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
ret = __gst_adjust_subtitle_position(player, format, position);
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
ret = __gst_adjust_video_position(player, offset);
}
static gboolean
-__mmplayer_is_midi_type( gchar* str_caps)
+__mmplayer_is_midi_type(gchar* str_caps)
{
- if ( ( g_strrstr(str_caps, "audio/midi") ) ||
- ( g_strrstr(str_caps, "application/x-gst_ff-mmf") ) ||
- ( g_strrstr(str_caps, "application/x-smaf") ) ||
- ( g_strrstr(str_caps, "audio/x-imelody") ) ||
- ( g_strrstr(str_caps, "audio/mobile-xmf") ) ||
- ( g_strrstr(str_caps, "audio/xmf") ) ||
- ( g_strrstr(str_caps, "audio/mxmf") ) )
+ if ((g_strrstr(str_caps, "audio/midi")) ||
+ (g_strrstr(str_caps, "application/x-gst_ff-mmf")) ||
+ (g_strrstr(str_caps, "application/x-smaf")) ||
+ (g_strrstr(str_caps, "audio/x-imelody")) ||
+ (g_strrstr(str_caps, "audio/mobile-xmf")) ||
+ (g_strrstr(str_caps, "audio/xmf")) ||
+ (g_strrstr(str_caps, "audio/mxmf")))
{
LOGD("midi\n");
}
static gboolean
-__mmplayer_is_only_mp3_type (gchar *str_caps)
+__mmplayer_is_only_mp3_type(gchar *str_caps)
{
if (g_strrstr(str_caps, "application/x-id3") ||
- (g_strrstr(str_caps, "audio/mpeg") && g_strrstr(str_caps, "mpegversion=(int)1")))
+ (g_strrstr(str_caps, "audio/mpeg") && g_strrstr(str_caps, "mpegversion= (int)1")))
{
return TRUE;
}
}
static void
-__mmplayer_set_audio_attrs (mm_player_t* player, GstCaps* caps)
+__mmplayer_set_audio_attrs(mm_player_t* player, GstCaps* caps)
{
GstStructure* caps_structure = NULL;
gint samplerate = 0;
gint channels = 0;
MMPLAYER_FENTER();
- MMPLAYER_RETURN_IF_FAIL (player && caps);
+ MMPLAYER_RETURN_IF_FAIL(player && caps);
caps_structure = gst_caps_get_structure(caps, 0);
/* set stream information */
- gst_structure_get_int (caps_structure, "rate", &samplerate);
- mm_attrs_set_int_by_name (player->attrs, "content_audio_samplerate", samplerate);
+ gst_structure_get_int(caps_structure, "rate", &samplerate);
+ mm_attrs_set_int_by_name(player->attrs, "content_audio_samplerate", samplerate);
- gst_structure_get_int (caps_structure, "channels", &channels);
- mm_attrs_set_int_by_name (player->attrs, "content_audio_channels", channels);
+ gst_structure_get_int(caps_structure, "channels", &channels);
+ mm_attrs_set_int_by_name(player->attrs, "content_audio_channels", channels);
- LOGD ("audio samplerate : %d channels : %d\n", samplerate, channels);
+ LOGD("audio samplerate : %d channels : %d\n", samplerate, channels);
}
static void
__mmplayer_update_content_type_info(mm_player_t* player)
{
MMPLAYER_FENTER();
- MMPLAYER_RETURN_IF_FAIL( player && player->type);
+ MMPLAYER_RETURN_IF_FAIL(player && player->type);
if (__mmplayer_is_midi_type(player->type))
{
}
static void
-__mmplayer_typefind_have_type( GstElement *tf, guint probability, // @
+__mmplayer_typefind_have_type( GstElement *tf, guint probability, // @
GstCaps *caps, gpointer data)
{
mm_player_t* player = (mm_player_t*)data;
MMPLAYER_FENTER();
- MMPLAYER_RETURN_IF_FAIL( player && tf && caps );
+ MMPLAYER_RETURN_IF_FAIL(player && tf && caps);
/* store type string */
MMPLAYER_FREEIF(player->type);
if (player->type)
LOGD("meida type %s found, probability %d%% / %d\n", player->type, probability, gst_caps_get_size(caps));
- if ( (!MMPLAYER_IS_WFD_STREAMING( player )) &&
- (!MMPLAYER_IS_RTSP_STREAMING( player )) &&
- (g_strrstr(player->type, "audio/x-raw-int")))
+ if ((!MMPLAYER_IS_WFD_STREAMING(player)) &&
+ (!MMPLAYER_IS_RTSP_STREAMING(player)) &&
+ (g_strrstr(player->type, "audio/x-raw-int")))
{
LOGE("not support media format\n");
if (player->msg_posted == FALSE)
{
MMMessageParamType msg_param;
- memset (&msg_param, 0, sizeof(MMMessageParamType));
+ memset(&msg_param, 0, sizeof(MMMessageParamType));
msg_param.code = MM_ERROR_PLAYER_NOT_SUPPORTED_FORMAT;
- MMPLAYER_POST_MSG( player, MM_MESSAGE_ERROR, &msg_param );
+ MMPLAYER_POST_MSG(player, MM_MESSAGE_ERROR, &msg_param);
/* don't post more if one was sent already */
player->msg_posted = TRUE;
__mmplayer_update_content_type_info(player);
pad = gst_element_get_static_pad(tf, "src");
- if ( !pad )
+ if (!pad)
{
LOGE("fail to get typefind src pad.\n");
return;
if (player->use_decodebin)
{
- if(!__mmplayer_try_to_plug_decodebin( player, pad, caps ))
+ if (!__mmplayer_try_to_plug_decodebin(player, pad, caps))
{
gboolean async = FALSE;
LOGE("failed to autoplug %s\n", player->type);
mm_attrs_get_int_by_name(player->attrs, "profile_prepare_async", &async);
- if ( async && player->msg_posted == FALSE )
+ if (async && player->msg_posted == FALSE)
{
- __mmplayer_handle_missed_plugin( player );
+ __mmplayer_handle_missed_plugin(player);
}
goto DONE;
else
{
/* try to plug */
- if ( ! __mmplayer_try_to_plug( player, pad, caps ) )
+ if (!__mmplayer_try_to_plug(player, pad, caps))
{
gboolean async = FALSE;
LOGE("failed to autoplug %s\n", player->type);
mm_attrs_get_int_by_name(player->attrs, "profile_prepare_async", &async);
- if ( async && player->msg_posted == FALSE )
+ if (async && player->msg_posted == FALSE)
{
- __mmplayer_handle_missed_plugin( player );
+ __mmplayer_handle_missed_plugin(player);
}
goto DONE;
}
/* finish autopluging if no dynamic pad waiting */
- if( ( ! player->have_dynamic_pad) && ( ! player->has_many_types) )
+ if ((!player->have_dynamic_pad) && (!player->has_many_types))
{
- if ( ! MMPLAYER_IS_RTSP_STREAMING( player ) )
+ if (!MMPLAYER_IS_RTSP_STREAMING(player))
{
- __mmplayer_pipeline_complete( NULL, (gpointer)player );
+ __mmplayer_pipeline_complete(NULL, (gpointer)player);
}
}
}
DONE:
- gst_object_unref( GST_OBJECT(pad) );
+ gst_object_unref(GST_OBJECT(pad));
MMPLAYER_FLEAVE();
}
static GstElement *
-__mmplayer_create_decodebin (mm_player_t* player)
+__mmplayer_create_decodebin(mm_player_t* player)
{
GstElement *decodebin = NULL;
}
/* raw pad handling signal */
- MMPLAYER_SIGNAL_CONNECT( player, G_OBJECT(decodebin), MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "pad-added",
+ MMPLAYER_SIGNAL_CONNECT(player, G_OBJECT(decodebin), MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "pad-added",
G_CALLBACK(__mmplayer_gst_decode_pad_added), player);
/* no-more-pad pad handling signal */
- MMPLAYER_SIGNAL_CONNECT( player, G_OBJECT(decodebin), MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "no-more-pads",
+ MMPLAYER_SIGNAL_CONNECT(player, G_OBJECT(decodebin), MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "no-more-pads",
G_CALLBACK(__mmplayer_gst_decode_no_more_pads), player);
- MMPLAYER_SIGNAL_CONNECT( player, G_OBJECT(decodebin), MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "pad-removed",
+ MMPLAYER_SIGNAL_CONNECT(player, G_OBJECT(decodebin), MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "pad-removed",
G_CALLBACK(__mmplayer_gst_decode_pad_removed), player);
/* This signal is emitted when a pad for which there is no further possible
decoding is added to the decodebin.*/
- MMPLAYER_SIGNAL_CONNECT( player, G_OBJECT(decodebin), MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "unknown-type",
- G_CALLBACK(__mmplayer_gst_decode_unknown_type), player );
+ MMPLAYER_SIGNAL_CONNECT(player, G_OBJECT(decodebin), MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "unknown-type",
+ G_CALLBACK(__mmplayer_gst_decode_unknown_type), player);
/* This signal is emitted whenever decodebin finds a new stream. It is emitted
before looking for any elements that can handle that stream.*/
- MMPLAYER_SIGNAL_CONNECT( player, G_OBJECT(decodebin), MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "autoplug-continue",
+ MMPLAYER_SIGNAL_CONNECT(player, G_OBJECT(decodebin), MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "autoplug-continue",
G_CALLBACK(__mmplayer_gst_decode_autoplug_continue), player);
/* This signal is emitted whenever decodebin finds a new stream. It is emitted
before looking for any elements that can handle that stream.*/
- MMPLAYER_SIGNAL_CONNECT( player, G_OBJECT(decodebin), MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "autoplug-select",
+ MMPLAYER_SIGNAL_CONNECT(player, G_OBJECT(decodebin), MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "autoplug-select",
G_CALLBACK(__mmplayer_gst_decode_autoplug_select), player);
/* This signal is emitted once decodebin has finished decoding all the data.*/
- MMPLAYER_SIGNAL_CONNECT( player, G_OBJECT(decodebin), MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "drained",
+ MMPLAYER_SIGNAL_CONNECT(player, G_OBJECT(decodebin), MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "drained",
G_CALLBACK(__mmplayer_gst_decode_drained), player);
/* This signal is emitted when a element is added to the bin.*/
- MMPLAYER_SIGNAL_CONNECT( player, G_OBJECT(decodebin), MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "element-added",
+ MMPLAYER_SIGNAL_CONNECT(player, G_OBJECT(decodebin), MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "element-added",
G_CALLBACK(__mmplayer_gst_element_added), player);
ERROR:
gdouble init_buffering_time = (gdouble)player->streamer->buffering_req.initial_second;
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL (player && player->pipeline && player->pipeline->mainbin, FALSE);
+ MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline && player->pipeline->mainbin, FALSE);
mainbin = player->pipeline->mainbin;
if ((!MMPLAYER_IS_HTTP_PD(player)) &&
(MMPLAYER_IS_HTTP_STREAMING(player)))
{
- LOGD ("creating http streaming buffering queue (queue2)\n");
+ LOGD("creating http streaming buffering queue(queue2)\n");
if (mainbin[MMPLAYER_M_MUXED_S_BUFFER].gst)
{
- LOGE ("MMPLAYER_M_MUXED_S_BUFFER is not null\n");
+ LOGE("MMPLAYER_M_MUXED_S_BUFFER is not null\n");
}
else
{
- queue2 = gst_element_factory_make ("queue2", "queue2");
+ queue2 = gst_element_factory_make("queue2", "queue2");
if (!queue2)
{
- LOGE ("failed to create buffering queue element\n");
+ LOGE("failed to create buffering queue element\n");
goto ERROR;
}
goto ERROR;
}
- if ( !gst_element_query_duration(player->pipeline->mainbin[MMPLAYER_M_SRC].gst, GST_FORMAT_BYTES, &dur_bytes))
+ if (!gst_element_query_duration(player->pipeline->mainbin[MMPLAYER_M_SRC].gst, GST_FORMAT_BYTES, &dur_bytes))
LOGE("fail to get duration.\n");
LOGD("dur_bytes = %lld\n", dur_bytes);
}
/* NOTE : we cannot get any duration info from ts container in case of streaming */
- // if(!g_strrstr(GST_ELEMENT_NAME(sinkelement), "mpegtsdemux"))
- if(!g_strrstr(player->type, "video/mpegts"))
+ // if (!g_strrstr(GST_ELEMENT_NAME(sinkelement), "mpegtsdemux"))
+ if (!g_strrstr(player->type, "video/mpegts"))
{
max_buffer_size_bytes = (type == MUXED_BUFFER_TYPE_FILE)?(player->ini.http_max_size_bytes):(5*1024*1024);
LOGD("max_buffer_size_bytes = %d\n", max_buffer_size_bytes);
(guint64)dur_bytes);
}
- if (GST_STATE_CHANGE_FAILURE == gst_element_sync_state_with_parent (queue2))
+ if (GST_STATE_CHANGE_FAILURE == gst_element_sync_state_with_parent(queue2))
{
LOGE("failed to sync queue2 state with parent\n");
goto ERROR;
/* to force caps on the decodebin element and avoid reparsing stuff by
* typefind. It also avoids a deadlock in the way typefind activates pads in
* the state change */
- g_object_set (decodebin, "sink-caps", caps, NULL);
+ g_object_set(decodebin, "sink-caps", caps, NULL);
sinkpad = gst_element_get_static_pad(decodebin, "sink");
/* set decodebin property about buffer in streaming playback. *
* in case of hls, it does not need to have big buffer *
* because it is kind of adaptive streaming. */
- if ( ((!MMPLAYER_IS_HTTP_PD(player)) &&
- (MMPLAYER_IS_HTTP_STREAMING(player))) || MMPLAYER_IS_DASH_STREAMING (player))
+ if (((!MMPLAYER_IS_HTTP_PD(player)) &&
+ (MMPLAYER_IS_HTTP_STREAMING(player))) || MMPLAYER_IS_DASH_STREAMING(player))
{
guint max_size_bytes = MAX_DECODEBIN_BUFFER_BYTES;
guint64 max_size_time = MAX_DECODEBIN_BUFFER_TIME;
max_size_time = MAX_DECODEBIN_ADAPTIVE_BUFFER_TIME;
}
- g_object_set (G_OBJECT(decodebin), "use-buffering", TRUE,
+ g_object_set(G_OBJECT(decodebin), "use-buffering", TRUE,
"high-percent", (gint)player->ini.http_buffering_limit,
"low-percent", 1, // 1%
"max-size-bytes", max_size_bytes,
ERROR:
- MMPLAYER_FREEIF( caps_str );
+ MMPLAYER_FREEIF(caps_str);
if (sinkpad)
gst_object_unref(GST_OBJECT(sinkpad));
/* And, it still has a parent "player".
* You need to let the parent manage the object instead of unreffing the object directly.
*/
- gst_bin_remove (GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), queue2);
- gst_object_unref (queue2);
+ gst_bin_remove(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), queue2);
+ gst_object_unref(queue2);
queue2 = NULL;
}
* You need to let the parent manage the object instead of unreffing the object directly.
*/
- gst_bin_remove (GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), decodebin);
- gst_object_unref (decodebin);
+ gst_bin_remove(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), decodebin);
+ gst_object_unref(decodebin);
decodebin = NULL;
}
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL( player && player->pipeline && player->pipeline->mainbin, FALSE );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline && player->pipeline->mainbin, FALSE);
mainbin = player->pipeline->mainbin;
mime = gst_structure_get_name(gst_caps_get_structure(caps, 0));
/* return if we got raw output */
- if(g_str_has_prefix(mime, "video/x-raw") || g_str_has_prefix(mime, "audio/x-raw")
+ if (g_str_has_prefix(mime, "video/x-raw") || g_str_has_prefix(mime, "audio/x-raw")
|| g_str_has_prefix(mime, "text/plain") ||g_str_has_prefix(mime, "text/x-pango-markup"))
{
* has linked. if so, we need to add queue for quality of output. note that
* decodebin also has same problem.
*/
- klass = gst_element_factory_get_metadata (gst_element_get_factory(element), GST_ELEMENT_METADATA_KLASS);
+ klass = gst_element_factory_get_metadata(gst_element_get_factory(element), GST_ELEMENT_METADATA_KLASS);
/* add queue if needed */
- if( (g_strrstr(klass, "Demux") || g_strrstr(klass, "Depayloader")
+ if ((g_strrstr(klass, "Demux") || g_strrstr(klass, "Depayloader")
|| g_strrstr(klass, "Parse")) && !g_str_has_prefix(mime, "text"))
{
LOGD("adding raw queue\n");
queue = gst_element_factory_make("queue", NULL);
- if ( ! queue )
+ if (!queue)
{
LOGW("failed to create queue\n");
goto ERROR;
}
/* warmup */
- if ( GST_STATE_CHANGE_FAILURE == gst_element_set_state(queue, GST_STATE_READY) )
+ if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(queue, GST_STATE_READY))
{
LOGW("failed to set state READY to queue\n");
goto ERROR;
}
/* add to pipeline */
- if ( ! gst_bin_add(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), queue) )
+ if (!gst_bin_add(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), queue))
{
LOGW("failed to add queue\n");
goto ERROR;
/* link queue */
queue_pad = gst_element_get_static_pad(queue, "sink");
- if ( GST_PAD_LINK_OK != gst_pad_link(pad, queue_pad) )
+ if (GST_PAD_LINK_OK != gst_pad_link(pad, queue_pad))
{
LOGW("failed to link queue\n");
goto ERROR;
}
- gst_object_unref ( GST_OBJECT(queue_pad) );
+ gst_object_unref(GST_OBJECT(queue_pad));
queue_pad = NULL;
/* running */
- if ( GST_STATE_CHANGE_FAILURE == gst_element_set_state(queue, GST_STATE_PAUSED) )
+ if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(queue, GST_STATE_PAUSED))
{
LOGW("failed to set state PAUSED to queue\n");
goto ERROR;
/* replace given pad to queue:src */
pad = gst_element_get_static_pad(queue, "src");
- if ( ! pad )
+ if (!pad)
{
LOGW("failed to get pad from queue\n");
goto ERROR;
/* check if player can do start continually */
MMPLAYER_CHECK_CMD_IF_EXIT(player);
- if(__mmplayer_link_sink(player,pad))
+ if (__mmplayer_link_sink(player,pad))
__mmplayer_gst_decode_callback(element, pad, player);
- gst_object_unref( GST_OBJECT(element));
+ gst_object_unref(GST_OBJECT(element));
element = NULL;
return TRUE;
}
item = player->factories;
- for(; item != NULL ; item = item->next)
+ for (; item != NULL ; item = item->next)
{
GstElementFactory *factory = GST_ELEMENT_FACTORY(item->data);
const GList *pads;
skip = FALSE;
/* filtering exclude keyword */
- for ( idx = 0; player->ini.exclude_element_keyword[idx][0] != '\0'; idx++ )
+ for (idx = 0; player->ini.exclude_element_keyword[idx][0] != '\0'; idx++)
{
- if ( g_strrstr(GST_OBJECT_NAME (factory),
- player->ini.exclude_element_keyword[idx] ) )
+ if (g_strrstr(GST_OBJECT_NAME(factory),
+ player->ini.exclude_element_keyword[idx]))
{
LOGW("skipping [%s] by exculde keyword [%s]\n",
- GST_OBJECT_NAME (factory),
- player->ini.exclude_element_keyword[idx] );
+ GST_OBJECT_NAME(factory),
+ player->ini.exclude_element_keyword[idx]);
skip = TRUE;
break;
}
}
- if ( MMPLAYER_IS_RTSP_STREAMING(player) && g_strrstr(GST_OBJECT_NAME (factory), "omx_mpeg4dec"))
+ if (MMPLAYER_IS_RTSP_STREAMING(player) && g_strrstr(GST_OBJECT_NAME(factory), "omx_mpeg4dec"))
{
// omx decoder can not support mpeg4video data partitioned
// rtsp streaming didn't know mpeg4video data partitioned format
// so, if rtsp playback, player will skip omx_mpeg4dec.
LOGW("skipping [%s] when rtsp streaming \n",
- GST_OBJECT_NAME (factory));
+ GST_OBJECT_NAME(factory));
skip = TRUE;
}
- if ( skip ) continue;
+ if (skip) continue;
/* check factory class for filtering */
- klass = gst_element_factory_get_metadata (GST_ELEMENT_FACTORY(factory), GST_ELEMENT_METADATA_KLASS);
+ klass = gst_element_factory_get_metadata(GST_ELEMENT_FACTORY(factory), GST_ELEMENT_METADATA_KLASS);
/*parsers are not required in case of external feeder*/
if (g_strrstr(klass, "Codec/Parser") && MMPLAYER_IS_MS_BUFF_SRC(player))
/* NOTE : msl don't need to use image plugins.
* So, those plugins should be skipped for error handling.
*/
- if ( g_strrstr(klass, "Codec/Decoder/Image") )
+ if (g_strrstr(klass, "Codec/Decoder/Image"))
{
- LOGD("skipping [%s] by not required\n", GST_OBJECT_NAME (factory));
+ LOGD("skipping [%s] by not required\n", GST_OBJECT_NAME(factory));
continue;
}
/* check pad compatability */
- for(pads = gst_element_factory_get_static_pad_templates(factory);
+ for (pads = gst_element_factory_get_static_pad_templates(factory);
pads != NULL; pads=pads->next)
{
GstStaticPadTemplate *temp1 = pads->data;
GstCaps* static_caps = NULL;
- if( temp1->direction != GST_PAD_SINK
+ if (temp1->direction != GST_PAD_SINK
|| temp1->presence != GST_PAD_ALWAYS)
continue;
- if ( GST_IS_CAPS( &temp1->static_caps.caps) )
+ if (GST_IS_CAPS(&temp1->static_caps.caps))
{
/* using existing caps */
- static_caps = gst_caps_ref(temp1->static_caps.caps );
+ static_caps = gst_caps_ref(temp1->static_caps.caps);
}
else
{
/* create one */
- static_caps = gst_caps_from_string ( temp1->static_caps.string );
+ static_caps = gst_caps_from_string(temp1->static_caps.string);
}
res = gst_caps_intersect((GstCaps*)caps, static_caps);
- gst_caps_unref( static_caps );
+ gst_caps_unref(static_caps);
static_caps = NULL;
- if( res && !gst_caps_is_empty(res) )
+ if (res && !gst_caps_is_empty(res))
{
GstElement *new_element;
GList *elements = player->parsers;
if ((g_strrstr(klass, "Codec/Decoder/Audio")))
{
/* consider mp3 audio only */
- if ( !MMPLAYER_IS_STREAMING(player) && __mmplayer_is_only_mp3_type(player->type) )
+ if (!MMPLAYER_IS_STREAMING(player) && __mmplayer_is_only_mp3_type(player->type))
{
/* try to use ALP decoder first instead of selected decoder */
GstElement *element = NULL;
{
LOGD("checking if ALP can be used or not");
element = gst_element_factory_make("omx_mp3dec", "omx mp3 decoder");
- if ( element )
+ if (element)
{
/* check availability because multi-instance is not supported */
GstStateChangeReturn ret = gst_element_set_state(element, GST_STATE_READY);
if (ret != GST_STATE_CHANGE_SUCCESS) // use just selected decoder
{
- gst_object_unref (element);
+ gst_object_unref(element);
}
else if (ret == GST_STATE_CHANGE_SUCCESS) // replace facotry to use omx
{
/* clean */
gst_element_set_state(element, GST_STATE_NULL);
- gst_object_unref (element);
+ gst_object_unref(element);
element_facory = gst_element_factory_find("omx_mp3dec");
/* replace, otherwise use selected thing instead */
}
else if ((g_strrstr(klass, "Codec/Decoder/Video")))
{
- if ( g_strrstr(GST_OBJECT_NAME(factory), "omx_") )
+ if (g_strrstr(GST_OBJECT_NAME(factory), "omx_"))
{
- char *env = getenv ("MM_PLAYER_HW_CODEC_DISABLE");
+ char *env = getenv("MM_PLAYER_HW_CODEC_DISABLE");
if (env != NULL)
{
if (strncasecmp(env, "yes", 3) == 0)
LOGD("found %s to plug\n", name_to_plug);
new_element = gst_element_factory_create(GST_ELEMENT_FACTORY(factory), NULL);
- if ( ! new_element )
+ if (!new_element)
{
LOGE("failed to create element [%s]. continue with next.\n",
- GST_OBJECT_NAME (factory));
+ GST_OBJECT_NAME(factory));
MMPLAYER_FREEIF(name_template);
{
gchar *selected = NULL;
- for ( ; elements; elements = g_list_next(elements))
+ for (; elements; elements = g_list_next(elements))
{
gchar *element_name = elements->data;
}
/* store specific handles for futher control */
- if(g_strrstr(klass, "Demux") || g_strrstr(klass, "Parse"))
+ if (g_strrstr(klass, "Demux") || g_strrstr(klass, "Parse"))
{
/* FIXIT : first value will be overwritten if there's more
* than 1 demuxer/parser
mainbin[MMPLAYER_M_DEMUX].gst = new_element;
/*Added for multi audio support */
- if(g_strrstr(klass, "Demux"))
+ if (g_strrstr(klass, "Demux"))
{
mainbin[MMPLAYER_M_DEMUX_EX].id = MMPLAYER_M_DEMUX_EX;
mainbin[MMPLAYER_M_DEMUX_EX].gst = new_element;
/* NOTE : workaround for bug in mpegtsdemux since doesn't emit
no-more-pad signal. this may cause wrong content attributes at PAUSED state
this code should be removed after mpegtsdemux is fixed */
- if ( g_strrstr(GST_OBJECT_NAME(factory), "mpegtsdemux") )
+ if (g_strrstr(GST_OBJECT_NAME(factory), "mpegtsdemux"))
{
LOGW("force no-more-pad to TRUE since mpegtsdemux os not giving no-more-pad signal. content attributes may wrong");
player->no_more_pad = TRUE;
g_object_set(mainbin[MMPLAYER_M_DEMUX_EX].gst, "file-location", player->profile.uri,NULL);
}
}
- else if(g_strrstr(klass, "Decoder") && __mmplayer_link_decoder(player,pad))
+ else if (g_strrstr(klass, "Decoder") && __mmplayer_link_decoder(player,pad))
{
- if(mainbin[MMPLAYER_M_DEC1].gst == NULL)
+ if (mainbin[MMPLAYER_M_DEC1].gst == NULL)
{
LOGD("plugged element is decoder. take it[MMPLAYER_M_DEC1]\n");
mainbin[MMPLAYER_M_DEC1].id = MMPLAYER_M_DEC1;
mainbin[MMPLAYER_M_DEC1].gst = new_element;
}
- else if(mainbin[MMPLAYER_M_DEC2].gst == NULL)
+ else if (mainbin[MMPLAYER_M_DEC2].gst == NULL)
{
LOGD("plugged element is decoder. take it[MMPLAYER_M_DEC2]\n");
mainbin[MMPLAYER_M_DEC2].id = MMPLAYER_M_DEC2;
* before returning result of play start. And, missing plugin should be
* updated here for multi track files.
*/
- if(g_str_has_prefix(mime, "video"))
+ if (g_str_has_prefix(mime, "video"))
{
GstPad *src_pad = NULL;
GstPadTemplate *pad_templ = NULL;
player->not_supported_codec &= MISSING_PLUGIN_AUDIO;
player->can_support_codec |= FOUND_PLUGIN_VIDEO;
- src_pad = gst_element_get_static_pad (new_element, "src");
- pad_templ = gst_pad_get_pad_template (src_pad);
+ src_pad = gst_element_get_static_pad(new_element, "src");
+ pad_templ = gst_pad_get_pad_template(src_pad);
caps = GST_PAD_TEMPLATE_CAPS(pad_templ);
caps_str = gst_caps_to_string(caps);
/* clean */
- MMPLAYER_FREEIF( caps_str );
- gst_object_unref (src_pad);
+ MMPLAYER_FREEIF(caps_str);
+ gst_object_unref(src_pad);
}
else if (g_str_has_prefix(mime, "audio"))
{
}
}
- if ( ! __mmplayer_close_link(player, pad, new_element,
- name_template,gst_element_factory_get_static_pad_templates(factory)) )
+ if (!__mmplayer_close_link(player, pad, new_element,
+ name_template,gst_element_factory_get_static_pad_templates(factory)))
{
MMPLAYER_FREEIF(name_template);
if (player->keep_detecting_vcodec)
ERROR:
/* release */
- if ( queue )
- gst_object_unref( queue );
+ if (queue)
+ gst_object_unref(queue);
- if ( queue_pad )
- gst_object_unref( queue_pad );
+ if (queue_pad)
+ gst_object_unref(queue_pad);
- if ( element )
- gst_object_unref ( element );
+ if (element)
+ gst_object_unref(element);
return FALSE;
}
MMPLAYER_FENTER();
MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline, MM_ERROR_PLAYER_NOT_INITIALIZED);
- MMPLAYER_RETURN_VAL_IF_FAIL ( mime, MM_ERROR_INVALID_ARGUMENT );
+ MMPLAYER_RETURN_VAL_IF_FAIL(mime, MM_ERROR_INVALID_ARGUMENT);
- LOGD("class : %s, mime : %s \n", factory_class, mime );
+ LOGD("class : %s, mime : %s \n", factory_class, mime);
/* add missing plugin */
/* NOTE : msl should check missing plugin for image mime type.
* Some motion jpeg clips can have playable audio track.
* So, msl have to play audio after displaying popup written video format not supported.
*/
- if ( !( player->pipeline->mainbin[MMPLAYER_M_DEMUX].gst ) )
+ if (!(player->pipeline->mainbin[MMPLAYER_M_DEMUX].gst))
{
- if ( !( player->can_support_codec | player->videodec_linked | player->audiodec_linked ) )
+ if (!(player->can_support_codec | player->videodec_linked | player->audiodec_linked))
{
LOGD("not found demuxer\n");
player->not_found_demuxer = TRUE;
- player->unlinked_demuxer_mime = g_strdup_printf ( "%s", mime );
+ player->unlinked_demuxer_mime = g_strdup_printf("%s", mime);
goto DONE;
}
}
- if( !g_strrstr(factory_class, "Demuxer"))
+ if (!g_strrstr(factory_class, "Demuxer"))
{
- if( ( g_str_has_prefix(mime, "video") ) ||( g_str_has_prefix(mime, "image") ) )
+ if ((g_str_has_prefix(mime, "video")) || (g_str_has_prefix(mime, "image")))
{
LOGD("can support codec=%d, vdec_linked=%d, adec_linked=%d\n",
player->can_support_codec, player->videodec_linked, player->audiodec_linked);
/* check that clip have multi tracks or not */
- if ( ( player->can_support_codec & FOUND_PLUGIN_VIDEO ) && ( player->videodec_linked ) )
+ if ((player->can_support_codec & FOUND_PLUGIN_VIDEO) && (player->videodec_linked))
{
LOGD("video plugin is already linked\n");
}
player->not_supported_codec |= MISSING_PLUGIN_VIDEO;
}
}
- else if ( g_str_has_prefix(mime, "audio") )
+ else if (g_str_has_prefix(mime, "audio"))
{
- if ( ( player->can_support_codec & FOUND_PLUGIN_AUDIO ) && ( player->audiodec_linked ) )
+ if ((player->can_support_codec & FOUND_PLUGIN_AUDIO) && (player->audiodec_linked))
{
LOGD("audio plugin is already linked\n");
}
MMPLAYER_FENTER();
- MMPLAYER_RETURN_IF_FAIL( player );
+ MMPLAYER_RETURN_IF_FAIL(player);
/* remove fakesink. */
- if ( !__mmplayer_gst_remove_fakesink( player,
- &player->pipeline->mainbin[MMPLAYER_M_SRC_FAKESINK]) )
+ if (!__mmplayer_gst_remove_fakesink(player,
+ &player->pipeline->mainbin[MMPLAYER_M_SRC_FAKESINK]))
{
/* NOTE : __mmplayer_pipeline_complete() can be called several time. because
- * signaling mechanism ( pad-added, no-more-pad, new-decoded-pad ) from various
+ * signaling mechanism(pad-added, no-more-pad, new-decoded-pad) from various
* source element are not same. To overcome this situation, this function will called
* several places and several times. Therefore, this is not an error case.
*/
LOGD("pipeline has completely constructed\n");
- if (( player->ini.async_start ) &&
- ( player->msg_posted == FALSE ) &&
- ( player->cmd >= MMPLAYER_COMMAND_START ))
+ if ((player->ini.async_start) &&
+ (player->msg_posted == FALSE) &&
+ (player->cmd >= MMPLAYER_COMMAND_START))
{
- __mmplayer_handle_missed_plugin( player );
+ __mmplayer_handle_missed_plugin(player);
}
- MMPLAYER_GENERATE_DOT_IF_ENABLED ( player, "pipeline-status-complete" );
+ MMPLAYER_GENERATE_DOT_IF_ENABLED(player, "pipeline-status-complete");
}
static gboolean
}
attrs = MMPLAYER_GET_ATTRS(player);
- if ( !attrs )
+ if (!attrs)
{
LOGE("fail to get attributes.\n");
goto ERROR;
}
#endif
- if (mm_attrs_get_int_by_name (attrs, "pd_mode", &mode) == MM_ERROR_NONE)
+ if (mm_attrs_get_int_by_name(attrs, "pd_mode", &mode) == MM_ERROR_NONE)
{
if (mode == TRUE)
{
LOGD("repeat count = %d, num_of_list = %d\n", count, num_of_list);
- if ( num_of_list == 0 )
+ if (num_of_list == 0)
{
if (mm_attrs_get_string_by_name(player->attrs, "profile_uri", &uri) != MM_ERROR_NONE)
{
uri_idx = player->uri_info.uri_idx;
- while(TRUE)
+ while (TRUE)
{
check_cnt++;
LOGD("uri idx : %d / %d\n", uri_idx, num_of_list);
- if ( uri_idx < num_of_list-1 )
+ if (uri_idx < num_of_list-1)
{
uri_idx++;
}
LOGD("no repeat.");
goto ERROR;
}
- else if ( count > 1 ) /* decrease play count */
+ else if (count > 1) /* decrease play count */
{
/* we successeded to rewind. update play count and then wait for next EOS */
count--;
mm_attrs_set_int_by_name(attrs, "profile_play_count", count);
/* commit attribute */
- if ( mmf_attrs_commit ( attrs ) )
+ if (mmf_attrs_commit(attrs))
{
LOGE("failed to commit attribute\n");
}
if ((profile.uri_type != MM_PLAYER_URI_TYPE_FILE) &&
(profile.uri_type != MM_PLAYER_URI_TYPE_URL_HTTP))
{
- LOGW("uri type is not supported (%d).", profile.uri_type);
+ LOGW("uri type is not supported(%d).", profile.uri_type);
continue;
}
goto ERROR;
}
- LOGD("next uri %s (%d)\n", uri, uri_idx);
+ LOGD("next uri %s(%d)\n", uri, uri_idx);
return TRUE;
if (player->parsers)
{
GList *parsers = player->parsers;
- for ( ;parsers ; parsers = g_list_next(parsers))
+ for (;parsers ; parsers = g_list_next(parsers))
{
gchar *name = parsers->data;
MMPLAYER_FREEIF(name);
if (player->audio_decoders)
{
GList *a_dec = player->audio_decoders;
- for ( ;a_dec ; a_dec = g_list_next(a_dec))
+ for (;a_dec ; a_dec = g_list_next(a_dec))
{
gchar *name = a_dec->data;
MMPLAYER_FREEIF(name);
msg_param.code = MM_ERROR_PLAYER_INTERNAL;
attrs = MMPLAYER_GET_ATTRS(player);
- if ( !attrs )
+ if (!attrs)
{
LOGE("fail to get attributes.\n");
goto ERROR;
}
/* setup source */
- switch ( player->profile.uri_type )
+ switch (player->profile.uri_type)
{
/* file source */
case MM_PLAYER_URI_TYPE_FILE:
element = gst_element_factory_make("filesrc", "source");
- if ( !element )
+ if (!element)
{
LOGE("failed to create filesrc\n");
break;
cookie_list = NULL;
element = gst_element_factory_make(player->ini.httpsrc_element, "http_streaming_source");
- if ( !element )
+ if (!element)
{
LOGE("failed to create http streaming source element[%s].\n", player->ini.httpsrc_element);
break;
LOGD("using http streamming source [%s].\n", player->ini.httpsrc_element);
/* get attribute */
- mm_attrs_get_string_by_name ( attrs, "streaming_cookie", &cookies );
- mm_attrs_get_string_by_name ( attrs, "streaming_user_agent", &user_agent );
- mm_attrs_get_string_by_name ( attrs, "streaming_proxy", &proxy );
- mm_attrs_get_int_by_name ( attrs, "streaming_timeout", &http_timeout );
+ mm_attrs_get_string_by_name(attrs, "streaming_cookie", &cookies);
+ mm_attrs_get_string_by_name(attrs, "streaming_user_agent", &user_agent);
+ mm_attrs_get_string_by_name(attrs, "streaming_proxy", &proxy);
+ mm_attrs_get_int_by_name(attrs, "streaming_timeout", &http_timeout);
if ((http_timeout == DEFAULT_HTTP_TIMEOUT) &&
(player->ini.http_timeout != DEFAULT_HTTP_TIMEOUT))
g_object_set(G_OBJECT(element), "blocksize", (unsigned long)(64*1024), NULL);
/* check if prosy is vailid or not */
- if ( util_check_valid_url ( proxy ) )
+ if (util_check_valid_url(proxy))
g_object_set(G_OBJECT(element), "proxy", proxy, NULL);
/* parsing cookies */
- if ( ( cookie_list = util_get_cookie_list ((const char*)cookies) ) )
+ if ((cookie_list = util_get_cookie_list((const char*)cookies)))
g_object_set(G_OBJECT(element), "cookies", cookie_list, NULL);
- if ( user_agent )
+ if (user_agent)
g_object_set(G_OBJECT(element), "user_agent", user_agent, NULL);
break;
}
break;
}
- if ( !element )
+ if (!element)
{
LOGE("no source element was created.\n");
goto ERROR;
elemId = MMPLAYER_M_TYPEFIND;
element = gst_element_factory_make("typefind", "typefinder");
- MMPLAYER_SIGNAL_CONNECT( player, element, MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "have-type",
- G_CALLBACK(__mmplayer_typefind_have_type), (gpointer)player );
+ MMPLAYER_SIGNAL_CONNECT(player, element, MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "have-type",
+ G_CALLBACK(__mmplayer_typefind_have_type), (gpointer)player);
}
else
{
}
/* check autoplug element is OK */
- if ( ! element )
+ if (!element)
{
- LOGE("can not create element (%d)\n", elemId);
+ LOGE("can not create element(%d)\n", elemId);
goto ERROR;
}
mainbin[elemId].id = elemId;
mainbin[elemId].gst = element;
- if ( gst_element_link (mainbin[MMPLAYER_M_SRC].gst, mainbin[elemId].gst) == FALSE )
+ if (gst_element_link(mainbin[MMPLAYER_M_SRC].gst, mainbin[elemId].gst) == FALSE)
{
- LOGE("Failed to link src - autoplug (or typefind)\n");
+ LOGE("Failed to link src - autoplug(or typefind)\n");
goto ERROR;
}
- if (gst_element_set_state (mainbin[MMPLAYER_M_SRC].gst, target) == GST_STATE_CHANGE_FAILURE)
+ if (gst_element_set_state(mainbin[MMPLAYER_M_SRC].gst, target) == GST_STATE_CHANGE_FAILURE)
{
LOGE("Failed to change state of src element\n");
goto ERROR;
if (!MMPLAYER_IS_HTTP_STREAMING(player))
{
- if (gst_element_set_state (mainbin[MMPLAYER_M_AUTOPLUG].gst, target) == GST_STATE_CHANGE_FAILURE)
+ if (gst_element_set_state(mainbin[MMPLAYER_M_AUTOPLUG].gst, target) == GST_STATE_CHANGE_FAILURE)
{
LOGE("Failed to change state of decodebin\n");
goto ERROR;
}
else
{
- if (gst_element_set_state (mainbin[MMPLAYER_M_TYPEFIND].gst, target) == GST_STATE_CHANGE_FAILURE)
+ if (gst_element_set_state(mainbin[MMPLAYER_M_TYPEFIND].gst, target) == GST_STATE_CHANGE_FAILURE)
{
LOGE("Failed to change state of src element\n");
goto ERROR;
gboolean send_notice = FALSE;
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL (player, FALSE);
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
LOGD("type %d", type);
srcpad = gst_element_get_static_pad(player->pipeline->mainbin[selectorId].gst, "src");
if (selector->event_probe_id != 0)
- gst_pad_remove_probe (srcpad, selector->event_probe_id);
+ gst_pad_remove_probe(srcpad, selector->event_probe_id);
selector->event_probe_id = 0;
if ((sinkbin) && (sinkbin[sinkId].gst))
{
/* after getting drained signal there is no data flows, so no need to do pad_block */
LOGD("unlink %s:%s, %s:%s", GST_DEBUG_PAD_NAME(srcpad), GST_DEBUG_PAD_NAME(sinkpad));
- gst_pad_unlink (srcpad, sinkpad);
+ gst_pad_unlink(srcpad, sinkpad);
/* send custom event to sink pad to handle it at video sink */
if (send_notice) {
LOGD("send custom event to sinkpad");
- GstStructure *s = gst_structure_new_empty ("application/flush-buffer");
- GstEvent *event = gst_event_new_custom (GST_EVENT_CUSTOM_DOWNSTREAM, s);
- gst_pad_send_event (sinkpad, event);
+ GstStructure *s = gst_structure_new_empty("application/flush-buffer");
+ GstEvent *event = gst_event_new_custom(GST_EVENT_CUSTOM_DOWNSTREAM, s);
+ gst_pad_send_event(sinkpad, event);
}
}
- gst_object_unref (sinkpad);
+ gst_object_unref(sinkpad);
sinkpad = NULL;
}
- gst_object_unref (srcpad);
+ gst_object_unref(srcpad);
srcpad = NULL;
LOGD("selector release");
/* release and unref requests pad from the selector */
for (n = 0; n < selector->channels->len; n++)
{
- GstPad *sinkpad = g_ptr_array_index (selector->channels, n);
- gst_element_release_request_pad ((player->pipeline->mainbin[selectorId].gst), sinkpad);
+ GstPad *sinkpad = g_ptr_array_index(selector->channels, n);
+ gst_element_release_request_pad((player->pipeline->mainbin[selectorId].gst), sinkpad);
}
- g_ptr_array_set_size (selector->channels, 0);
+ g_ptr_array_set_size(selector->channels, 0);
- gst_element_set_state (player->pipeline->mainbin[selectorId].gst, GST_STATE_NULL);
- gst_bin_remove (GST_BIN_CAST (player->pipeline->mainbin[MMPLAYER_M_PIPE].gst), player->pipeline->mainbin[selectorId].gst);
+ gst_element_set_state(player->pipeline->mainbin[selectorId].gst, GST_STATE_NULL);
+ gst_bin_remove(GST_BIN_CAST(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst), player->pipeline->mainbin[selectorId].gst);
player->pipeline->mainbin[selectorId].gst = NULL;
selector = NULL;
__mmplayer_deactivate_old_path(mm_player_t *player)
{
MMPLAYER_FENTER();
- MMPLAYER_RETURN_IF_FAIL ( player );
+ MMPLAYER_RETURN_IF_FAIL(player);
if ((!__mmplayer_deactivate_selector(player, MM_PLAYER_TRACK_TYPE_AUDIO)) ||
(!__mmplayer_deactivate_selector(player, MM_PLAYER_TRACK_TYPE_VIDEO)) ||
}
_mmplayer_track_destroy(player);
- __mmplayer_release_signal_connection( player, MM_PLAYER_SIGNAL_TYPE_AUTOPLUG );
+ __mmplayer_release_signal_connection(player, MM_PLAYER_SIGNAL_TYPE_AUTOPLUG);
if (player->streamer)
{
- __mm_player_streaming_deinitialize (player->streamer);
+ __mm_player_streaming_deinitialize(player->streamer);
__mm_player_streaming_destroy(player->streamer);
player->streamer = NULL;
}
MMPLAYER_PLAYBACK_LOCK(player);
- g_cond_signal( &player->next_play_thread_cond );
+ g_cond_signal(&player->next_play_thread_cond);
MMPLAYER_FLEAVE();
return;
mm_player_t* player = (mm_player_t*) hplayer;
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL (player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
if (file_path) {
player->http_file_buffering_path = (gchar*)file_path;
mm_player_t* player = (mm_player_t*) hplayer;
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL (player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
mm_attrs_set_string_by_name(player->attrs, "profile_uri", uri);
if (mmf_attrs_commit(player->attrs))
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL (player, MM_ERROR_PLAYER_NOT_INITIALIZED);
- MMPLAYER_RETURN_VAL_IF_FAIL (uri, MM_ERROR_INVALID_ARGUMENT);
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ MMPLAYER_RETURN_VAL_IF_FAIL(uri, MM_ERROR_INVALID_ARGUMENT);
if (player->pipeline && player->pipeline->textbin)
{
{
char *original_uri = NULL;
- if ( attrs )
+ if (attrs)
{
mm_attrs_get_string_by_name(attrs, "profile_uri", &original_uri);
player->uri_info.uri_list = g_list_append(player->uri_info.uri_list, g_strdup(original_uri));
player->uri_info.uri_idx = 0;
- LOGD("add original path at first : %s (%d)", original_uri);
+ LOGD("add original path at first : %s(%d)", original_uri);
}
}
player->uri_info.uri_list = g_list_append(player->uri_info.uri_list, g_strdup(uri));
- LOGD("add new path : %s (total num of list = %d)", uri, g_list_length(player->uri_info.uri_list));
+ LOGD("add new path : %s(total num of list = %d)", uri, g_list_length(player->uri_info.uri_list));
}
MMPLAYER_FLEAVE();
guint num_of_list = 0;
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL (player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
num_of_list = g_list_length(player->uri_info.uri_list);
{
gint uri_idx = player->uri_info.uri_idx;
- if ( uri_idx < num_of_list-1 )
+ if (uri_idx < num_of_list-1)
uri_idx++;
else
uri_idx = 0;
const gchar* mime = NULL;
gchar* caps_str = NULL;
- klass = gst_element_factory_get_metadata (gst_element_get_factory(elem), GST_ELEMENT_METADATA_KLASS);
- mime = gst_structure_get_name (gst_caps_get_structure(caps, 0));
+ klass = gst_element_factory_get_metadata(gst_element_get_factory(elem), GST_ELEMENT_METADATA_KLASS);
+ mime = gst_structure_get_name(gst_caps_get_structure(caps, 0));
caps_str = gst_caps_to_string(caps);
LOGW("unknown type of caps : %s from %s",
- caps_str, GST_ELEMENT_NAME (elem));
+ caps_str, GST_ELEMENT_NAME(elem));
MMPLAYER_FREEIF(caps_str);
/* There is no available codec. */
- __mmplayer_check_not_supported_codec (player, klass, mime);
+ __mmplayer_check_not_supported_codec(player, klass, mime);
}
static gboolean
gboolean ret = TRUE;
MMPLAYER_LOG_GST_CAPS_TYPE(caps);
- mime = gst_structure_get_name (gst_caps_get_structure(caps, 0));
+ mime = gst_structure_get_name(gst_caps_get_structure(caps, 0));
if (g_str_has_prefix(mime, "audio")) {
GstStructure* caps_structure = NULL;
gchar *caps_str = NULL;
caps_structure = gst_caps_get_structure(caps, 0);
- gst_structure_get_int (caps_structure, "rate", &samplerate);
- gst_structure_get_int (caps_structure, "channels", &channels);
+ gst_structure_get_int(caps_structure, "rate", &samplerate);
+ gst_structure_get_int(caps_structure, "channels", &channels);
- if ( (channels > 0 && samplerate == 0)) {
+ if ((channels > 0 && samplerate == 0)) {
LOGD("exclude audio...");
ret = FALSE;
}
if (g_strrstr(caps_str, "mobile-xmf")) {
mm_attrs_set_string_by_name(player->attrs, "content_audio_codec", "mobile-xmf");
}
- MMPLAYER_FREEIF (caps_str);
+ MMPLAYER_FREEIF(caps_str);
} else if (g_str_has_prefix(mime, "video") && !player->ini.video_playback_supported) {
MMMessageParamType msg_param;
- memset (&msg_param, 0, sizeof(MMMessageParamType));
+ memset(&msg_param, 0, sizeof(MMMessageParamType));
msg_param.code = MM_ERROR_NOT_SUPPORT_API;
- MMPLAYER_POST_MSG( player, MM_MESSAGE_ERROR, &msg_param );
+ MMPLAYER_POST_MSG(player, MM_MESSAGE_ERROR, &msg_param);
LOGD("video file is not supported on this device");
ret = FALSE;
} else if (g_str_has_prefix(mime, "video") && player->videodec_linked) {
gint idx = 0;
int surface_type = 0;
- factory_name = GST_OBJECT_NAME (factory);
- klass = gst_element_factory_get_metadata (factory, GST_ELEMENT_METADATA_KLASS);
+ factory_name = GST_OBJECT_NAME(factory);
+ klass = gst_element_factory_get_metadata(factory, GST_ELEMENT_METADATA_KLASS);
caps_str = gst_caps_to_string(caps);
LOGD("found new element [%s] to link", factory_name);
}
/* filtering exclude keyword */
- for ( idx = 0; player->ini.exclude_element_keyword[idx][0] != '\0'; idx++ )
+ for (idx = 0; player->ini.exclude_element_keyword[idx][0] != '\0'; idx++)
{
- if ( strstr(factory_name, player->ini.exclude_element_keyword[idx] ) )
+ if (strstr(factory_name, player->ini.exclude_element_keyword[idx]))
{
LOGW("skipping [%s] by exculde keyword [%s]\n",
- factory_name, player->ini.exclude_element_keyword[idx] );
+ factory_name, player->ini.exclude_element_keyword[idx]);
// NOTE : does we need to check n_value against the number of item selected?
result = GST_AUTOPLUG_SELECT_SKIP;
GstStructure* str = NULL;
gint channels = 0;
- str = gst_caps_get_structure( caps, 0 );
- if ( str )
+ str = gst_caps_get_structure(caps, 0);
+ if (str)
{
- gst_structure_get_int (str, "channels", &channels);
+ gst_structure_get_int(str, "channels", &channels);
- LOGD ("check audio ch : %d %d\n", player->max_audio_channels, channels);
+ LOGD("check audio ch : %d %d\n", player->max_audio_channels, channels);
if (player->max_audio_channels < channels)
{
player->max_audio_channels = channels;
if (!player->audiodec_linked)
{
/* set stream information */
- __mmplayer_set_audio_attrs (player, caps);
+ __mmplayer_set_audio_attrs(player, caps);
}
}
else if (g_strrstr(klass, "Codec/Decoder/Video"))
if (_mmplayer_resource_manager_prepare(&player->resource_manager, RESOURCE_TYPE_VIDEO_DECODER)
!= MM_ERROR_NONE)
{
- LOGW ("could not prepare for video_decoder resource, skip it.");
+ LOGW("could not prepare for video_decoder resource, skip it.");
result = GST_AUTOPLUG_SELECT_SKIP;
goto DONE;
}
gint stype = 0;
gint width = 0;
GstStructure *str = NULL;
- mm_attrs_get_int_by_name (player->attrs, "display_surface_type", &stype);
+ mm_attrs_get_int_by_name(player->attrs, "display_surface_type", &stype);
/* don't make video because of not required */
if ((stype == MM_DISPLAY_SURFACE_NULL) &&
(player->set_mode.media_packet_video_stream == FALSE))
{
- LOGD ("no video because it's not required. -> return expose");
+ LOGD("no video because it's not required. -> return expose");
result = GST_AUTOPLUG_SELECT_EXPOSE;
goto DONE;
}
/* get w/h for omx state-tune */
- str = gst_caps_get_structure (caps, 0);
- gst_structure_get_int (str, "width", &width);
+ str = gst_caps_get_structure(caps, 0);
+ gst_structure_get_int(str, "width", &width);
if (width != 0) {
if (player->v_stream_caps) {
}
player->v_stream_caps = gst_caps_copy(caps);
- LOGD ("take caps for video state tune");
+ LOGD("take caps for video state tune");
MMPLAYER_LOG_GST_CAPS_TYPE(player->v_stream_caps);
}
}
if (g_strrstr(klass, "Decoder"))
{
const char* mime = NULL;
- mime = gst_structure_get_name (gst_caps_get_structure(caps, 0));
+ mime = gst_structure_get_name(gst_caps_get_structure(caps, 0));
if (g_str_has_prefix(mime, "video"))
{
player->videodec_linked = 1;
}
- else if(g_str_has_prefix(mime, "audio"))
+ else if (g_str_has_prefix(mime, "audio"))
{
player->not_supported_codec &= MISSING_PLUGIN_VIDEO;
player->can_support_codec |= FOUND_PLUGIN_AUDIO;
gchar* caps_str = NULL;
caps_str = gst_caps_to_string(caps);
- LOGD("pad removed caps : %s from %s", caps_str, GST_ELEMENT_NAME(elem) );
+ LOGD("pad removed caps : %s from %s", caps_str, GST_ELEMENT_NAME(elem));
MMPLAYER_FREEIF(caps_str);
}
mm_player_t* player = (mm_player_t*)data;
MMPLAYER_FENTER();
- MMPLAYER_RETURN_IF_FAIL ( player );
+ MMPLAYER_RETURN_IF_FAIL(player);
LOGD("__mmplayer_gst_decode_drained");
}
static void
-__mmplayer_gst_element_added (GstElement *bin, GstElement *element, gpointer data)
+__mmplayer_gst_element_added(GstElement *bin, GstElement *element, gpointer data)
{
mm_player_t* player = (mm_player_t*)data;
const gchar* klass = NULL;
gchar* factory_name = NULL;
- klass = gst_element_factory_get_metadata (gst_element_get_factory(element), GST_ELEMENT_METADATA_KLASS);
- factory_name = GST_OBJECT_NAME (gst_element_get_factory(element));
+ klass = gst_element_factory_get_metadata(gst_element_get_factory(element), GST_ELEMENT_METADATA_KLASS);
+ factory_name = GST_OBJECT_NAME(gst_element_get_factory(element));
LOGD("new elem klass: %s, factory_name: %s, new elem name : %s\n", klass, factory_name, GST_ELEMENT_NAME(element));
if (g_strrstr(klass, "Codec/Decoder/Audio"))
{
gchar* selected = NULL;
- selected = g_strdup( GST_ELEMENT_NAME(element));
- player->audio_decoders = g_list_append (player->audio_decoders, selected);
+ selected = g_strdup(GST_ELEMENT_NAME(element));
+ player->audio_decoders = g_list_append(player->audio_decoders, selected);
}
//-> temp code
{
gchar* selected = NULL;
- selected = g_strdup (factory_name);
- player->parsers = g_list_append (player->parsers, selected);
+ selected = g_strdup(factory_name);
+ player->parsers = g_list_append(player->parsers, selected);
}
if ((g_strrstr(klass, "Demux") || g_strrstr(klass, "Parse")) && !(g_strrstr(klass, "Adaptive")))
* than 1 demuxer/parser
*/
- //LOGD ("plugged element is demuxer. take it\n");
+ //LOGD("plugged element is demuxer. take it\n");
player->pipeline->mainbin[MMPLAYER_M_DEMUX].id = MMPLAYER_M_DEMUX;
player->pipeline->mainbin[MMPLAYER_M_DEMUX].gst = element;
{
int surface_type = 0;
- mm_attrs_get_int_by_name (player->attrs, "display_surface_type", &surface_type);
+ mm_attrs_get_int_by_name(player->attrs, "display_surface_type", &surface_type);
}
// to support trust-zone only
if (g_strrstr(factory_name, "asfdemux"))
{
- LOGD ("set file-location %s\n", player->profile.uri);
- g_object_set (G_OBJECT(element), "file-location", player->profile.uri, NULL);
+ LOGD("set file-location %s\n", player->profile.uri);
+ g_object_set(G_OBJECT(element), "file-location", player->profile.uri, NULL);
if (player->video_hub_download_mode == TRUE)
{
- g_object_set (G_OBJECT(element), "downloading-mode", player->video_hub_download_mode, NULL);
+ g_object_set(G_OBJECT(element), "downloading-mode", player->video_hub_download_mode, NULL);
}
}
else if (g_strrstr(factory_name, "legacyh264parse"))
{
- LOGD ("[%s] output-format to legacyh264parse\n", "mssdemux");
- g_object_set (G_OBJECT(element), "output-format", 1, NULL); /* NALU/Byte Stream format */
+ LOGD("[%s] output-format to legacyh264parse\n", "mssdemux");
+ g_object_set(G_OBJECT(element), "output-format", 1, NULL); /* NALU/Byte Stream format */
}
else if (g_strrstr(factory_name, "mpegaudioparse"))
{
if ((MMPLAYER_IS_HTTP_STREAMING(player)) &&
(__mmplayer_is_only_mp3_type(player->type)))
{
- LOGD ("[mpegaudioparse] set streaming pull mode.");
+ LOGD("[mpegaudioparse] set streaming pull mode.");
g_object_set(G_OBJECT(element), "http-pull-mp3dec", TRUE, NULL);
}
}
if ((player->pipeline->mainbin[MMPLAYER_M_DEMUX].gst) &&
(g_strrstr(GST_ELEMENT_NAME(element), "multiqueue")))
{
- LOGD ("plugged element is multiqueue. take it\n");
+ LOGD("plugged element is multiqueue. take it\n");
player->pipeline->mainbin[MMPLAYER_M_DEMUXED_S_BUFFER].id = MMPLAYER_M_DEMUXED_S_BUFFER;
player->pipeline->mainbin[MMPLAYER_M_DEMUXED_S_BUFFER].gst = element;
static gboolean __mmplayer_configure_audio_callback(mm_player_t* player)
{
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, FALSE );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
- if ( MMPLAYER_IS_STREAMING(player) )
+ if (MMPLAYER_IS_STREAMING(player))
return FALSE;
/* This callback can be set to music player only. */
- if((player->can_support_codec & 0x02) == FOUND_PLUGIN_VIDEO)
+ if ((player->can_support_codec & 0x02) == FOUND_PLUGIN_VIDEO)
{
LOGW("audio callback is not supported for video");
return FALSE;
{
GstPad *pad = NULL;
- pad = gst_element_get_static_pad (player->pipeline->audiobin[MMPLAYER_A_SINK].gst, "sink");
+ pad = gst_element_get_static_pad(player->pipeline->audiobin[MMPLAYER_A_SINK].gst, "sink");
- if ( !pad )
+ if (!pad)
{
LOGE("failed to get sink pad from audiosink to probe data\n");
return FALSE;
}
- player->audio_cb_probe_id = gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_BUFFER,
+ player->audio_cb_probe_id = gst_pad_add_probe(pad, GST_PAD_PROBE_TYPE_BUFFER,
__mmplayer_audio_stream_probe, player, NULL);
- gst_object_unref (pad);
+ gst_object_unref(pad);
pad = NULL;
}
static void
__mmplayer_init_factories(mm_player_t* player) // @
{
- MMPLAYER_RETURN_IF_FAIL ( player );
+ MMPLAYER_RETURN_IF_FAIL(player);
player->factories = gst_registry_feature_filter(gst_registry_get(),
- (GstPluginFeatureFilter)__mmplayer_feature_filter, FALSE, NULL);
+ (GstPluginFeatureFilter)__mmplayer_feature_filter, FALSE, NULL);
player->factories = g_list_sort(player->factories, (GCompareFunc)util_factory_rank_compare);
}
__mmplayer_release_factories(mm_player_t* player) // @
{
MMPLAYER_FENTER();
- MMPLAYER_RETURN_IF_FAIL ( player );
+ MMPLAYER_RETURN_IF_FAIL(player);
if (player->factories)
{
- gst_plugin_feature_list_free (player->factories);
+ gst_plugin_feature_list_free(player->factories);
player->factories = NULL;
}
gboolean cur_mode = player->set_mode.rich_audio;
MMPLAYER_FENTER();
- MMPLAYER_RETURN_IF_FAIL ( player );
+ MMPLAYER_RETURN_IF_FAIL(player);
player->video_stream_cb = NULL;
player->video_stream_cb_user_param = NULL;
player->maximum_bitrate[i] = 0;
}
- /* remove media stream cb (appsrc cb) */
+ /* remove media stream cb(appsrc cb) */
for (i = 0; i < MM_PLAYER_STREAM_TYPE_MAX; i++)
{
player->media_stream_buffer_status_cb[i] = NULL;
/* player->pipeline is already released before. */
- MMPLAYER_RETURN_IF_FAIL ( player );
+ MMPLAYER_RETURN_IF_FAIL(player);
mm_attrs_set_int_by_name(player->attrs, "content_video_found", 0);
mm_attrs_set_int_by_name(player->attrs, "content_audio_found", 0);
if (player->parsers)
{
GList *parsers = player->parsers;
- for ( ;parsers ; parsers = g_list_next(parsers))
+ for (;parsers ; parsers = g_list_next(parsers))
{
gchar *name = parsers->data;
MMPLAYER_FREEIF(name);
if (player->audio_decoders)
{
GList *a_dec = player->audio_decoders;
- for ( ;a_dec ; a_dec = g_list_next(a_dec))
+ for (;a_dec ; a_dec = g_list_next(a_dec))
{
gchar *name = a_dec->data;
MMPLAYER_FREEIF(name);
}
GList *uri_list = player->uri_info.uri_list;
- for ( ;uri_list ; uri_list = g_list_next(uri_list))
+ for (;uri_list ; uri_list = g_list_next(uri_list))
{
gchar *uri = uri_list->data;
MMPLAYER_FREEIF(uri);
LOGD("creating %s to plug\n", name);
element = gst_element_factory_make(name, NULL);
- if ( ! element )
+ if (!element)
{
LOGE("failed to create queue\n");
return NULL;
}
- if ( GST_STATE_CHANGE_FAILURE == gst_element_set_state(element, GST_STATE_READY) )
+ if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(element, GST_STATE_READY))
{
LOGE("failed to set state READY to %s\n", name);
- gst_object_unref (element);
+ gst_object_unref(element);
return NULL;
}
- if ( ! gst_bin_add(GST_BIN(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst), element))
+ if (!gst_bin_add(GST_BIN(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst), element))
{
LOGE("failed to add %s\n", name);
- gst_object_unref (element);
+ gst_object_unref(element);
return NULL;
}
sinkpad = gst_element_get_static_pad(element, "sink");
- if ( GST_PAD_LINK_OK != gst_pad_link(pad, sinkpad) )
+ if (GST_PAD_LINK_OK != gst_pad_link(pad, sinkpad))
{
LOGE("failed to link %s\n", name);
- gst_object_unref (sinkpad);
- gst_object_unref (element);
+ gst_object_unref(sinkpad);
+ gst_object_unref(element);
return NULL;
}
LOGD("linked %s to pipeline successfully\n", name);
- gst_object_unref (sinkpad);
+ gst_object_unref(sinkpad);
return element;
}
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL ( player &&
+ MMPLAYER_RETURN_VAL_IF_FAIL(player &&
player->pipeline &&
player->pipeline->mainbin,
- FALSE );
+ FALSE);
mainbin = player->pipeline->mainbin;
LOGD("plugging pad %s:%s to newly create %s:%s\n",
- GST_ELEMENT_NAME( GST_PAD_PARENT ( srcpad ) ),
- GST_PAD_NAME( srcpad ),
- GST_ELEMENT_NAME( sinkelement ),
+ GST_ELEMENT_NAME(GST_PAD_PARENT(srcpad)),
+ GST_PAD_NAME(srcpad),
+ GST_ELEMENT_NAME(sinkelement),
padname);
factory = gst_element_get_factory(sinkelement);
- klass = gst_element_factory_get_metadata (factory, GST_ELEMENT_METADATA_KLASS);
+ klass = gst_element_factory_get_metadata(factory, GST_ELEMENT_METADATA_KLASS);
/* check if player can do start continually */
MMPLAYER_CHECK_CMD_IF_EXIT(player);
/* need it to warm up omx before linking to pipeline */
- if (g_strrstr(GST_ELEMENT_NAME( GST_PAD_PARENT ( srcpad ) ), "demux"))
+ if (g_strrstr(GST_ELEMENT_NAME(GST_PAD_PARENT(srcpad)), "demux"))
{
LOGD("get demux caps.\n");
if (player->state_tune_caps)
player->state_tune_caps = NULL;
}
- if ( GST_STATE_CHANGE_FAILURE == gst_element_set_state(sinkelement, target_state) )
+ if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(sinkelement, target_state))
{
- LOGE("failed to set %d state to %s\n", target_state, GST_ELEMENT_NAME( sinkelement ));
+ LOGE("failed to set %d state to %s\n", target_state, GST_ELEMENT_NAME(sinkelement));
if (isvideo_decoder)
{
gst_element_set_state(sinkelement, GST_STATE_NULL);
}
/* add to pipeline */
- if ( ! gst_bin_add(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), sinkelement) )
+ if (!gst_bin_add(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), sinkelement))
{
- LOGE("failed to add %s to mainbin\n", GST_ELEMENT_NAME( sinkelement ));
+ LOGE("failed to add %s to mainbin\n", GST_ELEMENT_NAME(sinkelement));
goto ERROR;
}
/* added to support multi track files */
/* only decoder case and any of the video/audio still need to link*/
- if(g_strrstr(klass, "Decoder") && __mmplayer_link_decoder(player,srcpad))
+ if (g_strrstr(klass, "Decoder") && __mmplayer_link_decoder(player,srcpad))
{
- gchar *name = g_strdup(GST_ELEMENT_NAME( GST_PAD_PARENT ( srcpad )));
+ gchar *name = g_strdup(GST_ELEMENT_NAME(GST_PAD_PARENT(srcpad)));
if (g_strrstr(name, "mpegtsdemux")|| g_strrstr(name, "mssdemux"))
{
parser = __mmplayer_element_create_and_link(player, srcpad, needed_parser);
MMPLAYER_FREEIF(needed_parser);
- if ( !parser )
+ if (!parser)
{
LOGE("failed to create parser\n");
}
{
if (smooth_streaming)
{
- g_object_set (parser, "output-format", 1, NULL); /* NALU/Byte Stream format */
+ g_object_set(parser, "output-format", 1, NULL); /* NALU/Byte Stream format */
}
/* update srcpad if parser is created */
MMPLAYER_FREEIF(name);
queue = __mmplayer_element_create_and_link(player, srcpad, "queue"); // parser - queue or demuxer - queue
- if ( ! queue )
+ if (!queue)
{
LOGE("failed to create queue\n");
goto ERROR;
q_max_size_time = GST_QUEUE_DEFAULT_TIME;
/* assigning queue handle for futher manipulation purpose */
- /* FIXIT : make it some kind of list so that msl can support more then two stream (text, data, etc...) */
- if(mainbin[MMPLAYER_M_Q1].gst == NULL)
+ /* FIXIT : make it some kind of list so that msl can support more then two stream(text, data, etc...) */
+ if (mainbin[MMPLAYER_M_Q1].gst == NULL)
{
mainbin[MMPLAYER_M_Q1].id = MMPLAYER_M_Q1;
mainbin[MMPLAYER_M_Q1].gst = queue;
if (player->profile.uri_type == MM_PLAYER_URI_TYPE_SS)
{
- g_object_set (G_OBJECT (mainbin[MMPLAYER_M_Q1].gst), "max-size-time", 0 , NULL);
- g_object_set (G_OBJECT (mainbin[MMPLAYER_M_Q1].gst), "max-size-buffers", 2, NULL);
- g_object_set (G_OBJECT (mainbin[MMPLAYER_M_Q1].gst), "max-size-bytes", 0, NULL);
+ g_object_set(G_OBJECT(mainbin[MMPLAYER_M_Q1].gst), "max-size-time", 0 , NULL);
+ g_object_set(G_OBJECT(mainbin[MMPLAYER_M_Q1].gst), "max-size-buffers", 2, NULL);
+ g_object_set(G_OBJECT(mainbin[MMPLAYER_M_Q1].gst), "max-size-bytes", 0, NULL);
}
else
{
if (!MMPLAYER_IS_RTSP_STREAMING(player))
- g_object_set (G_OBJECT (mainbin[MMPLAYER_M_Q1].gst), "max-size-time", q_max_size_time * GST_SECOND, NULL);
+ g_object_set(G_OBJECT(mainbin[MMPLAYER_M_Q1].gst), "max-size-time", q_max_size_time * GST_SECOND, NULL);
}
}
- else if(mainbin[MMPLAYER_M_Q2].gst == NULL)
+ else if (mainbin[MMPLAYER_M_Q2].gst == NULL)
{
mainbin[MMPLAYER_M_Q2].id = MMPLAYER_M_Q2;
mainbin[MMPLAYER_M_Q2].gst = queue;
if (player->profile.uri_type == MM_PLAYER_URI_TYPE_SS)
{
- g_object_set (G_OBJECT (mainbin[MMPLAYER_M_Q2].gst), "max-size-time", 0 , NULL);
- g_object_set (G_OBJECT (mainbin[MMPLAYER_M_Q2].gst), "max-size-buffers", 2, NULL);
- g_object_set (G_OBJECT (mainbin[MMPLAYER_M_Q2].gst), "max-size-bytes", 0, NULL);
+ g_object_set(G_OBJECT(mainbin[MMPLAYER_M_Q2].gst), "max-size-time", 0 , NULL);
+ g_object_set(G_OBJECT(mainbin[MMPLAYER_M_Q2].gst), "max-size-buffers", 2, NULL);
+ g_object_set(G_OBJECT(mainbin[MMPLAYER_M_Q2].gst), "max-size-bytes", 0, NULL);
}
else
{
if (!MMPLAYER_IS_RTSP_STREAMING(player))
- g_object_set (G_OBJECT (mainbin[MMPLAYER_M_Q2].gst), "max-size-time", q_max_size_time * GST_SECOND, NULL);
+ g_object_set(G_OBJECT(mainbin[MMPLAYER_M_Q2].gst), "max-size-time", q_max_size_time * GST_SECOND, NULL);
}
}
else
pad = gst_element_get_static_pad(sinkelement, padname);
- if ( ! pad )
+ if (!pad)
{
LOGW("failed to get pad(%s) from %s. retrying with [sink]\n",
- padname, GST_ELEMENT_NAME(sinkelement) );
+ padname, GST_ELEMENT_NAME(sinkelement));
pad = gst_element_get_static_pad(sinkelement, "sink");
- if ( ! pad )
+ if (!pad)
{
LOGE("failed to get pad(sink) from %s. \n",
- GST_ELEMENT_NAME(sinkelement) );
+ GST_ELEMENT_NAME(sinkelement));
goto ERROR;
}
}
const gchar *mime_type = NULL;
{
srccaps = gst_pad_query_caps(srcpad, NULL);
- if ( !srccaps )
+ if (!srccaps)
goto ERROR;
- str = gst_caps_get_structure( srccaps, 0 );
- if ( ! str )
+ str = gst_caps_get_structure(srccaps, 0);
+ if (!str)
goto ERROR;
mime_type = gst_structure_get_name(str);
- if ( ! mime_type )
+ if (!mime_type)
goto ERROR;
}
/* link queue and decoder. so, it will be queue - decoder. */
- if ( GST_PAD_LINK_OK != gst_pad_link(srcpad, pad) )
+ if (GST_PAD_LINK_OK != gst_pad_link(srcpad, pad))
{
gst_object_unref(GST_OBJECT(pad));
- LOGE("failed to link (%s) to pad(%s)\n", GST_ELEMENT_NAME( sinkelement ), padname );
+ LOGE("failed to link(%s) to pad(%s)\n", GST_ELEMENT_NAME(sinkelement), padname);
/* reconstitute supportable codec */
if (strstr(mime_type, "video"))
srccaps = NULL;
}
- if ( !MMPLAYER_IS_HTTP_PD(player) )
+ if (!MMPLAYER_IS_HTTP_PD(player))
{
- if( (g_strrstr(klass, "Demux") && !g_strrstr(klass, "Metadata")) || (g_strrstr(klass, "Parser") ) )
+ if ((g_strrstr(klass, "Demux") && !g_strrstr(klass, "Metadata")) || (g_strrstr(klass, "Parser")))
{
if (MMPLAYER_IS_HTTP_STREAMING(player))
{
gint64 dur_bytes = 0L;
muxed_buffer_type_e type = MUXED_BUFFER_TYPE_MEM_QUEUE;
- if ( !mainbin[MMPLAYER_M_MUXED_S_BUFFER].gst)
+ if (!mainbin[MMPLAYER_M_MUXED_S_BUFFER].gst)
{
LOGD("creating http streaming buffering queue\n");
queue = gst_element_factory_make("queue2", "queue2");
- if ( ! queue )
+ if (!queue)
{
- LOGE ( "failed to create buffering queue element\n" );
+ LOGE("failed to create buffering queue element\n");
goto ERROR;
}
- if ( GST_STATE_CHANGE_FAILURE == gst_element_set_state(queue, GST_STATE_READY) )
+ if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(queue, GST_STATE_READY))
{
LOGE("failed to set state READY to buffering queue\n");
goto ERROR;
}
- if ( !gst_bin_add(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), queue) )
+ if (!gst_bin_add(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), queue))
{
LOGE("failed to add buffering queue\n");
goto ERROR;
qsinkpad = gst_element_get_static_pad(queue, "sink");
qsrcpad = gst_element_get_static_pad(queue, "src");
- if ( GST_PAD_LINK_OK != gst_pad_link(srcpad, qsinkpad) )
+ if (GST_PAD_LINK_OK != gst_pad_link(srcpad, qsinkpad))
{
LOGE("failed to link buffering queue\n");
goto ERROR;
mainbin[MMPLAYER_M_MUXED_S_BUFFER].id = MMPLAYER_M_MUXED_S_BUFFER;
mainbin[MMPLAYER_M_MUXED_S_BUFFER].gst = queue;
- if ( !MMPLAYER_IS_HTTP_LIVE_STREAMING(player))
+ if (!MMPLAYER_IS_HTTP_LIVE_STREAMING(player))
{
- if ( !gst_element_query_duration(player->pipeline->mainbin[MMPLAYER_M_SRC].gst, GST_FORMAT_BYTES, &dur_bytes))
+ if (!gst_element_query_duration(player->pipeline->mainbin[MMPLAYER_M_SRC].gst, GST_FORMAT_BYTES, &dur_bytes))
LOGE("fail to get duration.\n");
if (dur_bytes > 0) {
}
/* NOTE : we cannot get any duration info from ts container in case of streaming */
- if(!g_strrstr(GST_ELEMENT_NAME(sinkelement), "mpegtsdemux"))
+ if (!g_strrstr(GST_ELEMENT_NAME(sinkelement), "mpegtsdemux"))
{
__mm_player_streaming_set_queue2(player->streamer,
queue,
}
/* if it is not decoder or */
/* in decoder case any of the video/audio still need to link*/
- if(!g_strrstr(klass, "Decoder"))
+ if (!g_strrstr(klass, "Decoder"))
{
pad = gst_element_get_static_pad(sinkelement, padname);
- if ( ! pad )
+ if (!pad)
{
LOGW("failed to get pad(%s) from %s. retrying with [sink]\n",
- padname, GST_ELEMENT_NAME(sinkelement) );
+ padname, GST_ELEMENT_NAME(sinkelement));
pad = gst_element_get_static_pad(sinkelement, "sink");
- if ( ! pad )
+ if (!pad)
{
LOGE("failed to get pad(sink) from %s. \n",
- GST_ELEMENT_NAME(sinkelement) );
+ GST_ELEMENT_NAME(sinkelement));
goto ERROR;
}
}
- if ( GST_PAD_LINK_OK != gst_pad_link(srcpad, pad) )
+ if (GST_PAD_LINK_OK != gst_pad_link(srcpad, pad))
{
gst_object_unref(GST_OBJECT(pad));
- LOGE("failed to link (%s) to pad(%s)\n", GST_ELEMENT_NAME( sinkelement ), padname );
+ LOGE("failed to link(%s) to pad(%s)\n", GST_ELEMENT_NAME(sinkelement), padname);
goto ERROR;
}
gst_object_unref(GST_OBJECT(pad));
}
- for(;templlist != NULL; templlist = templlist->next)
+ for (;templlist != NULL; templlist = templlist->next)
{
padtemplate = templlist->data;
- LOGD ("director = [%d], presence = [%d]\n", padtemplate->direction, padtemplate->presence);
+ LOGD("director = [%d], presence = [%d]\n", padtemplate->direction, padtemplate->presence);
- if( padtemplate->direction != GST_PAD_SRC ||
+ if ( padtemplate->direction != GST_PAD_SRC ||
padtemplate->presence == GST_PAD_REQUEST )
continue;
- switch(padtemplate->presence)
+ switch (padtemplate->presence)
{
case GST_PAD_ALWAYS:
{
GstCaps *caps = gst_pad_query_caps(srcpad, NULL);
/* Check whether caps has many types */
- if ( !gst_caps_is_fixed(caps))
+ if (!gst_caps_is_fixed(caps))
{
- LOGD ("always pad but, caps has many types");
+ LOGD("always pad but, caps has many types");
MMPLAYER_LOG_GST_CAPS_TYPE(caps);
has_many_types = TRUE;
break;
}
- if ( ! __mmplayer_try_to_plug(player, srcpad, caps) )
+ if (!__mmplayer_try_to_plug(player, srcpad, caps))
{
gst_object_unref(GST_OBJECT(srcpad));
gst_caps_unref(GST_CAPS(caps));
- LOGE("failed to plug something after %s\n", GST_ELEMENT_NAME( sinkelement ));
+ LOGE("failed to plug something after %s\n", GST_ELEMENT_NAME(sinkelement));
goto ERROR;
}
/* check if player can do start continually */
MMPLAYER_CHECK_CMD_IF_EXIT(player);
- if( has_dynamic_pads )
+ if (has_dynamic_pads)
{
player->have_dynamic_pad = TRUE;
- MMPLAYER_SIGNAL_CONNECT ( player, sinkelement, MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "pad-added",
+ MMPLAYER_SIGNAL_CONNECT(player, sinkelement, MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "pad-added",
G_CALLBACK(__mmplayer_add_new_pad), player);
/* for streaming, more then one typefind will used for each elementary stream
* so this doesn't mean the whole pipeline completion
*/
- if ( ! MMPLAYER_IS_RTSP_STREAMING( player ) )
+ if (!MMPLAYER_IS_RTSP_STREAMING(player))
{
- MMPLAYER_SIGNAL_CONNECT( player, sinkelement, MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "no-more-pads",
+ MMPLAYER_SIGNAL_CONNECT(player, sinkelement, MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "no-more-pads",
G_CALLBACK(__mmplayer_pipeline_complete), player);
}
}
player->has_many_types = has_many_types;
pad = gst_element_get_static_pad(sinkelement, "src");
- MMPLAYER_SIGNAL_CONNECT (player, pad, MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "notify::caps", G_CALLBACK(__mmplayer_add_new_caps), player);
- gst_object_unref (GST_OBJECT(pad));
+ MMPLAYER_SIGNAL_CONNECT(player, pad, MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "notify::caps", G_CALLBACK(__mmplayer_add_new_caps), player);
+ gst_object_unref(GST_OBJECT(pad));
}
/* check if player can do start continually */
MMPLAYER_CHECK_CMD_IF_EXIT(player);
- if ( GST_STATE_CHANGE_FAILURE == gst_element_set_state(sinkelement, GST_STATE_PAUSED) )
+ if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(sinkelement, GST_STATE_PAUSED))
{
- LOGE("failed to set state PAUSED to %s\n", GST_ELEMENT_NAME( sinkelement ));
+ LOGE("failed to set state PAUSED to %s\n", GST_ELEMENT_NAME(sinkelement));
goto ERROR;
}
- if ( queue )
+ if (queue)
{
- if ( GST_STATE_CHANGE_FAILURE == gst_element_set_state (queue, GST_STATE_PAUSED) )
+ if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(queue, GST_STATE_PAUSED))
{
LOGE("failed to set state PAUSED to queue\n");
goto ERROR;
queue = NULL;
- gst_object_unref (GST_OBJECT(qsrcpad));
+ gst_object_unref(GST_OBJECT(qsrcpad));
qsrcpad = NULL;
}
- if ( parser )
+ if (parser)
{
- if ( GST_STATE_CHANGE_FAILURE == gst_element_set_state (parser, GST_STATE_PAUSED) )
+ if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(parser, GST_STATE_PAUSED))
{
LOGE("failed to set state PAUSED to queue\n");
goto ERROR;
parser = NULL;
- gst_object_unref (GST_OBJECT(pssrcpad));
+ gst_object_unref(GST_OBJECT(pssrcpad));
pssrcpad = NULL;
}
ERROR:
- if ( queue )
+ if (queue)
{
gst_object_unref(GST_OBJECT(qsrcpad));
* You need to let the parent manage the object instead of unreffing the object directly.
*/
- gst_bin_remove (GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), queue);
- //gst_object_unref( queue );
+ gst_bin_remove(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), queue);
+ //gst_object_unref(queue);
}
- if ( srccaps )
+ if (srccaps)
gst_caps_unref(GST_CAPS(srccaps));
return FALSE;
return FALSE;
/* only parsers, demuxers and decoders */
- klass = gst_element_factory_get_metadata (GST_ELEMENT_FACTORY(feature), GST_ELEMENT_METADATA_KLASS);
+ klass = gst_element_factory_get_metadata(GST_ELEMENT_FACTORY(feature), GST_ELEMENT_METADATA_KLASS);
- if( g_strrstr(klass, "Demux") == NULL &&
+ if (g_strrstr(klass, "Demux") == NULL &&
g_strrstr(klass, "Codec/Decoder") == NULL &&
g_strrstr(klass, "Depayloader") == NULL &&
g_strrstr(klass, "Parse") == NULL)
MMPLAYER_FENTER();
- MMPLAYER_RETURN_IF_FAIL ( pad )
- MMPLAYER_RETURN_IF_FAIL ( unused )
- MMPLAYER_RETURN_IF_FAIL ( data )
+ MMPLAYER_RETURN_IF_FAIL(pad)
+ MMPLAYER_RETURN_IF_FAIL(unused)
+ MMPLAYER_RETURN_IF_FAIL(data)
caps = gst_pad_query_caps(pad, NULL);
- if ( !caps )
+ if (!caps)
return;
str = gst_caps_get_structure(caps, 0);
- if ( !str )
+ if (!str)
return;
name = gst_structure_get_name(str);
- if ( !name )
+ if (!name)
return;
LOGD("name=%s\n", name);
- if ( ! __mmplayer_try_to_plug(player, pad, caps) )
+ if (!__mmplayer_try_to_plug(player, pad, caps))
{
- LOGE("failed to autoplug for type (%s)\n", name);
+ LOGE("failed to autoplug for type(%s)\n", name);
gst_caps_unref(caps);
return;
}
gst_caps_unref(caps);
- __mmplayer_pipeline_complete( NULL, (gpointer)player );
+ __mmplayer_pipeline_complete(NULL, (gpointer)player);
MMPLAYER_FLEAVE();
MMPLAYER_FENTER();
- MMPLAYER_RETURN_IF_FAIL ( player );
- MMPLAYER_RETURN_IF_FAIL ( caps );
+ MMPLAYER_RETURN_IF_FAIL(player);
+ MMPLAYER_RETURN_IF_FAIL(caps);
str = gst_caps_get_structure(caps, 0);
- if ( !str )
+ if (!str)
return;
stream_type = gst_structure_get_name(str);
- if ( !stream_type )
+ if (!stream_type)
return;
{
if (g_str_has_prefix(stream_type, "video/mpeg"))
{
- gst_structure_get_int (str, MM_PLAYER_MPEG_VNAME, &version);
+ gst_structure_get_int(str, MM_PLAYER_MPEG_VNAME, &version);
version_field = MM_PLAYER_MPEG_VNAME;
}
else if (g_str_has_prefix(stream_type, "video/x-wmv"))
{
- gst_structure_get_int (str, MM_PLAYER_WMV_VNAME, &version);
+ gst_structure_get_int(str, MM_PLAYER_WMV_VNAME, &version);
version_field = MM_PLAYER_WMV_VNAME;
}
else if (g_str_has_prefix(stream_type, "video/x-divx"))
{
- gst_structure_get_int (str, MM_PLAYER_DIVX_VNAME, &version);
+ gst_structure_get_int(str, MM_PLAYER_DIVX_VNAME, &version);
version_field = MM_PLAYER_DIVX_VNAME;
}
{
if (g_str_has_prefix(stream_type, "audio/mpeg")) // mp3 or aac
{
- gst_structure_get_int (str, MM_PLAYER_MPEG_VNAME, &version);
+ gst_structure_get_int(str, MM_PLAYER_MPEG_VNAME, &version);
version_field = MM_PLAYER_MPEG_VNAME;
}
else if (g_str_has_prefix(stream_type, "audio/x-wma"))
{
- gst_structure_get_int (str, MM_PLAYER_WMA_VNAME, &version);
+ gst_structure_get_int(str, MM_PLAYER_WMA_VNAME, &version);
version_field = MM_PLAYER_WMA_VNAME;
}
const char *name;
MMPLAYER_FENTER();
- MMPLAYER_RETURN_IF_FAIL ( player );
- MMPLAYER_RETURN_IF_FAIL ( pad );
+ MMPLAYER_RETURN_IF_FAIL(player);
+ MMPLAYER_RETURN_IF_FAIL(pad);
- GST_OBJECT_LOCK (pad);
+ GST_OBJECT_LOCK(pad);
if ((caps = gst_pad_get_current_caps(pad)))
gst_caps_ref(caps);
- GST_OBJECT_UNLOCK (pad);
+ GST_OBJECT_UNLOCK(pad);
- if ( NULL == caps )
+ if (NULL == caps)
{
caps = gst_pad_query_caps(pad, NULL);
- if ( !caps ) return;
+ if (!caps) return;
}
MMPLAYER_LOG_GST_CAPS_TYPE(caps);
str = gst_caps_get_structure(caps, 0);
- if ( !str )
+ if (!str)
return;
name = gst_structure_get_name(str);
- if ( !name )
+ if (!name)
return;
player->num_dynamic_pad++;
/* set stream information */
/* if possible, set it here because the caps is not distrubed by resampler. */
- gst_structure_get_int (str, "rate", &samplerate);
+ gst_structure_get_int(str, "rate", &samplerate);
mm_attrs_set_int_by_name(player->attrs, "content_audio_samplerate", samplerate);
- gst_structure_get_int (str, "channels", &channels);
+ gst_structure_get_int(str, "channels", &channels);
mm_attrs_set_int_by_name(player->attrs, "content_audio_channels", channels);
LOGD("audio samplerate : %d channels : %d", samplerate, channels);
else if (g_strrstr(name, "video"))
{
gint stype;
- mm_attrs_get_int_by_name (player->attrs, "display_surface_type", &stype);
+ mm_attrs_get_int_by_name(player->attrs, "display_surface_type", &stype);
/* don't make video because of not required */
if (stype == MM_DISPLAY_SURFACE_NULL || stype == MM_DISPLAY_SURFACE_REMOTE)
player->v_stream_caps = gst_caps_copy(caps); //if needed, video caps is required when videobin is created
}
- if ( ! __mmplayer_try_to_plug(player, pad, caps) )
+ if (!__mmplayer_try_to_plug(player, pad, caps))
{
- LOGE("failed to autoplug for type (%s)", name);
+ LOGE("failed to autoplug for type(%s)", name);
__mmplayer_set_unlinked_mime_type(player, caps);
}
}
gboolean
-__mmplayer_check_subtitle( mm_player_t* player )
+__mmplayer_check_subtitle(mm_player_t* player)
{
MMHandleType attrs = 0;
char *subtitle_uri = NULL;
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL( player, FALSE );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
/* get subtitle attribute */
attrs = MMPLAYER_GET_ATTRS(player);
- if ( !attrs )
+ if (!attrs)
return FALSE;
mm_attrs_get_string_by_name(attrs, "subtitle_uri", &subtitle_uri);
- if ( !subtitle_uri || !strlen(subtitle_uri))
+ if (!subtitle_uri || !strlen(subtitle_uri))
return FALSE;
- LOGD ("subtite uri is %s[%d]\n", subtitle_uri, strlen(subtitle_uri));
+ LOGD("subtite uri is %s[%d]\n", subtitle_uri, strlen(subtitle_uri));
player->is_external_subtitle_present = TRUE;
MMPLAYER_FLEAVE();
}
static gboolean
-__mmplayer_can_extract_pcm( mm_player_t* player )
+__mmplayer_can_extract_pcm(mm_player_t* player)
{
MMHandleType attrs = 0;
gboolean sound_extraction = FALSE;
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, FALSE );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
attrs = MMPLAYER_GET_ATTRS(player);
if (!attrs)
}
static gboolean
-__mmplayer_handle_streaming_error ( mm_player_t* player, GstMessage * message )
+__mmplayer_handle_streaming_error (mm_player_t* player, GstMessage * message)
{
LOGD("\n");
MMMessageParamType msg_param;
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, FALSE );
- MMPLAYER_RETURN_VAL_IF_FAIL ( message, FALSE );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
+ MMPLAYER_RETURN_VAL_IF_FAIL(message, FALSE);
- s = malloc( sizeof(GstStructure) );
- memcpy ( s, gst_message_get_structure ( message ), sizeof(GstStructure));
+ s = malloc(sizeof(GstStructure));
+ memcpy(s, gst_message_get_structure(message), sizeof(GstStructure));
- if ( !gst_structure_get_uint (s, "error_id", &error_id) )
+ if (!gst_structure_get_uint(s, "error_id", &error_id))
error_id = MMPLAYER_STREAMING_ERROR_NONE;
- switch ( error_id )
+ switch (error_id)
{
case MMPLAYER_STREAMING_ERROR_UNSUPPORTED_AUDIO:
msg_param.code = MM_ERROR_PLAYER_STREAMING_UNSUPPORTED_AUDIO;
}
}
- error_string = g_strdup(gst_structure_get_string (s, "error_string"));
- if ( error_string )
+ error_string = g_strdup(gst_structure_get_string(s, "error_string"));
+ if (error_string)
msg_param.data = (void *) error_string;
- if ( message->src )
+ if (message->src)
{
- msg_src_element = GST_ELEMENT_NAME( GST_ELEMENT_CAST( message->src ) );
+ msg_src_element = GST_ELEMENT_NAME(GST_ELEMENT_CAST(message->src));
LOGE("-Msg src : [%s] Code : [%x] Error : [%s] \n",
- msg_src_element, msg_param.code, (char*)msg_param.data );
+ msg_src_element, msg_param.code, (char*)msg_param.data);
}
/* post error to application */
- if ( ! player->msg_posted )
+ if (!player->msg_posted)
{
- MMPLAYER_POST_MSG( player, MM_MESSAGE_ERROR, &msg_param );
+ MMPLAYER_POST_MSG(player, MM_MESSAGE_ERROR, &msg_param);
/* don't post more if one was sent already */
player->msg_posted = TRUE;
}
static void
-__mmplayer_handle_eos_delay( mm_player_t* player, int delay_in_ms )
+__mmplayer_handle_eos_delay(mm_player_t* player, int delay_in_ms)
{
- MMPLAYER_RETURN_IF_FAIL( player );
+ MMPLAYER_RETURN_IF_FAIL(player);
/* post now if delay is zero */
- if ( delay_in_ms == 0 || player->set_mode.pcm_extraction)
+ if (delay_in_ms == 0 || player->set_mode.pcm_extraction)
{
LOGD("eos delay is zero. posting EOS now\n");
- MMPLAYER_POST_MSG( player, MM_MESSAGE_END_OF_STREAM, NULL );
+ MMPLAYER_POST_MSG(player, MM_MESSAGE_END_OF_STREAM, NULL);
- if ( player->set_mode.pcm_extraction )
+ if (player->set_mode.pcm_extraction)
__mmplayer_cancel_eos_timer(player);
return;
}
/* cancel if existing */
- __mmplayer_cancel_eos_timer( player );
+ __mmplayer_cancel_eos_timer(player);
/* init new timeout */
/* NOTE : consider give high priority to this timer */
LOGD("posting EOS message after [%d] msec\n", delay_in_ms);
- player->eos_timer = g_timeout_add( delay_in_ms,
- __mmplayer_eos_timer_cb, player );
+ player->eos_timer = g_timeout_add(delay_in_ms,
+ __mmplayer_eos_timer_cb, player);
- player->context.global_default = g_main_context_default ();
+ player->context.global_default = g_main_context_default();
LOGD("global default context = %p, eos timer id = %d", player->context.global_default, player->eos_timer);
/* check timer is valid. if not, send EOS now */
- if ( player->eos_timer == 0 )
+ if (player->eos_timer == 0)
{
LOGW("creating timer for delayed EOS has failed. sending EOS now\n");
- MMPLAYER_POST_MSG( player, MM_MESSAGE_END_OF_STREAM, NULL );
+ MMPLAYER_POST_MSG(player, MM_MESSAGE_END_OF_STREAM, NULL);
}
}
static void
-__mmplayer_cancel_eos_timer( mm_player_t* player )
+__mmplayer_cancel_eos_timer(mm_player_t* player)
{
- MMPLAYER_RETURN_IF_FAIL( player );
+ MMPLAYER_RETURN_IF_FAIL(player);
- if ( player->eos_timer )
+ if (player->eos_timer)
{
LOGD("cancel eos timer");
__mmplayer_remove_g_source_from_context(player->context.global_default, player->eos_timer);
mm_player_t* player = NULL;
player = (mm_player_t*) u_data;
- MMPLAYER_RETURN_VAL_IF_FAIL( player, FALSE );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
- if ( player->play_count > 1 )
+ if (player->play_count > 1)
{
gint ret_value = 0;
- ret_value = __gst_set_position( player, MM_PLAYER_POS_FORMAT_TIME, 0, TRUE);
+ ret_value = __gst_set_position(player, MM_PLAYER_POS_FORMAT_TIME, 0, TRUE);
if (ret_value == MM_ERROR_NONE)
{
MMHandleType attrs = 0;
player->play_count--;
mm_attrs_set_int_by_name(attrs, "profile_play_count", player->play_count);
- mmf_attrs_commit ( attrs );
+ mmf_attrs_commit(attrs);
}
else
{
else
{
/* posting eos */
- MMPLAYER_POST_MSG( player, MM_MESSAGE_END_OF_STREAM, NULL );
+ MMPLAYER_POST_MSG(player, MM_MESSAGE_END_OF_STREAM, NULL);
}
/* we are returning FALSE as we need only one posting */
}
static gboolean
-__mmplayer_link_decoder( mm_player_t* player, GstPad *srcpad)
+__mmplayer_link_decoder(mm_player_t* player, GstPad *srcpad)
{
const gchar* name = NULL;
GstStructure* str = NULL;
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL( player, FALSE );
- MMPLAYER_RETURN_VAL_IF_FAIL ( srcpad, FALSE );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
+ MMPLAYER_RETURN_VAL_IF_FAIL(srcpad, FALSE);
- /* to check any of the decoder (video/audio) need to be linked to parser*/
- srccaps = gst_pad_query_caps( srcpad, NULL);
- if ( !srccaps )
+ /* to check any of the decoder(video/audio) need to be linked to parser*/
+ srccaps = gst_pad_query_caps(srcpad, NULL);
+ if (!srccaps)
goto ERROR;
- str = gst_caps_get_structure( srccaps, 0 );
- if ( ! str )
+ str = gst_caps_get_structure(srccaps, 0);
+ if (!str)
goto ERROR;
name = gst_structure_get_name(str);
- if ( ! name )
+ if (!name)
goto ERROR;
if (strstr(name, "video"))
{
- if(player->videodec_linked)
+ if (player->videodec_linked)
{
LOGI("Video decoder already linked\n");
return FALSE;
}
if (strstr(name, "audio"))
{
- if(player->audiodec_linked)
+ if (player->audiodec_linked)
{
LOGI("Audio decoder already linked\n");
return FALSE;
}
}
- gst_caps_unref( srccaps );
+ gst_caps_unref(srccaps);
MMPLAYER_FLEAVE();
return TRUE;
ERROR:
- if ( srccaps )
- gst_caps_unref( srccaps );
+ if (srccaps)
+ gst_caps_unref(srccaps);
return FALSE;
}
static gboolean
-__mmplayer_link_sink( mm_player_t* player , GstPad *srcpad)
+__mmplayer_link_sink(mm_player_t* player , GstPad *srcpad)
{
const gchar* name = NULL;
GstStructure* str = NULL;
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, FALSE );
- MMPLAYER_RETURN_VAL_IF_FAIL ( srcpad, FALSE );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
+ MMPLAYER_RETURN_VAL_IF_FAIL(srcpad, FALSE);
- /* to check any of the decoder (video/audio) need to be linked to parser*/
- srccaps = gst_pad_query_caps( srcpad, NULL );
- if ( !srccaps )
+ /* to check any of the decoder(video/audio) need to be linked to parser*/
+ srccaps = gst_pad_query_caps(srcpad, NULL);
+ if (!srccaps)
goto ERROR;
- str = gst_caps_get_structure( srccaps, 0 );
- if ( ! str )
+ str = gst_caps_get_structure(srccaps, 0);
+ if (!str)
goto ERROR;
name = gst_structure_get_name(str);
- if ( ! name )
+ if (!name)
goto ERROR;
if (strstr(name, "video"))
{
- if(player->videosink_linked)
+ if (player->videosink_linked)
{
LOGI("Video Sink already linked\n");
return FALSE;
}
if (strstr(name, "audio"))
{
- if(player->audiosink_linked)
+ if (player->audiosink_linked)
{
LOGI("Audio Sink already linked\n");
return FALSE;
}
if (strstr(name, "text"))
{
- if(player->textsink_linked)
+ if (player->textsink_linked)
{
LOGI("Text Sink already linked\n");
return FALSE;
}
}
- gst_caps_unref( srccaps );
+ gst_caps_unref(srccaps);
MMPLAYER_FLEAVE();
return TRUE;
- //return (!player->videosink_linked || !player->audiosink_linked);
+ //return(!player->videosink_linked || !player->audiosink_linked);
ERROR:
- if ( srccaps )
- gst_caps_unref( srccaps );
+ if (srccaps)
+ gst_caps_unref(srccaps);
return FALSE;
}
/* sending event to one of sinkelements */
static gboolean
-__gst_send_event_to_sink( mm_player_t* player, GstEvent* event )
+__gst_send_event_to_sink(mm_player_t* player, GstEvent* event)
{
GstEvent * event2 = NULL;
GList *sinks = NULL;
gboolean res = FALSE;
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL( player, FALSE );
- MMPLAYER_RETURN_VAL_IF_FAIL ( event, FALSE );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
+ MMPLAYER_RETURN_VAL_IF_FAIL(event, FALSE);
- if ( player->play_subtitle && !player->use_textoverlay)
+ if (player->play_subtitle && !player->use_textoverlay)
event2 = gst_event_copy((const GstEvent *)event);
sinks = player->sink_elements;
while (sinks)
{
- GstElement *sink = GST_ELEMENT_CAST (sinks->data);
+ GstElement *sink = GST_ELEMENT_CAST(sinks->data);
if (GST_IS_ELEMENT(sink))
{
/* keep ref to the event */
- gst_event_ref (event);
+ gst_event_ref(event);
- if ( (res = gst_element_send_event (sink, event)) )
+ if ((res = gst_element_send_event(sink, event)))
{
LOGD("sending event[%s] to sink element [%s] success!\n",
- GST_EVENT_TYPE_NAME(event), GST_ELEMENT_NAME(sink) );
+ GST_EVENT_TYPE_NAME(event), GST_ELEMENT_NAME(sink));
/* rtsp case, asyn_done is not called after seek during pause state */
if (MMPLAYER_IS_RTSP_STREAMING(player))
{
LOGD("RTSP seek completed, after pause state..\n");
player->doing_seek = FALSE;
- MMPLAYER_POST_MSG ( player, MM_MESSAGE_SEEK_COMPLETED, NULL );
+ MMPLAYER_POST_MSG(player, MM_MESSAGE_SEEK_COMPLETED, NULL);
}
}
}
- if( MMPLAYER_IS_MS_BUFF_SRC(player))
+ if (MMPLAYER_IS_MS_BUFF_SRC(player))
{
- sinks = g_list_next (sinks);
+ sinks = g_list_next(sinks);
continue;
}
else
}
LOGD("sending event[%s] to sink element [%s] failed. try with next one.\n",
- GST_EVENT_TYPE_NAME(event), GST_ELEMENT_NAME(sink) );
+ GST_EVENT_TYPE_NAME(event), GST_ELEMENT_NAME(sink));
}
- sinks = g_list_next (sinks);
+ sinks = g_list_next(sinks);
}
#if 0
/* Note : Textbin is not linked to the video or audio bin.
* It needs to send the event to the text sink seperatelly.
*/
- if ( player->play_subtitle && !player->use_textoverlay)
+ if (player->play_subtitle && !player->use_textoverlay)
{
- GstElement *text_sink = GST_ELEMENT_CAST (player->pipeline->textbin[MMPLAYER_T_FAKE_SINK].gst);
+ GstElement *text_sink = GST_ELEMENT_CAST(player->pipeline->textbin[MMPLAYER_T_FAKE_SINK].gst);
if (GST_IS_ELEMENT(text_sink))
{
/* keep ref to the event */
- gst_event_ref (event2);
+ gst_event_ref(event2);
- if ((res = gst_element_send_event (text_sink, event2)))
+ if ((res = gst_element_send_event(text_sink, event2)))
{
LOGD("sending event[%s] to subtitle sink element [%s] success!\n",
- GST_EVENT_TYPE_NAME(event2), GST_ELEMENT_NAME(text_sink) );
+ GST_EVENT_TYPE_NAME(event2), GST_ELEMENT_NAME(text_sink));
}
else
{
LOGE("sending event[%s] to subtitle sink element [%s] failed!\n",
- GST_EVENT_TYPE_NAME(event2), GST_ELEMENT_NAME(text_sink) );
+ GST_EVENT_TYPE_NAME(event2), GST_ELEMENT_NAME(text_sink));
}
- gst_event_unref (event2);
+ gst_event_unref(event2);
}
}
- gst_event_unref (event);
+ gst_event_unref(event);
MMPLAYER_FLEAVE();
}
static void
-__mmplayer_add_sink( mm_player_t* player, GstElement* sink )
+__mmplayer_add_sink(mm_player_t* player, GstElement* sink)
{
MMPLAYER_FENTER();
- MMPLAYER_RETURN_IF_FAIL ( player );
- MMPLAYER_RETURN_IF_FAIL ( sink );
+ MMPLAYER_RETURN_IF_FAIL(player);
+ MMPLAYER_RETURN_IF_FAIL(sink);
player->sink_elements =
g_list_append(player->sink_elements, sink);
}
static void
-__mmplayer_del_sink( mm_player_t* player, GstElement* sink )
+__mmplayer_del_sink(mm_player_t* player, GstElement* sink)
{
MMPLAYER_FENTER();
- MMPLAYER_RETURN_IF_FAIL ( player );
- MMPLAYER_RETURN_IF_FAIL ( sink );
+ MMPLAYER_RETURN_IF_FAIL(player);
+ MMPLAYER_RETURN_IF_FAIL(sink);
player->sink_elements =
g_list_remove(player->sink_elements, sink);
static gboolean
__gst_seek(mm_player_t* player, GstElement * element, gdouble rate,
GstFormat format, GstSeekFlags flags, GstSeekType cur_type,
- gint64 cur, GstSeekType stop_type, gint64 stop )
+ gint64 cur, GstSeekType stop_type, gint64 stop)
{
GstEvent* event = NULL;
gboolean result = FALSE;
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL( player, FALSE );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
- if ( player->pipeline && player->pipeline->textbin)
+ if (player->pipeline && player->pipeline->textbin)
__mmplayer_drop_subtitle(player, FALSE);
- event = gst_event_new_seek (rate, format, flags, cur_type,
+ event = gst_event_new_seek(rate, format, flags, cur_type,
cur, stop_type, stop);
- result = __gst_send_event_to_sink( player, event );
+ result = __gst_send_event_to_sink(player, event);
MMPLAYER_FLEAVE();
* with future versions of GObject by checking that the signal handler is still
* connected before disconnected it:
*
- * if (g_signal_handler_is_connected (instance, id))
- * g_signal_handler_disconnect (instance, id);
+ * if (g_signal_handler_is_connected(instance, id))
+ * g_signal_handler_disconnect(instance, id);
*/
static void
__mmplayer_release_signal_connection(mm_player_t* player, MMPlayerSignalType type)
MMPLAYER_FENTER();
- MMPLAYER_RETURN_IF_FAIL( player );
+ MMPLAYER_RETURN_IF_FAIL(player);
LOGD("release signals type : %d", type);
if ((type < MM_PLAYER_SIGNAL_TYPE_AUTOPLUG) || (type >= MM_PLAYER_SIGNAL_TYPE_ALL))
{
- __mmplayer_release_signal_connection (player, MM_PLAYER_SIGNAL_TYPE_AUTOPLUG);
- __mmplayer_release_signal_connection (player, MM_PLAYER_SIGNAL_TYPE_VIDEOBIN);
- __mmplayer_release_signal_connection (player, MM_PLAYER_SIGNAL_TYPE_AUDIOBIN);
- __mmplayer_release_signal_connection (player, MM_PLAYER_SIGNAL_TYPE_TEXTBIN);
- __mmplayer_release_signal_connection (player, MM_PLAYER_SIGNAL_TYPE_OTHERS);
+ __mmplayer_release_signal_connection(player, MM_PLAYER_SIGNAL_TYPE_AUTOPLUG);
+ __mmplayer_release_signal_connection(player, MM_PLAYER_SIGNAL_TYPE_VIDEOBIN);
+ __mmplayer_release_signal_connection(player, MM_PLAYER_SIGNAL_TYPE_AUDIOBIN);
+ __mmplayer_release_signal_connection(player, MM_PLAYER_SIGNAL_TYPE_TEXTBIN);
+ __mmplayer_release_signal_connection(player, MM_PLAYER_SIGNAL_TYPE_OTHERS);
return;
}
sig_list = player->signals[type];
- for ( ; sig_list; sig_list = sig_list->next )
+ for (; sig_list; sig_list = sig_list->next)
{
item = sig_list->data;
- if ( item && item->obj && GST_IS_ELEMENT(item->obj) )
+ if (item && item->obj && GST_IS_ELEMENT(item->obj))
{
- if ( g_signal_handler_is_connected ( item->obj, item->sig ) )
+ if (g_signal_handler_is_connected(item->obj, item->sig))
{
- g_signal_handler_disconnect ( item->obj, item->sig );
+ g_signal_handler_disconnect(item->obj, item->sig);
}
}
- MMPLAYER_FREEIF( item );
+ MMPLAYER_FREEIF(item);
}
- g_list_free ( player->signals[type] );
+ g_list_free(player->signals[type]);
player->signals[type] = NULL;
MMPLAYER_FLEAVE();
/* load previous attributes */
if (player->attrs)
{
- mm_attrs_get_int_by_name (player->attrs, "display_surface_type", &prev_display_surface_type);
- mm_attrs_get_data_by_name (player->attrs, "display_overlay", &prev_display_overlay);
+ mm_attrs_get_int_by_name(player->attrs, "display_surface_type", &prev_display_surface_type);
+ mm_attrs_get_data_by_name(player->attrs, "display_overlay", &prev_display_overlay);
LOGD("[0: Video surface, 1: EVAS surface] previous surface type(%d), new surface type(%d)", prev_display_surface_type, surface_type);
if (prev_display_surface_type == surface_type)
{
/* check videosink element is created */
if (!player->pipeline || !player->pipeline->videobin ||
- !player->pipeline->videobin[MMPLAYER_V_SINK].gst )
+ !player->pipeline->videobin[MMPLAYER_V_SINK].gst)
{
LOGD("videosink element is not yet ready");
/* videobin is not created yet, so we just set attributes related to display surface */
LOGD("store display attribute for given surface type(%d)", surface_type);
- mm_attrs_set_int_by_name (player->attrs, "display_surface_type", surface_type);
- mm_attrs_set_data_by_name (player->attrs, "display_overlay", display_overlay, sizeof(display_overlay));
- if ( mmf_attrs_commit ( player->attrs ) )
+ mm_attrs_set_int_by_name(player->attrs, "display_surface_type", surface_type);
+ mm_attrs_set_data_by_name(player->attrs, "display_overlay", display_overlay, sizeof(display_overlay));
+ if (mmf_attrs_commit(player->attrs))
{
LOGE("failed to commit attribute");
MMPLAYER_FLEAVE();
else
{
/* get player command status */
- if ( !(player->cmd == MMPLAYER_COMMAND_START || player->cmd == MMPLAYER_COMMAND_RESUME || player->cmd == MMPLAYER_COMMAND_PAUSE) )
+ if (!(player->cmd == MMPLAYER_COMMAND_START || player->cmd == MMPLAYER_COMMAND_RESUME || player->cmd == MMPLAYER_COMMAND_PAUSE))
{
LOGE("invalid player command status(%d), __mmplayer_do_change_videosink() is only available with START/RESUME/PAUSE command",player->cmd);
MMPLAYER_FLEAVE();
cur_videosink_name = GST_ELEMENT_NAME(player->pipeline->videobin[MMPLAYER_V_SINK].gst);
/* surface change */
- for ( i = 0 ; i < num_of_dec ; i++)
+ for (i = 0 ; i < num_of_dec ; i++)
{
- if ( player->pipeline->mainbin &&
- player->pipeline->mainbin[MMPLAYER_M_DEC1+i].gst )
+ if (player->pipeline->mainbin &&
+ player->pipeline->mainbin[MMPLAYER_M_DEC1+i].gst)
{
GstElementFactory *decfactory;
- decfactory = gst_element_get_factory (player->pipeline->mainbin[MMPLAYER_M_DEC1+i].gst);
+ decfactory = gst_element_get_factory(player->pipeline->mainbin[MMPLAYER_M_DEC1+i].gst);
- klass = gst_element_factory_get_metadata (decfactory, GST_ELEMENT_METADATA_KLASS);
+ klass = gst_element_factory_get_metadata(decfactory, GST_ELEMENT_METADATA_KLASS);
if ((g_strrstr(klass, "Codec/Decoder/Video")))
{
- if ( !strncmp(cur_videosink_name, "x", 1) && (surface_type == MM_DISPLAY_SURFACE_EVAS) )
+ if (!strncmp(cur_videosink_name, "x", 1) && (surface_type == MM_DISPLAY_SURFACE_EVAS))
{
ret = __mmplayer_do_change_videosink(player, MMPLAYER_M_DEC1+i, player->ini.videosink_element_evas, surface_type, display_overlay);
if (ret)
return MM_ERROR_NONE;
}
}
- else if (!strncmp(cur_videosink_name, "evas", 4) && (surface_type == MM_DISPLAY_SURFACE_OVERLAY) )
+ else if (!strncmp(cur_videosink_name, "evas", 4) && (surface_type == MM_DISPLAY_SURFACE_OVERLAY))
{
ret = __mmplayer_do_change_videosink(player, MMPLAYER_M_DEC1+i, player->ini.videosink_element_overlay, surface_type, display_overlay);
if (ret)
ERROR_CASE:
/* rollback to previous attributes */
- mm_attrs_set_int_by_name (player->attrs, "display_surface_type", prev_display_surface_type);
+ mm_attrs_set_int_by_name(player->attrs, "display_surface_type", prev_display_surface_type);
mm_attrs_set_data_by_name(player->attrs, "display_overlay", prev_display_overlay, sizeof(void*));
- if ( mmf_attrs_commit ( player->attrs ) )
+ if (mmf_attrs_commit(player->attrs))
{
LOGE("failed to commit attributes to rollback");
MMPLAYER_FLEAVE();
LOGD("surface type(%d), display overlay(%x)", surface_type, display_overlay);
/* get information whether if audiobin is created */
- if ( !player->pipeline->audiobin ||
- !player->pipeline->audiobin[MMPLAYER_A_SINK].gst )
+ if (!player->pipeline->audiobin ||
+ !player->pipeline->audiobin[MMPLAYER_A_SINK].gst)
{
LOGW("audiobin is null, this video content may not have audio data");
is_audiobin_created = FALSE;
/* get src pad of decoder and block it */
- src_pad_dec = gst_element_get_static_pad (GST_ELEMENT(player->pipeline->mainbin[dec_index].gst), "src");
+ src_pad_dec = gst_element_get_static_pad(GST_ELEMENT(player->pipeline->mainbin[dec_index].gst), "src");
if (!src_pad_dec)
{
LOGE("failed to get src pad from decode in mainbin");
if (!player->doing_seek && previous_state == MM_PLAYER_STATE_PLAYING)
{
LOGW("trying to block pad(video)");
-// if (!gst_pad_set_blocked (src_pad_dec, TRUE))
+// if (!gst_pad_set_blocked(src_pad_dec, TRUE))
gst_pad_add_probe(src_pad_dec, GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM,
NULL, NULL, NULL);
/* unlink between decoder and videobin and remove previous videosink from videobin */
GST_ELEMENT_UNLINK(GST_ELEMENT(player->pipeline->mainbin[dec_index].gst),GST_ELEMENT(player->pipeline->videobin[MMPLAYER_V_BIN].gst));
- if ( !gst_bin_remove (GST_BIN(player->pipeline->videobin[MMPLAYER_V_BIN].gst), GST_ELEMENT(player->pipeline->videobin[MMPLAYER_V_SINK].gst)) )
+ if (!gst_bin_remove(GST_BIN(player->pipeline->videobin[MMPLAYER_V_BIN].gst), GST_ELEMENT(player->pipeline->videobin[MMPLAYER_V_SINK].gst)))
{
LOGE("failed to remove former videosink from videobin");
return MM_ERROR_PLAYER_INTERNAL;
}
- __mmplayer_del_sink( player, player->pipeline->videobin[MMPLAYER_V_SINK].gst );
+ __mmplayer_del_sink(player, player->pipeline->videobin[MMPLAYER_V_SINK].gst);
/* create a new videosink and add it to videobin */
player->pipeline->videobin[MMPLAYER_V_SINK].gst = gst_element_factory_make(videosink_element, videosink_element);
if (!player->pipeline->videobin[MMPLAYER_V_SINK].gst)
{
- LOGE ( "failed to create videosink element\n" );
+ LOGE("failed to create videosink element\n");
MMPLAYER_FLEAVE();
return MM_ERROR_PLAYER_INTERNAL;
}
- gst_bin_add (GST_BIN(player->pipeline->videobin[MMPLAYER_V_BIN].gst), GST_ELEMENT(player->pipeline->videobin[MMPLAYER_V_SINK].gst));
- __mmplayer_add_sink( player, player->pipeline->videobin[MMPLAYER_V_SINK].gst );
- g_object_set (G_OBJECT (player->pipeline->videobin[MMPLAYER_V_SINK].gst), "qos", TRUE, NULL);
+ gst_bin_add(GST_BIN(player->pipeline->videobin[MMPLAYER_V_BIN].gst), GST_ELEMENT(player->pipeline->videobin[MMPLAYER_V_SINK].gst));
+ __mmplayer_add_sink(player, player->pipeline->videobin[MMPLAYER_V_SINK].gst);
+ g_object_set(G_OBJECT(player->pipeline->videobin[MMPLAYER_V_SINK].gst), "qos", TRUE, NULL);
/* save attributes */
if (player->attrs)
{
/* set a new display surface type */
- mm_attrs_set_int_by_name (player->attrs, "display_surface_type", surface_type);
+ mm_attrs_set_int_by_name(player->attrs, "display_surface_type", surface_type);
/* set a new diplay overlay */
switch (surface_type)
{
case MM_DISPLAY_SURFACE_OVERLAY:
LOGD("save attributes related to video display surface : id = %d", *(int*)display_overlay);
- mm_attrs_set_data_by_name (player->attrs, "display_overlay", display_overlay, sizeof(display_overlay));
+ mm_attrs_set_data_by_name(player->attrs, "display_overlay", display_overlay, sizeof(display_overlay));
break;
case MM_DISPLAY_SURFACE_EVAS:
LOGD("save attributes related to display surface to EVAS : evas image object = %x", display_overlay);
- mm_attrs_set_data_by_name (player->attrs, "display_overlay", display_overlay, sizeof(void*));
+ mm_attrs_set_data_by_name(player->attrs, "display_overlay", display_overlay, sizeof(void*));
break;
default:
LOGE("invalid type(%d) for changing display surface",surface_type);
MMPLAYER_FLEAVE();
return MM_ERROR_INVALID_ARGUMENT;
}
- if ( mmf_attrs_commit ( player->attrs ) )
+ if (mmf_attrs_commit(player->attrs))
{
LOGE("failed to commit");
MMPLAYER_FLEAVE();
}
/* update video param */
- if ( MM_ERROR_NONE != _mmplayer_update_video_param( player, "update_all_param") )
+ if (MM_ERROR_NONE != _mmplayer_update_video_param(player, "update_all_param"))
{
LOGE("failed to update video param");
return MM_ERROR_PLAYER_INTERNAL;
/* change ghostpad */
sink_pad_videosink = gst_element_get_static_pad(GST_ELEMENT(player->pipeline->videobin[MMPLAYER_V_SINK].gst), "sink");
- if ( !sink_pad_videosink )
+ if (!sink_pad_videosink)
{
LOGE("failed to get sink pad from videosink element");
return MM_ERROR_PLAYER_INTERNAL;
LOGE("failed to set active to ghost_pad");
return MM_ERROR_PLAYER_INTERNAL;
}
- if ( FALSE == gst_element_add_pad(player->pipeline->videobin[MMPLAYER_V_BIN].gst, player->ghost_pad_for_videobin) )
+ if (FALSE == gst_element_add_pad(player->pipeline->videobin[MMPLAYER_V_BIN].gst, player->ghost_pad_for_videobin))
{
LOGE("failed to change ghostpad for videobin");
return MM_ERROR_PLAYER_INTERNAL;
gst_object_unref(sink_pad_videosink);
/* link decoder with videobin */
- sink_pad_videobin = gst_element_get_static_pad( GST_ELEMENT(player->pipeline->videobin[MMPLAYER_V_BIN].gst), "sink");
- if ( !sink_pad_videobin )
+ sink_pad_videobin = gst_element_get_static_pad(GST_ELEMENT(player->pipeline->videobin[MMPLAYER_V_BIN].gst), "sink");
+ if (!sink_pad_videobin)
{
LOGE("failed to get sink pad from videobin");
return MM_ERROR_PLAYER_INTERNAL;
}
- if ( GST_PAD_LINK_OK != GST_PAD_LINK(src_pad_dec, sink_pad_videobin) )
+ if (GST_PAD_LINK_OK != GST_PAD_LINK(src_pad_dec, sink_pad_videobin))
{
LOGE("failed to link");
return MM_ERROR_PLAYER_INTERNAL;
if (!is_audiobin_created)
{
LOGW("audiobin is not created, get clock from pipeline..");
- clock = GST_ELEMENT_CLOCK (player->pipeline->mainbin[MMPLAYER_M_PIPE].gst);
+ clock = GST_ELEMENT_CLOCK(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst);
}
else
{
- clock = GST_ELEMENT_CLOCK (player->pipeline->audiobin[MMPLAYER_A_SINK].gst);
+ clock = GST_ELEMENT_CLOCK(player->pipeline->audiobin[MMPLAYER_A_SINK].gst);
}
if (clock)
{
GstClockTime now;
GstClockTime base_time;
LOGD("set the clock to videosink");
- gst_element_set_clock (GST_ELEMENT_CAST(player->pipeline->videobin[MMPLAYER_V_SINK].gst), clock);
- clock = GST_ELEMENT_CLOCK (player->pipeline->videobin[MMPLAYER_V_SINK].gst);
+ gst_element_set_clock(GST_ELEMENT_CAST(player->pipeline->videobin[MMPLAYER_V_SINK].gst), clock);
+ clock = GST_ELEMENT_CLOCK(player->pipeline->videobin[MMPLAYER_V_SINK].gst);
if (clock)
{
LOGD("got clock of videosink");
- now = gst_clock_get_time ( clock );
- base_time = GST_ELEMENT_CAST (player->pipeline->videobin[MMPLAYER_V_SINK].gst)->base_time;
- LOGD ("at time %" GST_TIME_FORMAT ", base %"
- GST_TIME_FORMAT, GST_TIME_ARGS (now), GST_TIME_ARGS (base_time));
+ now = gst_clock_get_time(clock);
+ base_time = GST_ELEMENT_CAST(player->pipeline->videobin[MMPLAYER_V_SINK].gst)->base_time;
+ LOGD("at time %" GST_TIME_FORMAT ", base %"
+ GST_TIME_FORMAT, GST_TIME_ARGS(now), GST_TIME_ARGS(base_time));
}
else
{
/* release blocked and unref src pad of video decoder */
#if 0
- if (!gst_pad_set_blocked (src_pad_dec, FALSE))
+ if (!gst_pad_set_blocked(src_pad_dec, FALSE))
{
LOGE("failed to set pad blocked FALSE(video)");
return MM_ERROR_PLAYER_INTERNAL;
gint64 pos_msec = 0;
LOGD("do get/set position for new videosink plugin");
- if (__gst_get_position(player, MM_PLAYER_POS_FORMAT_TIME, &position ))
+ if (__gst_get_position(player, MM_PLAYER_POS_FORMAT_TIME, &position))
{
LOGE("failed to get position");
return MM_ERROR_PLAYER_INTERNAL;
}
#ifdef SINKCHANGE_WITH_ACCURATE_SEEK
/* accurate seek */
- if (__gst_set_position(player, MM_PLAYER_POS_FORMAT_TIME, position, TRUE ))
+ if (__gst_set_position(player, MM_PLAYER_POS_FORMAT_TIME, position, TRUE))
{
LOGE("failed to set position");
return MM_ERROR_PLAYER_INTERNAL;
#else
/* key unit seek */
pos_msec = position * G_GINT64_CONSTANT(1000000);
- ret = __gst_seek ( player, player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, 1.0,
- GST_FORMAT_TIME, ( GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT ),
+ ret = __gst_seek(player, player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, 1.0,
+ GST_FORMAT_TIME, (GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT),
GST_SEEK_TYPE_SET, pos_msec,
- GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE );
- if ( !ret )
+ GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE);
+ if (!ret )
{
LOGE("failed to set position");
return MM_ERROR_PLAYER_INTERNAL;
if (src_pad_dec)
{
- gst_object_unref (src_pad_dec);
+ gst_object_unref(src_pad_dec);
}
LOGD("success to change sink");
/* Note : if silent is true, then subtitle would not be displayed. :*/
-int _mmplayer_set_subtitle_silent (MMHandleType hplayer, int silent)
+int _mmplayer_set_subtitle_silent(MMHandleType hplayer, int silent)
{
mm_player_t* player = (mm_player_t*) hplayer;
MMPLAYER_FENTER();
/* check player handle */
- MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
player->set_mode.subtitle_off = silent;
mainbin = player->pipeline->mainbin;
#if 0
- if(!gst_pad_set_blocked(inpad,TRUE))
+ if (!gst_pad_set_blocked(inpad,TRUE))
{
result = MM_ERROR_PLAYER_INTERNAL;
goto EXIT;
/*Getting pad connected to demuxer audio pad */
peer = gst_pad_get_peer(inpad);
/* Disconnecting Demuxer and its peer plugin [audio] */
- if(peer)
+ if (peer)
{
- if(!gst_pad_unlink(inpad,peer))
+ if (!gst_pad_unlink(inpad,peer))
{
result = MM_ERROR_PLAYER_INTERNAL;
goto EXIT;
goto EXIT;
}
/*Removing elements between Demuxer and audiobin*/
- while(peer != NULL)
+ while (peer != NULL)
{
gchar *Element_name = NULL;
gchar *factory_name = NULL;
GstElementFactory *factory = NULL;
/*Getting peer element*/
Element = gst_pad_get_parent_element(peer);
- if(Element == NULL)
+ if (Element == NULL)
{
gst_object_unref(peer);
result = MM_ERROR_PLAYER_INTERNAL;
Element_name = gst_element_get_name(Element);
factory = gst_element_get_factory(Element);
/*checking the element is audio bin*/
- if(!strcmp(Element_name,"audiobin"))
+ if (!strcmp(Element_name,"audiobin"))
{
gst_object_unref(peer);
result = MM_ERROR_NONE;
}
factory_name = GST_OBJECT_NAME(factory);
pad = gst_element_get_static_pad(Element,"src");
- if(pad == NULL)
+ if (pad == NULL)
{
result = MM_ERROR_PLAYER_INTERNAL;
g_free(Element_name);
}
gst_object_unref(peer);
peer = gst_pad_get_peer(pad);
- if(peer)
+ if (peer)
{
- if(!gst_pad_unlink(pad,peer))
+ if (!gst_pad_unlink(pad,peer))
{
gst_object_unref(peer);
gst_object_unref(pad);
}
elements = player->parsers;
/* Removing the element form the list*/
- for ( ; elements; elements = g_list_next(elements))
+ for (; elements; elements = g_list_next(elements))
{
Element_name = elements->data;
- if(g_strrstr(Element_name,factory_name))
+ if (g_strrstr(Element_name,factory_name))
{
player->parsers = g_list_remove(player->parsers,elements->data);
}
gst_element_set_state(Element,GST_STATE_NULL);
gst_bin_remove(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst),Element);
gst_object_unref(pad);
- if(Element == mainbin[MMPLAYER_M_Q1].gst)
+ if (Element == mainbin[MMPLAYER_M_Q1].gst)
{
mainbin[MMPLAYER_M_Q1].gst = NULL;
}
- else if(Element == mainbin[MMPLAYER_M_Q2].gst)
+ else if (Element == mainbin[MMPLAYER_M_Q2].gst)
{
mainbin[MMPLAYER_M_Q2].gst = NULL;
}
- else if(Element == mainbin[MMPLAYER_M_DEC1].gst)
+ else if (Element == mainbin[MMPLAYER_M_DEC1].gst)
{
mainbin[MMPLAYER_M_DEC1].gst = NULL;
}
- else if(Element == mainbin[MMPLAYER_M_DEC2].gst)
+ else if (Element == mainbin[MMPLAYER_M_DEC2].gst)
{
mainbin[MMPLAYER_M_DEC2].gst = NULL;
}
MMPLAYER_FENTER();
/* check player handle */
- MMPLAYER_RETURN_VAL_IF_FAIL ( player && player->pipeline , MM_ERROR_PLAYER_NOT_INITIALIZED);
+ MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline , MM_ERROR_PLAYER_NOT_INITIALIZED);
if (!(player->pipeline->mainbin) || !(player->pipeline->textbin))
{
mainbin = player->pipeline->mainbin;
textbin = player->pipeline->textbin;
- current_state = GST_STATE (mainbin[MMPLAYER_M_PIPE].gst);
+ current_state = GST_STATE(mainbin[MMPLAYER_M_PIPE].gst);
// sync clock with current pipeline
- curr_clock = GST_ELEMENT_CLOCK (player->pipeline->mainbin[MMPLAYER_M_PIPE].gst);
- curr_time = gst_clock_get_time (curr_clock);
+ curr_clock = GST_ELEMENT_CLOCK(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst);
+ curr_time = gst_clock_get_time(curr_clock);
- base_time = gst_element_get_base_time (GST_ELEMENT_CAST (player->pipeline->mainbin[MMPLAYER_M_PIPE].gst));
- start_time = gst_element_get_start_time (GST_ELEMENT_CAST(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst));
+ base_time = gst_element_get_base_time(GST_ELEMENT_CAST(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst));
+ start_time = gst_element_get_start_time(GST_ELEMENT_CAST(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst));
- LOGD ("base_time=%" GST_TIME_FORMAT " start_time=%" GST_TIME_FORMAT " curr_time=%" GST_TIME_FORMAT,
- GST_TIME_ARGS (base_time), GST_TIME_ARGS (start_time), GST_TIME_ARGS (curr_time));
+ LOGD("base_time=%" GST_TIME_FORMAT " start_time=%" GST_TIME_FORMAT " curr_time=%" GST_TIME_FORMAT,
+ GST_TIME_ARGS(base_time), GST_TIME_ARGS(start_time), GST_TIME_ARGS(curr_time));
if (current_state > GST_STATE_READY)
{
gst_element_set_state(mainbin[MMPLAYER_M_SUBPARSE].gst, GST_STATE_PAUSED);
gst_element_set_state(mainbin[MMPLAYER_M_SUBSRC].gst, GST_STATE_PAUSED);
- ret = gst_element_get_state (mainbin[MMPLAYER_M_SUBSRC].gst, &element_state, &element_pending_state, 5 * GST_SECOND);
- if ( GST_STATE_CHANGE_FAILURE == ret )
+ ret = gst_element_get_state(mainbin[MMPLAYER_M_SUBSRC].gst, &element_state, &element_pending_state, 5 * GST_SECOND);
+ if (GST_STATE_CHANGE_FAILURE == ret)
{
LOGE("fail to state change.\n");
}
}
- gst_element_set_base_time (textbin[MMPLAYER_T_BIN].gst, base_time);
+ gst_element_set_base_time(textbin[MMPLAYER_T_BIN].gst, base_time);
gst_element_set_start_time(textbin[MMPLAYER_T_BIN].gst, start_time);
if (curr_clock)
{
- gst_element_set_clock (textbin[MMPLAYER_T_BIN].gst, curr_clock);
- gst_object_unref (curr_clock);
+ gst_element_set_clock(textbin[MMPLAYER_T_BIN].gst, curr_clock);
+ gst_object_unref(curr_clock);
}
// seek to current position
- if (!gst_element_query_position (mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &time))
+ if (!gst_element_query_position(mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &time))
{
result = MM_ERROR_PLAYER_INVALID_STATE;
LOGE("gst_element_query_position failed, invalid state\n");
}
LOGD("seek time = %lld\n", time);
- event = gst_event_new_seek (1.0, GST_FORMAT_TIME, (GstSeekFlags)(GST_SEEK_FLAG_FLUSH), GST_SEEK_TYPE_SET, time, GST_SEEK_TYPE_NONE, -1);
+ event = gst_event_new_seek(1.0, GST_FORMAT_TIME, (GstSeekFlags)(GST_SEEK_FLAG_FLUSH), GST_SEEK_TYPE_SET, time, GST_SEEK_TYPE_NONE, -1);
if (event)
{
__gst_send_event_to_sink(player, event);
MMPLAYER_FENTER();
/* check player handle */
- MMPLAYER_RETURN_VAL_IF_FAIL( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
- MMPLAYER_RETURN_VAL_IF_FAIL( filepath, MM_ERROR_COMMON_INVALID_ARGUMENT );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ MMPLAYER_RETURN_VAL_IF_FAIL(filepath, MM_ERROR_COMMON_INVALID_ARGUMENT);
if (!(player->pipeline) || !(player->pipeline->mainbin))
{
mainbin = player->pipeline->mainbin;
textbin = player->pipeline->textbin;
- current_state = GST_STATE (mainbin[MMPLAYER_M_PIPE].gst);
+ current_state = GST_STATE(mainbin[MMPLAYER_M_PIPE].gst);
if (current_state < GST_STATE_READY)
{
result = MM_ERROR_PLAYER_INVALID_STATE;
goto EXIT;
}
- mm_attrs_get_string_by_name (attrs, "subtitle_uri", &subtitle_uri);
+ mm_attrs_get_string_by_name(attrs, "subtitle_uri", &subtitle_uri);
if (!subtitle_uri || strlen(subtitle_uri) < 1)
{
LOGE("subtitle uri is not proper filepath\n");
LOGD("old subtitle file path is [%s]\n", subtitle_uri);
LOGD("new subtitle file path is [%s]\n", filepath);
- if (!strcmp (filepath, subtitle_uri))
+ if (!strcmp(filepath, subtitle_uri))
{
LOGD("No need to swtich subtitle, as input filepath is same as current filepath\n");
goto EXIT;
charset = util_get_charset(filepath);
if (charset)
{
- LOGD ("detected charset is %s\n", charset );
- g_object_set (G_OBJECT (mainbin[MMPLAYER_M_SUBPARSE].gst), "subtitle-encoding", charset, NULL);
+ LOGD("detected charset is %s\n", charset);
+ g_object_set(G_OBJECT(mainbin[MMPLAYER_M_SUBPARSE].gst), "subtitle-encoding", charset, NULL);
}
result = _mmplayer_sync_subtitle_pipeline(player);
MMPLAYER_FENTER();
/* check player handle */
- MMPLAYER_RETURN_VAL_IF_FAIL( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
if (!player->pipeline) // IDLE state
{
result= MM_ERROR_PLAYER_INTERNAL;
}
}
- else // curr state <> IDLE (READY, PAUSE, PLAYING..)
+ else // curr state <> IDLE(READY, PAUSE, PLAYING..)
{
- if ( filepath == NULL )
+ if (filepath == NULL)
return MM_ERROR_COMMON_INVALID_ARGUMENT;
if (!__mmplayer_check_subtitle(player))
result = MM_ERROR_PLAYER_INTERNAL;
}
- if ( MM_ERROR_NONE != __mmplayer_gst_create_subtitle_src(player) )
+ if (MM_ERROR_NONE != __mmplayer_gst_create_subtitle_src(player))
LOGE("fail to create subtitle src\n");
result = _mmplayer_sync_subtitle_pipeline(player);
}
static int
-__mmplayer_change_selector_pad (mm_player_t* player, MMPlayerTrackType type, int index)
+__mmplayer_change_selector_pad(mm_player_t* player, MMPlayerTrackType type, int index)
{
int result = MM_ERROR_NONE;
gchar* change_pad_name = NULL;
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL (player && player->pipeline && player->pipeline->mainbin,
+ MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline && player->pipeline->mainbin,
MM_ERROR_PLAYER_NOT_INITIALIZED);
- LOGD ("Change Track(%d) to %d\n", type, index);
+ LOGD("Change Track(%d) to %d\n", type, index);
mainbin = player->pipeline->mainbin;
else
{
/* Changing Video Track is not supported. */
- LOGE ("Track Type Error\n");
+ LOGE("Track Type Error\n");
goto EXIT;
}
if (mainbin[elemId].gst == NULL)
{
result = MM_ERROR_PLAYER_NO_OP;
- LOGD ("Req track doesn't exist\n");
+ LOGD("Req track doesn't exist\n");
goto EXIT;
}
if (total_track_num <= 0)
{
result = MM_ERROR_PLAYER_NO_OP;
- LOGD ("Language list is not available \n");
+ LOGD("Language list is not available \n");
goto EXIT;
}
if ((index < 0) || (index >= total_track_num))
{
result = MM_ERROR_INVALID_ARGUMENT;
- LOGD ("Not a proper index : %d \n", index);
+ LOGD("Not a proper index : %d \n", index);
goto EXIT;
}
/*To get the new pad from the selector*/
- change_pad_name = g_strdup_printf ("sink_%u", index);
+ change_pad_name = g_strdup_printf("sink_%u", index);
if (change_pad_name == NULL)
{
result = MM_ERROR_PLAYER_INTERNAL;
- LOGD ("Pad does not exists\n");
+ LOGD("Pad does not exists\n");
goto EXIT;
}
- LOGD ("new active pad name: %s\n", change_pad_name);
+ LOGD("new active pad name: %s\n", change_pad_name);
- sinkpad = gst_element_get_static_pad (mainbin[elemId].gst, change_pad_name);
+ sinkpad = gst_element_get_static_pad(mainbin[elemId].gst, change_pad_name);
if (sinkpad == NULL)
{
- LOGD ("sinkpad is NULL");
+ LOGD("sinkpad is NULL");
result = MM_ERROR_PLAYER_INTERNAL;
goto EXIT;
}
- LOGD ("Set Active Pad - %s:%s\n", GST_DEBUG_PAD_NAME(sinkpad));
- g_object_set (mainbin[elemId].gst, "active-pad", sinkpad, NULL);
+ LOGD("Set Active Pad - %s:%s\n", GST_DEBUG_PAD_NAME(sinkpad));
+ g_object_set(mainbin[elemId].gst, "active-pad", sinkpad, NULL);
caps = gst_pad_get_current_caps(sinkpad);
MMPLAYER_LOG_GST_CAPS_TYPE(caps);
if (sinkpad)
- gst_object_unref (sinkpad);
+ gst_object_unref(sinkpad);
if (type == MM_PLAYER_TRACK_TYPE_AUDIO)
{
- __mmplayer_set_audio_attrs (player, caps);
+ __mmplayer_set_audio_attrs(player, caps);
}
EXIT:
return result;
}
-int _mmplayer_change_track_language (MMHandleType hplayer, MMPlayerTrackType type, int index)
+int _mmplayer_change_track_language(MMHandleType hplayer, MMPlayerTrackType type, int index)
{
int result = MM_ERROR_NONE;
mm_player_t* player = NULL;
MMPLAYER_FENTER();
player = (mm_player_t*)hplayer;
- MMPLAYER_RETURN_VAL_IF_FAIL (player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
if (!player->pipeline)
{
- LOGE ("Track %d pre setting -> %d\n", type, index);
+ LOGE("Track %d pre setting -> %d\n", type, index);
player->selector[type].active_pad_index = index;
goto EXIT;
if (current_state < GST_STATE_PAUSED)
{
result = MM_ERROR_PLAYER_INVALID_STATE;
- LOGW ("Pipeline not in porper state\n");
+ LOGW("Pipeline not in porper state\n");
goto EXIT;
}
result = __mmplayer_change_selector_pad(player, type, index);
if (result != MM_ERROR_NONE)
{
- LOGE ("change selector pad error\n");
+ LOGE("change selector pad error\n");
goto EXIT;
}
if (current_state == GST_STATE_PLAYING)
{
- event = gst_event_new_seek (1.0, GST_FORMAT_TIME,(GstSeekFlags) (GST_SEEK_FLAG_SEGMENT | GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_SKIP),GST_SEEK_TYPE_SET, time, GST_SEEK_TYPE_NONE, -1);
+ event = gst_event_new_seek(1.0, GST_FORMAT_TIME, (GstSeekFlags)(GST_SEEK_FLAG_SEGMENT | GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_SKIP),GST_SEEK_TYPE_SET, time, GST_SEEK_TYPE_NONE, -1);
if (event)
{
- __gst_send_event_to_sink (player, event);
+ __gst_send_event_to_sink(player, event);
}
else
{
return result;
}
-int _mmplayer_get_subtitle_silent (MMHandleType hplayer, int* silent)
+int _mmplayer_get_subtitle_silent(MMHandleType hplayer, int* silent)
{
mm_player_t* player = (mm_player_t*) hplayer;
MMPLAYER_FENTER();
/* check player handle */
- MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
*silent = player->set_mode.subtitle_off;
}
gboolean
-__is_ms_buff_src( mm_player_t* player )
+__is_ms_buff_src(mm_player_t* player)
{
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, FALSE );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
- return ( player->profile.uri_type == MM_PLAYER_URI_TYPE_MS_BUFF) ? TRUE : FALSE;
+ return(player->profile.uri_type == MM_PLAYER_URI_TYPE_MS_BUFF) ? TRUE : FALSE;
}
gboolean
__has_suffix(mm_player_t* player, const gchar* suffix)
{
- MMPLAYER_RETURN_VAL_IF_FAIL( player, FALSE );
- MMPLAYER_RETURN_VAL_IF_FAIL( suffix, FALSE );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
+ MMPLAYER_RETURN_VAL_IF_FAIL(suffix, FALSE);
gboolean ret = FALSE;
gchar* t_url = g_ascii_strdown(player->profile.uri, -1);
gchar* t_suffix = g_ascii_strdown(suffix, -1);
- if ( g_str_has_suffix(player->profile.uri, suffix) )
+ if (g_str_has_suffix(player->profile.uri, suffix))
{
ret = TRUE;
}
{
mm_player_t* player = (mm_player_t*) hplayer;
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
MMPLAYER_VIDEO_SINK_CHECK(player);
int _x = 0;
int _y = 0;
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
MMPLAYER_VIDEO_SINK_CHECK(player);
{
mm_player_t* player = (mm_player_t*) hplayer;
- MMPLAYER_RETURN_VAL_IF_FAIL (player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
if (MMPLAYER_CURRENT_STATE(player) != MM_PLAYER_STATE_NULL)
{
{
mm_player_t* player = (mm_player_t*) hplayer;
- MMPLAYER_RETURN_VAL_IF_FAIL (player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
LOGD("enable sync handler : %s", (enable)?"ON":"OFF");
player->sync_handler = enable;
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL ( player && player->pipeline, MM_ERROR_PLAYER_NOT_INITIALIZED);
- MMPLAYER_RETURN_VAL_IF_FAIL ( player->pipeline->mainbin, MM_ERROR_PLAYER_NOT_INITIALIZED);
- MMPLAYER_RETURN_VAL_IF_FAIL ( player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ MMPLAYER_RETURN_VAL_IF_FAIL(player->pipeline->mainbin, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ MMPLAYER_RETURN_VAL_IF_FAIL(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, MM_ERROR_PLAYER_NOT_INITIALIZED);
// LOGD("in(us) : %lld, %lld, %lld, %lld, %lld", clock, clock_delta, video_time, media_clock, audio_time);
mainbin = player->pipeline->mainbin;
- curr_clock = gst_pipeline_get_clock (GST_PIPELINE_CAST(mainbin[MMPLAYER_M_PIPE].gst));
- curr_time = gst_clock_get_time (curr_clock);
+ curr_clock = gst_pipeline_get_clock(GST_PIPELINE_CAST(mainbin[MMPLAYER_M_PIPE].gst));
+ curr_time = gst_clock_get_time(curr_clock);
current_state = MMPLAYER_CURRENT_STATE(player);
- if ( current_state == MM_PLAYER_STATE_PLAYING )
+ if (current_state == MM_PLAYER_STATE_PLAYING)
query_ret = gst_element_query_position(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &position);
- if ( ( current_state != MM_PLAYER_STATE_PLAYING ) ||
- ( !query_ret ))
+ if ((current_state != MM_PLAYER_STATE_PLAYING) ||
+ (!query_ret))
{
position = player->last_position;
- LOGD ("query fail. %lld", position);
+ LOGD("query fail. %lld", position);
}
clock*= GST_USECOND;
clock_delta *= GST_USECOND;
api_delta = clock - curr_time;
- if ((player->video_share_api_delta == 0 ) || (player->video_share_api_delta > api_delta))
+ if ((player->video_share_api_delta == 0) || (player->video_share_api_delta > api_delta))
{
player->video_share_api_delta = api_delta;
}
clock_delta += (api_delta - player->video_share_api_delta);
}
- if ((player->video_share_clock_delta == 0 ) || (player->video_share_clock_delta > clock_delta))
+ if ((player->video_share_clock_delta == 0) || (player->video_share_clock_delta > clock_delta))
{
player->video_share_clock_delta = (gint64)clock_delta;
position_delta *= GST_USECOND;
adj_base_time = position_delta;
- LOGD ("video_share_clock_delta = %lld, adj = %lld", player->video_share_clock_delta, adj_base_time);
+ LOGD("video_share_clock_delta = %lld, adj = %lld", player->video_share_clock_delta, adj_base_time);
}
else
adj_base_time = position - new_play_time;
- LOGD ("%lld(delay) = %lld - %lld / %lld(adj) = %lld(slave_pos) - %lld(master_pos) - %lld(delay)",
+ LOGD("%lld(delay) = %lld - %lld / %lld(adj) = %lld(slave_pos) - %lld(master_pos) - %lld(delay)",
network_delay, clock_delta, player->video_share_clock_delta, adj_base_time, position, video_time, network_delay);
}
if ((player->pipeline->audiobin) &&
(player->pipeline->audiobin[MMPLAYER_A_SINK].gst))
{
- start_time_audio = gst_element_get_start_time (player->pipeline->audiobin[MMPLAYER_A_SINK].gst);
+ start_time_audio = gst_element_get_start_time(player->pipeline->audiobin[MMPLAYER_A_SINK].gst);
if (start_time_audio != GST_CLOCK_TIME_NONE)
{
- LOGD ("audio sink : gst_element_set_start_time -> NONE");
+ LOGD("audio sink : gst_element_set_start_time -> NONE");
gst_element_set_start_time(player->pipeline->audiobin[MMPLAYER_A_SINK].gst, GST_CLOCK_TIME_NONE);
}
- base_time = gst_element_get_base_time (player->pipeline->audiobin[MMPLAYER_A_SINK].gst);
+ base_time = gst_element_get_base_time(player->pipeline->audiobin[MMPLAYER_A_SINK].gst);
}
if ((player->pipeline->videobin) &&
(player->pipeline->videobin[MMPLAYER_V_SINK].gst))
{
- start_time_video = gst_element_get_start_time (player->pipeline->videobin[MMPLAYER_V_SINK].gst);
+ start_time_video = gst_element_get_start_time(player->pipeline->videobin[MMPLAYER_V_SINK].gst);
if (start_time_video != GST_CLOCK_TIME_NONE)
{
- LOGD ("video sink : gst_element_set_start_time -> NONE");
+ LOGD("video sink : gst_element_set_start_time -> NONE");
gst_element_set_start_time(player->pipeline->videobin[MMPLAYER_V_SINK].gst, GST_CLOCK_TIME_NONE);
}
// if videobin exist, get base_time from videobin.
- base_time = gst_element_get_base_time (player->pipeline->videobin[MMPLAYER_V_SINK].gst);
+ base_time = gst_element_get_base_time(player->pipeline->videobin[MMPLAYER_V_SINK].gst);
}
new_base_time = base_time + adj_base_time;
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL ( player && player->pipeline, MM_ERROR_PLAYER_NOT_INITIALIZED);
- MMPLAYER_RETURN_VAL_IF_FAIL ( player->pipeline->mainbin, MM_ERROR_PLAYER_NOT_INITIALIZED);
- MMPLAYER_RETURN_VAL_IF_FAIL ( player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ MMPLAYER_RETURN_VAL_IF_FAIL(player->pipeline->mainbin, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ MMPLAYER_RETURN_VAL_IF_FAIL(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, MM_ERROR_PLAYER_NOT_INITIALIZED);
- MMPLAYER_RETURN_VAL_IF_FAIL ( video_time, MM_ERROR_COMMON_INVALID_ARGUMENT );
- MMPLAYER_RETURN_VAL_IF_FAIL ( media_clock, MM_ERROR_COMMON_INVALID_ARGUMENT );
- MMPLAYER_RETURN_VAL_IF_FAIL ( audio_time, MM_ERROR_COMMON_INVALID_ARGUMENT );
+ MMPLAYER_RETURN_VAL_IF_FAIL(video_time, MM_ERROR_COMMON_INVALID_ARGUMENT);
+ MMPLAYER_RETURN_VAL_IF_FAIL(media_clock, MM_ERROR_COMMON_INVALID_ARGUMENT);
+ MMPLAYER_RETURN_VAL_IF_FAIL(audio_time, MM_ERROR_COMMON_INVALID_ARGUMENT);
mainbin = player->pipeline->mainbin;
- curr_clock = gst_pipeline_get_clock (GST_PIPELINE_CAST(mainbin[MMPLAYER_M_PIPE].gst));
+ curr_clock = gst_pipeline_get_clock(GST_PIPELINE_CAST(mainbin[MMPLAYER_M_PIPE].gst));
current_state = MMPLAYER_CURRENT_STATE(player);
- if ( current_state != MM_PLAYER_STATE_PAUSED )
+ if (current_state != MM_PLAYER_STATE_PAUSED)
query_ret = gst_element_query_position(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &position);
- if ( ( current_state == MM_PLAYER_STATE_PAUSED ) ||
- ( !query_ret ))
+ if ((current_state == MM_PLAYER_STATE_PAUSED) ||
+ (!query_ret))
{
position = player->last_position;
}
*media_clock = *video_time = *audio_time = (position/GST_USECOND);
- LOGD("media_clock: %lld, video_time: %lld (us)", *media_clock, *video_time);
+ LOGD("media_clock: %lld, video_time: %lld(us)", *media_clock, *video_time);
if (curr_clock)
- gst_object_unref (curr_clock);
+ gst_object_unref(curr_clock);
MMPLAYER_FLEAVE();
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
- MMPLAYER_RETURN_VAL_IF_FAIL ( angle, MM_ERROR_COMMON_INVALID_ARGUMENT );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ MMPLAYER_RETURN_VAL_IF_FAIL(angle, MM_ERROR_COMMON_INVALID_ARGUMENT);
if (player->v_stream_caps)
{
GstStructure *str = NULL;
- str = gst_caps_get_structure (player->v_stream_caps, 0);
- if ( !gst_structure_get_int (str, "orientation", &org_angle))
+ str = gst_caps_get_structure(player->v_stream_caps, 0);
+ if (!gst_structure_get_int(str, "orientation", &org_angle))
{
- LOGD ("missing 'orientation' field in video caps");
+ LOGD("missing 'orientation' field in video caps");
}
}
static gboolean
__mmplayer_add_dump_buffer_probe(mm_player_t *player, GstElement *element)
{
- MMPLAYER_RETURN_VAL_IF_FAIL (player, FALSE);
- MMPLAYER_RETURN_VAL_IF_FAIL (element, FALSE);
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
+ MMPLAYER_RETURN_VAL_IF_FAIL(element, FALSE);
- gchar *factory_name = GST_OBJECT_NAME (gst_element_get_factory(element));
+ gchar *factory_name = GST_OBJECT_NAME(gst_element_get_factory(element));
gchar dump_file_name[PLAYER_INI_MAX_STRLEN*2];
int idx = 0;
- for ( idx = 0; player->ini.dump_element_keyword[idx][0] != '\0'; idx++ )
+ for (idx = 0; player->ini.dump_element_keyword[idx][0] != '\0'; idx++)
{
if (g_strrstr(factory_name, player->ini.dump_element_keyword[idx]))
{
LOGD("dump [%s] sink pad", player->ini.dump_element_keyword[idx]);
mm_player_dump_t *dump_s;
- dump_s = g_malloc (sizeof(mm_player_dump_t));
+ dump_s = g_malloc(sizeof(mm_player_dump_t));
if (dump_s == NULL)
{
- LOGE ("malloc fail");
+ LOGE("malloc fail");
return FALSE;
}
dump_s->dump_element_file = NULL;
dump_s->dump_pad = NULL;
- dump_s->dump_pad = gst_element_get_static_pad (element, "sink");
+ dump_s->dump_pad = gst_element_get_static_pad(element, "sink");
if (dump_s->dump_pad)
{
- memset (dump_file_name, 0x00, PLAYER_INI_MAX_STRLEN*2);
- snprintf (dump_file_name, PLAYER_INI_MAX_STRLEN*2, "%s/%s_sink_pad.dump", player->ini.dump_element_path, player->ini.dump_element_keyword[idx]);
+ memset(dump_file_name, 0x00, PLAYER_INI_MAX_STRLEN*2);
+ snprintf(dump_file_name, PLAYER_INI_MAX_STRLEN*2, "%s/%s_sink_pad.dump", player->ini.dump_element_path, player->ini.dump_element_keyword[idx]);
dump_s->dump_element_file = fopen(dump_file_name,"w+");
- dump_s->probe_handle_id = gst_pad_add_probe (dump_s->dump_pad, GST_PAD_PROBE_TYPE_BUFFER, __mmplayer_dump_buffer_probe_cb, dump_s->dump_element_file, NULL);
+ dump_s->probe_handle_id = gst_pad_add_probe(dump_s->dump_pad, GST_PAD_PROBE_TYPE_BUFFER, __mmplayer_dump_buffer_probe_cb, dump_s->dump_element_file, NULL);
/* add list for removed buffer probe and close FILE */
- player->dump_list = g_list_append (player->dump_list, dump_s);
- LOGD ("%s sink pad added buffer probe for dump", factory_name);
+ player->dump_list = g_list_append(player->dump_list, dump_s);
+ LOGD("%s sink pad added buffer probe for dump", factory_name);
return TRUE;
}
else
{
g_free(dump_s);
dump_s = NULL;
- LOGE ("failed to get %s sink pad added", factory_name);
+ LOGE("failed to get %s sink pad added", factory_name);
}
GstBuffer *buffer = gst_pad_probe_info_get_buffer(info);
GstMapInfo probe_info = GST_MAP_INFO_INIT;
- MMPLAYER_RETURN_VAL_IF_FAIL ( dump_data, FALSE );
+ MMPLAYER_RETURN_VAL_IF_FAIL(dump_data, FALSE);
gst_buffer_map(buffer, &probe_info, GST_MAP_READ);
-// LOGD ("buffer timestamp = %" GST_TIME_FORMAT, GST_TIME_ARGS( GST_BUFFER_TIMESTAMP(buffer)));
+// LOGD("buffer timestamp = %" GST_TIME_FORMAT, GST_TIME_ARGS(GST_BUFFER_TIMESTAMP(buffer)));
- fwrite ( probe_info.data, 1, probe_info.size , dump_data);
+ fwrite(probe_info.data, 1, probe_info.size , dump_data);
return GST_PAD_PROBE_OK;
}
static void
-__mmplayer_release_dump_list (GList *dump_list)
+__mmplayer_release_dump_list(GList *dump_list)
{
if (dump_list)
{
GList *d_list = dump_list;
- for ( ;d_list ; d_list = g_list_next(d_list))
+ for (;d_list ; d_list = g_list_next(d_list))
{
mm_player_dump_t *dump_s = d_list->data;
if (dump_s->dump_pad)
{
if (dump_s->probe_handle_id)
{
- gst_pad_remove_probe (dump_s->dump_pad, dump_s->probe_handle_id);
+ gst_pad_remove_probe(dump_s->dump_pad, dump_s->probe_handle_id);
}
}
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
- MMPLAYER_RETURN_VAL_IF_FAIL ( exist, MM_ERROR_INVALID_ARGUMENT );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ MMPLAYER_RETURN_VAL_IF_FAIL(exist, MM_ERROR_INVALID_ARGUMENT);
*exist = player->has_closed_caption;
MMPlayerStreamType type = MM_PLAYER_STREAM_TYPE_AUDIO;
guint64 current_level_bytes=0;
- MMPLAYER_RETURN_IF_FAIL ( player );
+ MMPLAYER_RETURN_IF_FAIL(player);
g_object_get(G_OBJECT(element), "current-level-bytes", ¤t_level_bytes, NULL);
- LOGI("app-src: feed audio (%llu)\n", current_level_bytes);
+ LOGI("app-src: feed audio(%llu)\n", current_level_bytes);
if (player->media_stream_buffer_status_cb[type])
{
MMPlayerStreamType type = MM_PLAYER_STREAM_TYPE_VIDEO;
guint64 current_level_bytes=0;
- MMPLAYER_RETURN_IF_FAIL ( player );
+ MMPLAYER_RETURN_IF_FAIL(player);
g_object_get(G_OBJECT(element), "current-level-bytes", ¤t_level_bytes, NULL);
- LOGI("app-src: feed video (%llu)\n", current_level_bytes);
+ LOGI("app-src: feed video(%llu)\n", current_level_bytes);
if (player->media_stream_buffer_status_cb[type])
{
MMPlayerStreamType type = MM_PLAYER_STREAM_TYPE_TEXT;
guint64 current_level_bytes=0;
- MMPLAYER_RETURN_IF_FAIL ( player );
+ MMPLAYER_RETURN_IF_FAIL(player);
LOGI("app-src: feed subtitle\n");
MMPlayerStreamType type = MM_PLAYER_STREAM_TYPE_AUDIO;
guint64 current_level_bytes=0;
- MMPLAYER_RETURN_IF_FAIL ( player );
+ MMPLAYER_RETURN_IF_FAIL(player);
LOGI("app-src: audio buffer is full.\n");
MMPlayerStreamType type = MM_PLAYER_STREAM_TYPE_VIDEO;
guint64 current_level_bytes=0;
- MMPLAYER_RETURN_IF_FAIL ( player );
+ MMPLAYER_RETURN_IF_FAIL(player);
LOGI("app-src: video buffer is full.\n");
}
gboolean
-__gst_seek_audio_data (GstElement * appsrc, guint64 position, gpointer user_data)
+__gst_seek_audio_data(GstElement * appsrc, guint64 position, gpointer user_data)
{
mm_player_t *player = (mm_player_t*)user_data;
MMPlayerStreamType type = MM_PLAYER_STREAM_TYPE_AUDIO;
- MMPLAYER_RETURN_VAL_IF_FAIL( player, FALSE );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
LOGD("app-src: seek audio data %llu\n", position);
}
gboolean
-__gst_seek_video_data (GstElement * appsrc, guint64 position, gpointer user_data)
+__gst_seek_video_data(GstElement * appsrc, guint64 position, gpointer user_data)
{
mm_player_t *player = (mm_player_t*)user_data;
MMPlayerStreamType type = MM_PLAYER_STREAM_TYPE_VIDEO;
- MMPLAYER_RETURN_VAL_IF_FAIL( player, FALSE );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
LOGD("app-src: seek video data %llu\n", position);
}
gboolean
-__gst_seek_subtitle_data (GstElement * appsrc, guint64 position, gpointer user_data)
+__gst_seek_subtitle_data(GstElement * appsrc, guint64 position, gpointer user_data)
{
mm_player_t *player = (mm_player_t*)user_data;
MMPlayerStreamType type = MM_PLAYER_STREAM_TYPE_TEXT;
- MMPLAYER_RETURN_VAL_IF_FAIL( player, FALSE );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
LOGD("app-src: seek subtitle data\n");
MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL ( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
player->pcm_samplerate = samplerate;
player->pcm_channel = channel;