{"action":"created","issue":{"url":"https://api.github.com/repos/xbmc/xbmc/issues/7171","labels_url":"https://api.github.com/repos/xbmc/xbmc/issues/7171/labels{/name}","comments_url":"https://api.github.com/repos/xbmc/xbmc/issues/7171/comments","events_url":"https://api.github.com/repos/xbmc/xbmc/issues/7171/events","html_url":"https://github.com/xbmc/xbmc/pull/7171","id":78990791,"number":7171,"title":"[RFC] Add multi source input stream/demuxer","user":{"login":"ace20022","id":2150851,"avatar_url":"https://avatars.githubusercontent.com/u/2150851?v=3","gravatar_id":"","url":"https://api.github.com/users/ace20022","html_url":"https://github.com/ace20022","followers_url":"https://api.github.com/users/ace20022/followers","following_url":"https://api.github.com/users/ace20022/following{/other_user}","gists_url":"https://api.github.com/users/ace20022/gists{/gist_id}","starred_url":"https://api.github.com/users/ace20022/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ace20022/subscriptions","organizations_url":"https://api.github.com/users/ace20022/orgs","repos_url":"https://api.github.com/users/ace20022/repos","events_url":"https://api.github.com/users/ace20022/events{/privacy}","received_events_url":"https://api.github.com/users/ace20022/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-05-21T13:12:21Z","updated_at":"2015-10-30T14:01:27Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/xbmc/xbmc/pulls/7171","html_url":"https://github.com/xbmc/xbmc/pull/7171","diff_url":"https://github.com/xbmc/xbmc/pull/7171.diff","patch_url":"https://github.com/xbmc/xbmc/pull/7171.patch"},"body":"@FernetMenta \r\nStill a bit work to do, therefore RFC. Please ignore the [Util] changes.\r\n\r\n**_Reading from demuxers:_**\r\n\r\nThe available demuxers are organized via a min heap. The sorting criteria is the dts or pts of the last packet they had delivered. The top demuxer in that heap is selected for reading.\r\n\r\n**_Organizing the streams:_**\r\n\r\nUnfortunately this does not work out of the box because each demuxer d_i numbers its streams from 0 to n_i, but the dvdplayer numbers them from 0 to sum_i(n_i). Hence the dvdplayer can't determine if the current packet should be forwarded to the audio/video player (because of the stream id mismatch). There are two solutions I can think of.  First we could copy the streams and collected them in the multi source demuxer. This is less future-proof and less efficient imo.I have implemented that as a poc here: https://github.com/xbmc/xbmc/compare/master...ace20022:ext3\r\n\r\nThe second one is presented by this pr. The streams of the demuxers are renumbered so that the ids match the ids of the dvdplayer. \r\nBefore I put more work into it, which solution is preferable, or is there an even better one?"},"comment":{"url":"https://api.github.com/repos/xbmc/xbmc/issues/comments/152533637","html_url":"https://github.com/xbmc/xbmc/pull/7171#issuecomment-152533637","issue_url":"https://api.github.com/repos/xbmc/xbmc/issues/7171","id":152533637,"user":{"login":"FernetMenta","id":576009,"avatar_url":"https://avatars.githubusercontent.com/u/576009?v=3","gravatar_id":"","url":"https://api.github.com/users/FernetMenta","html_url":"https://github.com/FernetMenta","followers_url":"https://api.github.com/users/FernetMenta/followers","following_url":"https://api.github.com/users/FernetMenta/following{/other_user}","gists_url":"https://api.github.com/users/FernetMenta/gists{/gist_id}","starred_url":"https://api.github.com/users/FernetMenta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FernetMenta/subscriptions","organizations_url":"https://api.github.com/users/FernetMenta/orgs","repos_url":"https://api.github.com/users/FernetMenta/repos","events_url":"https://api.github.com/users/FernetMenta/events{/privacy}","received_events_url":"https://api.github.com/users/FernetMenta/received_events","type":"User","site_admin":false},"created_at":"2015-10-30T14:01:27Z","updated_at":"2015-10-30T14:01:27Z","body":"CSelectionStreams really needs some rework and if you take this job, it is highly appreciated. IMO the biggest flaw of this class is that it does not allow gaps between streams. For this reason ffmpeg and pvr demuxers have become messy and error prone because on mpegts steams like an additional audio language may disappear. Currently those demuxers map a uid (PID) to a stream index, which is quite ugly.\r\n\r\nWould be great if this could be simplified. I think this is what you mean by adding a uid, right?"}}