Hi Brandon!
Le 13 juillet 2011 23:09, Brandon Casci <[email protected]> a écrit :
> I've implemented a custom crossfade based from one of the examples. The
> crossfade works great, but metadata updates to icecast always stop after the
> second track is played. If I restart liquidsoap metadata updates will
> resume, but will stop after the second track is played. Metadata updates
> process as usual when I remove the crossfade code. I'm using a trunk version
> of liquidsoap that's about 2 or three weeks old. Any theories?
Sure!
> Here is a
> snippet of the code:
>
>
> def my_crossfade (~start_next=5.,~fade_in=3.,~fade_out=3.,
> ~default=(fun (a,b) -> sequence([a, b])),
> ~high=-15., ~medium=-32., ~margin=4.,
> ~width=2.,~conservative=false,s)
> fade.out = fade.out(type="sin",duration=fade_out)
> fade.in = fade.in(type="sin",duration=fade_in)
> add = fun (a,b) -> add(normalize=false,[b, a])
> log = log(label="smart_crossfade")
>
> def transition(a,b,ma,mb,sa,sb)
>
> list.iter(fun(x)-> log(level=4,"Before: #{x}"),ma)
> list.iter(fun(x)-> log(level=4,"After : #{x}"),mb)
> if ma["crossfade"] == "yes" and mb["crossfade"] == "yes" then
> add(fade.initial(type="sin", sb),fade.final(type="sin", sa))
This is your problem: add only relays metadata of the first stream.
Therefore, you should write:
add([fade.final(type="sin", sa),fade.initial(type="sin", sb)])
(BTW: it should be an array of sources I think..)
> else
> log("No transition defined: using default.")
> default(sa, sb)
> end
> end
>
> smart_cross(width=width, duration=start_next,
> conservative=conservative,transition,s)
> end
>
> live_broadcast = input.http(id="live_broadcast_url", buffer = 5.0,
> "http://#{live_server}:#{live_port}#{live_mount}")
> live_broadcast = nrj(live_broadcast)
> local_playlist = playlist(id = "local_playlist", mode = "normal",
> "content.m3u")
> local_playlist =
> request.dynamic(id="local_playlist",{request.create(get_process_output("#{track_script}
> #{channel_id}"))})
> local_playlist = rewrite_metadata(
> [
> ("title", '$(if $(player_title),"$(player_title)","$(title)")'),
> ],
> local_playlist)
I have two minor remarks concerning this: I happen to think this
rewrite syntax is rather obscure. I personally prefer to use
map_metadata this way:
# This will only update by default so
# we only need to return the fields that
# need to be updated..
def update_meta(m) =
if m["player_title"] != "" then
[("title",m["player_title")]
else
[]
end
end
local_playlist = map_metadata(update_meta,local_playlist)
Romain
------------------------------------------------------------------------------
AppSumo Presents a FREE Video for the SourceForge Community by Eric
Ries, the creator of the Lean Startup Methodology on "Lean Startup
Secrets Revealed." This video shows you how to validate your ideas,
optimize your ideas and identify your business strategy.
http://p.sf.net/sfu/appsumosfdev2dev
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users