+++ /dev/null
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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.
-
--- /dev/null
+Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ 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.
+
SET(submodule "player")
# for package file
-SET(dependents "dlog mm-player capi-base-common capi-media-tool libtbm evas ecore elementary")
+SET(dependents "dlog mm-player capi-base-common capi-media-tool libtbm")
SET(fw_name "${service}-${submodule}")
PATTERN "${INC_DIR}/*.h"
)
-ADD_SUBDIRECTORY(test)
* If you want to change display handle after calling legacy_player_prepare(), you must use the same display type as what you set before.
* @param[in] player The handle to the media player
* @param[in] type The display type
- * @param[in] display The handle to display
+ * @param[in] wl_surface_id Wayland surface grobal id
* @return @c 0 on success,
* otherwise a negative error value
* @retval #PLAYER_ERROR_NONE Successful
* @pre The player state must be one of these: #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
* @see legacy_player_set_display_rotation
*/
-int legacy_player_set_display(player_h player, player_display_type_e type, player_display_h display);
+int legacy_player_set_display(player_h player, player_display_type_e type, unsigned int wl_surface_id);
/**
* @brief Registers a media packet video callback function to be called once per frame.
*/
int legacy_player_unset_retrieve_buffer_cb(player_h player);
#endif
+
/**
-* @brief Manage the external storage state
-*/
+ * @brief Manage the external storage state
+ * @since_tizen 3.0
+ * @param[in] player The handle to the media player
+ * @param[in] state The state of external storage
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ */
int legacy_player_manage_external_storage_state(player_h player, int state);
+/**
+ * @brief Sets the ROI(Region Of Interest) area of display.
+ * @since_tizen 3.0
+ * @remarks If no display is set, no operation is performed.
+ * @remarks Before set display ROI area, #PLAYER_DISPLAY_MODE_DST_ROI must be set with legacy_player_set_display_mode().
+ * The minimum value of width and height are 1.
+ * @param[in] player The handle to the media player
+ * @param[in] x X coordinate of area
+ * @param[in] y Y coordinate of area
+ * @param[in] width Width of area
+ * @param[in] height Height of area
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @pre display_mode must be set to #PLAYER_DISPLAY_MODE_DST_ROI.
+ * @pre The player state must be one of #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
+ * @see legacy_player_set_display()
+ * @see legacy_player_set_display_mode()
+ */
+int legacy_player_set_roi_area(player_h player, int x, int y, int w, int h);
+
+/**
+ * @brief Sets sound stream info
+ * @since_tizen 3.0
+ * @param[in] player The handle to the media player
+ * @param[in] stream_type The type of stream
+ * @param[in] stream_index The index of stream
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ */
+int legacy_player_set_sound_stream_info_for_mused(player_h player, char *stream_type, int stream_index);
+
+/**
+ * @brief Registers sound process id to ASM server
+ * @since_tizen 3.0
+ * @param[in] player The handle to the media player
+ * @param[in] pid The sound process id
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ */
+int legacy_player_sound_register(player_h player, int pid);
+
+/**
+ * @brief Gets time out time from muse-server
+ * @since_tizen 3.0
+ * @param[in] player The handle to the media player
+ * @param[in] timeout The time out time of muse-server
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ */
+int legacy_player_get_timeout_for_muse(player_h player, int *timeout);
+
+/**
+ * @brief Gets number of video out buffers
+ * @since_tizen 3.0
+ * @param[in] player The handle to the media player
+ * @param[in] num The number of video buffer
+ * @param[in] extra_num The number of extra video buffer
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ */
+int legacy_player_get_num_of_video_out_buffers(player_h player, int *num, int *extra_num);
+
+/**
+ * @brief Sets file path for buffering
+ * @since_tizen 3.0
+ * @param[in] player The handle to the media player
+ * @param[in] file_path The file path for buffering
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ */
+int legacy_player_set_file_buffering_path(player_h player, const char *file_path);
+
+/**
+ * @brief Checks user callback lock
+ * @since_tizen 3.0
+ * @param[in] type The event type of player
+ * @return @c 1 on success, 0 on failure
+ */
+bool _check_enabled_user_cb_lock(int event_id);
+
/**
* @}
*/
#define PLAYER_TRACE_ASYNC_END(NAME, KEY)
#endif
-#ifndef USE_ECORE_FUNCTIONS
typedef enum {
PLAYER_MESSAGE_NONE,
PLAYER_MESSAGE_PREPARED,
#endif
PLAYER_MESSAGE_MAX
} _player_message_e;
-#endif
typedef struct _player_s {
MMHandleType mm_handle;
bool is_progressive_download;
bool is_media_stream;
pthread_t prepare_async_thread;
-#ifdef USE_ECORE_FUNCTIONS
- GHashTable *ecore_jobs;
- bool is_doing_jobs;
-#else
pthread_t message_thread;
GQueue *message_queue;
GMutex message_queue_lock;
GCond message_queue_cond;
int current_message;
-#endif
player_error_e error_code;
media_format_h pkt_fmt;
int last_play_position;
int __player_convert_error_code(int code, char* func_name);
bool __player_state_validate(player_s * handle, player_state_e threshold);
-/*
-* define for lagacy API for mused
-*/
-int legacy_player_set_display_wl_for_mused(player_h player, player_display_type_e type, unsigned int wl_surface_id);
-int legacy_player_set_roi_area(player_h player, int x, int y, int w, int h);
-int legacy_player_set_sound_stream_info_for_mused(player_h player, char *stream_type, int stream_index);
-int legacy_player_sound_register(player_h player, int pid);
-int legacy_player_get_timeout_for_muse(player_h player, int *timeout);
-int legacy_player_get_num_of_video_out_buffers(player_h player, int *num, int *extra_num);
-int legacy_player_set_file_buffering_path(player_h player, const char *file_path);
-bool _check_enabled_user_cb_lock(int event_id);
-
#ifdef __cplusplus
}
#endif
#include <sound_manager.h>
#include <sound_manager_internal.h>
#include <dlog.h>
-#include <Evas.h>
-#include <Ecore.h>
-#include <Elementary.h>
-#include <Ecore.h>
-#include <Ecore_Wayland.h>
#include <tbm_bufmgr.h>
#include <tbm_surface_internal.h>
-#include <mm_sound.h>
#ifdef TIZEN_FEATURE_ASM
-#include <mm_session.h>
#include <mm_session_private.h>
#endif
#include "muse_player.h"
#include "legacy_player.h"
#include "legacy_player_private.h"
-//#define VIDEO_MEDIA_PACKET_DUMP
-#define __JOB_KEY_PREPARED "prepared"
-#define __JOB_KEY_ERROR "error"
-#define __JOB_KEY_SEEK_DONE "seek_done"
-#define __JOB_KEY_EOS "eos"
-
#define __RELEASEIF_PREPARE_THREAD(thread_id) \
do { \
if (thread_id) { \
} \
} while (0)
-#ifndef USE_ECORE_FUNCTIONS
#define __RELEASEIF_MESSAGE_THREAD(thread_id) \
do { \
if (thread_id) { \
LOGI("message thread released\n"); \
} \
} while (0)
-#endif
-#ifdef USE_ECORE_FUNCTIONS
-#define __DELETE_ECORE_ITEM(ecore_job) \
- do { \
- if (ecore_job) { \
- ecore_job_del(ecore_job); \
- ecore_job = NULL; \
- } \
- } while (0)
-
-#define __ADD_ECORE_JOB(handle, key, job_callback) \
- do { \
- Ecore_Job *job = NULL; \
- job = ecore_job_add(job_callback, (void *)handle); \
- LOGI("adding %s job - %p\n", key, job); \
- g_hash_table_insert(handle->ecore_jobs, g_strdup(key), job); \
- } while (0)
-
-#define __REMOVE_ECORE_JOB(handle, job_key) \
- do { \
- LOGI("%s done so, remove\n", job_key); \
- g_hash_table_remove(handle->ecore_jobs, job_key); \
- handle->is_doing_jobs = FALSE; \
- } while (0)
-#else
#define __GET_MESSAGE(handle) \
do { \
if (handle && handle->message_queue) { \
LOGI("Failed to add message [%d] to queue", message); \
} \
} while (0)
-#endif
/*
* Internal Implementation
return PLAYER_ERROR_NONE;
}
-#ifdef USE_ECORE_FUNCTIONS
-static void __job_prepared_cb(void *user_data)
-{
- player_s *handle = (player_s *)user_data;
- LOGI("Start");
- handle->is_doing_jobs = TRUE;
- handle->state = PLAYER_STATE_READY;
- ((player_prepared_cb)handle->user_cb[MUSE_PLAYER_EVENT_TYPE_PREPARE])(handle->user_data[MUSE_PLAYER_EVENT_TYPE_PREPARE]);
- handle->user_cb[MUSE_PLAYER_EVENT_TYPE_PREPARE] = NULL;
- handle->user_data[MUSE_PLAYER_EVENT_TYPE_PREPARE] = NULL;
- __REMOVE_ECORE_JOB(handle, __JOB_KEY_PREPARED);
- LOGI("End");
-}
-
-static void __job_error_cb(void *user_data)
-{
- player_s *handle = (player_s *)user_data;
- LOGI("Start");
- handle->is_doing_jobs = TRUE;
- ((player_error_cb)handle->user_cb[MUSE_PLAYER_EVENT_TYPE_ERROR])(handle->error_code, handle->user_data[MUSE_PLAYER_EVENT_TYPE_ERROR]);
- __REMOVE_ECORE_JOB(handle, __JOB_KEY_ERROR);
- LOGI("End");
-}
-
-static void __job_seek_done_cb(void *user_data)
-{
- player_s *handle = (player_s *)user_data;
- LOGI("Start");
- handle->is_doing_jobs = TRUE;
- ((player_seek_completed_cb)handle->user_cb[MUSE_PLAYER_EVENT_TYPE_SEEK])(handle->user_data[MUSE_PLAYER_EVENT_TYPE_SEEK]);
- handle->user_cb[MUSE_PLAYER_EVENT_TYPE_SEEK] = NULL;
- handle->user_data[MUSE_PLAYER_EVENT_TYPE_SEEK] = NULL;
- __REMOVE_ECORE_JOB(handle, __JOB_KEY_SEEK_DONE);
- LOGI("End");
-}
-
-static void __job_eos_cb(void *user_data)
-{
- player_s *handle = (player_s *)user_data;
- LOGI("Start");
- handle->is_doing_jobs = TRUE;
- ((player_completed_cb)handle->user_cb[MUSE_PLAYER_EVENT_TYPE_COMPLETE])(handle->user_data[MUSE_PLAYER_EVENT_TYPE_COMPLETE]);
- __REMOVE_ECORE_JOB(handle, __JOB_KEY_EOS);
- LOGI("End");
-}
-
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
-static void __job_retrieve_buffer_cb(void *user_data)
-{
- player_s *handle = (player_s *)user_data;
- LOGI("Start");
- handle->is_doing_jobs = TRUE;
- ((player_retrieve_buffer_cb)handle->user_cb[MUSE_PLAYER_EVENT_TYPE_RETURN_BUFFER])(handle->user_data[MUSE_PLAYER_EVENT_TYPE_RETURN_BUFFER]);
- __REMOVE_ECORE_JOB(handle, "test");
- LOGI("End");
-}
-#endif
-#else
static void __message_cb_loop(void *data)
{
bool running = TRUE;
} while (running);
return;
}
-#endif
static int __msg_callback(int message, void *param, void *user_data)
{
/* asyc && prepared cb has been set */
LOGI("[%s] Prepared! [current state : %d]", __FUNCTION__, handle->state);
PLAYER_TRACE_ASYNC_END("MM:PLAYER:PREPARE_ASYNC", *(int *)handle);
-#ifdef USE_ECORE_FUNCTIONS
- __ADD_ECORE_JOB(handle, __JOB_KEY_PREPARED, __job_prepared_cb);
-#else
__ADD_MESSAGE(handle, PLAYER_MESSAGE_PREPARED);
-#endif
}
}
break;
break;
case MM_MESSAGE_END_OF_STREAM: /* 0x105 */
if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_COMPLETE]) {
-#ifdef USE_ECORE_FUNCTIONS
- __ADD_ECORE_JOB(handle, __JOB_KEY_EOS, __job_eos_cb);
-#else
__ADD_MESSAGE(handle, PLAYER_MESSAGE_EOS);
-#endif
}
break;
#ifdef TIZEN_FEATURE_EVAS_RENDERER
case MM_MESSAGE_GAPLESS_CONSTRUCTION: /* 0x105 */
if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_RETURN_BUFFER]) {
-#ifdef USE_ECORE_FUNCTIONS
- __ADD_ECORE_JOB(handle, "test", __job_retrieve_buffer_cb);
-#else
__ADD_MESSAGE(handle, PLAYER_MESSAGE_GAPLESS_CONSTRUCTION);
-#endif
}
break;
#endif
mm_player_set_attribute(handle->mm_handle, NULL, "display_visible", 1, (char *)NULL);
}
if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_SEEK]) {
-#ifdef USE_ECORE_FUNCTIONS
- __ADD_ECORE_JOB(handle, __JOB_KEY_SEEK_DONE, __job_seek_done_cb);
-#else
__ADD_MESSAGE(handle, PLAYER_MESSAGE_SEEK_DONE);
-#endif
}
break;
case MM_MESSAGE_PLAY_POSITION:
if (err_code != PLAYER_ERROR_NONE && handle->user_cb[MUSE_PLAYER_EVENT_TYPE_ERROR]) {
handle->error_code = err_code;
-#ifdef USE_ECORE_FUNCTIONS
- __ADD_ECORE_JOB(handle, __JOB_KEY_ERROR, __job_error_cb);
-#else
__ADD_MESSAGE(handle, PLAYER_MESSAGE_ERROR);
-#endif
}
LOGW("[%s] End", __FUNCTION__);
return 1;
return 0;
}
-#ifdef USE_ECORE_FUNCTIONS
-static void __job_key_to_remove(gpointer key)
-{
- LOGI("%s", key);
- g_free(key);
-}
-
-static void __job_value_to_destroy(gpointer value)
-{
- Ecore_Job *job = (Ecore_Job *) value;
- LOGI("%p", job);
- __DELETE_ECORE_ITEM(job);
-}
-#endif
-
static MMDisplaySurfaceType __player_convet_display_type(player_display_type_e type)
{
switch (type) {
if (_check_enabled_user_cb_lock(type))
g_mutex_init(&handle->user_cb_lock[type]);
}
-#ifdef USE_ECORE_FUNCTIONS
- handle->ecore_jobs = g_hash_table_new_full(g_str_hash, g_str_equal, __job_key_to_remove, __job_value_to_destroy);
-#else
+
handle->message_queue = g_queue_new();
g_mutex_init(&handle->message_queue_lock);
g_cond_init(&handle->message_queue_cond);
LOGE("[%s] failed to create message thread ret = %d", __FUNCTION__, ret);
return PLAYER_ERROR_OUT_OF_MEMORY;
}
-#endif
+
LOGI("[%s] new handle : %p", __FUNCTION__, *player);
PLAYER_TRACE_END();
return PLAYER_ERROR_NONE;
PLAYER_TRACE_BEGIN("MM:PLAYER:DESTROY");
PLAYER_INSTANCE_CHECK(player);
player_s *handle = (player_s *)player;
-#ifdef USE_ECORE_FUNCTIONS
- if (handle->is_doing_jobs) {
- LOGE("jobs not completed. can't do destroy");
- return PLAYER_ERROR_INVALID_OPERATION;
- }
- g_hash_table_remove_all(handle->ecore_jobs);
- g_hash_table_unref(handle->ecore_jobs);
- handle->ecore_jobs = NULL;
-#else
+
__ADD_MESSAGE(handle, PLAYER_MESSAGE_LOOP_EXIT);
-#endif
__RELEASEIF_PREPARE_THREAD(handle->prepare_async_thread);
-
-#ifndef USE_ECORE_FUNCTIONS
__RELEASEIF_MESSAGE_THREAD(handle->message_thread);
-#endif
int ret = mm_player_destroy(handle->mm_handle);
g_mutex_clear(&handle->user_cb_lock[type]);
}
-#ifndef USE_ECORE_FUNCTIONS
if (handle->message_queue) {
g_queue_free(handle->message_queue);
handle->message_queue = NULL;
g_cond_broadcast(&handle->message_queue_cond);
g_mutex_clear(&handle->message_queue_lock);
g_cond_clear(&handle->message_queue_cond);
-#endif
+
free(handle);
handle = NULL;
LOGI("[%s] End", __FUNCTION__);
}
}
-int legacy_player_set_display(player_h player, player_display_type_e type, player_display_h display)
-{
- PLAYER_INSTANCE_CHECK(player);
- player_s *handle = (player_s *)player;
- Evas_Object *obj = NULL;
- const char *object_type = NULL;
- void *set_handle = NULL;
- void *set_wl_display = NULL;
- Ecore_Wl_Window *wl_window = NULL;
- int ret;
-
- if (type != PLAYER_DISPLAY_TYPE_NONE && display == NULL) {
- LOGE("display type[%d] is not NONE, but display handle is NULL", type);
- return PLAYER_ERROR_INVALID_PARAMETER;
- }
-
- if (handle->is_set_pixmap_cb) {
- if (handle->state < PLAYER_STATE_READY) {
- /* just set below and go to "changing surface case" */
- handle->is_set_pixmap_cb = FALSE;
- } else {
- LOGE("[%s] pixmap callback was set, try it again after calling legacy_player_unprepare()", __FUNCTION__, PLAYER_ERROR_INVALID_OPERATION);
- LOGE("[%s] PLAYER_ERROR_INVALID_OPERATION(0x%08x)", __FUNCTION__, PLAYER_ERROR_INVALID_OPERATION);
- return PLAYER_ERROR_INVALID_OPERATION;
- }
- }
-
- void *temp = NULL;
- if (type == PLAYER_DISPLAY_TYPE_NONE) {
- /* NULL surface */
- handle->display_handle = 0;
- handle->display_type = PLAYER_DISPLAY_TYPE_NONE;
- set_handle = NULL;
- } else {
- /* get handle from overlay or evas surface */
- obj = (Evas_Object *) display;
- object_type = evas_object_type_get(obj);
- if (object_type) {
- temp = handle->display_handle;
- if (type == PLAYER_DISPLAY_TYPE_OVERLAY && !strcmp(object_type, "elm_win")) {
- /* wayland overlay surface */
- LOGI("Wayland overlay surface type");
-
- wl_window = elm_win_wl_window_get(obj);
-
- /* get wl_surface */
- handle->display_handle = (void *)ecore_wl_window_surface_get(wl_window);
- set_handle = handle->display_handle;
-
- /* get wl_display */
- handle->wl_display = (void *)ecore_wl_display_get();
- set_wl_display = handle->wl_display;
- }
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
- else if (type == PLAYER_DISPLAY_TYPE_EVAS && !strcmp(object_type, "image")) {
- /* evas object surface */
- LOGI("evas surface type");
- handle->display_handle = display;
- set_handle = display;
- }
-#endif
- else {
- LOGE("invalid surface type");
- return PLAYER_ERROR_INVALID_PARAMETER;
- }
- } else {
- LOGE("falied to get evas object type from %p", obj);
- return PLAYER_ERROR_INVALID_PARAMETER;
- }
- }
-
- /* set display handle */
- if (handle->display_type == PLAYER_DISPLAY_TYPE_NONE || type == handle->display_type) {
- /* first time or same type */
- ret = mm_player_set_attribute(handle->mm_handle, NULL, "display_surface_type", __player_convet_display_type(type),
- "use_wl_surface", TRUE,
- "wl_display", set_wl_display, sizeof(void *),
- "display_overlay", set_handle, sizeof(player_display_h), (char *)NULL);
-
- if (ret != MM_ERROR_NONE) {
- handle->display_handle = temp;
- LOGE("[%s] Failed to display surface change :%d", __FUNCTION__, ret);
- } else {
- if (type != PLAYER_DISPLAY_TYPE_NONE) {
- handle->display_type = type;
- LOGI("[%s] video display has been changed- type :%d, addr : 0x%x", __FUNCTION__, handle->display_type, handle->display_handle);
- } else
- LOGI("NULL surface");
- }
- } else {
- /* changing surface case */
- if (handle->state >= PLAYER_STATE_READY) {
- LOGE("[%s] it is not available to change display surface from %d to %d", __FUNCTION__, handle->display_type, type);
- return PLAYER_ERROR_INVALID_OPERATION;
- }
- ret = mm_player_change_videosink(handle->mm_handle, __player_convet_display_type(type), set_handle);
- if (ret != MM_ERROR_NONE) {
- handle->display_handle = temp;
- if (ret == MM_ERROR_NOT_SUPPORT_API) {
- LOGE("[%s] change video sink is not available.", __FUNCTION__);
- ret = PLAYER_ERROR_NONE;
- } else {
- LOGE("[%s] Failed to display surface change :%d", __FUNCTION__, ret);
- }
- } else {
- handle->display_type = type;
- LOGI("[%s] video display has been changed- type :%d, addr : 0x%x", __FUNCTION__, handle->display_type, handle->display_handle);
- }
- }
-
- if (ret != MM_ERROR_NONE) {
- handle->display_type = PLAYER_DISPLAY_TYPE_NONE;
- return __player_convert_error_code(ret, (char *)__FUNCTION__);
- } else {
- return PLAYER_ERROR_NONE;
- }
-}
-
int legacy_player_set_display_mode(player_h player, player_display_mode_e mode)
{
PLAYER_INSTANCE_CHECK(player);
return PLAYER_ERROR_NONE;
}
-int legacy_player_set_display_wl_for_mused(player_h player, player_display_type_e type, unsigned int wl_surface_id)
+int legacy_player_set_display(player_h player, player_display_type_e type, unsigned int wl_surface_id)
{
PLAYER_INSTANCE_CHECK(player);
player_s *handle = (player_s *)player;
+++ /dev/null
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-SET(fw_test "${fw_name}-test")
-
-INCLUDE_DIRECTORIES(../include/)
-link_directories(${CMAKE_SOURCE_DIR}/../)
-
-SET(WIN_PKG "${WIN_PKG} ecore-wayland")
-
-INCLUDE(FindPkgConfig)
-pkg_check_modules(${fw_test} REQUIRED libtbm mm-player appcore-efl elementary ecore evas capi-media-sound-manager ${WIN_PKG})
-FOREACH(flag ${${fw_test}_CFLAGS})
- SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -pie -Wno-deprecated-declarations")
-SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib/gstreamer-1.0")
-
-aux_source_directory(. sources)
-FOREACH(src ${sources})
- GET_FILENAME_COMPONENT(src_name ${src} NAME_WE)
- MESSAGE("${src_name}")
- ADD_EXECUTABLE(${src_name} ${src})
- TARGET_LINK_LIBRARIES(${src_name} legacy-player ${${fw_test}_LDFLAGS})
- INSTALL(TARGETS ${src_name} DESTINATION bin)
-ENDFOREACH()
-
+++ /dev/null
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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.
- */
-
-#include <Elementary.h>
-#include <tbm_surface.h>
-#include <dlog.h>
-#include <legacy_player.h>
-#include <legacy_player_internal.h>
-#include <glib.h>
-#include <appcore-efl.h>
-#include <Ecore.h>
-#include <Ecore_Wayland.h>
-
-#define KEY_END "XF86Stop"
-
-#define ES_DEFAULT_DIR_PATH "/home/owner/content/"
-#define ES_DEFAULT_H264_VIDEO_PATH ES_DEFAULT_DIR_PATH"test.h264"
-#define ES_DEFAULT_VIDEO_FORMAT_TYPE MEDIA_FORMAT_H264_SP
-#define ES_DEFAULT_VIDEO_FORMAT_WIDTH 1280
-#define ES_DEFAULT_VIDEO_FORMAT_HEIGHT 544
-#define ES_DEFAULT_VIDEO_PTS_OFFSET 20000000
-#define ES_DEFAULT_NUMBER_OF_FEED 2000
-
-unsigned char sps[100];
-unsigned char pps[100];
-unsigned char tmp_buf[1000000];
-static int sps_len, pps_len;
-
-#ifdef PACKAGE
-#undef PACKAGE
-#endif
-#define PACKAGE "player_es_push_test"
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-#define LOG_TAG "PLAYER_TEST"
-
-static int app_create(void *data);
-static int app_reset(bundle *b, void *data);
-static int app_resume(void *data);
-static int app_pause(void *data);
-static int app_terminate(void *data);
-
-struct appcore_ops ops = {
- .create = app_create,
- .terminate = app_terminate,
- .pause = app_pause,
- .resume = app_resume,
- .reset = app_reset,
-};
-
-typedef struct appdata {
- Evas_Object *win;
- Evas_Object *rect;
- player_h player_handle;
- media_packet_h video_pkt;
- media_format_h video_fmt;
- FILE *file_src;
- pthread_t feeding_thread_id;
-} appdata_s;
-
-static void win_delete_request_cb(void *data, Evas_Object *obj, void *event_info)
-{
- elm_exit();
-}
-
-static Eina_Bool keydown_cb(void *data, int type, void *event)
-{
- /* appdata_s *ad = data; */
- Ecore_Event_Key *ev = event;
-
- LOGD("start");
-
- if (!strcmp(ev->keyname, KEY_END)) {
- /* Let window go to hide state. */
- /* elm_win_lower(ad->win); */
- LOGD("elm exit");
- elm_exit();
-
- return ECORE_CALLBACK_DONE;
- }
-
- LOGD("done");
-
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static void win_del(void *data, Evas_Object *obj, void *event)
-{
- elm_exit();
-}
-
-static Evas_Object *create_win(const char *name)
-{
- Evas_Object *eo = NULL;
- int w = 0;
- int h = 0;
-
- eo = elm_win_add(NULL, name, ELM_WIN_BASIC);
- if (eo) {
- elm_win_title_set(eo, name);
- elm_win_borderless_set(eo, EINA_TRUE);
- evas_object_smart_callback_add(eo, "delete,request", win_del, NULL);
- elm_win_screen_size_get(eo, NULL, NULL, &w, &h);
- g_print("window size :%d,%d", w, h);
- evas_object_resize(eo, w, h);
- elm_win_autodel_set(eo, EINA_TRUE);
- elm_win_alpha_set(eo, EINA_TRUE);
- }
- return eo;
-}
-
-static Evas_Object *create_render_rect(Evas_Object *pParent)
-{
- if (!pParent)
- return NULL;
-
- Evas *pEvas = evas_object_evas_get(pParent);
- Evas_Object *pObj = evas_object_rectangle_add(pEvas);
- if (pObj == NULL)
- return NULL;
-
- evas_object_size_hint_weight_set(pObj, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_color_set(pObj, 0, 0, 0, 0);
- evas_object_render_op_set(pObj, EVAS_RENDER_COPY);
- evas_object_show(pObj);
- elm_win_resize_object_add(pParent, pObj);
-
- return pObj;
-}
-
-static void create_base_gui(appdata_s *ad)
-{
- /* Enable GLES Backened */
- elm_config_preferred_engine_set("3d");
-
- /* Window */
- ad->win = create_win(PACKAGE); /* elm_win_util_standard_add(PACKAGE, PACKAGE); */
- ad->rect = create_render_rect(ad->win);
- /* This is not supported in 3.0
- elm_win_wm_desktop_layout_support_set(ad->win, EINA_TRUE); */
- elm_win_autodel_set(ad->win, EINA_TRUE);
- evas_object_smart_callback_add(ad->win, "delete,request", win_delete_request_cb, ad);
-
- /* Show window after base gui is set up */
- elm_win_activate(ad->win);
- evas_object_show(ad->win);
-}
-
-static int app_create(void *data)
-{
- /* Hook to take necessary actions before main event loop starts
- Initialize UI resources and application's data
- If this function returns true, the main loop of application starts
- If this function returns false, the application is terminated */
- appdata_s *ad = data;
-
- LOGD("start");
-
- create_base_gui(ad);
- ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, keydown_cb, NULL);
-
- /* open test file */
- ad->file_src = fopen(ES_DEFAULT_H264_VIDEO_PATH, "r");
-
- LOGD("done");
-
- return 0;
-}
-
-static int app_pause(void *data)
-{
- /* Take necessary actions when application becomes invisible. */
- appdata_s *ad = (appdata_s *)data;
- int ret = PLAYER_ERROR_NONE;
-
- LOGD("start");
-
- if (ad == NULL) {
- LOGE("appdata is NULL");
- return -1;
- }
-
- if (ad->player_handle == NULL) {
- LOGE("player_handle is NULL");
- return -1;
- }
-
- if (ad->feeding_thread_id) {
- pthread_join(ad->feeding_thread_id, NULL);
- ad->feeding_thread_id = 0;
- }
-
- legacy_player_unset_media_stream_buffer_status_cb_ex(ad->player_handle, PLAYER_STREAM_TYPE_VIDEO);
- legacy_player_unset_media_stream_buffer_status_cb_ex(ad->player_handle, PLAYER_STREAM_TYPE_AUDIO);
- legacy_player_unset_media_stream_seek_cb(ad->player_handle, PLAYER_STREAM_TYPE_VIDEO);
- legacy_player_unset_media_stream_seek_cb(ad->player_handle, PLAYER_STREAM_TYPE_AUDIO);
-
- ret = legacy_player_unprepare(ad->player_handle);
- if (ret != PLAYER_ERROR_NONE) {
- LOGE("legacy_player_unprepare failed : 0x%x", ret);
- return false;
- }
-
- /* unref media format */
- if (ad->video_fmt)
- media_format_unref(ad->video_fmt);
-
- fclose(ad->file_src);
-
- /* destroy player handle */
- ret = legacy_player_destroy(ad->player_handle);
- if (ret != PLAYER_ERROR_NONE) {
- LOGE("legacy_player_destroy failed : 0x%x", ret);
- return false;
- }
-
- ad->player_handle = NULL;
-
- LOGD("done");
-
- return 0;
-}
-
-static int app_resume(void *data)
-{
- LOGD("start");
-
- LOGD("done");
-
- return 0;
-}
-
-static void _player_prepared_cb(void *user_data)
-{
- int ret = PLAYER_ERROR_NONE;
- appdata_s *ad = (appdata_s *)user_data;
-
- LOGD("prepared");
-
- ret = legacy_player_start(ad->player_handle);
- if (ret != PLAYER_ERROR_NONE)
- LOGE("player start failed : 0x%x", ret);
-
- LOGD("done");
-}
-
-int bytestream2nalunit(FILE *fd, unsigned char *nal)
-{
- int nal_length = 0;
- size_t result;
- int read_size = 1;
- unsigned char buffer[1000000];
- unsigned char val, zero_count, i;
- int nal_unit_type = 0;
- int init;
-
- zero_count = 0;
- if (feof(fd))
- return -1;
-
- result = fread(buffer, 1, read_size, fd);
-
- if (result != read_size)
- return -1;
-
- val = buffer[0];
- while (!val) {
- if ((zero_count == 2 || zero_count == 3) && val == 1)
- break;
-
- zero_count++;
- result = fread(buffer, 1, read_size, fd);
-
- if (result != read_size)
- break;
-
- val = buffer[0];
- }
- nal[nal_length++] = 0;
- nal[nal_length++] = 0;
- nal[nal_length++] = 0;
- nal[nal_length++] = 1;
- zero_count = 0;
- init = 1;
- while (1) {
- if (feof(fd))
- return -1;
-
- result = fread(buffer, 1, read_size, fd);
- if (result != read_size) {
- if (init == 1)
- return -1;
- break;
- }
- val = buffer[0];
-
- if (init) {
- nal_unit_type = val & 0xf;
- init = 0;
- }
- if (!val) {
- zero_count++;
- } else {
- if ((zero_count == 2 || zero_count == 3 || zero_count == 4) && (val == 1)) {
- break;
- } else {
- for (i = 0; i < zero_count; i++)
- nal[nal_length++] = 0;
-
- nal[nal_length++] = val;
- zero_count = 0;
- }
- }
- }
-
- fseek(fd, -(zero_count + 1), SEEK_CUR);
-
- if (nal_unit_type == 0x7) {
- sps_len = nal_length;
- memcpy(sps, nal, nal_length);
- return 0;
- } else if (nal_unit_type == 0x8) {
- pps_len = nal_length;
- memcpy(pps, nal, nal_length);
- return 0;
- } else if (nal_unit_type == 0x5) {
- memcpy(tmp_buf, nal, nal_length);
- memcpy(nal, sps, sps_len);
- memcpy(nal + sps_len, pps, pps_len);
- memcpy(nal + sps_len + pps_len, tmp_buf, nal_length);
- nal_length += sps_len + pps_len;
- }
-
- return nal_length;
-}
-
-static void feed_eos_data(appdata_s *appdata)
-{
- appdata_s *ad = appdata;
-
- LOGD("push EOS");
-
- if (media_packet_create_alloc(ad->video_fmt, NULL, NULL, &ad->video_pkt) != MEDIA_PACKET_ERROR_NONE) {
- LOGE("media_packet_create_alloc failed\n");
- return;
- }
-
- if (media_packet_set_buffer_size(ad->video_pkt, (uint64_t)0) != MEDIA_PACKET_ERROR_NONE) {
- LOGE("media_packet_set_buffer_size failed\n");
- return;
- }
-
- media_packet_set_flags(ad->video_pkt, MEDIA_PACKET_END_OF_STREAM);
- if (legacy_player_push_media_stream(ad->player_handle, ad->video_pkt) != PLAYER_ERROR_NONE)
- LOGE("fail to push media packet\n");
-
- media_packet_destroy(ad->video_pkt);
- ad->video_pkt = NULL;
-
- return;
-}
-
-static bool feed_video_data(appdata_s *appdata)
-{
- bool ret = FALSE;
- int read = 0;
- static guint64 pts = 0L;
- void *buf_data_ptr = NULL;
- appdata_s *ad = appdata;
-
- if (media_packet_create_alloc(ad->video_fmt, NULL, NULL, &ad->video_pkt) != MEDIA_PACKET_ERROR_NONE) {
- LOGE("media_packet_create_alloc failed\n");
- return FALSE;
- }
-
- if (media_packet_get_buffer_data_ptr(ad->video_pkt, &buf_data_ptr) != MEDIA_PACKET_ERROR_NONE) {
- LOGE("media_packet_get_buffer_data_ptr failed\n");
- goto ERROR;
- }
-
- if (media_packet_set_pts(ad->video_pkt, (uint64_t)pts) != MEDIA_PACKET_ERROR_NONE) {
- LOGE("media_packet_set_pts failed\n");
- goto ERROR;
- }
-
- /* NOTE: In case of H.264 video, stream format for feeding is NAL unit.
- * And, SPS(0x67) and PPS(0x68) should be located before IDR.(0x65).
- */
- read = bytestream2nalunit(ad->file_src, buf_data_ptr);
- LOGD("real length = %d\n", read);
- if (read == 0) {
- LOGE("input file read failed\n");
- ret = TRUE;
- goto ERROR;
- } else if (read < 0) {
- LOGD("push EOS");
- media_packet_set_buffer_size(ad->video_pkt, (uint64_t)0);
- media_packet_set_flags(ad->video_pkt, MEDIA_PACKET_END_OF_STREAM);
- if (legacy_player_push_media_stream(ad->player_handle, ad->video_pkt) != PLAYER_ERROR_NONE)
- LOGE("fail to push media packet\n");
- goto ERROR;
- }
-
- if (media_packet_set_buffer_size(ad->video_pkt, (uint64_t)read) != MEDIA_PACKET_ERROR_NONE) {
- LOGE("media_packet_set_buffer_size failed\n");
- goto ERROR;
- }
-
- /* push media packet */
- legacy_player_push_media_stream(ad->player_handle, ad->video_pkt);
- pts += ES_DEFAULT_VIDEO_PTS_OFFSET;
- ret = TRUE;
-
-ERROR:
- /* destroy media packet after use */
- media_packet_destroy(ad->video_pkt);
- ad->video_pkt = NULL;
- return ret;
-}
-
-static void feed_video_data_thread_func(void *data)
-{
- appdata_s *ad = (appdata_s *)data;
-
- while (TRUE) {
- static int frame_count = 0;
-
- if (frame_count < ES_DEFAULT_NUMBER_OF_FEED) {
- if (!feed_video_data(ad))
- break;
- frame_count++;
- } else {
- feed_eos_data(ad);
- break;
- }
- }
-}
-
-void _video_buffer_status_cb_ex(player_media_stream_buffer_status_e status, unsigned long long bytes, void *user_data)
-{
- if (status == PLAYER_MEDIA_STREAM_BUFFER_UNDERRUN)
- LOGE("video buffer is underrun state, current level byte = %llu", bytes);
- else if (status == PLAYER_MEDIA_STREAM_BUFFER_OVERFLOW)
- LOGE("video buffer is overrun state, current level byte = %llu", bytes);
-}
-
-void _audio_buffer_status_cb_ex(player_media_stream_buffer_status_e status, unsigned long long bytes, void *user_data)
-{
- if (status == PLAYER_MEDIA_STREAM_BUFFER_UNDERRUN)
- LOGE("audio buffer is underrun state, current level byte = %llu", bytes);
- else if (status == PLAYER_MEDIA_STREAM_BUFFER_OVERFLOW)
- LOGE("audio buffer is overrun state, current level byte = %llu", bytes);
-}
-
-void _video_seek_data_cb(unsigned long long offset, void *user_data)
-{
- LOGE("seek offset of video is %llu", offset);
-}
-
-void _audio_seek_data_cb(unsigned long long offset, void *user_data)
-{
- LOGE("seek offset of audio is %llu", offset);
-}
-
-static int app_reset(bundle *b, void *data)
-{
- /* Take necessary actions when application becomes visible. */
- appdata_s *ad = (appdata_s *)data;
- int ret = PLAYER_ERROR_NONE;
-
- LOGD("start");
-
- if (ad == NULL) {
- LOGE("appdata is NULL");
- return -1;
- }
-
- ret = legacy_player_create(&ad->player_handle);
- if (ret != PLAYER_ERROR_NONE) {
- LOGE("legacy_player_create failed : 0x%x", ret);
- return -1;
- }
-
- ret = legacy_player_set_display(ad->player_handle, PLAYER_DISPLAY_TYPE_OVERLAY, GET_DISPLAY(ad->win));
- if (ret != PLAYER_ERROR_NONE) {
- LOGE("legacy_player_set_display failed : 0x%x", ret);
- goto FAILED;
- }
-
- /* get media format format */
- ret = media_format_create(&ad->video_fmt);
- if (ret != MEDIA_FORMAT_ERROR_NONE) {
- LOGE("media_format_create : 0x%x", ret);
- goto FAILED;
- }
-
- /* set video format */
- media_format_set_video_mime(ad->video_fmt, ES_DEFAULT_VIDEO_FORMAT_TYPE);
- media_format_set_video_width(ad->video_fmt, ES_DEFAULT_VIDEO_FORMAT_WIDTH);
- media_format_set_video_height(ad->video_fmt, ES_DEFAULT_VIDEO_FORMAT_HEIGHT);
-
- legacy_player_set_media_stream_buffer_max_size(ad->player_handle, PLAYER_STREAM_TYPE_VIDEO, (unsigned long long)3*1024*1024);
- legacy_player_set_media_stream_buffer_min_threshold(ad->player_handle, PLAYER_STREAM_TYPE_VIDEO, 50);
-
- ret = legacy_player_set_media_stream_buffer_status_cb_ex(ad->player_handle, PLAYER_STREAM_TYPE_VIDEO, _video_buffer_status_cb_ex, (void *)ad);
- if (ret != PLAYER_ERROR_NONE) {
- LOGE("player set video buffer status cb failed : 0x%x", ret);
- goto FAILED;
- }
- ret = legacy_player_set_media_stream_buffer_status_cb_ex(ad->player_handle, PLAYER_STREAM_TYPE_AUDIO, _audio_buffer_status_cb_ex, (void *)ad);
- if (ret != PLAYER_ERROR_NONE) {
- LOGE("player set audio buffer status cb failed : 0x%x", ret);
- goto FAILED;
- }
-
- ret = legacy_player_set_media_stream_seek_cb(ad->player_handle, PLAYER_STREAM_TYPE_VIDEO, _video_seek_data_cb, (void *)ad);
- if (ret != PLAYER_ERROR_NONE) {
- LOGE("player set seek data cb for video failed : 0x%x", ret);
- goto FAILED;
- }
- ret = legacy_player_set_media_stream_seek_cb(ad->player_handle, PLAYER_STREAM_TYPE_AUDIO, _audio_seek_data_cb, (void *)ad);
- if (ret != PLAYER_ERROR_NONE) {
- LOGE("player set seek data cb for audio failed : 0x%x", ret);
- goto FAILED;
- }
-
- /* send media packet to player */
- legacy_player_set_media_stream_info(ad->player_handle, PLAYER_STREAM_TYPE_VIDEO, ad->video_fmt);
-
- ret = legacy_player_prepare_async(ad->player_handle, _player_prepared_cb, (void *)ad);
- if (ret != PLAYER_ERROR_NONE) {
- LOGE("player prepare failed : 0x%x", ret);
- goto FAILED;
- }
-
- pthread_create(&ad->feeding_thread_id, NULL, (void *)feed_video_data_thread_func, (void *)ad);
-
- LOGD("done");
-
- return 0;
-
-FAILED:
- if (ad->player_handle) {
- legacy_player_destroy(ad->player_handle);
- ad->player_handle = NULL;
- }
-
- return -1;
-}
-
-static int app_terminate(void *data)
-{
- /* Release all resources. */
- appdata_s *ad = (appdata_s *)data;
-
- LOGD("start");
-
- if (ad == NULL) {
- LOGE("appdata is NULL");
- return -1;
- }
-
- app_pause(data);
-
- LOGD("done");
-
- return 0;
-}
-
-int main(int argc, char *argv[])
-{
- int ret = 0;
- static appdata_s ad = {0, };
-
- LOGD("start");
-
- memset(&ad, 0x0, sizeof(appdata_s));
-
- LOGD("call appcore_efl_main");
-
- ops.data = &ad;
-
- ret = appcore_efl_main(PACKAGE, &argc, &argv, &ops);
-
- LOGD("appcore_efl_main() ret = 0x%x", ret);
-
- return ret;
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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.
- */
-
-#include <Elementary.h>
-#include <tbm_surface.h>
-#include <dlog.h>
-#include <legacy_player.h>
-#include <glib.h>
-#include <appcore-efl.h>
-
-#define KEY_END "XF86Stop"
-#define MEDIA_FILE_PATH "/home/owner/content/Color.mp4"
-#ifdef PACKAGE
-#undef PACKAGE
-#endif
-#define PACKAGE "player_test"
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-#define LOG_TAG "PLAYER_TEST"
-
-static int app_create(void *data);
-static int app_reset(bundle *b, void *data);
-static int app_resume(void *data);
-static int app_pause(void *data);
-static int app_terminate(void *data);
-
-struct appcore_ops ops = {
- .create = app_create,
- .terminate = app_terminate,
- .pause = app_pause,
- .resume = app_resume,
- .reset = app_reset,
-};
-
-typedef struct appdata {
- Evas_Object *win;
- Evas_Object *img;
- media_packet_h packet;
- Ecore_Pipe *pipe;
- player_h player_handle;
- GList *packet_list;
- GMutex buffer_lock;
- int w, h;
-} appdata_s;
-
-static void win_delete_request_cb(void *data, Evas_Object *obj, void *event_info)
-{
- elm_exit();
-}
-
-static Eina_Bool keydown_cb(void *data, int type, void *event)
-{
- /* appdata_s *ad = data; */
- Ecore_Event_Key *ev = event;
-
- LOGD("start");
-
- if (!strcmp(ev->keyname, KEY_END)) {
- /* Let window go to hide state. */
- /* elm_win_lower(ad->win); */
- LOGD("elm exit");
- elm_exit();
-
- return ECORE_CALLBACK_DONE;
- }
-
- LOGD("done");
-
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static void create_base_gui(appdata_s *ad)
-{
- /* Enable GLES Backened */
- elm_config_preferred_engine_set("3d");
-
- /* Window */
- ad->win = elm_win_util_standard_add(PACKAGE, PACKAGE);
- /* This is not supported in 3.0
- elm_win_wm_desktop_layout_support_set(ad->win, EINA_TRUE); */
- elm_win_autodel_set(ad->win, EINA_TRUE);
-#if 0
- if (elm_win_wm_rotation_supported_get(ad->win)) {
- int rots[4] = { 0, 90, 180, 270 };
- elm_win_wm_rotation_available_rotations_set(ad->win, (const int *)(&rots), 4);
- }
-#endif
- evas_object_smart_callback_add(ad->win, "delete,request", win_delete_request_cb, ad);
-
- Evas *e = evas_object_evas_get(ad->win);
-
- elm_win_screen_size_get(ad->win, NULL, NULL, &ad->w, &ad->h);
- LOGD("surface size (%d x %d)\n", ad->w, ad->h);
-
- /* Image Object */
- ad->img = evas_object_image_filled_add(e);
- evas_object_image_size_set(ad->img, ad->w, ad->h);
- evas_object_size_hint_weight_set(ad->img, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_show(ad->img);
-
- elm_win_resize_object_add(ad->win, ad->img);
-
- /* Show window after base gui is set up */
- evas_object_show(ad->win);
-}
-
-static void _media_packet_video_decoded_cb(media_packet_h packet, void *user_data)
-{
- /* This callback function would be called on different thread */
- appdata_s *ad = user_data;
-
- if (ad == NULL) {
- LOGE("appdata is NULL");
- return;
- }
-
- g_mutex_lock(&ad->buffer_lock);
-
- if (ad->pipe == NULL) {
- media_packet_destroy(packet);
- LOGW("release media packet immediately");
- return;
- }
-
- /* add packet list */
- ad->packet_list = g_list_prepend(ad->packet_list, (gpointer)packet);
-
- LOGD("packet %p", packet);
-
- /* Send packet to main thread */
- ecore_pipe_write(ad->pipe, &packet, sizeof(media_packet_h));
-
- g_mutex_unlock(&ad->buffer_lock);
-
- return;
-}
-
-static void pipe_cb(void *data, void *buf, unsigned int len)
-{
- /* Now, we get a player surface to be set here. */
- appdata_s *ad = data;
- tbm_surface_h surface;
-#if _CAN_USE_NATIVE_SURFACE_TBM
- Evas_Native_Surface surf;
-#endif
- tbm_surface_info_s suf_info;
- uint32_t plane_idx;
- int ret;
- GList *last_item = NULL;
-
- LOGD("start");
-
- g_mutex_lock(&ad->buffer_lock);
-
- /* Destroy previous packet */
- if (ad->packet) {
- ret = media_packet_destroy(ad->packet);
- if (ret != MEDIA_PACKET_ERROR_NONE)
- LOGE("Failed to destroy media packet. ret (%d)", ret);
- ad->packet = NULL;
- }
-
- /* remove packet from list */
- last_item = g_list_last(ad->packet_list);
- if (last_item) {
- /* Get new packet */
- ad->packet = (media_packet_h)last_item->data;;
- ad->packet_list = g_list_remove(ad->packet_list, ad->packet);
- LOGD("ad->packet %p", ad->packet);
- }
-
- if (ad->packet == NULL) {
- LOGW("NULL packet");
- g_mutex_unlock(&ad->buffer_lock);
- return;
- }
-
- ret = media_packet_get_tbm_surface(ad->packet, &surface);
- if (ret != MEDIA_PACKET_ERROR_NONE) {
- LOGE("Failed to get surface from media packet. ret(0x%x)", ret);
-
- media_packet_destroy(ad->packet);
- ad->packet = NULL;
-
- g_mutex_unlock(&ad->buffer_lock);
-
- return;
- }
-
- LOGD("surface %p", surface);
-
- g_mutex_unlock(&ad->buffer_lock);
-
-#if _CAN_USE_NATIVE_SURFACE_TBM
- /* Set tbm surface to image native surface */
- memset(&surf, 0x0, sizeof(surf));
- surf.version = EVAS_NATIVE_SURFACE_VERSION;
- surf.type = EVAS_NATIVE_SURFACE_TBM;
- surf.data.tizen.buffer = surface;
- surf.data.tizen.rot = 270;
- evas_object_image_native_surface_set(ad->img, &surf);
-
- /* Set dirty image region to be redrawn */
- evas_object_image_data_update_add(ad->img, 0, 0, ad->w, ad->h);
-#else
- unsigned char *ptr = NULL;
- unsigned char *buf_data = NULL;
- media_format_h format = NULL;
- media_format_mimetype_e mimetype;
-
- media_packet_get_format(ad->packet, &format);
- media_format_get_video_info(format, &mimetype, NULL, NULL, NULL, NULL);
- media_format_unref(format);
-
- if (mimetype == MEDIA_FORMAT_I420 || mimetype == MEDIA_FORMAT_NV12 || mimetype == MEDIA_FORMAT_NV12T) {
-
- tbm_surface_get_info(surface, &suf_info);
- buf_data = (unsigned char *)g_malloc0(suf_info.size);
- if (!buf_data) {
- LOGE("no free space");
- return;
- }
- ptr = buf_data;
-
- for (plane_idx = 0; plane_idx < suf_info.num_planes; plane_idx++) {
- memcpy(ptr, suf_info.planes[plane_idx].ptr, suf_info.planes[plane_idx].size);
- ptr += suf_info.planes[plane_idx].size;
- }
- /* dump buf data here, if needed */
- g_free(buf_data);
- }
-#endif
-
- LOGD("done");
-
- return;
-}
-
-static int app_create(void *data)
-{
- /* Hook to take necessary actions before main event loop starts
- Initialize UI resources and application's data
- If this function returns true, the main loop of application starts
- If this function returns false, the application is terminated */
- appdata_s *ad = data;
-
- LOGD("start");
-
- create_base_gui(ad);
- ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, keydown_cb, NULL);
-
- g_mutex_init(&ad->buffer_lock);
-
- LOGD("done");
-
- return 0;
-}
-
-static int app_pause(void *data)
-{
- /* Take necessary actions when application becomes invisible. */
- appdata_s *ad = (appdata_s *)data;
- GList *list = NULL;
- media_packet_h packet = NULL;
- int ret = PLAYER_ERROR_NONE;
-
- LOGD("start");
-
- if (ad == NULL) {
- LOGE("appdata is NULL");
- return -1;
- }
-
- if (ad->player_handle == NULL) {
- printf("player_handle is NULL");
- return -1;
- }
-
- /* stop render last set frame */
- evas_object_image_native_surface_set(ad->img, NULL);
-
- g_mutex_lock(&ad->buffer_lock);
-
- /* remove ecore pipe */
- ecore_pipe_del(ad->pipe);
- ad->pipe = NULL;
-
- /* remove packet list */
- list = ad->packet_list;
- while (list) {
- packet = list->data;
- list = g_list_next(list);
-
- if (!packet) {
- LOGW("packet is NULL");
- } else {
- LOGD("destroy packet %p", packet);
- media_packet_destroy(packet);
- packet = NULL;
- ad->packet_list = g_list_remove(ad->packet_list, packet);
- }
- }
-
- if (ad->packet_list) {
- g_list_free(ad->packet_list);
- ad->packet_list = NULL;
- }
-
- /* Destroy previous packet */
- if (ad->packet) {
- LOGD("destroy packet %p", ad->packet);
- ret = media_packet_destroy(ad->packet);
- if (ret != MEDIA_PACKET_ERROR_NONE)
- LOGE("Failed to destroy media packet. ret (%d)", ret);
- ad->packet = NULL;
- }
-
- g_mutex_unlock(&ad->buffer_lock);
-
- ret = legacy_player_unprepare(ad->player_handle);
- if (ret != PLAYER_ERROR_NONE) {
- printf("legacy_player_unprepare failed : 0x%x", ret);
- return false;
- }
-
- ret = legacy_player_destroy(ad->player_handle);
- if (ret != PLAYER_ERROR_NONE) {
- printf("legacy_player_destroy failed : 0x%x", ret);
- return false;
- }
-
- ad->player_handle = NULL;
-
- LOGD("done");
-
- return 0;
-}
-
-static int app_resume(void *data)
-{
- LOGD("start");
-
- LOGD("done");
-
- return 0;
-}
-
-static int app_reset(bundle *b, void *data)
-{
- /* Take necessary actions when application becomes visible. */
- appdata_s *ad = (appdata_s *)data;
- int ret = PLAYER_ERROR_NONE;
-
- LOGD("start");
-
- if (ad == NULL) {
- LOGE("appdata is NULL");
- return -1;
- }
-
- /* create ecore pipe */
- ad->pipe = ecore_pipe_add(pipe_cb, ad);
-
- ret = legacy_player_create(&ad->player_handle);
- if (ret != PLAYER_ERROR_NONE) {
- LOGE("legacy_player_create failed : 0x%x", ret);
- return -1;
- }
-
- ret = legacy_player_set_media_packet_video_frame_decoded_cb(ad->player_handle, _media_packet_video_decoded_cb, ad);
- if (ret != PLAYER_ERROR_NONE) {
- LOGE("legacy_player_set_media_packet_video_frame_decoded_cb failed : 0x%x", ret);
- goto FAILED;
- }
-
- ret = legacy_player_set_display(ad->player_handle, PLAYER_DISPLAY_TYPE_NONE, NULL);
- if (ret != PLAYER_ERROR_NONE) {
- LOGE("legacy_player_set_display failed : 0x%x", ret);
- goto FAILED;
- }
-
- ret = legacy_player_set_uri(ad->player_handle, MEDIA_FILE_PATH);
- if (ret != PLAYER_ERROR_NONE) {
- LOGE("legacy_player_set_uri failed : 0x%x", ret);
- goto FAILED;
- }
-
- ret = legacy_player_prepare(ad->player_handle);
- if (ret != PLAYER_ERROR_NONE) {
- LOGE("player prepare failed : 0x%x", ret);
- goto FAILED;
- }
-
- ret = legacy_player_start(ad->player_handle);
- if (ret != PLAYER_ERROR_NONE) {
- LOGE("player start failed : 0x%x", ret);
- goto FAILED;
- }
-
- LOGD("done");
-
- return 0;
-
-FAILED:
- if (ad->player_handle) {
- legacy_player_destroy(ad->player_handle);
- ad->player_handle = NULL;
- }
-
- return -1;
-
-}
-
-static int app_terminate(void *data)
-{
- /* Release all resources. */
- appdata_s *ad = (appdata_s *)data;
-
- LOGD("start");
-
- if (ad == NULL) {
- LOGE("appdata is NULL");
- return -1;
- }
-
- app_pause(data);
-
- g_mutex_clear(&ad->buffer_lock);
-
- LOGD("done");
-
- return 0;
-}
-
-int main(int argc, char *argv[])
-{
- int ret = 0;
- static appdata_s ad = {0, };
-
- LOGD("start");
-
- memset(&ad, 0x0, sizeof(appdata_s));
-
- LOGD("call appcore_efl_main");
-
- ops.data = &ad;
-
- ret = appcore_efl_main(PACKAGE, &argc, &argv, &ops);
-
- LOGD("appcore_efl_main() ret = 0x%x", ret);
-
- return ret;
-}
+++ /dev/null
-/*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
-*
-* 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.
-*/
-#include <legacy_player.h>
-#include <legacy_player_internal.h>
-#include <sound_manager.h>
-#include <pthread.h>
-#include <glib.h>
-#include <dlfcn.h>
-#include <appcore-efl.h>
-#include <Elementary.h>
-#include <Ecore.h>
-#include <Ecore_Wayland.h>
-#define PACKAGE "player_test"
-#define MAX_STRING_LEN 2048
-#define MMTS_SAMPLELIST_INI_DEFAULT_PATH "/opt/etc/mmts_filelist.ini"
-#define PLAYER_TEST_DUMP_PATH_PREFIX "/home/owner/content/dump_pcm_"
-#define INI_SAMPLE_LIST_MAX 9
-#define DEFAULT_HTTP_TIMEOUT -1
-
-static gboolean g_memory_playback = FALSE;
-static char g_uri[MAX_STRING_LEN];
-static char g_subtitle_uri[MAX_STRING_LEN];
-static FILE *g_pcm_fd;
-
-static gboolean is_es_push_mode = FALSE;
-static pthread_t g_feed_video_thread_id = 0;
-static bool g_thread_end = FALSE;
-static media_packet_h g_audio_pkt = NULL;
-static media_format_h g_audio_fmt = NULL;
-
-static media_packet_h g_video_pkt = NULL;
-static media_format_h g_video_fmt = NULL;
-
-/* #define DUMP_OUTBUF 1 */
-#if DUMP_OUTBUF
-FILE *fp_out1 = NULL;
-FILE *fp_out2 = NULL;
-#endif
-
-enum {
- CURRENT_STATUS_MAINMENU,
- CURRENT_STATUS_HANDLE_NUM,
- CURRENT_STATUS_FILENAME,
- CURRENT_STATUS_VOLUME,
- CURRENT_STATUS_SOUND_TYPE,
- CURRENT_STATUS_SOUND_STREAM_INFO,
- CURRENT_STATUS_MUTE,
- CURRENT_STATUS_POSITION_TIME,
- CURRENT_STATUS_LOOPING,
- CURRENT_STATUS_DISPLAY_SURFACE_CHANGE,
- CURRENT_STATUS_DISPLAY_MODE,
- CURRENT_STATUS_DISPLAY_ROTATION,
- CURRENT_STATUS_DISPLAY_VISIBLE,
- CURRENT_STATUS_SUBTITLE_FILENAME,
- CURRENT_STATUS_AUDIO_EQUALIZER,
- CURRENT_STATUS_PLAYBACK_RATE,
- CURRENT_STATUS_SWITCH_SUBTITLE,
-};
-
-#define MAX_HANDLE 20
-
-/* for video display */
-Evas_Object *g_win_id;
-Evas_Object *g_eo_win;
-Evas_Object *g_eo[MAX_HANDLE] = {0, };
-
-int g_current_surface_type = PLAYER_DISPLAY_TYPE_OVERLAY;
-
-struct appdata {
-
- Evas_Object *win;
- Evas_Object *bg;
- Evas_Object *rect;
- Evas_Object *layout_main; /* layout widget based on EDJ */
- /* add more variables here */
-};
-
-static Evas_Object *create_bg(Evas_Object * pParent)
-{
- if (!pParent)
- return NULL;
-
- Evas_Object *pObj = NULL;
-
- pObj = elm_bg_add(pParent);
- evas_object_size_hint_weight_set(pObj, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_win_resize_object_add(pParent, pObj);
- evas_object_color_set(pObj, 0, 0, 0, 0);
- evas_object_show(pObj);
- return pObj;
-}
-
-static void win_del(void *data, Evas_Object * obj, void *event)
-{
- elm_exit();
-}
-
-static Evas_Object *create_win(const char *name)
-{
- Evas_Object *eo = NULL;
- int w = 0;
- int h = 0;
-
- g_print("[%s][%d] name=%s\n", __func__, __LINE__, name);
-
- eo = elm_win_add(NULL, name, ELM_WIN_BASIC);
- if (eo) {
- elm_win_title_set(eo, name);
- elm_win_borderless_set(eo, EINA_TRUE);
- evas_object_smart_callback_add(eo, "delete,request", win_del, NULL);
- elm_win_screen_size_get(eo, NULL, NULL, &w, &h);
- g_print("window size :%d,%d", w, h);
- evas_object_resize(eo, w, h);
- elm_win_autodel_set(eo, EINA_TRUE);
- elm_win_alpha_set(eo, EINA_TRUE);
- }
- return eo;
-}
-
-static Evas_Object *create_image_object(Evas_Object * eo_parent)
-{
- if (!eo_parent)
- return NULL;
-
- Evas *evas = evas_object_evas_get(eo_parent);
- Evas_Object *eo = NULL;
-
- eo = evas_object_image_add(evas);
-
- return eo;
-}
-
-static Evas_Object *create_render_rect(Evas_Object * pParent)
-{
- if (!pParent)
- return NULL;
-
- Evas *pEvas = evas_object_evas_get(pParent);
- Evas_Object *pObj = evas_object_rectangle_add(pEvas);
- if (pObj == NULL)
- return NULL;
-
- evas_object_size_hint_weight_set(pObj, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_color_set(pObj, 0, 0, 0, 0);
- evas_object_render_op_set(pObj, EVAS_RENDER_COPY);
- evas_object_show(pObj);
- elm_win_resize_object_add(pParent, pObj);
-
- return pObj;
-}
-
-static int app_create(void *data)
-{
- struct appdata *ad = data;
- Evas_Object *win = NULL;
-
- /* use gl backend */
- elm_config_preferred_engine_set("3d");
-
- /* create window */
- win = create_win(PACKAGE);
- if (win == NULL)
- return -1;
- ad->win = win;
- g_eo_win = win;
- ad->bg = create_bg(ad->win);
- ad->rect = create_render_rect(ad->win);
- g_win_id = ad->win;
- /* Create evas image object for EVAS surface */
- g_eo[0] = create_image_object(ad->win);
- evas_object_image_size_set(g_eo[0], 500, 500);
- evas_object_image_fill_set(g_eo[0], 0, 0, 500, 500);
- evas_object_resize(g_eo[0], 500, 500);
-
- elm_win_activate(win);
- evas_object_show(win);
-
- return 0;
-}
-
-static int app_terminate(void *data)
-{
- struct appdata *ad = data;
- int i = 0;
-
- for (i = 0; i < MAX_HANDLE; i++) {
- if (g_eo[i]) {
- evas_object_del(g_eo[i]);
- g_eo[i] = NULL;
- }
- }
- if (g_eo_win) {
- evas_object_del(g_eo_win);
- g_eo_win = NULL;
- }
- ad->win = NULL;
- return 0;
-}
-
-struct appcore_ops ops = {
- .create = app_create,
- .terminate = app_terminate,
-};
-
-struct appdata ad;
-static player_h g_player[MAX_HANDLE] = {0, };
-
-int g_handle_num = 1;
-int g_menu_state = CURRENT_STATUS_MAINMENU;
-char g_file_list[9][256];
-gboolean quit_pushing;
-sound_stream_info_h g_stream_info_h = NULL;
-
-static void prepared_cb(void *user_data)
-{
- g_print("[Player_Test] prepared_cb!!!!\n");
-}
-
-static void _audio_frame_decoded_cb_ex(player_audio_raw_data_s *audio_raw_frame, void *user_data)
-{
- player_audio_raw_data_s *audio_raw = audio_raw_frame;
-
- if (!audio_raw)
- return;
-
- g_print("[Player_Test] decoded_cb_ex! channel: %d channel_mask: %" G_GUINT64_FORMAT "\n", audio_raw->channel, audio_raw->channel_mask);
-
-#ifdef DUMP_OUTBUF
- if (audio_raw->channel_mask == 1)
- fwrite((guint8 *) audio_raw->data, 1, audio_raw->size, fp_out1);
- else if (audio_raw->channel_mask == 2)
- fwrite((guint8 *) audio_raw->data, 1, audio_raw->size, fp_out2);
-#endif
-}
-
-static void progress_down_cb(player_pd_message_type_e type, void *user_data)
-{
- g_print("[Player_Test] progress_down_cb!!!! type : %d\n", type);
-}
-
-static void buffering_cb(int percent, void *user_data)
-{
- g_print("[Player_Test] buffering_cb!!!! percent : %d\n", percent);
-}
-
-static void seek_completed_cb(void *user_data)
-{
- g_print("[Player_Test] seek_completed_cb!!! \n");
-}
-
-static void completed_cb(void *user_data)
-{
- g_print("[Player_Test] completed_cb!!!!\n");
-}
-
-static void error_cb(int code, void *user_data)
-{
- g_print("[Player_Test] error_cb!!!! code : %d\n", code);
-}
-
-static void interrupted_cb(player_interrupted_code_e code, void *user_data)
-{
- g_print("[Player_Test] interrupted_cb!!!! code : %d\n", code);
-}
-
-#if 0
-static void audio_frame_decoded_cb(unsigned char *data, unsigned int size, void *user_data)
-{
- int pos = 0;
-
- if (data && g_pcm_fd)
- fwrite(data, 1, size, g_pcm_fd);
-
- legacy_player_get_play_position(g_player[0], &pos);
- g_print("[Player_Test] audio_frame_decoded_cb [size: %d] --- current pos : %d!!!!\n", size, pos);
-}
-#endif
-
-static void subtitle_updated_cb(unsigned long duration, char *text, void *user_data)
-{
- g_print("[Player_Test] subtitle_updated_cb!!!! [%ld] %s\n", duration, text);
-}
-
-static void video_captured_cb(unsigned char *data, int width, int height, unsigned int size, void *user_data)
-{
- g_print("[Player_Test] video_captured_cb!!!! width: %d, height : %d, size : %d \n", width, height, size);
-}
-
-int _save(unsigned char *src, int length)
-{
- /* unlink(CAPTUERD_IMAGE_SAVE_PATH); */
- FILE *fp;
- char filename[256] = {0, };
- static int WRITE_COUNT = 0;
-
- /* gchar *filename = CAPTUERD_IMAGE_SAVE_PATH; */
- snprintf(filename, 256, "/tmp/ALBUM_ART_IMAGE_%d", WRITE_COUNT);
- WRITE_COUNT++;
- fp = fopen(filename, "w+");
- if (fp == NULL) {
- g_print("file open error!!\n");
- return FALSE;
- } else {
- g_print("open success\n");
- if (fwrite(src, 1, length, fp) < 1) {
- g_print("file write error!!\n");
- fclose(fp);
- return FALSE;
- }
- g_print("write success(%s)\n", filename);
- fclose(fp);
- }
-
- return TRUE;
-}
-
-static void reset_display()
-{
- int i = 0;
-
- /* delete evas window, if it is */
- for (i = 0; i < MAX_HANDLE; i++) {
- if (g_eo[i]) {
- evas_object_del(g_eo[i]);
- g_eo[i] = NULL;
- }
- }
-
-}
-
-static void input_filename(char *filename)
-{
- int len = strlen(filename);
- int i = 0;
-
- if (len < 0 || len > MAX_STRING_LEN)
- return;
-
- for (i = 0; i < g_handle_num; i++) {
- if (g_player[i] != NULL) {
- legacy_player_unprepare(g_player[i]);
- legacy_player_destroy(g_player[i]);
- }
- g_player[i] = 0;
-
- if (legacy_player_create(&g_player[i]) != PLAYER_ERROR_NONE)
- g_print("legacy_player create is failed\n");
- }
-
- strncpy(g_uri, filename, len);
-
-#if 0
- /* ned(APPSRC_TEST) */
- gchar uri[100];
- gchar *ext;
- gsize file_size;
- GMappedFile *file;
- GError *error = NULL;
- guint8 *g_media_mem = NULL;
-
- ext = filename;
-
- file = g_mapped_file_new(ext, FALSE, &error);
- file_size = g_mapped_file_get_length(file);
- g_media_mem = (guint8 *) g_mapped_file_get_contents(file);
-
- g_sprintf(uri, "mem://ext=%s,size=%d", ext ? ext : "", file_size);
- g_print("[uri] = %s\n", uri);
-
- mm_player_set_attribute(g_player[0], &g_err_name, "profile_uri", uri, strlen(uri), "profile_user_param", g_media_mem, file_size NULL);
-#else
- /* legacy_player_set_uri(g_player[0], filename); */
-#endif
- /* APPSRC_TEST */
- int ret;
- player_state_e state;
- for (i = 0; i < g_handle_num; i++) {
- ret = legacy_player_get_state(g_player[i], &state);
- g_print("legacy_player_get_state returned [%d]", ret);
- g_print("1. After legacy_player_create() - Current State : %d \n", state);
- }
-}
-
-/* use this API instead of legacy_player_set_uri */
-static void player_set_memory_buffer_test()
-{
- GMappedFile *file;
- gsize file_size;
- guint8 *g_media_mem = NULL;
-
- file = g_mapped_file_new(g_uri, FALSE, NULL);
- file_size = g_mapped_file_get_length(file);
- g_media_mem = (guint8 *) g_mapped_file_get_contents(file);
-
- int ret = legacy_player_set_memory_buffer(g_player[0], (void *)g_media_mem, file_size);
- g_print("legacy_player_set_memory_buffer ret : %d\n", ret);
-}
-
-int video_packet_count = 0;
-
-static void buffer_need_video_data_cb(unsigned int size, void *user_data)
-{
- int real_read_len = 0;
- char fname[128];
- char fptsname[128];
- static guint64 pts = 0L;
-
- FILE *fp = NULL;
- guint8 *buff_ptr = NULL;
- void *src = NULL;
-
- memset(fname, 0, 128);
- memset(fptsname, 0, 128);
-
- video_packet_count++;
-
- if (video_packet_count > 1000) {
- g_print("EOS.\n");
- /* player_submit_packet(g_player[0], NULL, 0, 0, 1); */
- legacy_player_push_media_stream(g_player[0], NULL);
- g_thread_end = TRUE;
- }
- /* snprintf(fname, 128, "/opt/storage/usb/test/packet/packet_%d.dat", video_packet_count); */
- /* snprintf(fptsname, 128, "/opt/storage/usb/test/packet/gstpts_%d.dat", video_packet_count); */
- snprintf(fname, 128, "/home/developer/test/packet/packet_%d.dat", video_packet_count);
- snprintf(fptsname, 128, "/home/developer/test/packet/gstpts_%d.dat", video_packet_count);
-
- fp = fopen(fptsname, "rb");
- if (fp) {
- int pts_len = 0;
- pts_len = fread(&pts, 1, sizeof(guint64), fp);
- if (pts_len != sizeof(guint64))
- g_print("Warning, pts value can be wrong.\n");
-
- fclose(fp);
- fp = NULL;
- }
-
- fp = fopen(fname, "rb");
- if (fp) {
- buff_ptr = (guint8 *) g_malloc0(1048576);
- if (!buff_ptr) {
- g_print("no free space\n");
- fclose(fp);
- fp = NULL;
- return;
- }
-
- real_read_len = fread(buff_ptr, 1, size, fp);
- fclose(fp);
- fp = NULL;
- }
- g_print("video need data - data size : %d, pts : %" G_GUINT64_FORMAT "\n", real_read_len, pts);
-#if 0
- player_submit_packet(g_player[0], buff_ptr, real_read_len, (pts / 1000000), 1);
-#else
- /* create media packet */
- if (g_video_pkt) {
- media_packet_destroy(g_video_pkt);
- g_video_pkt = NULL;
- }
-
- media_packet_create_alloc(g_video_fmt, NULL, NULL, &g_video_pkt);
-
- g_print("packet = %p, src = %p\n", g_video_pkt, src);
-
- if (media_packet_get_buffer_data_ptr(g_video_pkt, &src) != MEDIA_PACKET_ERROR_NONE)
- goto EXIT;
-
- if (media_packet_set_pts(g_video_pkt, (uint64_t)pts) != MEDIA_PACKET_ERROR_NONE)
- goto EXIT;
-
- if (media_packet_set_buffer_size(g_video_pkt, (uint64_t) real_read_len) != MEDIA_PACKET_ERROR_NONE)
- goto EXIT;
-
- memcpy(src, buff_ptr, real_read_len);
-
- /* then, push it */
- legacy_player_push_media_stream(g_player[0], g_video_pkt);
-#endif
-
-EXIT:
- if (buff_ptr) {
- g_free(buff_ptr);
- buff_ptr = NULL;
- }
-}
-
-int audio_packet_count = 0;
-static void buffer_need_audio_data_cb(unsigned int size, void *user_data)
-{
- int real_read_len = 0;
- char fname[128];
- FILE *fp = NULL;
- guint8 *buff_ptr = NULL;
- void *src = NULL;
-
- memset(fname, 0, 128);
- audio_packet_count++;
-
- if (audio_packet_count > 1000) {
- g_print("EOS.\n");
- /* player_submit_packet(g_player[0], NULL, 0, 0, 0); */
- legacy_player_push_media_stream(g_player[0], NULL);
- g_thread_end = TRUE;
- }
- /* snprintf(fname, 128, "/opt/storage/usb/test/audio_packet/packet_%d.dat", audio_packet_count); */
- snprintf(fname, 128, "/home/developer/test/audio_packet/packet_%d.dat", audio_packet_count);
-
- static guint64 audio_pts = 0;
- guint64 audio_dur = 21333333;
-
- fp = fopen(fname, "rb");
- if (fp) {
- buff_ptr = (guint8 *) g_malloc0(1048576);
- if (!buff_ptr) {
- g_print("no free space\n");
- fclose(fp);
- fp = NULL;
- return;
- }
-
- real_read_len = fread(buff_ptr, 1, size, fp);
- fclose(fp);
- fp = NULL;
-
- g_print("\t audio need data - data size : %d, pts : %" G_GUINT64_FORMAT "\n", real_read_len, audio_pts);
- }
-#if 0
- player_submit_packet(g_player[0], buff_ptr, real_read_len, (audio_pts / 1000000), 0);
-#else
- /* create media packet */
- if (g_audio_pkt) {
- media_packet_destroy(g_audio_pkt);
- g_audio_pkt = NULL;
- }
- media_packet_create_alloc(g_audio_fmt, NULL, NULL, &g_audio_pkt);
-
- g_print("packet = %p, src = %p\n", g_audio_pkt, src);
-
- if (media_packet_get_buffer_data_ptr(g_audio_pkt, &src) != MEDIA_PACKET_ERROR_NONE)
- goto EXIT;
-
- if (media_packet_set_pts(g_audio_pkt, (uint64_t)audio_pts) != MEDIA_PACKET_ERROR_NONE)
- goto EXIT;
-
- if (media_packet_set_buffer_size(g_audio_pkt, (uint64_t) real_read_len) != MEDIA_PACKET_ERROR_NONE)
- goto EXIT;
-
- memcpy(src, buff_ptr, real_read_len);
-
- /* then, push it */
- legacy_player_push_media_stream(g_player[0], g_audio_pkt);
-#endif
-
- audio_pts += audio_dur;
-
-EXIT:
- if (buff_ptr) {
- g_free(buff_ptr);
- buff_ptr = NULL;
- }
-}
-
-static void set_content_info(bool is_push_mode)
-{
- /* testcode for es buff src case, please input url as es_buff://123 or es_buff://push_mode */
- /* unsigned char codec_data[45] = {0x0,0x0,0x1,0xb0,0x1,0x0,0x0,0x1,0xb5,0x89,0x13,0x0,0x0,0x1,0x0,0x0,0x0,0x1,0x20,0x0,0xc4,0x8d,0x88,0x5d,0xad,0x14,0x4,0x22,0x14,0x43,0x0,0x0,0x1,0xb2,0x4c,0x61,0x76,0x63,0x35,0x31,0x2e,0x34,0x30,0x2e,0x34}; */
-
- /* create media format */
- media_format_create(&g_audio_fmt);
- media_format_create(&g_video_fmt);
-
- /* Video */
- /* configure media format for video and set to player */
- media_format_set_video_mime(g_video_fmt, MEDIA_FORMAT_MPEG4_SP);
- media_format_set_video_width(g_video_fmt, 640);
- media_format_set_video_height(g_video_fmt, 272);
- /* legacy_player_set_media_stream_info(g_player[0], PLAYER_STREAM_TYPE_VIDEO, g_video_fmt); */
-
- /* Audio--aac--StarWars.mp4 */
- media_format_set_audio_mime(g_audio_fmt, MEDIA_FORMAT_AAC);
- media_format_set_audio_channel(g_audio_fmt, 2);
- media_format_set_audio_samplerate(g_audio_fmt, 48000);
- /* legacy_player_set_media_stream_info(g_player[0], PLAYER_STREAM_TYPE_AUDIO, g_audio_fmt); */
-#if 0
- /* video_info->mime = g_strdup("video/mpeg"); */ /* CODEC_ID_MPEG4VIDEO */
- video_info->width = 640;
- video_info->height = 272;
- video_info->version = 4;
- video_info->framerate_den = 100;
- video_info->framerate_num = 2997;
-
- video_info->extradata_size = 45;
- video_info->codec_extradata = codec_data;
- player_set_video_stream_info(g_player[0], video_info);
-
- /* audio--aac--StarWars.mp4 */
- /* audio_info->mime = g_strdup("audio/mpeg"); */
- /* audio_info->version = 2; */
- /* audio_info->user_info = 0;*/ /* raw */
-#endif
-
-#ifdef _ES_PULL_
- if (!is_push_mode) {
- player_set_buffer_need_video_data_cb(g_player[0], buffer_need_video_data_cb, (void *)g_player[0]);
- player_set_buffer_need_audio_data_cb(g_player[0], buffer_need_audio_data_cb, (void *)g_player[0]);
- }
-#endif
-}
-
-static void feed_video_data_thread_func(void *data)
-{
- while (!g_thread_end) {
- buffer_need_video_data_cb(1048576, NULL);
- buffer_need_audio_data_cb(1048576, NULL);
- }
-}
-
-static void _player_prepare(bool async)
-{
- int ret = FALSE;
- int slen = strlen(g_subtitle_uri);
-
- if (slen > 0 && slen < MAX_STRING_LEN) {
- g_print("0. set subtile path() (size : %d) - %s \n", slen, g_subtitle_uri);
- legacy_player_set_subtitle_path(g_player[0], g_subtitle_uri);
- legacy_player_set_subtitle_updated_cb(g_player[0], subtitle_updated_cb, (void *)g_player[0]);
- }
- if (g_current_surface_type == PLAYER_DISPLAY_TYPE_OVERLAY) {
- legacy_player_set_display(g_player[0], g_current_surface_type, GET_DISPLAY(g_win_id));
- legacy_player_set_buffering_cb(g_player[0], buffering_cb, (void *)g_player[0]);
- legacy_player_set_completed_cb(g_player[0], completed_cb, (void *)g_player[0]);
- legacy_player_set_interrupted_cb(g_player[0], interrupted_cb, (void *)g_player[0]);
- legacy_player_set_error_cb(g_player[0], error_cb, (void *)g_player[0]);
- if (g_memory_playback)
- player_set_memory_buffer_test();
- else
- legacy_player_set_uri(g_player[0], g_uri);
- } else {
- int i = 0;
- for (i = 0; i < g_handle_num; i++) {
- legacy_player_set_display(g_player[i], g_current_surface_type, g_eo[i]);
- legacy_player_set_buffering_cb(g_player[i], buffering_cb, (void *)g_player[i]);
- legacy_player_set_completed_cb(g_player[i], completed_cb, (void *)g_player[i]);
- legacy_player_set_interrupted_cb(g_player[i], interrupted_cb, (void *)g_player[i]);
- legacy_player_set_error_cb(g_player[i], error_cb, (void *)g_player[i]);
- if (g_memory_playback)
- player_set_memory_buffer_test();
- else
- legacy_player_set_uri(g_player[i], g_uri);
- }
- }
-
- if (strstr(g_uri, "es_buff://")) {
- is_es_push_mode = FALSE;
- video_packet_count = 0;
- audio_packet_count = 0;
-
- if (strstr(g_uri, "es_buff://push_mode")) {
- set_content_info(TRUE);
- async = TRUE;
- is_es_push_mode = TRUE;
- }
-#ifdef _ES_PULL_
- else
- set_content_info(FALSE);
-#endif
- }
-
- if (g_current_surface_type == PLAYER_DISPLAY_TYPE_OVERLAY) {
- if (async)
- ret = legacy_player_prepare_async(g_player[0], prepared_cb, (void *)g_player[0]);
- else
- ret = legacy_player_prepare(g_player[0]);
- } else {
- int i = 0;
- for (i = 0; i < g_handle_num; i++) {
- if (async)
- ret = legacy_player_prepare_async(g_player[i], prepared_cb, (void *)g_player[i]);
- else
- ret = legacy_player_prepare(g_player[i]);
- }
- }
-
- if (ret != PLAYER_ERROR_NONE)
- g_print("prepare is failed (errno = %d) \n", ret);
-
- player_state_e state;
- if (g_current_surface_type == PLAYER_DISPLAY_TYPE_OVERLAY) {
- ret = legacy_player_get_state(g_player[0], &state);
- g_print("After legacy_player_prepare() - Current State : %d \n", state);
- } else {
- int i = 0;
- for (i = 0; i < g_handle_num; i++) {
- ret = legacy_player_get_state(g_player[i], &state);
- g_print("After legacy_player_prepare() - Current State : %d \n", state);
- }
- }
-
- if (is_es_push_mode)
- pthread_create(&g_feed_video_thread_id, NULL, (void *)feed_video_data_thread_func, NULL);
-}
-
-static void _player_unprepare()
-{
- int ret = FALSE;
- int i = 0;
- if (g_current_surface_type == PLAYER_DISPLAY_TYPE_OVERLAY) {
- ret = legacy_player_unprepare(g_player[0]);
- if (ret != PLAYER_ERROR_NONE)
- g_print("unprepare is failed (errno = %d) \n", ret);
- ret = legacy_player_unset_subtitle_updated_cb(g_player[0]);
- g_print("legacy_player_unset_subtitle_updated_cb ret %d\n", ret);
-
- ret = legacy_player_unset_buffering_cb(g_player[0]);
- g_print("legacy_player_unset_buffering_cb ret %d\n", ret);
-
- ret = legacy_player_unset_completed_cb(g_player[0]);
- g_print("legacy_player_unset_completed_cb ret %d\n", ret);
-
- ret = legacy_player_unset_interrupted_cb(g_player[0]);
- g_print("legacy_player_unset_interrupted_cb ret %d\n", ret);
-
- ret = legacy_player_unset_error_cb(g_player[0]);
- g_print("legacy_player_unset_error_cb ret %d\n", ret);
- } else {
- for (i = 0; i < g_handle_num; i++) {
- if (g_player[i] != NULL) {
- ret = legacy_player_unprepare(g_player[i]);
- if (ret != PLAYER_ERROR_NONE)
- g_print("unprepare is failed (errno = %d) \n", ret);
-
- ret = legacy_player_unset_subtitle_updated_cb(g_player[i]);
- g_print("legacy_player_unset_subtitle_updated_cb [%d] ret %d\n", i, ret);
-
- ret = legacy_player_unset_buffering_cb(g_player[i]);
- g_print("legacy_player_unset_buffering_cb [%d] ret %d\n", i, ret);
-
- ret = legacy_player_unset_completed_cb(g_player[i]);
- g_print("legacy_player_unset_completed_cb [%d] ret %d\n", i, ret);
-
- ret = legacy_player_unset_interrupted_cb(g_player[i]);
- g_print("legacy_player_unset_interrupted_cb [%d] ret %d\n", i, ret);
-
- ret = legacy_player_unset_error_cb(g_player[i]);
- g_print("legacy_player_unset_error_cb [%d] ret %d\n", i, ret);
- }
- }
- }
- reset_display();
- memset(g_subtitle_uri, 0, sizeof(g_subtitle_uri));
- player_state_e state;
- if (g_current_surface_type == PLAYER_DISPLAY_TYPE_OVERLAY) {
- ret = legacy_player_get_state(g_player[0], &state);
- g_print(" After player_unprepare() - Current State : %d \n", state);
- } else {
- for (i = 0; i < g_handle_num; i++) {
- ret = legacy_player_get_state(g_player[i], &state);
- g_print(" After legacy_player_unprepare() - Current State : %d \n", state);
- }
- }
-}
-
-static void _player_destroy()
-{
- int i = 0;
-
- if (g_current_surface_type == PLAYER_DISPLAY_TYPE_OVERLAY) {
- legacy_player_unprepare(g_player[0]);
- for (i = 0; i < g_handle_num; i++) {
- legacy_player_destroy(g_player[i]);
- g_player[i] = 0;
- }
- } else {
- for (i = 0; i < g_handle_num; i++) {
- if (g_player[i] != NULL) {
- legacy_player_unprepare(g_player[i]);
- legacy_player_destroy(g_player[i]);
- g_player[i] = 0;
- }
- }
- }
-
- if (g_stream_info_h) {
- sound_manager_destroy_stream_information(g_stream_info_h);
- g_stream_info_h = NULL;
- }
-
- if (g_video_pkt)
- media_packet_destroy(g_video_pkt);
-
- if (g_audio_pkt)
- media_packet_destroy(g_audio_pkt);
-
-#if DUMP_OUTBUF
- if (fp_out1)
- fclose(fp_out1);
- if (fp_out2)
- fclose(fp_out2);
-#endif
-
-}
-
-static void _player_play()
-{
- int bRet = FALSE;
- int i = 0;
- if (g_current_surface_type == PLAYER_DISPLAY_TYPE_OVERLAY) {
- bRet = legacy_player_start(g_player[0]);
- g_print("legacy_player_start returned [%d]", bRet);
- } else {
- for (i = 0; i < g_handle_num; i++) {
- bRet = legacy_player_start(g_player[i]);
- g_print("legacy_player_start returned [%d]", bRet);
- }
- }
-}
-
-static void _player_stop()
-{
- int bRet = FALSE;
- int i = 0;
- if (g_current_surface_type == PLAYER_DISPLAY_TYPE_OVERLAY) {
- bRet = legacy_player_stop(g_player[0]);
- g_print("legacy_player_stop returned [%d]", bRet);
- } else {
- for (i = 0; i < g_handle_num; i++) {
- bRet = legacy_player_stop(g_player[i]);
- g_print("legacy_player_stop returned [%d]", bRet);
- }
- }
-
- g_thread_end = TRUE;
- if (g_feed_video_thread_id) {
- pthread_join(g_feed_video_thread_id, NULL);
- g_feed_video_thread_id = 0;
- }
-
-}
-
-static void _player_resume()
-{
- int bRet = FALSE;
- int i = 0;
- if (g_current_surface_type == PLAYER_DISPLAY_TYPE_OVERLAY) {
- bRet = legacy_player_start(g_player[0]);
- g_print("legacy_player_start returned [%d]", bRet);
- } else {
- for (i = 0; i < g_handle_num; i++) {
- bRet = legacy_player_start(g_player[i]);
- g_print("legacy_player_start returned [%d]", bRet);
- }
- }
-}
-
-static void _player_pause()
-{
- int bRet = FALSE;
- int i = 0;
- if (g_current_surface_type == PLAYER_DISPLAY_TYPE_OVERLAY) {
- bRet = legacy_player_pause(g_player[0]);
- g_print("legacy_player_pause returned [%d]", bRet);
- } else {
- for (i = 0; i < g_handle_num; i++) {
- bRet = legacy_player_pause(g_player[i]);
- g_print("legacy_player_pause returned [%d]", bRet);
- }
- }
-}
-
-static void _player_state()
-{
- player_state_e state;
- legacy_player_get_state(g_player[0], &state);
- g_print(" ==> [Player_Test] Current Player State : %d\n", state);
-}
-
-static void _player_set_progressive_download()
-{
- legacy_player_set_progressive_download_path(g_player[0], "/home/owner/test.pd");
- legacy_player_set_progressive_download_message_cb(g_player[0], progress_down_cb, (void *)g_player[0]);
-}
-
-static void set_volume(float volume)
-{
- if (legacy_player_set_volume(g_player[0], volume, volume) != PLAYER_ERROR_NONE)
- g_print("failed to set volume\n");
-}
-
-static void get_volume(float *left, float *right)
-{
- legacy_player_get_volume(g_player[0], left, right);
- g_print(" ==> [Player_Test] volume - left : %f, right : %f\n", *left, *right);
-}
-
-static void set_mute(bool mute)
-{
- if (legacy_player_set_mute(g_player[0], mute) != PLAYER_ERROR_NONE)
- g_print("failed to set_mute\n");
-}
-
-static void get_mute(bool * mute)
-{
- legacy_player_is_muted(g_player[0], mute);
- g_print(" ==> [Player_Test] mute = %d\n", *mute);
-}
-
-static void set_sound_type(sound_type_e type)
-{
- if (legacy_player_set_sound_type(g_player[0], type) != PLAYER_ERROR_NONE)
- g_print("failed to set sound type(%d)\n", type);
- else
- g_print("set sound type(%d) success", type);
-}
-
-void focus_callback(sound_stream_info_h stream_info,
- sound_stream_focus_mask_e focus_mask,
- sound_stream_focus_state_e focus_state,
- sound_stream_focus_change_reason_e reason_for_change,
- int sound_behavior, const char *additional_info,
- void *user_data)
-{
- g_print("FOCUS callback is called, reason_for_change(%d), additional_info(%s), userdata(%p)", reason_for_change, additional_info, user_data);
- return;
-}
-
-static void set_sound_stream_info(int type)
-{
- if (g_stream_info_h) {
- g_print("stream information is already set, please destory handle and try again\n");
- return;
- }
- if (sound_manager_create_stream_information(type, focus_callback, g_player[0], &g_stream_info_h)) {
- g_print("failed to create stream_information()\n");
- return;
- }
- if (legacy_player_set_sound_stream_info(g_player[0], g_stream_info_h) != PLAYER_ERROR_NONE)
- g_print("failed to set sound stream information(%p)\n", g_stream_info_h);
- else
- g_print("set stream information(%p) success", g_stream_info_h);
-}
-
-static void get_position()
-{
- int position = 0;
- int ret;
- ret = legacy_player_get_play_position(g_player[0], &position);
- g_print(" ==> [Player_Test] legacy_player_get_play_position()%d return : %d\n", ret, position);
-}
-
-static void set_position(int position)
-{
- if (legacy_player_set_play_position(g_player[0], position, TRUE, seek_completed_cb, g_player[0]) != PLAYER_ERROR_NONE)
- g_print("failed to set position\n");
-}
-
-static void set_playback_rate(float rate)
-{
- if (legacy_player_set_playback_rate(g_player[0], rate) != PLAYER_ERROR_NONE)
- g_print("failed to set playback rate\n");
-}
-
-static void get_duration()
-{
- int duration = 0;
- int ret;
- ret = legacy_player_get_duration(g_player[0], &duration);
- g_print(" ==> [Player_Test] legacy_player_get_duration() return : %d\n", ret);
- g_print(" ==> [Player_Test] Duration: [%d ] msec\n", duration);
-}
-
-static int get_download_progress()
-{
- int ret;
- int start = 0, current = 0;
- ret = legacy_player_get_streaming_download_progress(g_player[0], &start, ¤t);
- g_print(" ==> [Player_Test] download progress: [%d ~ %d]\n", start, current);
- return ret;
-}
-static void audio_frame_decoded_cb_ex()
-{
- int ret;
-
-#if DUMP_OUTBUF
- fp_out1 = fopen("/home/owner/content/out1.pcm", "wb");
- fp_out2 = fopen("/home/owner/content/out2.pcm", "wb");
- if (!fp_out1 || !fp_out2) {
- g_print("File open error\n");
- return;
- }
-#endif
-
- ret = legacy_player_set_pcm_extraction_mode(g_player[0], false, _audio_frame_decoded_cb_ex, &ret);
- g_print(" ==> [Player_Test] player_set_audio_frame_decoded_cb_ex return: %d\n", ret);
-}
-
-static void set_pcm_spec()
-{
- int ret;
-
- ret = legacy_player_set_pcm_spec(g_player[0], "F32LE", 44100, 2);
- g_print("[Player_Test] set_pcm_spec return: %d\n", ret);
-}
-
-static void get_stream_info()
-{
- int w = 0;
- int h = 0;
-
- char *value = NULL;
- legacy_player_get_content_info(g_player[0], PLAYER_CONTENT_INFO_ALBUM, &value);
- g_print(" ==> [Player_Test] PLAYER_CONTENT_INFO_ALBUM: [%s ] \n", value);
- legacy_player_get_content_info(g_player[0], PLAYER_CONTENT_INFO_ARTIST, &value);
- g_print(" ==> [Player_Test] PLAYER_CONTENT_INFO_ARTIST: [%s ] \n", value);
- legacy_player_get_content_info(g_player[0], PLAYER_CONTENT_INFO_AUTHOR, &value);
- g_print(" ==> [Player_Test] PLAYER_CONTENT_INFO_AUTHOR: [%s ] \n", value);
- legacy_player_get_content_info(g_player[0], PLAYER_CONTENT_INFO_GENRE, &value);
- g_print(" ==> [Player_Test] PLAYER_CONTENT_INFO_GENRE: [%s ] \n", value);
- legacy_player_get_content_info(g_player[0], PLAYER_CONTENT_INFO_TITLE, &value);
- g_print(" ==> [Player_Test] PLAYER_CONTENT_INFO_TITLE: [%s ] \n", value);
- void *album;
- int size;
- legacy_player_get_album_art(g_player[0], &album, &size);
- _save(album, size);
- g_print(" ==> [Player_Test] Album art : [ data : %p, size : %d ]\n", (unsigned int *)album, size);
- if (value != NULL) {
- free(value);
- value = NULL;
- }
-
- int sample_rate;
- int channel;
- int bit_rate;
- int fps, v_bit_rate;
- legacy_player_get_audio_stream_info(g_player[0], &sample_rate, &channel, &bit_rate);
- g_print(" ==> [Player_Test] Sample Rate: [%d ] , Channel: [%d ] , Bit Rate: [%d ] \n", sample_rate, channel, bit_rate);
-
- legacy_player_get_video_stream_info(g_player[0], &fps, &v_bit_rate);
- g_print(" ==> [Player_Test] fps: [%d ] , Bit Rate: [%d ] \n", fps, v_bit_rate);
-
- char *audio_codec = NULL;
- char *video_codec = NULL;
- legacy_player_get_codec_info(g_player[0], &audio_codec, &video_codec);
- if (audio_codec != NULL) {
- g_print(" ==> [Player_Test] Audio Codec: [%s ] \n", audio_codec);
- free(audio_codec);
- audio_codec = NULL;
- }
- if (video_codec != NULL) {
- g_print(" ==> [Player_Test] Video Codec: [%s ] \n", video_codec);
- free(video_codec);
- video_codec = NULL;
- }
- legacy_player_get_video_size(g_player[0], &w, &h);
- g_print(" ==> [Player_Test] Width: [%d ] , Height: [%d ] \n", w, h);
-}
-
-static void set_looping(bool looping)
-{
- if (g_current_surface_type == PLAYER_DISPLAY_TYPE_OVERLAY) {
- if (legacy_player_set_looping(g_player[0], looping) != PLAYER_ERROR_NONE)
- g_print("failed to set_looping\n");
- } else {
- int i = 0;
- for (i = 0; i < g_handle_num; i++) {
- if (legacy_player_set_looping(g_player[i], looping) != PLAYER_ERROR_NONE)
- g_print("failed to set_looping\n");
- }
- }
-}
-
-static void get_looping(bool * looping)
-{
- legacy_player_is_looping(g_player[0], looping);
- g_print(" ==> [Player_Test] looping = %d\n", *looping);
-}
-
-static void change_surface(int option)
-{
- player_display_type_e surface_type = 0;
- int ret = PLAYER_ERROR_NONE;
-
- switch (option) {
- case 0:
- /* X surface */
- surface_type = PLAYER_DISPLAY_TYPE_OVERLAY;
- g_print("change surface type to X\n");
- break;
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
- case 1:
- /* EVAS surface */
- surface_type = PLAYER_DISPLAY_TYPE_EVAS;
- g_print("change surface type to EVAS\n");
- break;
-#endif
- case 2:
- g_print("change surface type to NONE\n");
- legacy_player_set_display(g_player[0], PLAYER_DISPLAY_TYPE_NONE, NULL);
- break;
- default:
- g_print("invalid surface type\n");
- return;
- }
-
- if (surface_type == g_current_surface_type) {
- g_print("same with the previous surface type(%d)\n", g_current_surface_type);
- return;
- } else {
- player_state_e player_state = PLAYER_STATE_NONE;
- ret = legacy_player_get_state(g_player[0], &player_state);
- if (ret)
- g_print("failed to player_get_state(), ret(0x%x)\n", ret);
-
- /* state check */
- if (player_state == PLAYER_STATE_NONE || player_state == PLAYER_STATE_IDLE) {
- reset_display();
-
- if (surface_type == PLAYER_DISPLAY_TYPE_OVERLAY) {
- g_win_id = g_eo_win;
- ret = legacy_player_set_display(g_player[0], surface_type, GET_DISPLAY(g_win_id));
- } else {
- int i = 0;
- for (i = 0; i < g_handle_num; i++) {
- /* Create evas image object for EVAS surface */
- if (!g_eo[i]) {
- g_eo[i] = create_image_object(g_eo_win);
- evas_object_image_size_set(g_eo[i], 500, 500);
- evas_object_image_fill_set(g_eo[i], 0, 0, 500, 500);
- evas_object_resize(g_eo[i], 500, 500);
- evas_object_move(g_eo[i], i * 20, i * 20);
- }
- ret = legacy_player_set_display(g_player[i], surface_type, g_eo[i]);
- }
- }
- if (ret) {
- g_print("failed to set display, surface_type(%d)\n", surface_type);
- return;
- }
- g_current_surface_type = surface_type;
- } else {
- g_print("could not change surface type, current_state(%d)\n", player_state);
- }
- }
- return;
-}
-
-static void set_display_mode(int mode)
-{
- if (legacy_player_set_display_mode(g_player[0], mode) != PLAYER_ERROR_NONE)
- g_print("failed to legacy_player_set_display_mode\n");
-}
-
-static void get_display_mode()
-{
- player_display_mode_e mode;
- legacy_player_get_display_mode(g_player[0], &mode);
- g_print(" ==> [Player_Test] Display mode: [%d ] \n", mode);
-}
-
-static void set_display_rotation(int rotation)
-{
- if (legacy_player_set_display_rotation(g_player[0], rotation) != PLAYER_ERROR_NONE)
- g_print("failed to set_display_rotation\n");
-}
-
-static void get_display_rotation()
-{
- player_display_rotation_e rotation = 0;
- legacy_player_get_display_rotation(g_player[0], &rotation);
- g_print(" ==> [Player_Test] X11 Display rotation: [%d ] \n", rotation);
-}
-
-static void set_display_visible(bool visible)
-{
- if (legacy_player_set_display_visible(g_player[0], visible) != PLAYER_ERROR_NONE)
- g_print("failed to player_set_x11_display_visible\n");
-}
-
-static void get_display_visible(bool * visible)
-{
- legacy_player_is_display_visible(g_player[0], visible);
- g_print(" ==> [Player_Test] X11 Display Visible = %d\n", *visible);
-}
-
-static void input_subtitle_filename(char *subtitle_filename)
-{
- int len = strlen(subtitle_filename);
-
- if (len < 1 || len > MAX_STRING_LEN)
- return;
-
- strncpy(g_subtitle_uri, subtitle_filename, len);
- g_print("subtitle uri is set to %s\n", g_subtitle_uri);
- legacy_player_set_subtitle_path(g_player[0], g_subtitle_uri);
-}
-
-static void switch_subtitle(int index)
-{
- int len = 0;
- char *lang_code = NULL;
-
- if (legacy_player_select_track(g_player[0], PLAYER_STREAM_TYPE_TEXT, index) != PLAYER_ERROR_NONE)
- g_print("legacy_player_select_track failed\n");
-
- if (legacy_player_get_track_language_code(g_player[0], PLAYER_STREAM_TYPE_TEXT, index, &lang_code, &len) == PLAYER_ERROR_NONE) {
- g_print("selected track code %s\n", lang_code);
- free(lang_code);
- }
-}
-
-static void capture_video()
-{
- if (legacy_player_capture_video(g_player[0], video_captured_cb, NULL) != PLAYER_ERROR_NONE)
- g_print("failed to legacy_player_capture_video\n");
-}
-
-static void decoding_audio()
-{
-#if 0
- int ret;
- char *suffix, *dump_path;
- GDateTime *time = g_date_time_new_now_local();
-
- suffix = g_date_time_format(time, "%Y%m%d_%H%M%S.pcm");
- dump_path = g_strjoin(NULL, PLAYER_TEST_DUMP_PATH_PREFIX, suffix, NULL);
- g_pcm_fd = fopen(dump_path, "w+");
- g_free(dump_path);
- g_free(suffix);
- g_date_time_unref(time);
- if (!g_pcm_fd)
- g_print("Can not create debug dump file");
-
- ret = legacy_player_set_audio_frame_decoded_cb(g_player[0], 0, 0, audio_frame_decoded_cb, (void *)g_player[0]);
- if (ret != PLAYER_ERROR_NONE)
- g_print("legacy_player_set_audio_frame_decoded_cb is failed (errno = %d) \n", ret);
-
-#endif
-}
-
-static void set_audio_eq(int value)
-{
- bool available = FALSE;
- int index, min, max;
-
- if (value) {
- if (legacy_player_audio_effect_equalizer_is_available(g_player[0], &available) != PLAYER_ERROR_NONE)
- g_print("failed to legacy_player_audio_effect_equalizer_is_available\n");
-
- if (available) {
- if ((legacy_player_audio_effect_get_equalizer_bands_count(g_player[0], &index) != PLAYER_ERROR_NONE) || (legacy_player_audio_effect_get_equalizer_level_range(g_player[0], &min, &max) != PLAYER_ERROR_NONE) || (legacy_player_audio_effect_set_equalizer_band_level(g_player[0], index / 2, max) != PLAYER_ERROR_NONE))
- g_print("failed to legacy_player_audio_effect_set_equalizer_band_level index %d, level %d\n", index / 2, max);
- }
- }
-
- else {
- if (legacy_player_audio_effect_equalizer_clear(g_player[0]) != PLAYER_ERROR_NONE)
- g_print("failed to legacy_player_audio_effect_equalizer_clear\n");
- }
-
-}
-
-static void get_audio_eq()
-{
- int index, min, max, value;
- legacy_player_audio_effect_get_equalizer_bands_count(g_player[0], &index);
- g_print(" ==> [Player_Test] eq bands count: [%d] \n", index);
- legacy_player_audio_effect_get_equalizer_level_range(g_player[0], &min, &max);
- g_print(" ==> [Player_Test] eq bands range: [%d~%d] \n", min, max);
- legacy_player_audio_effect_get_equalizer_band_level(g_player[0], index / 2, &value);
- g_print(" ==> [Player_Test] eq bands level: [%d] \n", value);
- legacy_player_audio_effect_get_equalizer_band_frequency(g_player[0], 0, &value);
- g_print(" ==> [Player_Test] eq bands frequency: [%d] \n", value);
- legacy_player_audio_effect_get_equalizer_band_frequency_range(g_player[0], 0, &value);
- g_print(" ==> [Player_Test] eq bands frequency range: [%d] \n", value);
-}
-
-void quit_program()
-{
- int i = 0;
-
- if (g_pcm_fd)
- fclose(g_pcm_fd);
-
- for (i = 0; i < g_handle_num; i++) {
- if (g_player[i] != NULL) {
- legacy_player_unprepare(g_player[i]);
- legacy_player_destroy(g_player[i]);
- g_player[i] = 0;
- }
- }
- elm_exit();
-
- if (g_audio_fmt)
- media_format_unref(g_audio_fmt);
-
- if (g_video_fmt)
- media_format_unref(g_video_fmt);
-}
-
-void play_with_ini(char *file_path)
-{
- input_filename(file_path);
- _player_play();
-}
-
-void _interpret_main_menu(char *cmd)
-{
- int len = strlen(cmd);
- if (len == 1) {
- if (strncmp(cmd, "a", 1) == 0) {
- g_menu_state = CURRENT_STATUS_FILENAME;
- } else if (strncmp(cmd, "1", 1) == 0) {
- play_with_ini(g_file_list[0]);
- } else if (strncmp(cmd, "2", 1) == 0) {
- play_with_ini(g_file_list[1]);
- } else if (strncmp(cmd, "3", 1) == 0) {
- play_with_ini(g_file_list[2]);
- } else if (strncmp(cmd, "4", 1) == 0) {
- play_with_ini(g_file_list[3]);
- } else if (strncmp(cmd, "5", 1) == 0) {
- play_with_ini(g_file_list[4]);
- } else if (strncmp(cmd, "6", 1) == 0) {
- play_with_ini(g_file_list[5]);
- } else if (strncmp(cmd, "7", 1) == 0) {
- play_with_ini(g_file_list[6]);
- } else if (strncmp(cmd, "8", 1) == 0) {
- play_with_ini(g_file_list[7]);
- } else if (strncmp(cmd, "9", 1) == 0) {
- play_with_ini(g_file_list[8]);
- } else if (strncmp(cmd, "b", 1) == 0) {
- _player_play();
- } else if (strncmp(cmd, "c", 1) == 0) {
- _player_stop();
- } else if (strncmp(cmd, "d", 1) == 0) {
- _player_resume();
- } else if (strncmp(cmd, "e", 1) == 0) {
- _player_pause();
- } else if (strncmp(cmd, "S", 1) == 0) {
- _player_state();
- } else if (strncmp(cmd, "f", 1) == 0) {
- g_menu_state = CURRENT_STATUS_VOLUME;
- } else if (strncmp(cmd, "g", 1) == 0) {
- float left;
- float right;
- get_volume(&left, &right);
- } else if (strncmp(cmd, "z", 1) == 0) {
- g_menu_state = CURRENT_STATUS_SOUND_TYPE;
- } else if (strncmp(cmd, "k", 1) == 0) {
- g_menu_state = CURRENT_STATUS_SOUND_STREAM_INFO;
- } else if (strncmp(cmd, "h", 1) == 0) {
- g_menu_state = CURRENT_STATUS_MUTE;
- } else if (strncmp(cmd, "i", 1) == 0) {
- bool mute;
- get_mute(&mute);
- } else if (strncmp(cmd, "j", 1) == 0) {
- g_menu_state = CURRENT_STATUS_POSITION_TIME;
- } else if (strncmp(cmd, "l", 1) == 0) {
- get_position();
- } else if (strncmp(cmd, "m", 1) == 0) {
- get_duration();
- } else if (strncmp(cmd, "n", 1) == 0) {
- get_stream_info();
- } else if (strncmp(cmd, "o", 1) == 0) {
- g_menu_state = CURRENT_STATUS_LOOPING;
- } else if (strncmp(cmd, "p", 1) == 0) {
- bool looping;
- get_looping(&looping);
- } else if (strncmp(cmd, "r", 1) == 0) {
- g_menu_state = CURRENT_STATUS_DISPLAY_MODE;
- } else if (strncmp(cmd, "s", 1) == 0) {
- get_display_mode();
- } else if (strncmp(cmd, "t", 1) == 0) {
- g_menu_state = CURRENT_STATUS_DISPLAY_ROTATION;
- } else if (strncmp(cmd, "u", 1) == 0) {
- get_display_rotation();
- } else if (strncmp(cmd, "v", 1) == 0) {
- g_menu_state = CURRENT_STATUS_DISPLAY_VISIBLE;
- } else if (strncmp(cmd, "w", 1) == 0) {
- bool visible;
- get_display_visible(&visible);
- } else if (strncmp(cmd, "A", 1) == 0) {
- g_menu_state = CURRENT_STATUS_SUBTITLE_FILENAME;
- } else if (strncmp(cmd, "C", 1) == 0) {
- capture_video();
- } else if (strncmp(cmd, "D", 1) == 0) {
- decoding_audio();
- } else if (strncmp(cmd, "q", 1) == 0) {
- quit_pushing = TRUE;
- quit_program();
- } else if (strncmp(cmd, "E", 1) == 0) {
- g_menu_state = CURRENT_STATUS_AUDIO_EQUALIZER;
- } else if (strncmp(cmd, "H", 1) == 0) {
- get_audio_eq();
- } else {
- g_print("unknown menu \n");
- }
- } else if (len == 2) {
- if (strncmp(cmd, "pr", 2) == 0) {
- _player_prepare(FALSE); /* sync */
- } else if (strncmp(cmd, "pa", 2) == 0) {
- _player_prepare(TRUE); /* async */
- } else if (strncmp(cmd, "un", 2) == 0) {
- _player_unprepare();
- } else if (strncmp(cmd, "dt", 2) == 0) {
- _player_destroy();
- } else if (strncmp(cmd, "sp", 2) == 0) {
- _player_set_progressive_download();
- } else if (strncmp(cmd, "mp", 2) == 0) {
- g_memory_playback = (g_memory_playback ? FALSE : TRUE);
- g_print("memory playback = %d\n", g_memory_playback);
- } else if (strncmp(cmd, "ds", 2) == 0) {
- g_menu_state = CURRENT_STATUS_DISPLAY_SURFACE_CHANGE;
- } else if (strncmp(cmd, "nb", 2) == 0) {
- g_menu_state = CURRENT_STATUS_HANDLE_NUM;
- } else if (strncmp(cmd, "tr", 2) == 0) {
- g_menu_state = CURRENT_STATUS_PLAYBACK_RATE;
- } else if (strncmp(cmd, "ss", 2) == 0) {
- g_menu_state = CURRENT_STATUS_SWITCH_SUBTITLE;
- } else if (strncmp(cmd, "X3", 2) == 0) {
- audio_frame_decoded_cb_ex();
- } else if (strncmp(cmd, "X4", 2) == 0) {
- set_pcm_spec();
- } else if (strncmp(cmd, "dp", 2) == 0) {
- get_download_progress();
- } else {
- g_print("unknown menu \n");
- }
- } else {
- g_print("unknown menu \n");
- }
-}
-
-void display_sub_basic()
-{
- int idx;
- g_print("\n");
- g_print("=========================================================================================\n");
- g_print(" Player Test (press q to quit) \n");
- g_print("-----------------------------------------------------------------------------------------\n");
- g_print("*. Sample List in [%s] \t", MMTS_SAMPLELIST_INI_DEFAULT_PATH);
- g_print("nb. num. of handles \n");
- for (idx = 1; idx <= INI_SAMPLE_LIST_MAX; idx++) {
- if (strlen(g_file_list[idx - 1]) > 0)
- g_print("%d. Play [%s]\n", idx, g_file_list[idx - 1]);
- }
- g_print("-----------------------------------------------------------------------------------------\n");
- g_print("[playback] a. Create\t");
- g_print("pr. Prepare \t");
- g_print("pa. Prepare async \t");
- g_print("b. Play \t");
- g_print("c. Stop \t");
- g_print("d. Resume\t");
- g_print("e. Pause \t");
- g_print("un. Unprepare \t");
- g_print("dt. Destroy \n");
- g_print("[State] S. Player State \n");
- g_print("[ volume ] f. Set Volume\t");
- g_print("g. Get Volume\t");
- g_print("z. Set Sound type\t");
- g_print("k. Set Sound Stream Info.\t");
- g_print("[ mute ] h. Set Mute\t");
- g_print("i. Get Mute\n");
- g_print("[audio eq] E. Set Audio EQ\t");
- g_print("H. Get Audio EQ\n");
- g_print("[position] j. Set Position \t");
- g_print("l. Get Position\n");
- g_print("[trick] tr. set playback rate\n");
- g_print("[duration] m. Get Duration\n");
- g_print("[buffering] dp. Get Download Progress\n");
- g_print("[Stream Info] n. Get stream info (Video Size, codec, audio stream info, and tag info)\n");
- g_print("[Looping] o. Set Looping\t");
- g_print("p. Get Looping\n");
- g_print("[display] v. Set display visible\t");
- g_print("w. Get display visible\n");
- g_print("[display] ds. Change display surface type\n");
- g_print("[overlay display] r. Set display mode\t");
- g_print("s. Get display mode\n");
- g_print("[overlay display] t. Set display Rotation\t");
- g_print("[Track] tl. Get Track language info(single only)\n");
- g_print("[subtitle] A. Set(or change) subtitle path\n");
- g_print("[subtitle] ss. Select(or change) subtitle track\n");
- g_print("[Video Capture] C. Capture \n");
- g_print("[etc] sp. Set Progressive Download\t");
- g_print("mp. memory playback\n");
- g_print("[audio_frame_decoded_cb_ex] X3. (input) set audio_frame_decoded_cb_ex callback \n");
- g_print("\n");
- g_print("=========================================================================================\n");
-}
-
-static void displaymenu()
-{
- if (g_menu_state == CURRENT_STATUS_MAINMENU) {
- display_sub_basic();
- } else if (g_menu_state == CURRENT_STATUS_HANDLE_NUM) {
- g_print("*** input number of handles.(recommended only for EVAS surface)\n");
- } else if (g_menu_state == CURRENT_STATUS_FILENAME) {
- g_print("*** input mediapath.\n");
- } else if (g_menu_state == CURRENT_STATUS_VOLUME) {
- g_print("*** input volume value.(0~1.0)\n");
- } else if (g_menu_state == CURRENT_STATUS_SOUND_TYPE) {
- g_print("*** input sound type.(0:SYSTEM 1:NOTIFICATION 2:ALARM 3:RINGTONE 4:MEDIA 5:CALL 6:VOIP 7:FIXED)\n");
- } else if (g_menu_state == CURRENT_STATUS_SOUND_STREAM_INFO) {
- g_print("*** input sound stream type.(0:MEDIA 1:SYSTEM 2:ALARM 3:NOTIFICATION 4:RINGTONE 5:CALL 6:VOIP)\n");
- } else if (g_menu_state == CURRENT_STATUS_MUTE) {
- g_print("*** input mute value.(0: Not Mute, 1: Mute) \n");
- } else if (g_menu_state == CURRENT_STATUS_POSITION_TIME) {
- g_print("*** input position value(msec)\n");
- } else if (g_menu_state == CURRENT_STATUS_LOOPING) {
- g_print("*** input looping value.(0: Not Looping, 1: Looping) \n");
- } else if (g_menu_state == CURRENT_STATUS_DISPLAY_SURFACE_CHANGE) {
- g_print("*** input display surface type.(0: X surface, 1: EVAS surface) \n");
- } else if (g_menu_state == CURRENT_STATUS_DISPLAY_MODE) {
- g_print("*** input display mode value.(0: LETTER BOX, 1: ORIGIN SIZE, 2: FULL_SCREEN, 3: CROPPED_FULL, 4: ORIGIN_OR_LETTER) \n");
- } else if (g_menu_state == CURRENT_STATUS_DISPLAY_ROTATION) {
- g_print("*** input display rotation value.(0: NONE, 1: 90, 2: 180, 3: 270, 4:F LIP_HORZ, 5: FLIP_VERT ) \n");
- } else if (g_menu_state == CURRENT_STATUS_DISPLAY_VISIBLE) {
- g_print("*** input display visible value.(0: HIDE, 1: SHOW) \n");
- } else if (g_menu_state == CURRENT_STATUS_SUBTITLE_FILENAME) {
- g_print(" *** input subtitle file path.\n");
- } else if (g_menu_state == CURRENT_STATUS_AUDIO_EQUALIZER) {
- g_print(" *** input audio eq value.(0: UNSET, 1: SET) \n");
- } else if (g_menu_state == CURRENT_STATUS_PLAYBACK_RATE) {
- g_print(" *** input playback rate.(-5.0 ~ 5.0)\n");
- } else if (g_menu_state == CURRENT_STATUS_SWITCH_SUBTITLE) {
- int count = 0, cur_index = 0;
- int ret = 0;
-
- ret = legacy_player_get_track_count(g_player[0], PLAYER_STREAM_TYPE_TEXT, &count);
- if (ret != PLAYER_ERROR_NONE)
- g_print("legacy_player_get_track_count fail!!!!\n");
- else if (count) {
- g_print("Total subtitle tracks = %d \n", count);
- legacy_player_get_current_track(g_player[0], PLAYER_STREAM_TYPE_TEXT, &cur_index);
- g_print("Current index = %d \n", cur_index);
- g_print(" *** input correct index 0 to %d\n:", (count - 1));
- } else
- g_print("no track\n");
- } else {
- g_print("*** unknown status.\n");
- quit_program();
- }
- g_print(" >>> ");
-}
-
-gboolean timeout_menu_display(void *data)
-{
- displaymenu();
- return FALSE;
-}
-
-gboolean timeout_quit_program(void *data)
-{
- quit_program();
- return FALSE;
-}
-
-void reset_menu_state(void)
-{
- g_menu_state = CURRENT_STATUS_MAINMENU;
-}
-
-static void interpret(char *cmd)
-{
- switch (g_menu_state) {
- case CURRENT_STATUS_MAINMENU:
- {
- _interpret_main_menu(cmd);
- }
- break;
- case CURRENT_STATUS_HANDLE_NUM:
- {
- int num_handle = atoi(cmd);
- if (0 >= num_handle || num_handle > MAX_HANDLE)
- g_print("not supported this number for handles(%d)\n", num_handle);
- else
- g_handle_num = num_handle;
-
- reset_menu_state();
- }
- break;
- case CURRENT_STATUS_FILENAME:
- {
- input_filename(cmd);
- reset_menu_state();
- }
- break;
- case CURRENT_STATUS_VOLUME:
- {
- float level = atof(cmd);
- set_volume(level);
- reset_menu_state();
- }
- break;
- case CURRENT_STATUS_SOUND_TYPE:
- {
- int type = atoi(cmd);
- set_sound_type(type);
- reset_menu_state();
- }
- break;
- case CURRENT_STATUS_SOUND_STREAM_INFO:
- {
- int type = atoi(cmd);
- set_sound_stream_info(type);
- reset_menu_state();
- }
- break;
- case CURRENT_STATUS_MUTE:
- {
- int mute = atoi(cmd);
- set_mute(mute);
- reset_menu_state();
- }
- break;
- case CURRENT_STATUS_POSITION_TIME:
- {
- long position = atol(cmd);
- set_position(position);
- reset_menu_state();
- }
- break;
- case CURRENT_STATUS_LOOPING:
- {
- int looping = atoi(cmd);
- set_looping(looping);
- reset_menu_state();
- }
- break;
- case CURRENT_STATUS_DISPLAY_SURFACE_CHANGE:
- {
- int type = atoi(cmd);
- change_surface(type);
- reset_menu_state();
- }
- break;
- case CURRENT_STATUS_DISPLAY_MODE:
- {
- int mode = atoi(cmd);
- set_display_mode(mode);
- reset_menu_state();
- }
- break;
- case CURRENT_STATUS_DISPLAY_ROTATION:
- {
- int rotation = atoi(cmd);
- set_display_rotation(rotation);
- reset_menu_state();
- }
- break;
- case CURRENT_STATUS_DISPLAY_VISIBLE:
- {
- int visible = atoi(cmd);
- set_display_visible(visible);
- reset_menu_state();
- }
- break;
- case CURRENT_STATUS_SUBTITLE_FILENAME:
- {
- input_subtitle_filename(cmd);
- reset_menu_state();
- }
- break;
- case CURRENT_STATUS_AUDIO_EQUALIZER:
- {
- int value = atoi(cmd);
- set_audio_eq(value);
- reset_menu_state();
- }
- break;
- case CURRENT_STATUS_PLAYBACK_RATE:
- {
- float rate = atof(cmd);
- set_playback_rate(rate);
- reset_menu_state();
- }
- break;
- case CURRENT_STATUS_SWITCH_SUBTITLE:
- {
- int index = atoi(cmd);
- switch_subtitle(index);
- reset_menu_state();
- }
- break;
- }
- g_timeout_add(100, timeout_menu_display, 0);
-}
-
-gboolean input(GIOChannel *channel)
-{
- gchar buf[MAX_STRING_LEN];
- gsize read;
- GError *error = NULL;
-
- g_io_channel_read_chars(channel, buf, MAX_STRING_LEN, &read, &error);
- buf[read] = '\0';
- g_strstrip(buf);
- interpret(buf);
-
- return TRUE;
-}
-
-int main(int argc, char *argv[])
-{
- GIOChannel *stdin_channel;
- stdin_channel = g_io_channel_unix_new(0);
- g_io_channel_set_flags(stdin_channel, G_IO_FLAG_NONBLOCK, NULL);
- g_io_add_watch(stdin_channel, G_IO_IN, (GIOFunc) input, NULL);
-
- displaymenu();
- memset(&ad, 0x0, sizeof(struct appdata));
- ops.data = &ad;
-
- return appcore_efl_main(PACKAGE, &argc, &argv, &ops);
-}
muse_player = (muse_player_handle_s *)muse_core_ipc_get_handle(module);
player_msg_get_array(wl_win_msg, muse_core_client_get_msg(module));
- ret = legacy_player_set_display_wl_for_mused(muse_player->player_handle, wl_win.type, wl_win.wl_surface_id);
+ ret = legacy_player_set_display(muse_player->player_handle, wl_win.type, wl_win.wl_surface_id);
player_msg_return(api, ret, module);
return ret;
<request>
<domain name="_" />
</request>
- <assign>
- <filesystem path="/usr/bin/legacy_player_test" label="_" exec_label="none" />
- </assign>
</manifest>
Name: mmsvc-player
Summary: A Media Player module for muse server
-Version: 0.2.47
+Version: 0.2.48
Release: 0
Group: Multimedia/Libraries
License: Apache-2.0
BuildRequires: pkgconfig(mm-player)
BuildRequires: pkgconfig(capi-base-common)
BuildRequires: pkgconfig(capi-media-sound-manager)
-BuildRequires: pkgconfig(appcore-efl)
-BuildRequires: pkgconfig(elementary)
-BuildRequires: pkgconfig(ecore)
-BuildRequires: pkgconfig(evas)
-BuildRequires: pkgconfig(ecore-wayland)
BuildRequires: pkgconfig(capi-media-tool)
BuildRequires: pkgconfig(json-c)
BuildRequires: pkgconfig(libtbm)
BuildRequires: pkgconfig(ttrace)
BuildRequires: pkgconfig(capi-system-info)
-BuildRequires: pkgconfig(mm-sound)
BuildRequires: pkgconfig(mm-session)
-BuildRequires: pkgconfig(eom)
BuildRequires: pkgconfig(libtzplatform-config)
Requires(post): /sbin/ldconfig
%files
%manifest mmsvc-player.manifest
-%license LICENSE.APLv2
+%license LICENSE.Apache-2.0
%{_libdir}/liblegacy-player.so*
%{_libdir}/libmuse-player.so*
-%{_bindir}/*
%files devel
%{_includedir}/media/*.h