[0.6.185] send pcm_format info to client 63/204263/1
authorEunhye Choi <eunhae1.choi@samsung.com>
Mon, 22 Apr 2019 11:20:38 +0000 (20:20 +0900)
committerEunhye Choi <eunhae1.choi@samsung.com>
Mon, 22 Apr 2019 11:20:41 +0000 (20:20 +0900)
- share the audio pcm mime type to client
  which is required to make media packet for extracted pcm
- remove mm_player_internal.h

Change-Id: Icf40f9663875e1c4ec03ca3088eff646c1ae20de

packaging/libmm-player.spec
src/Makefile.am
src/include/mm_player.h
src/include/mm_player_internal.h [deleted file]
src/include/mm_player_priv.h
src/mm_player_es.c
src/mm_player_priv.c

index 5341028..9641306 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-player
 Summary:    Multimedia Framework Player Library
-Version:    0.6.184
+Version:    0.6.185
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index e3b0705..c5ff218 100644 (file)
@@ -3,7 +3,6 @@ lib_LTLIBRARIES = libmmfplayer.la
 includelibmmfplayerdir = $(includedir)/mmf
 
 includelibmmfplayer_HEADERS = include/mm_player.h \
-                             include/mm_player_internal.h \
                              include/mm_player_audioeffect.h
 
 libmmfplayer_la_SOURCES = mm_player.c \
index aaf39bf..a022aee 100644 (file)
 
 #define BUFFER_MAX_PLANE_NUM (4)
 
-typedef struct {
-       MMPixelFormatType format;              /**< image format */
-       int width;                             /**< width of video buffer */
-       int height;                            /**< height of video buffer */
-       unsigned int timestamp;                /**< timestamp of stream buffer (msec)*/
-       unsigned int length_total;             /**< total length of stream buffer (in byte)*/
-       void *data[BUFFER_MAX_PLANE_NUM];
-       void *bo[BUFFER_MAX_PLANE_NUM];        /**< TBM buffer object */
-       void *internal_buffer;                 /**< Internal buffer pointer */
-       int stride[BUFFER_MAX_PLANE_NUM];      /**< stride of plane */
-       int elevation[BUFFER_MAX_PLANE_NUM];   /**< elevation of plane */
-       int orientation;                       /**< orientation */
-       int bo_size;                           /**< TBM buffer object size */
-       int plane_num;                         /**< number of Plane */
-} mmplayer_video_decoded_data_info_t;
-
 /**
  * Enumerations of player state.
  */
@@ -391,6 +375,18 @@ typedef enum {
        MM_PLAYER_AUDIO_EXTRACT_DEINTERLEAVE_WITH_PLAYBACK     = MM_PLAYER_AUDIO_EXTRACT_DEINTERLEAVE | MM_PLAYER_AUDIO_EXTRACT_WITH_PLAYBACK,
 } mmplayer_audio_extract_opt_e;
 
+/*
+ * Enumerations of video colorspace
+ */
+typedef enum {
+       MM_PLAYER_COLORSPACE_I420 = 0,                  /**< I420 format - planer */
+       MM_PLAYER_COLORSPACE_RGB888,                    /**< RGB888 pixel format */
+       MM_PLAYER_COLORSPACE_NV12_TILED,                /**< Customized color format */
+       MM_PLAYER_COLORSPACE_NV12,
+       MM_PLAYER_COLORSPACE_BGRx,                              /**< BGRx pixel format */
+       MM_PLAYER_COLORSPACE_MAX = 0x7FFFFFFF
+} mmplayer_video_color_space_e;
+
 /**
  * Attribute validity structure
  */
@@ -439,6 +435,42 @@ typedef struct {
        };
 } mmplayer_attrs_info_t;
 
+typedef struct {
+       MMPixelFormatType format;              /**< image format */
+       int width;                             /**< width of video buffer */
+       int height;                            /**< height of video buffer */
+       unsigned int timestamp;                /**< timestamp of stream buffer (msec)*/
+       unsigned int length_total;             /**< total length of stream buffer (in byte)*/
+       void *data[BUFFER_MAX_PLANE_NUM];
+       void *bo[BUFFER_MAX_PLANE_NUM];        /**< TBM buffer object */
+       void *internal_buffer;                 /**< Internal buffer pointer */
+       int stride[BUFFER_MAX_PLANE_NUM];      /**< stride of plane */
+       int elevation[BUFFER_MAX_PLANE_NUM];   /**< elevation of plane */
+       int orientation;                       /**< orientation */
+       int bo_size;                           /**< TBM buffer object size */
+       int plane_num;                         /**< number of Plane */
+} mmplayer_video_decoded_data_info_t;
+
+typedef struct {
+       void *data;
+       int data_size;
+       int channel;
+       int bitrate;
+       int depth;
+       bool is_little_endian;
+       guint64 channel_mask;
+       media_format_mimetype_e pcm_format;
+} mmplayer_audio_decoded_data_info_t;
+
+typedef struct {
+       unsigned char *data;                                    /* capture image buffer */
+       int size;                                                               /* capture image size */
+       mmplayer_video_color_space_e fmt;                       /* color space type */
+       unsigned int width;                                             /* width of captured image */
+       unsigned int height;                                    /* height of captured image */
+       unsigned int orientation;                               /* content orientation */
+} mmplayer_video_capture_t;
+
 /**
  * Video stream info in external demux case
  *
@@ -526,6 +558,53 @@ typedef bool (*mm_player_media_stream_seek_data_callback)(mmplayer_stream_type_e
  */
 typedef bool (*mm_player_stream_changed_callback)(void *user_param);
 
+/**
+ * Video decoded callback function type.
+ *
+ * @param      stream          [in]    Reference pointer to video frame data
+ * @param      stream_size     [in]    Size of video frame data
+ * @param      user_param      [in]    User defined parameter which is passed when set
+ *                                                             video stream callback
+ * @param      width           [in]    width of video frame
+ * @param      height          [in]    height of video frame
+ *
+ * @return     This callback function have to return MM_ERROR_NONE.
+ */
+typedef bool (*mm_player_video_decoded_callback)(void *stream, void *user_param);
+
+/**
+ * Audio stream callback function type.
+ *
+ * @param      stream          [in]    Reference pointer to audio frame data
+ * @param      stream_size     [in]    Size of audio frame data
+ * @param      user_param      [in]    User defined parameter which is passed when set
+ *                                                             audio stream callback
+ *
+ * @return     This callback function have to return MM_ERROR_NONE.
+ */
+typedef bool (*mm_player_video_capture_callback)(void *stream, int stream_size, void *user_param);
+
+/**
+ * Video frame render error callback function type.
+ *
+ * @param      error_id        [in]    cause of error
+ * @param      user_param      [in]    User defined parameter which is passed when set
+ *                                                             video frame render error callback
+ *
+ * @return     This callback function have to return MM_ERROR_NONE.
+ */
+typedef bool (*mm_player_video_frame_render_error_callback)(void *error_id, void *user_param);
+
+/**
+ * Audio stream callback function type.
+ *
+ * @param      stream          [in]    Reference pointer to audio frame data
+ * @param      user_param      [in]    User defined parameter which is passed when set
+ *                                                             audio stream callback
+ *
+ * @return     This callback function have to return MM_ERROR_NONE.
+ */
+typedef bool (*mm_player_audio_decoded_callback)(void *stream, void *user_param);
 
 /*===========================================================================================
 |                                                                                           |
@@ -1401,6 +1480,82 @@ int mm_player_set_video_roi_area(MMHandleType player, double scale_x, double sca
 int mm_player_get_video_roi_area(MMHandleType player, double *scale_x, double *scale_y, double *scale_width, double *scale_height);
 
 /**
+ * This function is to set play speed for playback.
+ *
+ * @param      player          [in]    Handle of player.
+ * @param      ratio           [in]    Speed for playback.
+ * @param      streaming       [in]    If @c true, rate value can be set even if it is streaming playback.
+ * @return     This function returns zero on success, or negative value with error
+ *                     code
+ * @remark     The current supported range is from -64x to 64x.
+ *             But, the quailty is dependent on codec performance.
+ *             And, the sound is muted under normal speed and more than double speed.
+ * @see
+ * @since
+ */
+int mm_player_set_play_speed(MMHandleType player, float rate, bool streaming);
+
+/**
+ * This function set callback function for receiving video stream from player.
+ *
+ * @param      player          [in]    Handle of player.
+ * @param      callback        [in]    Video stream callback function.
+ * @param      user_param      [in]    User parameter.
+ *
+ * @return     This function returns zero on success, or negative value with error
+ *                     code.
+ * @remark
+ * @since
+ */
+int mm_player_set_video_decoded_callback(MMHandleType player, mm_player_video_decoded_callback callback, void *user_param);
+
+/**
+ * This function set callback function for receiving audio stream from player.
+ *
+ * @param      player          [in]    Handle of player.
+ * @param      opt             [in]    audio extract option.
+ * @param      callback        [in]    audio stream callback function.
+ * @param      user_param      [in]    User parameter.
+ *
+ * @return     This function returns zero on success, or negative value with error
+ *                     code.
+ * @remark
+ * @see                mm_player_audio_decoded_callback
+ * @since
+ */
+int mm_player_set_audio_decoded_callback(MMHandleType player, mmplayer_audio_extract_opt_e opt, mm_player_audio_decoded_callback callback, void *user_param);
+
+/**
+ * This function is to capture video frame.
+ *
+ * @param      player          [in]    Handle of player.
+ *
+ * @return     This function returns zero on success, or negative value with error
+ *                     code.
+ *
+ * @remark     Captured buffer is sent asynchronously through message callback with MM_MESSAGE_VIDEO_CAPTURED.
+ *                     And, application should free the captured buffer directly.
+ * @see                MM_MESSAGE_VIDEO_CAPTURED
+ * @since
+ */
+int mm_player_do_video_capture(MMHandleType player);
+
+/**
+ * This function changes the previous videosink plugin for a new one
+ *
+ * @param      player                  [in]    Handle of player.
+ * @param      display_surface_type    [in]    display surface type to set
+ * @param      display_overlay                 [in]    display overlay to set
+ *
+ * @return     This function returns zero on success, or negative value with error
+ *                     code.
+ * @remark
+ * @see
+ * @since
+ */
+int mm_player_change_videosink(MMHandleType player, MMDisplaySurfaceType display_surface_type, void *display_overlay);
+
+/**
        @}
  */
 
diff --git a/src/include/mm_player_internal.h b/src/include/mm_player_internal.h
deleted file mode 100644 (file)
index 8f68a98..0000000
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * libmm-player
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: JongHyuk Choi <jhchoi.choi@samsung.com>, YeJin Cho <cho.yejin@samsung.com>,
- * Seungbae Shin <seungbae.shin@samsung.com>, YoungHwan An <younghwan_.an@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#ifndef __MM_PLAYER_INTERNAL_H__
-#define        __MM_PLAYER_INTERNAL_H__
-
-#include <mm_types.h>
-
-#ifdef __cplusplus
-       extern "C" {
-#endif
-
-/*
- * Enumerations of video colorspace
- */
-typedef enum {
-       MM_PLAYER_COLORSPACE_I420 = 0,                  /**< I420 format - planer */
-       MM_PLAYER_COLORSPACE_RGB888,                    /**< RGB888 pixel format */
-       MM_PLAYER_COLORSPACE_NV12_TILED,                /**< Customized color format */
-       MM_PLAYER_COLORSPACE_NV12,
-       MM_PLAYER_COLORSPACE_BGRx,                              /**< BGRx pixel format */
-       MM_PLAYER_COLORSPACE_MAX = 0x7FFFFFFF
-} mmplayer_video_color_space_e;
-
-typedef struct {
-       unsigned char *data;                                    /* capture image buffer */
-       int size;                                                               /* capture image size */
-       mmplayer_video_color_space_e fmt;                       /* color space type */
-       unsigned int width;                                             /* width of captured image */
-       unsigned int height;                                    /* height of captured image */
-       unsigned int orientation;                               /* content orientation */
-} mmplayer_video_capture_t;
-
-typedef struct {
-       void *data;
-       int data_size;
-       int channel;
-       int bitrate;
-       int depth;
-       bool is_little_endian;
-       guint64 channel_mask;
-} mmplayer_audio_decoded_data_info_t;
-
-/**
- * Video decoded callback function type.
- *
- * @param      stream          [in]    Reference pointer to video frame data
- * @param      stream_size     [in]    Size of video frame data
- * @param      user_param      [in]    User defined parameter which is passed when set
- *                                                             video stream callback
- * @param      width           [in]    width of video frame
- * @param      height          [in]    height of video frame
- *
- * @return     This callback function have to return MM_ERROR_NONE.
- */
-typedef bool (*mm_player_video_decoded_callback)(void *stream, void *user_param);
-
-/**
- * Audio stream callback function type.
- *
- * @param      stream          [in]    Reference pointer to audio frame data
- * @param      stream_size     [in]    Size of audio frame data
- * @param      user_param      [in]    User defined parameter which is passed when set
- *                                                             audio stream callback
- *
- * @return     This callback function have to return MM_ERROR_NONE.
- */
-typedef bool (*mm_player_video_capture_callback)(void *stream, int stream_size, void *user_param);
-
-/**
- * Video frame render error callback function type.
- *
- * @param      error_id        [in]    cause of error
- * @param      user_param      [in]    User defined parameter which is passed when set
- *                                                             video frame render error callback
- *
- * @return     This callback function have to return MM_ERROR_NONE.
- */
-typedef bool (*mm_player_video_frame_render_error_callback)(void *error_id, void *user_param);
-
-/**
- * Audio stream callback function type.
- *
- * @param      stream          [in]    Reference pointer to audio frame data
- * @param      user_param      [in]    User defined parameter which is passed when set
- *                                                             audio stream callback
- *
- * @return     This callback function have to return MM_ERROR_NONE.
- */
-typedef bool (*mm_player_audio_decoded_callback)(mmplayer_audio_decoded_data_info_t *stream, void *user_param);
-/**
- * This function is to set play speed for playback.
- *
- * @param      player          [in]    Handle of player.
- * @param      ratio           [in]    Speed for playback.
- * @param      streaming       [in]    If @c true, rate value can be set even if it is streaming playback.
- * @return     This function returns zero on success, or negative value with error
- *                     code
- * @remark     The current supported range is from -64x to 64x.
- *             But, the quailty is dependent on codec performance.
- *             And, the sound is muted under normal speed and more than double speed.
- * @see
- * @since
- */
-int mm_player_set_play_speed(MMHandleType player, float rate, bool streaming);
-
-/**
- * This function set callback function for receiving video stream from player.
- *
- * @param      player          [in]    Handle of player.
- * @param      callback        [in]    Video stream callback function.
- * @param      user_param      [in]    User parameter.
- *
- * @return     This function returns zero on success, or negative value with error
- *                     code.
- * @remark
- * @since
- */
-int mm_player_set_video_decoded_callback(MMHandleType player, mm_player_video_decoded_callback callback, void *user_param);
-
-/**
- * This function set callback function for receiving audio stream from player.
- *
- * @param      player          [in]    Handle of player.
- * @param      opt             [in]    audio extract option.
- * @param      callback        [in]    audio stream callback function.
- * @param      user_param      [in]    User parameter.
- *
- * @return     This function returns zero on success, or negative value with error
- *                     code.
- * @remark
- * @see                mm_player_audio_decoded_callback
- * @since
- */
-int mm_player_set_audio_decoded_callback(MMHandleType player, mmplayer_audio_extract_opt_e opt, mm_player_audio_decoded_callback callback, void *user_param);
-
-/**
- * This function is to capture video frame.
- *
- * @param      player          [in]    Handle of player.
- *
- * @return     This function returns zero on success, or negative value with error
- *                     code.
- *
- * @remark     Captured buffer is sent asynchronously through message callback with MM_MESSAGE_VIDEO_CAPTURED.
- *                     And, application should free the captured buffer directly.
- * @see                MM_MESSAGE_VIDEO_CAPTURED
- * @since
- */
-int mm_player_do_video_capture(MMHandleType player);
-
-/**
- * This function changes the previous videosink plugin for a new one
- *
- * @param      player                  [in]    Handle of player.
- * @param      display_surface_type    [in]    display surface type to set
- * @param      display_overlay                 [in]    display overlay to set
- *
- * @return     This function returns zero on success, or negative value with error
- *                     code.
- * @remark
- * @see
- * @since
- */
-int mm_player_change_videosink(MMHandleType player, MMDisplaySurfaceType display_surface_type, void *display_overlay);
-
-/**
-       @}
- */
-
-#ifdef __cplusplus
-       }
-#endif
-
-#endif /* __MM_PLAYER_INTERNAL_H__ */
index a8d3a54..662ef0d 100644 (file)
@@ -39,7 +39,6 @@
 #include <tbm_bufmgr.h>
 #include <storage.h>
 #include "mm_player.h"
