Name: libmm-player
Summary: Multimedia Framework Player Library
-Version: 0.6.172
+Version: 0.6.173
Release: 0
Group: Multimedia/Libraries
License: Apache-2.0
*/
#define MM_PLAYER_AUDIO_OFFLOAD "audio_offload"
+/**
+ * MM_PLAYER_PITCH_CONTROL (int)
+ */
+#define MM_PLAYER_PITCH_CONTROL "pitch_control"
+
+/**
+ * MM_PLAYER_PITCH_VALUE (double)
+ */
+#define MM_PLAYER_PITCH_VALUE "pitch_value"
+
+
#define BUFFER_MAX_PLANE_NUM (4)
typedef struct {
MMPLAYER_A_RESAMPLER,
MMPLAYER_A_DEINTERLEAVE,
MMPLAYER_A_RGVOL,
+ MMPLAYER_A_CONV_PITCH,
+ MMPLAYER_A_PITCH,
MMPLAYER_A_NUM
};
player = MM_PLAYER_CAST(handle);
MMPlayerGstPipelineInfo *pipeline = player->pipeline;
+ /* before preparing, just keep the attr value */
+ MMPLAYER_RETURN_VAL_IF_FAIL(pipeline && pipeline->mainbin, MM_ERROR_NONE);
+
+ if (g_strrstr(attribute_name, MM_PLAYER_PITCH_VALUE)) {
+ int pitch_control = 0;
+ double pitch_value = 0;
+
+ mm_attrs_multiple_get(player->attrs, NULL,
+ MM_PLAYER_PITCH_CONTROL, &pitch_control,
+ MM_PLAYER_PITCH_VALUE, &pitch_value,
+ NULL);
+
+ if (!pitch_control || !pipeline->audiobin[MMPLAYER_A_PITCH].gst)
+ return MM_ERROR_PLAYER_NO_OP;
+
+ LOGD("set pitch value to %1.3f", pitch_value);
+ g_object_set(pipeline->audiobin[MMPLAYER_A_PITCH].gst, "pitch", (gdouble)pitch_value, NULL);
+ }
+
/* Currently, there are only display related implementation at below */
- if (!pipeline ||
- !pipeline->videobin ||
+ if (!pipeline->videobin ||
!pipeline->videobin[MMPLAYER_V_SINK].gst) {
/*
* The attribute should be committed even though videobin is not created yet.
FALSE,
TRUE
},
+ {
+ "pitch_control", /* MM_PLAYER_PITCH_CONTROL */
+ MM_ATTRS_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ (void *)FALSE,
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ FALSE,
+ TRUE
+ },
+ {
+ "pitch_value", /* MM_PLAYER_PITCH_VALUE */
+ MM_ATTRS_TYPE_DOUBLE,
+ MM_ATTRS_FLAG_RW,
+ (void *)1,
+ MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
+ 0.5,
+ 2
+ },
};
num_of_attrs = ARRAY_SIZE(player_attrs);
GList *element_bucket = NULL;
GstCaps *acaps = NULL;
GstPad *sink_pad = NULL;
+ int pitch_control = 0;
+ double pitch_value = 1.0;
MMPLAYER_FENTER();
MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline &&
goto DONE;
}
+ /* pitch */
+ mm_attrs_multiple_get(player->attrs, NULL,
+ MM_PLAYER_PITCH_CONTROL, &pitch_control,
+ MM_PLAYER_PITCH_VALUE, &pitch_value,
+ NULL);
+
+ LOGD("pitch %d / %1.3f", pitch_control, pitch_value);
+ if (pitch_control && (player->videodec_linked == 0)) {
+ GstElementFactory *factory;
+
+ factory = gst_element_factory_find("pitch");
+ if (factory) {
+ gst_object_unref(factory);
+
+ /* converter */
+ MMPLAYER_CREATE_ELEMENT(audiobin, MMPLAYER_A_CONV_PITCH, "audioconvert", "audio convert pitch", TRUE, player);
+
+ /* pitch */
+ MMPLAYER_CREATE_ELEMENT(audiobin, MMPLAYER_A_PITCH, "pitch", "audio pitch", TRUE, player);
+ g_object_set(G_OBJECT(audiobin[MMPLAYER_A_PITCH].gst), "pitch", (gdouble)pitch_value, NULL);
+ } else {
+ LOGW("there is no pitch element");
+ }
+ }
+
/* converter */
MMPLAYER_CREATE_ELEMENT(audiobin, MMPLAYER_A_CONV, "audioconvert", "audio converter", TRUE, player);