<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div class="moz-cite-prefix">Many thanks Gareth.</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">Looks like your code was about the same
as mine.</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">I have managed to get my test code to
work however I don't know the reason it didn't work before.
Enclosed is my code that works for anyone else in the same boat.<br>
</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">In my attached code only the function
gstAudioAddPadCallback3() works as the "pad-added" callback for
adding an MP3 audio processing sub pipeline.</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">It seems:</div>
<div class="moz-cite-prefix">1. If you use decodebin in the attached
sub pipeline, the pipeline will not go to the PLAYING state for
some reason (no errors/warnings).</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">2. If you use
gst_parse_bin_from_description(), gst_bin_add() and
gst_element_sync_state_with_parent() the pipeline will not go to
the PLAYING state for some reason (no errors/warnings).</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">No idea on why these issue occur. Using
decodebin would have been more useful to handle different audio
formats automatically (I assume it would have done that).<br>
</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">Terry<br>
</div>
<div class="moz-cite-prefix">On 03/10/2024 09:24, Gareth Alldread
via gstreamer-devel wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAENg58osT5ChaTZQSkym3Ubxxwsjdc5Jiug_7Rj8-ME+6Em6pA@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div>I haven't got experience with filesrc - but I attached my
example doing something similar with uridecodebin (which will
work with an video file btw). I have stripped this out of my
app - so it is encapsulated inside a class - but I'm sure you
get the idea.<br>
</div>
<div><br>
</div>
<div><br>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Wed, 2 Oct 2024 at 17:46,
Terry Barnaby via gstreamer-devel <<a
href="mailto:gstreamer-devel@lists.freedesktop.org"
moz-do-not-send="true" class="moz-txt-link-freetext">gstreamer-devel@lists.freedesktop.org</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote"
style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<div>I have tried using g_signal_connect(m_sourceElement,
"pad-added", ...) and within that adding a sub pipeline to
the main pipeline, but I am getting something wrong when I
add the sub pipeline.</div>
<div><br>
</div>
<div>My simple program attached, sees the signal callback,
but when I add the sub pipeline and link it to the new
pad, the displayed video just freezes.</div>
<div>I've looked at the "Basic tutorial 3: Dynamic
pipelines" and it looks like I am doing the right thing
and no errors are seen.</div>
<div><br>
</div>
<div>Any ideas on what I am ding wrong ?<br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>On 02/10/2024 08:26, Gareth Alldread via
gstreamer-devel wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div>I would add a handler for the "pad-added" event on
the filesrc element and only create/add the audio part
of the pipeline if you get an audio pad created. That
is what I have done to handle rtspsrc streams that may
or may not have audio. Reply if you want more
details.</div>
<div><br>
</div>
<div> g_signal_connect(m_sourceElement, "pad-added",
G_CALLBACK(&SynxRTSPPipeline::onPadAdded), this);<br>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Wed, 2 Oct 2024 at
07:30, Terry Barnaby via gstreamer-devel <<a
href="mailto:gstreamer-devel@lists.freedesktop.org"
target="_blank" moz-do-not-send="true"
class="moz-txt-link-freetext">gstreamer-devel@lists.freedesktop.org</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote"
style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<p>I am developing a C++ video inspection program
that creates MP4/H264/MP3 files and needs to play
them back with the video stream processed by
various gstreamer elements and audio separately.</p>
<p>In general this has been working fine when just
video was being recorded/played back, but I am
just adding audio to the mix. Some MP4 files will
contain only a video stream and some will contain
both video and audio streams.</p>
<p>I need some way to handle the playback of these
MP4 files that may or may not have MP3 audio
streams.<br>
</p>
<p>As a simple idea if I use something like (The
real C++ code constructs the gstreamer piple line
and tees the video stream to various gstreamer sub
pipelines):<br>
</p>
<pre>gst-launch-1.0 -v filesrc location=temp.mp4 ! qtdemux name=demux</pre>
<pre> demux.video_0 ! queue ! h264parse ! openh264dec ! glimagesink</pre>
<pre> demux.audio_0 ! queue ! decodebin ! audioconvert ! pulsesink</pre>
<p>This plays back the video and audio streams fine
(not sure how well synchronised?) from an MP4 with
video and audio streams, but hangs if the MP4 only
has a video stream.</p>
<p>So I think I need to:</p>
<p>1. Maybe there is some gstreamer element or
attribute that can ignore the audio stream if not
present somehow ?</p>
<p>2. Check if the MP4 file has an audio stream
before creating the gstreamer pipeline in C++.</p>
<p>3. Create the basic C++ pipleline in C++ and
interrogate pads or something somehow and add the
"demux.audio_0 ! queue ! decodebin ! audioconvert
! pulsesink" sub pipeline if it is seen an audio
stream is present.<br>
</p>
Any ideas on the simplest/most CPU efficient way of
doing this with gstreamer ?<br>
<p><br>
</p>
</div>
</blockquote>
</div>
</blockquote>
<p><br>
</p>
</div>
</blockquote>
</div>
</blockquote>
<p><br>
</p>
</body>
</html>