_mmplayer_submit_packet (MMHandleType hplayer, media_packet_h packet)
{
int ret = MM_ERROR_NONE;
- GstBuffer *_buffer;
+ GstBuffer *_buffer = NULL;
mm_player_t *player = (mm_player_t *) hplayer;
guint8 *buf = NULL;
MMPlayerTrackType streamtype = MM_PLAYER_TRACK_TYPE_AUDIO;
media_format_h fmt = NULL;
+ bool flag = FALSE;
return_val_if_fail (packet, MM_ERROR_INVALID_ARGUMENT);
return_val_if_fail ( player &&
player->pipeline->mainbin[MMPLAYER_M_SRC].gst,
MM_ERROR_PLAYER_INTERNAL );
+ /* get stream type if audio or video */
+ media_packet_is_audio (packet, &flag);
+ if (flag) {
+ streamtype = MM_PLAYER_TRACK_TYPE_AUDIO;
+ } else {
+ media_packet_is_video (packet, &flag);
+
+ if (flag)
+ streamtype = MM_PLAYER_TRACK_TYPE_VIDEO;
+ else
+ streamtype = MM_PLAYER_TRACK_TYPE_TEXT;
+ }
+
/* get data */
media_packet_get_buffer_data_ptr (packet, (void **) &buf);
GstMapInfo buff_info = GST_MAP_INFO_INIT;
uint64_t size = 0;
uint64_t pts = 0;
- bool flag = FALSE;
/* get size */
media_packet_get_buffer_size (packet, &size);
_buffer = gst_buffer_new_and_alloc (size);
+ if (!_buffer) {
+ debug_error("failed to allocate memory for push buffer\n");
+ return MM_ERROR_PLAYER_NO_FREE_SPACE;
+ }
+
if (gst_buffer_map (_buffer, &buff_info, GST_MAP_READWRITE)) {
memcpy (buff_info.data, buf, size);
media_packet_get_pts (packet, &pts);
GST_BUFFER_PTS (_buffer) = (GstClockTime) (pts * 1000000);
- /* get stream type if audio or video */
- media_packet_is_audio (packet, &flag);
- if (flag) {
- streamtype = MM_PLAYER_TRACK_TYPE_AUDIO;
- } else {
- media_packet_is_video (packet, &flag);
-
- if (flag)
- streamtype = MM_PLAYER_TRACK_TYPE_VIDEO;
- else
- streamtype = MM_PLAYER_TRACK_TYPE_TEXT;
- }
-
if (streamtype == MM_PLAYER_TRACK_TYPE_AUDIO) {
#if 0 // TO CHECK : has gone (set to pad)
if (GST_CAPS_IS_SIMPLE (player->a_stream_caps))
{
GstPad *sink_pad = NULL;
sink_pad = gst_element_get_static_pad(videobin[MMPLAYER_V_SINK].gst, "sink");
- MMPLAYER_SIGNAL_CONNECT (player, sink_pad, MM_PLAYER_SIGNAL_TYPE_VIDEOBIN,
+ if (sink_pad)
+ {
+ MMPLAYER_SIGNAL_CONNECT (player, sink_pad, MM_PLAYER_SIGNAL_TYPE_VIDEOBIN,
"notify::caps", G_CALLBACK(__mmplayer_gst_caps_notify_cb), player);
- gst_object_unref (GST_OBJECT(sink_pad));
+ gst_object_unref (GST_OBJECT(sink_pad));
+ }
}
/* store it as it's sink element */
MMPlayerGstElement* mainbin = NULL;
GstElement* decodebin2 = NULL;
GstElement* queue2 = NULL;
+ GstElement* id3demux = NULL;
GstPad* sinkpad = NULL;
GstPad* qsrcpad= NULL;
gchar *caps_str = NULL;
queue2 = NULL;
}
+ if (id3demux)
+ {
+ /* NOTE : Trying to dispose element id3demux, but it is in READY instead of the NULL state.
+ * You need to explicitly set elements to the NULL state before
+ * dropping the final reference, to allow them to clean up.
+ */
+ gst_element_set_state(id3demux, GST_STATE_NULL);
+
+ /* And, it still has a parent "player".
+ * You need to let the parent manage the object instead of unreffing the object directly.
+ */
+ gst_bin_remove (GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), id3demux);
+ gst_object_unref (id3demux);
+ id3demux = NULL;
+ }
+
if (decodebin2)
{
/* NOTE : Trying to dispose element queue0, but it is in READY instead of the NULL state.
if( temp1->direction != GST_PAD_SINK
|| temp1->presence != GST_PAD_ALWAYS)
continue;
-#if 0 //should check
+
if ( GST_IS_CAPS( &temp1->static_caps.caps) )
{
/* using existing caps */
- static_caps = gst_caps_ref( &temp1->static_caps.caps );
+ static_caps = gst_caps_ref(temp1->static_caps.caps );
}
else
{
static_caps = gst_caps_from_string ( temp1->static_caps.string );
}
- res = gst_caps_intersect(caps, static_caps);
-#endif
+ res = gst_caps_intersect((GstCaps*)caps, static_caps);
gst_caps_unref( static_caps );
static_caps = NULL;