Lines Matching refs:mix
106 MIX_RESULT mix_audio_initialize_default(MixAudio *mix, MixCodecMode mode, MixAudioInitParams *aip, …
107 MIX_RESULT mix_audio_configure_default(MixAudio *mix, MixAudioConfigParams *audioconfigparams, MixD…
108 MIX_RESULT mix_audio_decode_default(MixAudio *mix, const MixIOVec *iovin, gint iovincnt, guint64 *i…
109 MIX_RESULT mix_audio_capture_encode_default(MixAudio *mix, MixIOVec *iovout, gint iovoutcnt);
110 MIX_RESULT mix_audio_start_default(MixAudio *mix);
111 MIX_RESULT mix_audio_stop_drop_default(MixAudio *mix);
112 MIX_RESULT mix_audio_stop_drain_default(MixAudio *mix);
113 MIX_RESULT mix_audio_pause_default(MixAudio *mix);
114 MIX_RESULT mix_audio_resume_default(MixAudio *mix);
115 MIX_RESULT mix_audio_get_timestamp_default(MixAudio *mix, guint64 *msecs);
116 MIX_RESULT mix_audio_set_mute_default(MixAudio *mix, gboolean mute);
117 MIX_RESULT mix_audio_get_mute_default(MixAudio *mix, gboolean* muted);
118 MIX_RESULT mix_audio_get_max_vol_default(MixAudio *mix, gint *maxvol);
119 MIX_RESULT mix_audio_get_min_vol_default(MixAudio *mix, gint *minvol);
120 MIX_RESULT mix_audio_get_volume_default(MixAudio *mix, gint *currvol, MixVolType type);
121 MIX_RESULT mix_audio_set_volume_default(MixAudio *mix, gint currvol, MixVolType type, gulong msecs,…
122 MIX_RESULT mix_audio_deinitialize_default(MixAudio *mix);
123 MIX_RESULT mix_audio_get_stream_state_default(MixAudio *mix, MixStreamState *streamState);
124 MIX_RESULT mix_audio_get_state_default(MixAudio *mix, MixState *state);
125 MIX_RESULT mix_audio_is_am_available_default(MixAudio *mix, MixAudioManager am, gboolean *avail);
126 MIX_RESULT mix_audio_get_output_configuration_default(MixAudio *mix, MixAudioConfigParams **audioco…
129 MIX_RESULT mix_audio_am_unregister(MixAudio *mix, MixAudioConfigParams *audioconfigparams);
130 MIX_RESULT mix_audio_am_register(MixAudio *mix, MixAudioConfigParams *audioconfigparams);
139 static MIX_RESULT mix_audio_FW_INFO(MixAudio *mix);
140 static MIX_RESULT mix_audio_SST_SET_PARAMS(MixAudio *mix, MixAudioConfigParams *params);
141 static MIX_RESULT mix_audio_SST_writev(MixAudio *mix, const MixIOVec *iovin, gint iovincnt, guint64…
142 static MIX_RESULT mix_audio_SST_STREAM_DECODE(MixAudio *mix, const MixIOVec *iovin, gint iovincnt, …
143 static void mix_audio_debug_dump(MixAudio *mix);
292 MixAudio *mix = MIX_AUDIO(obj); in mix_audio_finalize() local
294 if (G_UNLIKELY(!mix)) return; in mix_audio_finalize()
305 g_debug("_finalized(). bytes written=%" G_GUINT64_FORMAT, mix->bytes_written); in mix_audio_finalize()
307 g_static_rec_mutex_free (&mix->streamlock); in mix_audio_finalize()
308 g_static_rec_mutex_free (&mix->controllock); in mix_audio_finalize()
310 if (mix->audioconfigparams) in mix_audio_finalize()
312 mix_acp_unref(mix->audioconfigparams); in mix_audio_finalize()
313 mix->audioconfigparams = NULL; in mix_audio_finalize()
317 MixAudio *mix_audio_ref(MixAudio *mix) in mix_audio_ref() argument
319 if (G_UNLIKELY(!mix)) return NULL; in mix_audio_ref()
321 return (MixAudio*)g_object_ref(G_OBJECT(mix)); in mix_audio_ref()
324 MIX_RESULT mix_audio_initialize_default(MixAudio *mix, MixCodecMode mode, MixAudioInitParams *aip, … in mix_audio_initialize_default() argument
328 if (G_UNLIKELY(!mix)) return MIX_RESULT_NULL_PTR; in mix_audio_initialize_default()
335 if (!g_static_rec_mutex_trylock(&mix->streamlock)) return MIX_RESULT_WRONG_STATE; in mix_audio_initialize_default()
338 _LOCK(&mix->controllock); in mix_audio_initialize_default()
340 if (mix->state == MIX_STATE_UNINITIALIZED) in mix_audio_initialize_default()
357 mix->fileDescriptor = open(fn, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR); in mix_audio_initialize_default()
359 if (mix->fileDescriptor == -1) in mix_audio_initialize_default()
361 mix->fileDescriptor = g_file_open_tmp ("mixaudio.XXXXXX", &filename, &err); in mix_audio_initialize_default()
379 mix->fileDescriptor = open(LPE_DEVICE, O_RDWR); in mix_audio_initialize_default()
381 if (mix->fileDescriptor != -1) in mix_audio_initialize_default()
383 mix->codecMode = mode; in mix_audio_initialize_default()
384 mix->state = MIX_STATE_INITIALIZED; in mix_audio_initialize_default()
386 g_debug("open() succeeded. fd=%d", mix->fileDescriptor); in mix_audio_initialize_default()
404 _UNLOCK(&mix->controllock); in mix_audio_initialize_default()
405 _UNLOCK(&mix->streamlock); in mix_audio_initialize_default()
417 gboolean mix_audio_base_am_is_enabled(MixAudio *mix) in mix_audio_base_am_is_enabled() argument
433 MIX_RESULT mix_audio_SST_SET_PARAMS(MixAudio *mix, MixAudioConfigParams *params) in mix_audio_SST_SET_PARAMS() argument
437 if (G_UNLIKELY(!mix)) return MIX_RESULT_NULL_PTR; in mix_audio_SST_SET_PARAMS()
439 if (mix->state == MIX_STATE_UNINITIALIZED) return MIX_RESULT_NOT_INIT; in mix_audio_SST_SET_PARAMS()
454 sst_params.stream_id = mix->streamID; in mix_audio_SST_SET_PARAMS()
457 if (mix->codecMode == MIX_CODING_ENCODE) in mix_audio_SST_SET_PARAMS()
470 g_debug("Calling SNDRV_SST_STREAM_SET_PARAMS. fd=%d", mix->fileDescriptor); in mix_audio_SST_SET_PARAMS()
471 retVal = ioctl(mix->fileDescriptor, SNDRV_SST_STREAM_SET_PARAMS, &sst_params); in mix_audio_SST_SET_PARAMS()
486 mix->deviceState = MIX_AUDIO_DEV_ALLOCATED; in mix_audio_SST_SET_PARAMS()
487 mix->streamState = MIX_STREAM_STOPPED; in mix_audio_SST_SET_PARAMS()
488 mix->streamID = sst_params.stream_id; in mix_audio_SST_SET_PARAMS()
490 if (MIX_IS_AUDIOCONFIGPARAMS(mix->audioconfigparams)) in mix_audio_SST_SET_PARAMS()
492 mix_acp_unref(mix->audioconfigparams); in mix_audio_SST_SET_PARAMS()
493 mix->audioconfigparams=NULL; in mix_audio_SST_SET_PARAMS()
496 mix->audioconfigparams = MIX_AUDIOCONFIGPARAMS(mix_params_dup(MIX_PARAMS(params))); in mix_audio_SST_SET_PARAMS()
498 g_debug("SET_PARAMS succeeded streamID=%d.", mix->streamID); in mix_audio_SST_SET_PARAMS()
539 MIX_RESULT mix_audio_get_state_default(MixAudio *mix, MixState *state) in mix_audio_get_state_default() argument
542 if (G_UNLIKELY(!mix)) return MIX_RESULT_NULL_PTR; in mix_audio_get_state_default()
545 *state = mix->state; in mix_audio_get_state_default()
552 MIX_RESULT mix_audio_decode_default(MixAudio *mix, const MixIOVec *iovin, gint iovincnt, guint64 *i… in mix_audio_decode_default() argument
556 if (G_UNLIKELY(!mix)) return MIX_RESULT_NULL_PTR; in mix_audio_decode_default()
558 if (!g_static_rec_mutex_trylock(&mix->streamlock)) return MIX_RESULT_WRONG_STATE; in mix_audio_decode_default()
560 if (mix->state != MIX_STATE_CONFIGURED) _UNLOCK_RETURN(&mix->streamlock, MIX_RESULT_WRONG_STATE); in mix_audio_decode_default()
562 if (MIX_ACP_DECODEMODE(mix->audioconfigparams) == MIX_DECODE_DIRECTRENDER) in mix_audio_decode_default()
563 ret = mix_audio_SST_writev(mix, iovin, iovincnt, insize); in mix_audio_decode_default()
565 ret = mix_audio_SST_STREAM_DECODE(mix, iovin, iovincnt, insize, iovout, iovoutcnt, outsize); in mix_audio_decode_default()
567 _UNLOCK(&mix->streamlock); in mix_audio_decode_default()
572 MIX_RESULT mix_audio_deinitialize_default(MixAudio *mix) in mix_audio_deinitialize_default() argument
575 if (G_UNLIKELY(!mix)) return MIX_RESULT_NULL_PTR; in mix_audio_deinitialize_default()
577 if (!g_static_rec_mutex_trylock(&mix->streamlock)) return MIX_RESULT_WRONG_STATE; in mix_audio_deinitialize_default()
580 if (mix->amStreamID && (lpe_stream_unregister(mix->amStreamID) < 0)) { in mix_audio_deinitialize_default()
586 _LOCK(&mix->controllock); in mix_audio_deinitialize_default()
588 if (mix->state == MIX_STATE_UNINITIALIZED) in mix_audio_deinitialize_default()
590 else if ((mix->streamState != MIX_STREAM_STOPPED) && (mix->streamState != MIX_STREAM_NULL)) in mix_audio_deinitialize_default()
594 if (mix->fileDescriptor != -1) in mix_audio_deinitialize_default()
596 g_debug("Closing fd=%d\n", mix->fileDescriptor); in mix_audio_deinitialize_default()
597 close(mix->fileDescriptor); in mix_audio_deinitialize_default()
598 mix->fileDescriptor = -1; in mix_audio_deinitialize_default()
599 mix->deviceState = MIX_AUDIO_DEV_CLOSED; in mix_audio_deinitialize_default()
601 mix->state = MIX_STATE_UNINITIALIZED; in mix_audio_deinitialize_default()
604 mix->bytes_written = 0; in mix_audio_deinitialize_default()
606 _UNLOCK(&mix->controllock); in mix_audio_deinitialize_default()
607 _UNLOCK(&mix->streamlock); in mix_audio_deinitialize_default()
613 MIX_RESULT mix_audio_stop_drop_default(MixAudio *mix) in mix_audio_stop_drop_default() argument
617 if (G_UNLIKELY(!mix)) return MIX_RESULT_NULL_PTR; in mix_audio_stop_drop_default()
619 _LOCK(&mix->controllock); in mix_audio_stop_drop_default()
621 if (mix->state != MIX_STATE_CONFIGURED) in mix_audio_stop_drop_default()
622 _UNLOCK_RETURN(&mix->controllock, MIX_RESULT_NOT_CONFIGURED); in mix_audio_stop_drop_default()
633 g_debug("Calling SNDRV_SST_STREAM_DROP. fd=%d", mix->fileDescriptor); in mix_audio_stop_drop_default()
634 retVal = ioctl(mix->fileDescriptor, SNDRV_SST_STREAM_DROP); in mix_audio_stop_drop_default()
640 mix->streamState = MIX_STREAM_STOPPED; in mix_audio_stop_drop_default()
650 _UNLOCK(&mix->controllock); in mix_audio_stop_drop_default()
655 MIX_RESULT mix_audio_stop_drain_default(MixAudio *mix) in mix_audio_stop_drain_default() argument
660 if (G_UNLIKELY(!mix)) return MIX_RESULT_NULL_PTR; in mix_audio_stop_drain_default()
664 if (g_static_rec_mutex_trylock(&mix->streamlock)) in mix_audio_stop_drain_default()
668 if (mix->state != MIX_STATE_CONFIGURED) in mix_audio_stop_drain_default()
669 _UNLOCK_RETURN(&mix->streamlock, MIX_RESULT_NOT_CONFIGURED); in mix_audio_stop_drain_default()
671 _LOCK(&mix->controllock); in mix_audio_stop_drain_default()
673 if (mix->streamState == MIX_STREAM_STOPPED) in mix_audio_stop_drain_default()
675 …else if ((mix->streamState == MIX_STREAM_DRAINING) || mix->streamState == MIX_STREAM_PAUSED_DRAINI… in mix_audio_stop_drain_default()
681 mix->streamState = MIX_STREAM_DRAINING; in mix_audio_stop_drain_default()
684 _UNLOCK(&mix->controllock); in mix_audio_stop_drain_default()
697 g_debug("Calling SNDRV_SST_STREAM_DRAIN fd=%d", mix->fileDescriptor); in mix_audio_stop_drain_default()
698 retVal = ioctl(mix->fileDescriptor, SNDRV_SST_STREAM_DRAIN); in mix_audio_stop_drain_default()
704 _LOCK(&mix->controllock); in mix_audio_stop_drain_default()
705 if (mix->streamState != MIX_STREAM_STOPPED) in mix_audio_stop_drain_default()
712 _UNLOCK(&mix->controllock); in mix_audio_stop_drain_default()
716 _LOCK(&mix->controllock); in mix_audio_stop_drain_default()
717 if ((mix->streamState != MIX_STREAM_DRAINING) && in mix_audio_stop_drain_default()
718 (mix->streamState != MIX_STREAM_STOPPED)) in mix_audio_stop_drain_default()
721 g_warning("MIX Internal state error! DRAIN state(%u) changed!",mix->streamState); in mix_audio_stop_drain_default()
726 mix->streamState = MIX_STREAM_STOPPED; in mix_audio_stop_drain_default()
729 _UNLOCK(&mix->controllock); in mix_audio_stop_drain_default()
733 _UNLOCK(&mix->streamlock); in mix_audio_stop_drain_default()
745 MIX_RESULT mix_audio_start_default(MixAudio *mix) in mix_audio_start_default() argument
749 if (G_UNLIKELY(!mix)) return MIX_RESULT_NULL_PTR; in mix_audio_start_default()
751 _LOCK(&mix->controllock); in mix_audio_start_default()
753 if (mix->state != MIX_STATE_CONFIGURED) in mix_audio_start_default()
754 _UNLOCK_RETURN(&mix->controllock, MIX_RESULT_NOT_CONFIGURED); in mix_audio_start_default()
756 if (MIX_ACP_DECODEMODE(mix->audioconfigparams) == MIX_DECODE_DECODERETURN) in mix_audio_start_default()
757 _UNLOCK_RETURN(&mix->controllock, MIX_RESULT_WRONGMODE); in mix_audio_start_default()
760 switch (mix->streamState) in mix_audio_start_default()
773 g_debug("Calling SNDRV_SST_STREAM_START. fd=%d", mix->fileDescriptor); in mix_audio_start_default()
774 retVal = ioctl(mix->fileDescriptor, SNDRV_SST_STREAM_START); in mix_audio_start_default()
781 mix_audio_debug_dump(mix); in mix_audio_start_default()
785 mix->streamState = MIX_STREAM_PLAYING; in mix_audio_start_default()
796 _UNLOCK(&mix->controllock); in mix_audio_start_default()
801 if (mix->ts_last == 0) in mix_audio_start_default()
805 mix->ts_last = 1000ll * tval.tv_sec + tval.tv_usec / 1000; in mix_audio_start_default()
824 MIX_RESULT mix_audio_configure_default(MixAudio *mix, MixAudioConfigParams *audioconfigparams, MixD… in mix_audio_configure_default() argument
828 if (G_UNLIKELY(!mix)) return MIX_RESULT_NULL_PTR; in mix_audio_configure_default()
836 if (!g_static_rec_mutex_trylock(&mix->streamlock)) return MIX_RESULT_WRONG_STATE; in mix_audio_configure_default()
838 _LOCK(&mix->controllock); in mix_audio_configure_default()
841 if (mix->state == MIX_STATE_UNINITIALIZED) in mix_audio_configure_default()
843 else if ((mix->codecMode != MIX_CODING_DECODE) && (mix->codecMode != MIX_CODING_ENCODE)) in mix_audio_configure_default()
845 else if ((mix->streamState != MIX_STREAM_STOPPED) && (mix->streamState != MIX_STREAM_NULL)) in mix_audio_configure_default()
851 _UNLOCK(&mix->controllock); in mix_audio_configure_default()
852 _UNLOCK(&mix->streamlock); in mix_audio_configure_default()
857 mix->useIAM = TRUE; in mix_audio_configure_default()
861 ret = mix_audio_am_unregister(mix, audioconfigparams); in mix_audio_configure_default()
865 ret = mix_audio_SST_SET_PARAMS(mix, audioconfigparams); in mix_audio_configure_default()
870 ret = mix_audio_am_register(mix, audioconfigparams); in mix_audio_configure_default()
875 mix->state = MIX_STATE_CONFIGURED; in mix_audio_configure_default()
879 mix->state = MIX_STATE_INITIALIZED; in mix_audio_configure_default()
882 _UNLOCK(&mix->controllock); in mix_audio_configure_default()
883 _UNLOCK(&mix->streamlock); in mix_audio_configure_default()
888 MIX_RESULT mix_audio_get_timestamp_default(MixAudio *mix, guint64 *msecs) in mix_audio_get_timestamp_default() argument
892 if (G_UNLIKELY(!mix)) return MIX_RESULT_NULL_PTR; in mix_audio_get_timestamp_default()
896 _LOCK(&mix->controllock); in mix_audio_get_timestamp_default()
898 if (mix->state == MIX_STATE_CONFIGURED) in mix_audio_get_timestamp_default()
900 …if ((mix->codecMode == MIX_CODING_DECODE) && (MIX_ACP_DECODEMODE(mix->audioconfigparams) == MIX_DE… in mix_audio_get_timestamp_default()
911 if (MIX_ACP_BITRATE(mix->audioconfigparams) > 0) in mix_audio_get_timestamp_default()
915 ts = mix->bytes_written * 8000 / MIX_ACP_BITRATE(mix->audioconfigparams); in mix_audio_get_timestamp_default()
917 else if (mix->ts_last) in mix_audio_get_timestamp_default()
922 ts -= mix->ts_last; in mix_audio_get_timestamp_default()
923 ts += mix->ts_elapsed; in mix_audio_get_timestamp_default()
930 g_debug("Calling SNDRV_SST_STREAM_GET_TSTAMP. fd=%d", mix->fileDescriptor); in mix_audio_get_timestamp_default()
931 ioctl(mix->fileDescriptor, SNDRV_SST_STREAM_GET_TSTAMP, &ts); in mix_audio_get_timestamp_default()
939 mix_audio_debug_dump(mix); in mix_audio_get_timestamp_default()
951 _UNLOCK(&mix->controllock); in mix_audio_get_timestamp_default()
965 MIX_RESULT mix_audio_am_unregister(MixAudio *mix, MixAudioConfigParams *audioconfigparams) in mix_audio_am_unregister() argument
969 if (G_UNLIKELY(!mix)) return MIX_RESULT_NULL_PTR; in mix_audio_am_unregister()
971 …if (mix->am_registered && MIX_IS_AUDIOCONFIGPARAMS(mix->audioconfigparams) && MIX_IS_AUDIOCONFIGPA… in mix_audio_am_unregister()
974 if ((MIX_ACP_DECODEMODE(mix->audioconfigparams) != MIX_ACP_DECODEMODE(audioconfigparams)) || in mix_audio_am_unregister()
975 …mix_audio_AM_Change(mix->audioconfigparams, audioconfigparams)) //TODO: add checking for SST change in mix_audio_am_unregister()
978 if (mix->amStreamID > 0) { in mix_audio_am_unregister()
979 if (lpe_stream_unregister(mix->amStreamID) != 0) { in mix_audio_am_unregister()
982 mix->am_registered = FALSE; in mix_audio_am_unregister()
990 MIX_RESULT mix_audio_am_register(MixAudio *mix, MixAudioConfigParams *audioconfigparams) in mix_audio_am_register() argument
994 if (G_UNLIKELY(!mix)) return MIX_RESULT_NULL_PTR; in mix_audio_am_register()
998 if (mix->codecMode == MIX_CODING_DECODE) in mix_audio_am_register()
1000 else if (mix->codecMode == MIX_CODING_ENCODE) in mix_audio_am_register()
1010 if (mix->useIAM && !mix->am_registered) { in mix_audio_am_register()
1011 …gint32 amStreamID = lpe_stream_register(mix->streamID, "music", audioconfigparams->stream_name, co… in mix_audio_am_register()
1014 mix->amStreamID = 0; in mix_audio_am_register()
1018 mix->amStreamID = 0; in mix_audio_am_register()
1021 mix->am_registered = TRUE; in mix_audio_am_register()
1022 mix->amStreamID = amStreamID; in mix_audio_am_register()
1029 MIX_RESULT mix_audio_capture_encode_default(MixAudio *mix, MixIOVec *iovout, gint iovoutcnt) in mix_audio_capture_encode_default() argument
1034 if (G_UNLIKELY(!mix)) return MIX_RESULT_NULL_PTR; in mix_audio_capture_encode_default()
1055 bytes_read = readv(mix->fileDescriptor, vec, iovoutcnt); in mix_audio_capture_encode_default()
1072 MIX_RESULT mix_audio_get_max_vol_default(MixAudio *mix, gint *maxvol) in mix_audio_get_max_vol_default() argument
1074 if (G_UNLIKELY(!mix)) return MIX_RESULT_NULL_PTR; in mix_audio_get_max_vol_default()
1080 _LOCK(&mix->controllock); in mix_audio_get_max_vol_default()
1084 ret = mix_audio_FW_INFO(mix); in mix_audio_get_max_vol_default()
1092 _UNLOCK(&mix->controllock); in mix_audio_get_max_vol_default()
1098 MIX_RESULT mix_audio_get_min_vol_default(MixAudio *mix, gint *minvol) in mix_audio_get_min_vol_default() argument
1100 if (G_UNLIKELY(!mix)) return MIX_RESULT_NULL_PTR; in mix_audio_get_min_vol_default()
1106 _LOCK(&mix->controllock); in mix_audio_get_min_vol_default()
1110 ret = mix_audio_FW_INFO(mix); in mix_audio_get_min_vol_default()
1118 _UNLOCK(&mix->controllock); in mix_audio_get_min_vol_default()
1123 MIX_RESULT mix_audio_get_stream_state_default(MixAudio *mix, MixStreamState *streamState) in mix_audio_get_stream_state_default() argument
1125 if (G_UNLIKELY(!mix)) return MIX_RESULT_NULL_PTR; in mix_audio_get_stream_state_default()
1129 _LOCK(&mix->controllock); in mix_audio_get_stream_state_default()
1131 …if (mix->state != MIX_STATE_CONFIGURED) _UNLOCK_RETURN(&mix->controllock, MIX_RESULT_NOT_CONFIGURE… in mix_audio_get_stream_state_default()
1134 if (mix->streamState == MIX_STREAM_PAUSED_DRAINING) in mix_audio_get_stream_state_default()
1137 *streamState = mix->streamState; in mix_audio_get_stream_state_default()
1139 _UNLOCK(&mix->controllock); in mix_audio_get_stream_state_default()
1145 MIX_RESULT mix_audio_get_volume_default(MixAudio *mix, gint *currvol, MixVolType type) in mix_audio_get_volume_default() argument
1147 if (G_UNLIKELY(!mix)) return MIX_RESULT_NULL_PTR; in mix_audio_get_volume_default()
1156 _LOCK(&mix->controllock); in mix_audio_get_volume_default()
1158 …if (mix->state != MIX_STATE_CONFIGURED) _UNLOCK_RETURN(&mix->controllock, MIX_RESULT_NOT_CONFIGURE… in mix_audio_get_volume_default()
1160 vol.stream_id = mix->streamID; in mix_audio_get_volume_default()
1167 g_debug("Calling SNDRV_SST_GET_VOL. fd=%d", mix->fileDescriptor); in mix_audio_get_volume_default()
1168 retVal = ioctl(mix->fileDescriptor, SNDRV_SST_GET_VOL, &vol); in mix_audio_get_volume_default()
1176 mix_audio_debug_dump(mix); in mix_audio_get_volume_default()
1181 ret = mix_audio_get_max_vol(mix, &maxvol); in mix_audio_get_volume_default()
1192 _UNLOCK(&mix->controllock); in mix_audio_get_volume_default()
1197 MIX_RESULT mix_audio_get_mute_default(MixAudio *mix, gboolean* muted) in mix_audio_get_mute_default() argument
1203 MIX_RESULT mix_audio_set_mute_default(MixAudio *mix, gboolean mute) in mix_audio_set_mute_default() argument
1205 if (G_UNLIKELY(!mix)) return MIX_RESULT_NULL_PTR; in mix_audio_set_mute_default()
1214 _LOCK(&mix->controllock); in mix_audio_set_mute_default()
1216 …if (mix->state != MIX_STATE_CONFIGURED) _UNLOCK_RETURN(&mix->controllock, MIX_RESULT_NOT_CONFIGURE… in mix_audio_set_mute_default()
1218 m.stream_id = mix->streamID; in mix_audio_set_mute_default()
1225 retVal = ioctl(mix->fileDescriptor, SNDRV_SST_MUTE, &m); in mix_audio_set_mute_default()
1233 mix_audio_debug_dump(mix); in mix_audio_set_mute_default()
1236 _UNLOCK(&mix->controllock); in mix_audio_set_mute_default()
1241 MIX_RESULT mix_audio_pause_default(MixAudio *mix) in mix_audio_pause_default() argument
1243 if (G_UNLIKELY(!mix)) return MIX_RESULT_NULL_PTR; in mix_audio_pause_default()
1247 _LOCK(&mix->controllock); in mix_audio_pause_default()
1249 …if (mix->state != MIX_STATE_CONFIGURED) _UNLOCK_RETURN(&mix->controllock, MIX_RESULT_NOT_CONFIGURE… in mix_audio_pause_default()
1251 if (mix->streamState == MIX_STREAM_PAUSED) _UNLOCK_RETURN(&mix->controllock, MIX_RESULT_SUCCESS); in mix_audio_pause_default()
1253 if ((mix->streamState != MIX_STREAM_PLAYING) && (mix->streamState != MIX_STREAM_DRAINING)) in mix_audio_pause_default()
1254 _UNLOCK_RETURN(&mix->controllock, MIX_RESULT_WRONG_STATE); in mix_audio_pause_default()
1261 g_debug("Calling SNDRV_SST_STREAM_PAUSE. fd=%d", mix->fileDescriptor); in mix_audio_pause_default()
1262 retVal = ioctl(mix->fileDescriptor, SNDRV_SST_STREAM_PAUSE); in mix_audio_pause_default()
1268 if (mix->streamState == MIX_STREAM_DRAINING) in mix_audio_pause_default()
1283 mix_audio_debug_dump(mix); in mix_audio_pause_default()
1288 if (mix->streamState == MIX_STREAM_DRAINING) in mix_audio_pause_default()
1290 mix->streamState = MIX_STREAM_PAUSED_DRAINING; in mix_audio_pause_default()
1294 mix->streamState = MIX_STREAM_PAUSED; in mix_audio_pause_default()
1298 _UNLOCK(&mix->controllock); in mix_audio_pause_default()
1306 mix->ts_elapsed += ts - mix->ts_last; in mix_audio_pause_default()
1307 mix->ts_last = 0; in mix_audio_pause_default()
1313 MIX_RESULT mix_audio_resume_default(MixAudio *mix) in mix_audio_resume_default() argument
1315 if (G_UNLIKELY(!mix)) return MIX_RESULT_NULL_PTR; in mix_audio_resume_default()
1319 _LOCK(&mix->controllock); in mix_audio_resume_default()
1321 …if (mix->state != MIX_STATE_CONFIGURED) _UNLOCK_RETURN(&mix->controllock, MIX_RESULT_NOT_CONFIGURE… in mix_audio_resume_default()
1323 if ((mix->streamState == MIX_STREAM_PLAYING) || (mix->streamState == MIX_STREAM_DRAINING)) in mix_audio_resume_default()
1324 _UNLOCK_RETURN(&mix->controllock, MIX_RESULT_SUCCESS); in mix_audio_resume_default()
1326 if ((mix->streamState != MIX_STREAM_PAUSED_DRAINING) && (mix->streamState != MIX_STREAM_PAUSED)) in mix_audio_resume_default()
1327 _UNLOCK_RETURN(&mix->controllock, MIX_RESULT_WRONG_STATE); in mix_audio_resume_default()
1335 retVal = ioctl(mix->fileDescriptor, SNDRV_SST_STREAM_RESUME); in mix_audio_resume_default()
1343 mix_audio_debug_dump(mix); in mix_audio_resume_default()
1346 if (mix->streamState == MIX_STREAM_PAUSED_DRAINING) in mix_audio_resume_default()
1347 mix->streamState = MIX_STREAM_DRAINING; in mix_audio_resume_default()
1349 mix->streamState = MIX_STREAM_PLAYING; in mix_audio_resume_default()
1352 _UNLOCK(&mix->controllock); in mix_audio_resume_default()
1360 mix->ts_last = ts; in mix_audio_resume_default()
1367 MIX_RESULT mix_audio_set_volume_default(MixAudio *mix, gint currvol, MixVolType type, gulong msecs,… in mix_audio_set_volume_default() argument
1369 if (G_UNLIKELY(!mix)) return MIX_RESULT_NULL_PTR; in mix_audio_set_volume_default()
1378 if (!mix) return MIX_RESULT_NULL_PTR; in mix_audio_set_volume_default()
1382 _LOCK(&mix->controllock); in mix_audio_set_volume_default()
1384 …if (mix->state != MIX_STATE_CONFIGURED) _UNLOCK_RETURN(&mix->controllock, MIX_RESULT_NOT_CONFIGURE… in mix_audio_set_volume_default()
1386 vol.stream_id = mix->streamID; in mix_audio_set_volume_default()
1395 ret = mix_audio_get_max_vol(mix, &maxvol); in mix_audio_set_volume_default()
1412 retVal = ioctl(mix->fileDescriptor, SNDRV_SST_SET_VOL, &vol); in mix_audio_set_volume_default()
1420 mix_audio_debug_dump(mix); in mix_audio_set_volume_default()
1423 _UNLOCK(&mix->controllock); in mix_audio_set_volume_default()
1428 MIX_RESULT mix_audio_FW_INFO(MixAudio *mix) in mix_audio_FW_INFO() argument
1430 if (G_UNLIKELY(!mix)) return MIX_RESULT_NULL_PTR; in mix_audio_FW_INFO()
1434 _LOCK(&mix->controllock); in mix_audio_FW_INFO()
1442 g_debug("calling SNDRV_SST_FW_INFO fd=%d", mix->fileDescriptor); in mix_audio_FW_INFO()
1443 retVal = ioctl(mix->fileDescriptor, SNDRV_SST_FW_INFO, &cur_FW_INFO); in mix_audio_FW_INFO()
1455 mix_audio_debug_dump(mix); in mix_audio_FW_INFO()
1458 _UNLOCK(&mix->controllock); in mix_audio_FW_INFO()
1464 static MIX_RESULT mix_audio_SST_writev(MixAudio *mix, const MixIOVec *iovin, gint iovincnt, guint64… in mix_audio_SST_writev() argument
1468 if (G_UNLIKELY(!mix)) return MIX_RESULT_NULL_PTR; in mix_audio_SST_writev()
1478 if (!mix) return MIX_RESULT_NULL_PTR; in mix_audio_SST_writev()
1497 if (MIX_ACP_BITRATE(mix->audioconfigparams) > 0) in mix_audio_SST_writev()
1499 wait_time = total_bytes*8*1000*1000/MIX_ACP_BITRATE(mix->audioconfigparams); in mix_audio_SST_writev()
1505 g_debug("calling writev(fd=%d)", mix->fileDescriptor); in mix_audio_SST_writev()
1506 written = writev(mix->fileDescriptor, in, iovincnt); in mix_audio_SST_writev()
1507 if (written >= 0) mix->bytes_written += written; in mix_audio_SST_writev()
1508 g_debug("writev() returned %d. Total %" G_GUINT64_FORMAT, written, mix->bytes_written); in mix_audio_SST_writev()
1515 if ((MIX_ACP_BITRATE(mix->audioconfigparams) > 0) && (wait_time > elapsed)) in mix_audio_SST_writev()
1521 g_debug("calling writev(fd=%d) with %d", mix->fileDescriptor, total_bytes); in mix_audio_SST_writev()
1522 written = writev(mix->fileDescriptor, in, iovincnt); in mix_audio_SST_writev()
1523 if (written > 0) mix->bytes_written += written; in mix_audio_SST_writev()
1524 g_debug("writev() returned %d. Total %" G_GUINT64_FORMAT, written, mix->bytes_written); in mix_audio_SST_writev()
1545 static MIX_RESULT mix_audio_SST_STREAM_DECODE(MixAudio *mix, const MixIOVec *iovin, gint iovincnt, … in mix_audio_SST_STREAM_DECODE() argument
1550 if (G_UNLIKELY(!mix)) return MIX_RESULT_NULL_PTR; in mix_audio_SST_STREAM_DECODE()
1626 g_debug("calling stub STREAM_DECODE (writev) (fd=%d)", mix->fileDescriptor); in mix_audio_SST_STREAM_DECODE()
1627 written = writev(mix->fileDescriptor, in, iovincnt); in mix_audio_SST_STREAM_DECODE()
1630 mix->bytes_written += written; in mix_audio_SST_STREAM_DECODE()
1634 …g_debug("stub STREAM_DECODE (writev) returned %d. Total %" G_GUINT64_FORMAT, written, mix->bytes_w… in mix_audio_SST_STREAM_DECODE()
1636 g_debug("calling SNDRV_SST_STREAM_DECODE fd=%d", mix->fileDescriptor); in mix_audio_SST_STREAM_DECODE()
1637 retVal = ioctl(mix->fileDescriptor, SNDRV_SST_STREAM_DECODE, &dbufs); in mix_audio_SST_STREAM_DECODE()
1645 mix_audio_debug_dump(mix); in mix_audio_SST_STREAM_DECODE()
1660 MIX_RESULT mix_audio_initialize(MixAudio *mix, MixCodecMode mode, MixAudioInitParams *aip, MixDrmPa… in mix_audio_initialize() argument
1662 if (G_UNLIKELY(!mix)) return MIX_RESULT_NULL_PTR; in mix_audio_initialize()
1664 MixAudioClass *klass = MIX_AUDIO_GET_CLASS(mix); in mix_audio_initialize()
1679 return klass->initialize(mix, mode, aip, drminitparams); in mix_audio_initialize()
1682 MIX_RESULT mix_audio_configure(MixAudio *mix, MixAudioConfigParams *audioconfigparams, MixDrmParams… in mix_audio_configure() argument
1684 if (G_UNLIKELY(!mix)) return MIX_RESULT_NULL_PTR; in mix_audio_configure()
1686 MixAudioClass *klass = MIX_AUDIO_GET_CLASS(mix); in mix_audio_configure()
1691 return klass->configure(mix, audioconfigparams, drmparams); in mix_audio_configure()
1694 MIX_RESULT mix_audio_decode(MixAudio *mix, const MixIOVec *iovin, gint iovincnt, guint64 *insize, M… in mix_audio_decode() argument
1696 if (G_UNLIKELY(!mix)) return MIX_RESULT_NULL_PTR; in mix_audio_decode()
1698 MixAudioClass *klass = MIX_AUDIO_GET_CLASS(mix); in mix_audio_decode()
1703 return klass->decode(mix, iovin, iovincnt, insize, iovout, iovoutcnt, outsize); in mix_audio_decode()
1706 MIX_RESULT mix_audio_capture_encode(MixAudio *mix, MixIOVec *iovout, gint iovoutcnt) in mix_audio_capture_encode() argument
1708 if (G_UNLIKELY(!mix)) return MIX_RESULT_NULL_PTR; in mix_audio_capture_encode()
1710 MixAudioClass *klass = MIX_AUDIO_GET_CLASS(mix); in mix_audio_capture_encode()
1715 return klass->capture_encode(mix, iovout, iovoutcnt); in mix_audio_capture_encode()
1718 MIX_RESULT mix_audio_start(MixAudio *mix) in mix_audio_start() argument
1720 if (G_UNLIKELY(!mix)) return MIX_RESULT_NULL_PTR; in mix_audio_start()
1722 MixAudioClass *klass = MIX_AUDIO_GET_CLASS(mix); in mix_audio_start()
1727 return klass->start(mix); in mix_audio_start()
1730 MIX_RESULT mix_audio_stop_drop(MixAudio *mix) in mix_audio_stop_drop() argument
1732 if (G_UNLIKELY(!mix)) return MIX_RESULT_NULL_PTR; in mix_audio_stop_drop()
1734 MixAudioClass *klass = MIX_AUDIO_GET_CLASS(mix); in mix_audio_stop_drop()
1739 return klass->stop_drop(mix); in mix_audio_stop_drop()
1742 MIX_RESULT mix_audio_stop_drain(MixAudio *mix) in mix_audio_stop_drain() argument
1744 if (G_UNLIKELY(!mix)) return MIX_RESULT_NULL_PTR; in mix_audio_stop_drain()
1746 MixAudioClass *klass = MIX_AUDIO_GET_CLASS(mix); in mix_audio_stop_drain()
1751 return klass->stop_drain(mix); in mix_audio_stop_drain()
1754 MIX_RESULT mix_audio_pause(MixAudio *mix) in mix_audio_pause() argument
1756 if (G_UNLIKELY(!mix)) return MIX_RESULT_NULL_PTR; in mix_audio_pause()
1758 MixAudioClass *klass = MIX_AUDIO_GET_CLASS(mix); in mix_audio_pause()
1763 return klass->pause(mix); in mix_audio_pause()
1766 MIX_RESULT mix_audio_resume(MixAudio *mix) in mix_audio_resume() argument
1768 if (G_UNLIKELY(!mix)) return MIX_RESULT_NULL_PTR; in mix_audio_resume()
1770 MixAudioClass *klass = MIX_AUDIO_GET_CLASS(mix); in mix_audio_resume()
1775 return klass->resume(mix); in mix_audio_resume()
1778 MIX_RESULT mix_audio_get_timestamp(MixAudio *mix, guint64 *msecs) in mix_audio_get_timestamp() argument
1780 if (G_UNLIKELY(!mix)) return MIX_RESULT_NULL_PTR; in mix_audio_get_timestamp()
1782 MixAudioClass *klass = MIX_AUDIO_GET_CLASS(mix); in mix_audio_get_timestamp()
1787 return klass->get_timestamp(mix, msecs); in mix_audio_get_timestamp()
1790 MIX_RESULT mix_audio_get_mute(MixAudio *mix, gboolean* muted) in mix_audio_get_mute() argument
1792 if (G_UNLIKELY(!mix)) return MIX_RESULT_NULL_PTR; in mix_audio_get_mute()
1794 MixAudioClass *klass = MIX_AUDIO_GET_CLASS(mix); in mix_audio_get_mute()
1799 return klass->get_mute(mix, muted); in mix_audio_get_mute()
1802 MIX_RESULT mix_audio_set_mute(MixAudio *mix, gboolean mute) in mix_audio_set_mute() argument
1804 if (G_UNLIKELY(!mix)) return MIX_RESULT_NULL_PTR; in mix_audio_set_mute()
1806 MixAudioClass *klass = MIX_AUDIO_GET_CLASS(mix); in mix_audio_set_mute()
1811 return klass->set_mute(mix, mute); in mix_audio_set_mute()
1814 MIX_RESULT mix_audio_get_max_vol(MixAudio *mix, gint *maxvol) in mix_audio_get_max_vol() argument
1816 if (G_UNLIKELY(!mix)) return MIX_RESULT_NULL_PTR; in mix_audio_get_max_vol()
1818 MixAudioClass *klass = MIX_AUDIO_GET_CLASS(mix); in mix_audio_get_max_vol()
1823 return klass->get_max_vol(mix, maxvol); in mix_audio_get_max_vol()
1826 MIX_RESULT mix_audio_get_min_vol(MixAudio *mix, gint *minvol) in mix_audio_get_min_vol() argument
1828 if (G_UNLIKELY(!mix)) return MIX_RESULT_NULL_PTR; in mix_audio_get_min_vol()
1830 MixAudioClass *klass = MIX_AUDIO_GET_CLASS(mix); in mix_audio_get_min_vol()
1835 return klass->get_min_vol(mix, minvol); in mix_audio_get_min_vol()
1838 MIX_RESULT mix_audio_get_volume(MixAudio *mix, gint *currvol, MixVolType type) in mix_audio_get_volume() argument
1840 if (G_UNLIKELY(!mix)) return MIX_RESULT_NULL_PTR; in mix_audio_get_volume()
1842 MixAudioClass *klass = MIX_AUDIO_GET_CLASS(mix); in mix_audio_get_volume()
1847 return klass->get_volume(mix, currvol, type); in mix_audio_get_volume()
1850 MIX_RESULT mix_audio_set_volume(MixAudio *mix, gint currvol, MixVolType type, gulong msecs, MixVolR… in mix_audio_set_volume() argument
1852 if (G_UNLIKELY(!mix)) return MIX_RESULT_NULL_PTR; in mix_audio_set_volume()
1854 MixAudioClass *klass = MIX_AUDIO_GET_CLASS(mix); in mix_audio_set_volume()
1859 return klass->set_volume(mix, currvol, type, msecs, ramptype); in mix_audio_set_volume()
1862 MIX_RESULT mix_audio_deinitialize(MixAudio *mix) in mix_audio_deinitialize() argument
1864 if (G_UNLIKELY(!mix)) return MIX_RESULT_NULL_PTR; in mix_audio_deinitialize()
1866 MixAudioClass *klass = MIX_AUDIO_GET_CLASS(mix); in mix_audio_deinitialize()
1871 return klass->deinitialize(mix); in mix_audio_deinitialize()
1874 MIX_RESULT mix_audio_get_stream_state(MixAudio *mix, MixStreamState *streamState) in mix_audio_get_stream_state() argument
1876 if (G_UNLIKELY(!mix)) return MIX_RESULT_NULL_PTR; in mix_audio_get_stream_state()
1878 MixAudioClass *klass = MIX_AUDIO_GET_CLASS(mix); in mix_audio_get_stream_state()
1883 return klass->get_stream_state(mix, streamState); in mix_audio_get_stream_state()
1886 MIX_RESULT mix_audio_get_state(MixAudio *mix, MixState *state) in mix_audio_get_state() argument
1888 if (G_UNLIKELY(!mix)) return MIX_RESULT_NULL_PTR; in mix_audio_get_state()
1890 MixAudioClass *klass = MIX_AUDIO_GET_CLASS(mix); in mix_audio_get_state()
1895 return klass->get_state(mix, state); in mix_audio_get_state()
1898 MIX_RESULT mix_audio_is_am_available_default(MixAudio *mix, MixAudioManager am, gboolean *avail) in mix_audio_is_am_available_default() argument
1910 MIX_RESULT mix_audio_is_am_available(MixAudio *mix, MixAudioManager am, gboolean *avail) in mix_audio_is_am_available() argument
1912 MixAudioClass *klass = MIX_AUDIO_GET_CLASS(mix); in mix_audio_is_am_available()
1917 return klass->is_am_available(mix, am, avail); in mix_audio_is_am_available()
2001 void mix_audio_debug_dump(MixAudio *mix) in mix_audio_debug_dump() argument
2005 if (!MIX_IS_AUDIO(mix)) in mix_audio_debug_dump()
2011 g_debug("%s streamState(%s)", prefix, _mix_stream_state_get_name(mix->streamState)); in mix_audio_debug_dump()
2012 g_debug("%s encoding(%s)", prefix, mix->encoding?mix->encoding:dbgstr_UNKNOWN); in mix_audio_debug_dump()
2013 g_debug("%s fileDescriptor(%d)", prefix, mix->fileDescriptor); in mix_audio_debug_dump()
2014 g_debug("%s state(%s)", prefix, _mix_state_get_name(mix->state)); in mix_audio_debug_dump()
2015 g_debug("%s codecMode(%s)", prefix, _mix_codec_mode_get_name(mix->codecMode)); in mix_audio_debug_dump()
2018 g_debug("%s streamID(%d)", prefix, mix->streamID); in mix_audio_debug_dump()
2021 if (MIX_IS_AUDIOCONFIGPARAMS(mix->audioconfigparams)) in mix_audio_debug_dump()
2030 g_debug("%s deviceState(%s)", prefix, _mix_device_state_get_name(mix->deviceState)); in mix_audio_debug_dump()
2032 g_debug("%s ts_last(%" G_GUINT64_FORMAT ")", prefix, mix->ts_last); in mix_audio_debug_dump()
2033 g_debug("%s ts_elapsed(%" G_GUINT64_FORMAT ")", prefix, mix->ts_elapsed); in mix_audio_debug_dump()
2034 g_debug("%s bytes_written(%" G_GUINT64_FORMAT ")", prefix, mix->bytes_written); in mix_audio_debug_dump()
2039 MIX_RESULT mix_audio_get_output_configuration(MixAudio *mix, MixAudioConfigParams **audioconfigpara… in mix_audio_get_output_configuration() argument
2041 if (G_UNLIKELY(!mix)) return MIX_RESULT_NULL_PTR; in mix_audio_get_output_configuration()
2043 MixAudioClass *klass = MIX_AUDIO_GET_CLASS(mix); in mix_audio_get_output_configuration()
2048 return klass->get_output_configuration(mix, audioconfigparams); in mix_audio_get_output_configuration()
2051 MIX_RESULT mix_audio_get_output_configuration_default(MixAudio *mix, MixAudioConfigParams **audioco… in mix_audio_get_output_configuration_default() argument
2058 if (G_UNLIKELY(!mix || !audioconfigparams)) return MIX_RESULT_NULL_PTR; in mix_audio_get_output_configuration_default()
2060 _LOCK(&mix->controllock); in mix_audio_get_output_configuration_default()
2062 if (mix->state <= MIX_STATE_UNINITIALIZED) _UNLOCK_RETURN(&mix->controllock, MIX_RESULT_NOT_INIT); in mix_audio_get_output_configuration_default()
2067 g_debug("Calling SNDRV_SST_STREAM_GET_PARAMS. fd=%d", mix->fileDescriptor); in mix_audio_get_output_configuration_default()
2068 retVal = ioctl(mix->fileDescriptor, SNDRV_SST_STREAM_GET_PARAMS, &stream_params); in mix_audio_get_output_configuration_default()
2072 _UNLOCK(&mix->controllock); in mix_audio_get_output_configuration_default()
2088 MIX_RESULT mix_audio_get_stream_byte_decoded(MixAudio *mix, guint64 *byte) in mix_audio_get_stream_byte_decoded() argument