Now I have been using the Directshowlib-2005 Libs. And the SDK BDA sample called DTVViewer.

Now I am not the type of person to ask for help and annoy the living *&^*& out of some poor person..

...But....

I just need some simple help to convert the code into something that I can use as a Media Centre All in one..I have already designed a Touch Screen Media Player and UI and works fine but now I would just like to add the Digital TV Module....

OK using the DTVViewer sample code I finally got some source code to work with 2 different brands of DVB-T Tuner Cards (DVICO/Fusion and Compro E700). Now I have not modified the sample code MUCH at all it just worked! Just by entering the Frequency and Hitting Build Graph..

What I would like to do is mod the code so that I can Either use a combo box with Pre-Entered Frequency’s (i.e..Channel ??/Freq 191500).

Now the help I need as I have just started to programming in c# again(after a few years). And I can’t seem to figure out how this works completely...

So basically what I need is to somehow call the DVBTTuning() class with predefined Values(Frequencies) from a Combo box(or Whatever).

This is the section of code that I think! I need to change.

namespace DirectShowLib.Sample

{

     /// <summary>
     /// Description résumée de DVBTTuning.
     /// </summary>
     public class DVBTTuning : Form, ITuningSelector
     {

    private System.Windows.Forms.Label label1;
    private System.Windows.Forms.Label label2;
    private System.Windows.Forms.Label label3;
    private System.Windows.Forms.Label label4;
    private System.Windows.Forms.Label label5;
    private System.Windows.Forms.Button button1;
    private System.Windows.Forms.TextBox textCarrierFreq;
    private System.Windows.Forms.TextBox textONID;
    private System.Windows.Forms.TextBox textTSID;
    private System.Windows.Forms.TextBox textSID;


    /// <summary>
         /// Variable nécessaire au concepteur.
         /// </summary>

         private System.ComponentModel.Container components = null;



    private IDVBTuningSpace tuningSpace = null;
    private IDVBTuneRequest tuneRequest = null;

         public DVBTTuning()
         {
     InitializeComponent();

     int hr = 0;

     this.tuningSpace = (IDVBTuningSpace) new DVBTuningSpace();
     hr = this.tuningSpace.put_UniqueName("DVBT TuningSpace");
     hr = this.tuningSpace.put_FriendlyName("DVBT TuningSpace");
     hr = this.tuningSpace.put__NetworkType(typeof(DVBTNetworkProvider).GUID);
     hr = this.tuningSpace.put_SystemType(DVBSystemType.Terrestrial);

         MessageBox.Show(this.tuningSpace.ToString());

     ITuneRequest tr = null;

     hr = this.tuningSpace.CreateTuneRequest(out tr);

     DsError.ThrowExceptionForHR(hr);

     this.tuneRequest = (IDVBTuneRequest) tr;

     hr = this.tuneRequest.put_ONID(-1);
     hr = this.tuneRequest.put_TSID(-1);
     hr = this.tuneRequest.put_SID(-1);

    IDVBTLocator locator = (IDVBTLocator) new DVBTLocator();


     hr = locator.put_CarrierFrequency(191500); <- I have enter the vaule manually(191500)


     hr = tr.put_Locator(locator as ILocator);

         }

*****I have not sent the whole sample...But the Link is http://sourceforge.net/project/showfiles.php?group_id=136334&package_id=188409

This Class calls a form with the tuning Freq(s) and SID and such...I just would like to be able to pass a value within a call say User clicks button Channel Up and it Calls Change Channel(FreqComboBox).
(In other words remove the need to manually enter each Frequencies when Hitting retune)

OK my basic question is how would I rewrite this sample for only DVB-T(not DVBS) and add Predefined Channels(Frequencies) later in the build I would like to attempt Auto Scan Feature...But would like to just get the basic working....

and one other thing what the hell is the ' hr ' varible doing? were is it's value being sent...I KNOW THAT'S A VAGUE Question.

Any Help Would be greatly appreciated..

First question: You can get the selected item from a combo box and use that to send to your procedure.. (which is I think what you asked)

Second..

hr Its just a return variable, it probably should be checked that the value is as expected.. but.. I havent read up on the SDK..

Thanks Liz, For your response,

and thats the problem. I'm a little confused on how to send the Frequencys to the procedure. I have tried but iam not really sure how. I would usually send somehting like DVBTTuning(Combobox.Selectedtext).

But i can't work out how to send from mainform to DVBTTuning() class(Method)..

do i use ChannelTuneRequest Blah = new ChannelTuneRequest(); or somehting similar or try and mod this...But still can't seem to send Combobox.text to this method...This is the code I think I'm having trouble with:-

public bool TuneSelect()
    {
      int hr = 0;
      ILocator locator;
      int freq;
      int onid, tsid, sid;


      hr = this.tuneRequest.get_Locator(out locator);
 
     //How can i set the value for freq from the combobox located on the mainform???
  
      hr = locator.get_CarrierFrequency(out freq);

      hr = this.tuneRequest.get_ONID(out onid);
      hr = this.tuneRequest.get_TSID(out tsid);
      hr = this.tuneRequest.get_SID(out sid);

      textCarrierFreq.Text = freq.ToString();
      textONID.Text = onid.ToString();
      textTSID.Text = tsid.ToString();
      textSID.Text = sid.ToString();

      this.ShowDialog();

      if (this.DialogResult == DialogResult.OK)
      {
        hr = locator.put_CarrierFrequency(Convert.ToInt32(textCarrierFreq.Text));
        hr = this.tuneRequest.put_Locator(locator);
        Marshal.ReleaseComObject(locator);

        hr = this.tuneRequest.put_ONID(Convert.ToInt32(textONID.Text));
        hr = this.tuneRequest.put_TSID(Convert.ToInt32(textTSID.Text));
        hr = this.tuneRequest.put_SID(Convert.ToInt32(textSID.Text));
        return true;
      }
      else
      {
        Marshal.ReleaseComObject(locator);
        return false;
      }
    }
Any help would be great.. I know that there is a simple way to do this...I just can't seem to wrap my head around the Procedure(I think I have convinced myself it's harder than it would appear)
    #endregion

If the methods you have dont allow you to send values to them, then you arguably cant.

In your code above, thats hopefully where your combo box data would go in, so you know how to retrieve it, try it, whats the worst that can happen.. it doesnt work :)

This article has been dead for over six months. Start a new discussion instead.