7 Replies Latest reply on Oct 9, 2010 1:09 AM by AlbionM

    Field Type detection

    AlbionM Level 1

      I am trying to write a filter for which the field type (e.g. lower field first, upper field first or

      progressive of the SOURCE material is important.

       

      I am guessing the following should do the trick, but it always returns 0 (while source material is lower field first PAL DV)

       

      VideoSequenceParser videoSequenceParser(SPBasic,0,0,0,0);

      videoSequenceParser.ParseSequence((*theData)->timelineData,0);

      PrClipID clipID=videoSequenceParser.FindClipIDAtTime(10000);

      ClipRenderSuite->GetClipFieldType(clipID, &fieldType);

       

      I also tried :

      returnValue = mSegmentSuite->GetNodeProperty(mediaNodeID,kVideoSegmentProperty_Media_StreamFieldType,&m ediaFieldTypeString);

       

      But with the same result always 0.

       

      BTW (I am using the Premiere SDK and not the After Effects SDK, because I thought I will be able to obtain more details. If it is possible with the After Effects SDK all the better.)

       

      Can anybody help me with this an explain how I can obtain the field type of a source clip?

       

      Thanks in advance,

       

      Arjan

       

       

        • 1. Re: Field Type detection
          Zac Lam Adobe Employee

          Hi Arjan,

           

          Getting the kVideoSegmentProperty_Media_StreamFieldType is the right approach.  Are you using the actual media node ID, which is not the same as the clipID?

           

          Also, since a single segment may contain more than one media, and there may be multiple instances of your effect applied to those media, the question can arise: which effect instance is the current effect?  You can get the kVideoSegmentProperty_Effect_RuntimeInstanceID property, and compare that with the instanceID in the VideoRecord structure passed to the video filter.

           

          This info is not retrievable using the AE API in Premiere Pro.

           

          Regards,

           

          Zac

          1 person found this helpful
          • 2. Re: Field Type detection
            AlbionM Level 1

            Dear Zac,

             

            Thank you very much for your concise reply!

             

            For the call to: ClipRenderSuite->GetClipFieldType(clipID, &fieldType) I use the clipID, should I use the medianodeID here?

             

            For the call to: mSegmentSuite->GetNodeProperty(mediaNodeID,kVideoSegmentProperty_Medi a_StreamFieldType,&mediaFieldTypeString) I use the mediaNodeID (At least I assume as I simply modified the VideoParser code in the SDK code a bit, but I will double check.)

             

            >Also, since a single segment may contain more than one media, and there may be multiple instances of your effect applied to those media, the

            >question can arise: which effect instance is the current effect?  You can get the kVideoSegmentProperty_Effect_RuntimeInstanceID property, and

            >compare that with the instanceID in the VideoRecord structure passed to the video filter.

             

             

             

            This I indeed noticed, thank you on the hint how to resolve this. I double check however with simple sequences which just contain one clip.

             

            An addition to the API to simply retrieve the current clipID and medianodeID would simplify matters greatly and also increase performance (as I have to iterate over the entire segment structure now to get basic information about teh source material).

             

            BTW. Do you happen to know how I can add a popup style UI element via the Premiere Pro SDK? (I found how to do a checkbox in one of the examples, although it uses numeric identifiers not part of the headers, but cannot figure out how to do a popup style element.)

             

            Best Regards,

             

            Arjan Mels

            • 3. Re: Field Type detection
              Zac Lam Adobe Employee

              Hi Arjan,

               

              In the sample VideoSequenceParser code, inside parseMedia(), I added a call to GetNodeProperty() with kVideoSegmentProperty_Media_StreamFieldType.  It passes back a string that contains a prFieldType, defined in PrSDKTypes.h.  Seemed to work well.

               

              Popup menus are not available using the Premiere Pro filter API, unfortunately.  All the effects that use popup menus are written using the After Effects API.  If you provide a setup dialog during fsSetup, you can bring up your own dialog that contains any UI you want to provide using platform-specific UI calls.

               

              Regards,

               

              Zac

              • 4. Re: Field Type detection
                AlbionM Level 1

                nklem remaining Hi Zac.

                 

                Thanks for your efforts. Strange! I will try testing with more different sources.

                 

                BTW I figured out that you can call the media information API from inside an AE plugin. Only problem remaining is how to get a timelineID. The effect ID I can obtain via

                VideoSegmentSuite->GetNodeInfo((csSDK_int32)FilterInstanceID,NodeType, &Hash, &Flags) I think.

                 

                Best Regards,

                 

                Arjan

                • 5. Re: Field Type detection
                  Zac Lam Adobe Employee

                  Hi Arjan,

                   

                  I don't think there is any way to get a PrTimelineID from an AE effect plug-in running in Premiere Pro...  That would make an interesting feature request.

                   

                  Thanks,

                   

                  Zac

                  • 6. Re: Field Type detection
                    AlbionM Level 1

                    Hi Zac,

                     

                    That is a pitty, because then I could combine the best of both worlds.

                     

                    In the mean time I have tested the GetNodproperty on more samples and indeed I get a proper field code, so apologies for asking a question for nothing. However the discussion was very worthwhile in other respects!

                     

                    Thanks for all you assistance.

                     

                    Arjan

                    • 7. Re: Field Type detection
                      AlbionM Level 1

                      Dear Zac,

                       

                      I found a work-around. It is a bit ugly, but it works. I simply scan all "timelineID" values below a certain limit (as I noticed that it are not pointers, but actually ID values with a fairly low number).

                       

                      Then for all timelines I look for a matching effectID/filterID as you suggested.

                       

                      E.g.:

                       

                      // arbitrary end number: if too high too time consuming & crashes, too low: might miss sequences in large projects

                      for (int i=0; i<=0xffffff && !result; i++) 

                      {
                        if (PrSuiteErrorSucceeded(VideoSegmentSuite->AcquireVideoSegmentsID(i,&VideoSegmentsID)))
                        {
                          result=ParseSequence(VideoSegmentSuite, MemorySuite, FilterID, VideoSegmentsID);
                          VideoSegmentSuite->ReleaseVideoSegmentsID(VideoSegmentsID);
                        }
                      }

                       

                      Best regards, and thanks again,

                       

                      Arjan Mels