-#include "mm_player_internal.h"
 #include "mm_player_audioeffect.h"
 #include "mm_message.h"
 #include "mm_player_ini.h"
index 74af354..d36405c 100644 (file)
@@ -28,7 +28,6 @@
 #include <dlog.h>
 #include "mm_player_es.h"
 #include "mm_player_utils.h"
-#include "mm_player_internal.h"
 
 #include <gst/app/gstappsrc.h>
 
index 79f4026..df00ea4 100644 (file)
@@ -2286,6 +2286,7 @@ __mmplayer_audio_stream_send_data(mmplayer_t *player, mmplayer_audio_stream_buff
        audio_stream.channel_mask = a_buffer->channel_mask;
        audio_stream.data_size = a_buffer->data_size;
        audio_stream.data = a_buffer->pcm_data;
+       audio_stream.pcm_format = a_buffer->pcm_format;
 
        /* LOGD("[%"G_GUINT64_FORMAT"] send data size:%d, %p", audio_stream.channel_mask, audio_stream.data_size, player->audio_decoded_cb_user_param); */
        player->audio_decoded_cb(&audio_stream, player->audio_decoded_cb_user_param);
@@ -2365,7 +2366,7 @@ __mmplayer_audio_stream_decoded_render_cb(GstElement *object, GstBuffer *buffer,
                }
        }
 
-       /* create new audio stream data */
+       /* create new audio stream data for newly found audio channel */
        a_buffer = (mmplayer_audio_stream_buff_t *)g_try_malloc0(sizeof(mmplayer_audio_stream_buff_t));
        if (a_buffer == NULL) {
                LOGE("failed to alloc data.");