How can I switch audio track when play back a multi-audio-track movie?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How can I switch audio track when play back a multi-audio-track movie?

zhangal
Hi,
   
    I met some movies(like *.mkv and *.avi files) which include multi audio tracks and then my application can not switch audio when playback.
 
    I tried to just unlink the demuxer and the audio decoder and then called gst-element-get-pad() to get another audio pad which will be linked to the audio decoder that is able to decode the audio. But I can not hear anything. The code looks like following
 
GstPad *src_pad, *sink_pad, *demux_src; 
 
FAIL_CHECK (NULL == (demux_src = gst_element_get_pad(demuxer,"audio_01")));//Get anotherdemuxer source pad
FAIL_CHECK (NULL == (sink_pad = gst_element_get_pad(a_decoder, "sink")));// Get audio decoder sink pad
 
src_pad = gst_pad_get_peer(sink_pad);//get the audio pad connected to decoder sink pad
gst_element_set_state(player_status->bin, GST_STATE_PAUSED); 

gst_pad_unlink (src_pad, sink_pad);

gst_pad_link(demux_src, sink_pad);

gst_object_unref(src_pad);  
gst_object_unref(sink_pad);
gst_object_unref(demux_src);

gst_element_set_state(player_status->bin, GST_STATE_PLAYING);

//End
 
It seems that does not work well. Does anyone have the idea about this?
 
Thanks a lot
 
 


MSN上小游戏,工作休闲两不误! 马上就开始玩!
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How can I switch audio track when play back a multi-audio-track movie?

Eric Zhang-6
Hi, zhangal:

    Maybe the element `selector' can do some help for you.

Eric Zhang

2008/9/5 zhangal <[hidden email]>
Hi,
   
    I met some movies(like *.mkv and *.avi files) which include multi audio tracks and then my application can not switch audio when playback.
 
    I tried to just unlink the demuxer and the audio decoder and then called gst-element-get-pad() to get another audio pad which will be linked to the audio decoder that is able to decode the audio. But I can not hear anything. The code looks like following
 
GstPad *src_pad, *sink_pad, *demux_src; 
 
FAIL_CHECK (NULL == (demux_src = gst_element_get_pad(demuxer,"audio_01")));//Get anotherdemuxer source pad
FAIL_CHECK (NULL == (sink_pad = gst_element_get_pad(a_decoder, "sink")));// Get audio decoder sink pad
 
src_pad = gst_pad_get_peer(sink_pad);//get the audio pad connected to decoder sink pad
gst_element_set_state(player_status->bin, GST_STATE_PAUSED); 

gst_pad_unli nk (src_pad, sink_pad);

gst_pad_link(demux_src, sink_pad);

gst_object_unref(src_pad);  
gst_object_unref(sink_pad);
gst_object_unref(demux_src);

gst_element_set_state(player_status->bin, GST_STATE_PLAYING);

//End
 
It seems that does not work well. Does anyone have the idea about this?
 
Thanks a lot
 
 


MSN上小游戏,工作休闲两不误! 马上就开始玩!

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel