2 * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 * @file mediademuxer_port_gst.h
19 * @brief Handling for GST Port
22 #ifndef __TIZEN_MEDIADEMUXER_PORT_GST_H__
23 #define __TIZEN_MEDIADEMUXER_PORT_GST_H__
27 #include <media_format.h>
28 #include <gst/app/gstappsink.h>
33 #define POLLING_INTERVAL 10000
34 #define MAX_APP_BUFFER 100
36 #define MEDIADEMUXER_SET_STATE(x_element, x_state, error) \
38 MD_I("setting state [%s:%d] to [%s]\n", #x_state, x_state, GST_ELEMENT_NAME(x_element)); \
39 if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(x_element, x_state)) { \
40 MD_E("failed to set state %s to %s\n", #x_state, GST_ELEMENT_NAME(x_element)); \
45 #define MEDIADEMUXER_LINK_PAD(srcpad, sinkpad, error) \
47 if (GST_PAD_LINK_OK != gst_pad_link(srcpad, sinkpad)) { \
48 MD_E("failed to linkpad\n"); \
54 _GST_EVENT_TYPE_COMPLETE,
55 _GST_EVENT_TYPE_ERROR,
60 typedef struct track {
68 media_format_h format;
72 typedef struct track_info {
75 int num_subtitle_track;
80 /* GST port Private data */
81 typedef struct _mdgst_handle_t {
82 void *hdemux; /*< demux handle */
83 int state; /*< demux current state */
90 GMainContext *thread_default;
91 gulong signal_handoff;
93 bool is_valid_container;
95 int state_change_timeout;
96 bool *selected_tracks;
100 void *user_cb[_GST_EVENT_TYPE_NUM];
101 void *user_data[_GST_EVENT_TYPE_NUM];
106 * @brief Called when the error has occured.
108 * @details It will be invoked when the error has occured.
109 * @param[in] error_code The error code
110 * @param[in] user_data The user data passed from the callback registration function
111 * @pre It will be invoked when the error has occured if user register this callback using mediademuxer_set_error_cb().
112 * @see mediademuxer_set_error_cb()
113 * @see mediademuxer_unset_error_cb()
115 typedef void (*gst_error_cb)(mediademuxer_error_e error, void *user_data);
118 * @brief Called when the eos has occured.
120 * @details It will be invoked when the eos has occured.
121 * @param[in] track_num track number to indicate eos
122 * @param[in] user_data The user data passed from the callback registration function
123 * @pre It will be invoked when the eos has occured if user register this callback using mediademuxer_set_eos_cb().
124 * @see mediademuxer_set_eos_cb()
125 * @see mediademuxer_unset_eos_cb()
127 typedef void (*gst_eos_cb)(int track_num, void *user_data);
132 #endif /* __TIZEN_MEDIADEMUXER_PORT_GST_H__ */