[mythtv] CardUtil::CreateCaptureCard / CardUtil::CreateCardInput and mythconverg.inputgroup
David Engel
david at istwok.net
Fri Jul 8 01:23:13 UTC 2022
On Thu, Jul 07, 2022 at 08:27:33PM -0400, Peter Bennett wrote:
>
> On 7/7/22 19:13, John P Poet wrote:
> > On Thu, Jul 7, 2022 at 5:02 PM David Engel <david at istwok.net> wrote:
> >
> > On Thu, Jul 07, 2022 at 01:33:49PM -0600, John P Poet wrote:
> > > Hi David,
> > >
> > > After a call to
> > > CardUtil::CreateCaptureCard()
> > > and
> > > CardUtil::CreateCardInput()
> > >
> > > The resulting capturecard and inputgroup tables look like:
> > >
> > > select * from capturecard;
> > >
> > +--------+----------+------------------------------------------------------------------------+-------------+-----------+----------+--------------+----------------+----------------+--------------+--------------+-----------------------+-------------+---------------+-----------------+----------------+----------------+---------------------+----------------+-----------------+------------------+----------+------------+--------+-----+----------+-------------+-----------+----------+-----------------+----------------+---------------+----------+-----------+-------------+-------------+-------------+-----------+------------+-------------+----------+------------+
> > > | cardid | parentid | videodevice
> > > | audiodevice | vbidevice | cardtype |
> > defaultinput |
> > > audioratelimit | hostname | dvb_swfilter | dvb_sat_type |
> > > dvb_wait_for_seqstart | skipbtaudio | dvb_on_demand |
> > dvb_diseqc_type |
> > > firewire_speed | firewire_model | firewire_connection |
> > signal_timeout |
> > > channel_timeout | dvb_tuning_delay | contrast | brightness |
> > colour | hue |
> > > diseqcid | dvb_eitscan | inputname | sourceid | externalcommand |
> > > changer_device | changer_model | tunechan | startchan |
> > displayname |
> > > dishnet_eit | recpriority | quicktune | schedorder | livetvorder
> > | reclimit
> > > | schedgroup |
> > >
> > +--------+----------+------------------------------------------------------------------------+-------------+-----------+----------+--------------+----------------+----------------+--------------+--------------+-----------------------+-------------+---------------+-----------------+----------------+----------------+---------------------+----------------+-----------------+------------------+----------+------------+--------+-----+----------+-------------+-----------+----------+-----------------+----------------+---------------+----------+-----------+-------------+-------------+-------------+-----------+------------+-------------+----------+------------+
> > > | 1 | 0 | /usr/local/bin/mythexternrecorder --conf
> > > /home/mythtv/etc/mag-1-2.conf | NULL | NULL | EXTERNAL |
> > > Television | NULL | cubic.sobie.us
> > <http://cubic.sobie.us> | 0 |
> > > 0 | 1 | 0 | 1 | 0
> > > | 0 | NULL | 0 |
> > 0 |
> > > 4000 | 0 | 0 | 0 | 0 | 0 |
> > > NULL | 0 | MPEG2TS | 2 | |
> > > | | | | mag/1-2 |
> > 0 |
> > > 1 | 0 | 1 | 0 | 1 |
> > 1 |
> > >
> > +--------+----------+------------------------------------------------------------------------+-------------+-----------+----------+--------------+----------------+----------------+--------------+--------------+-----------------------+-------------+---------------+-----------------+----------------+----------------+---------------------+----------------+-----------------+------------------+----------+------------+--------+-----+----------+-------------+-----------+----------+-----------------+----------------+---------------+----------+-----------+-------------+-------------+-------------+-----------+------------+-------------+----------+------------+
> > > 1 row in set (0.001 sec)
> > >
> > > select * from inputgroup;
> > >
> > +-------------+--------------+-----------------------------------------------------------------------------------------+
> > > | cardinputid | inputgroupid | inputgroupname
> > > |
> > >
> > +-------------+--------------+-----------------------------------------------------------------------------------------+
> > > | 0 | 1 | cubic.sobie.us
> > <http://cubic.sobie.us>|/usr/local/bin/mythexternrecorder
> > > --conf /home/mythtv/etc/mag-1-2.conf|1 |
> > > | 1 | 1 | cubic.sobie.us
> > <http://cubic.sobie.us>|/usr/local/bin/mythexternrecorder
> > > --conf /home/mythtv/etc/mag-1-2.conf|1 |
> > >
> > +-------------+--------------+-----------------------------------------------------------------------------------------+
> > > 2 rows in set (0.001 sec)
> > >
> > > I am curious about the entry in inputgroup with a cardinputid of
> > zero (0).
> > > Is that what you would expect to see or is something amiss?
> > >
> > > I know you did some magic to make "multirec" work without having
> > to create
> > > a bunch of inputs. Does this happen automatically with a call
> > > CardUtil::CreateCaptureCard() and/or
> > CardUtil::CreateCardInput(), or are
> > > extra steps necessary? I see that the default "reclimit" is 1,
> > but did not
> > > dig enough to see if that is still relevant. Does the multirec
> > magic happen
> > > when schedgroup is 1?
> > >
> > > To be clear, I am making these calls via the ServicesAPI and
> > want to make
> > > sure I am not missing any steps. I do want multirec to work.
> >
> > Okay. I've refreshed my memory and remember what a mess is still left
> > over.
> >
> > The inputgroup entry with cardinputid = 0 is a hold over from Daniel
> > K's bad design of that table. Basically, that entry is a placeholder
> > for the mythtv-setup GUI to see the group name. It's eventually
> > cleaned up when CardUtil::UnlinkInputGroup(0, 0) is called. The
> > services API or whatever it ultimately calls also needs to make sure
> > that cleanup occurs. It's harmless as there can never be an inputid =
> > 0 but still should be cleaned up.
> >
> > The separate CardUtil::CreateCaptureCard() and
> > CardUtil::CreateCardInput() methods are a holdover from the very, old
> > days when they were truly separate. The intent that was never
> > finished was to combine the mythtv-setup screens for capture cards and
> > inputs together. The new services API should not perpetuate that
> > split card/input interface. IOW, the new API should have a single
> > CreateInput() method exposed to API users. (*) (**). As I've stated
> > before the old, services API for cards and inputs was so bad, it
> > should simple be deleted and never spoken of again.
> >
> > David
> >
> > (*)At the time card/input was refactored, "input" was chosen as the
> > perferred name for tuner thingies. I think all user-facing code
> > except mythtv-setup tries to follow that naming.
> >
> > (**)Unless you are feeling really enegetic and want to rewrite much of
> > CardUtil and it's callers to fully eradicate the remaining vestiges of
> > separete cards and inputs, the API will need to call the separate,
> > lower, level methods in the right way. See CaptureCard::Save() and
> > CardInput::Save() in videosource.cpp for examples.
> >
> > -- David Engel
> >
> >
> > My first thought was that CardUtil::UnlinkInputGroup(0, 0) should be
> > added to the bottom of CardUtil::CreateCardInput, but that would be
> > /slightly/ inefficient.
> >
> > Apparently there is an issue with the ServicesAPI and a limit to the
> > maximum number of arguments. With V2, long argument lists are being
> > passed as JSON to get around that issue. I will take a look at merging
> > the capturecard and cardinput API calls for V2.
> >
> > John
> >
> >
> I am already using the capturecard apis as they are now, in developing the
> new setup pages. The new setup works the same as the old setup. If you want
> to join the capture card creation page with the input setup page let me know
> how it should look. The problem I see is that you have to set up the
> listings source before you set up the input, so it makes somewhat sense to
> have them separate, i.e. create capture card, then create listings source,
> then link them up using the input setup. Otherwise you would have to set up
> your listings source before the capture card.
I feel pretty strongly that they should be combined. The split dates
all the way back to the earyly days of analog, capture cards where
there were multiple inputs (tuner, composite, s-video, etc.). Those
are by far the exception these days and have been for a long time.
Keeping that distinction only promotes unnecessary confusion.
FWIW, I think creating video source logically comes first.
Regardless, it should be allowed to leave the videosource blank/empty
and fill it in later.
> Another problem is that there will be some 10 capture card setup pages to be
> developed, for all the capture card types, but it seems tedious to have the
> input setup process repeated in the code 10 times for each capture card
> type.
>
> You can test the setup pages I have already done. I have done the general
> setup, and the ceton and DVB capture cards so far, plus the deletion of
> cards, delete all cards, delete all cards on all hosts.
>
> The update for capture cards via the API is rather primitive and different
> from others, you specify database columns to update one at a time. I have
> used it anyway.
By repeating, are you talking about C++ code or whatever web GUI
framework you all are using or both? I'm guessing you mean the
framework. Does it not support some form of code re-use?
David
--
David Engel
david at istwok.net
More information about the mythtv-dev
mailing list