Professional Web Applications Themes

OpenADefaultComponent - Mac Programming

It appears that OpenADefaultComponent doesn't want the codec code as a parameter; it instead wants to receive the quicktime file type constants. These are entirely different. For example, the code code for JPEG files is "jpeg", but the quicktime file type is "JPEG". The PICT file type comes through the quickdraw codec "qdrw", but the type code is "PICT". How in the world am I supposed to figure out what the file type was? I want to be able to re-decode the contents of the file in RAM later on again, and I can get the codec type from the ...

  1. #1

    Default RE: OpenADefaultComponent

    It appears that OpenADefaultComponent doesn't want the codec code as a
    parameter; it instead wants to receive the quicktime file type constants.
    These are entirely different. For example, the code code for JPEG files is
    "jpeg", but the quicktime file type is "JPEG". The PICT file type comes
    through the quickdraw codec "qdrw", but the type code is "PICT". How in the
    world am I supposed to figure out what the file type was? I want to be able
    to re-decode the contents of the file in RAM later on again, and I can get
    the codec type from the ImageDescriptionHandle (which has cType field), but
    where do I get the file type code???


    Edward de Jong Guest

  2. #2

    Default Re: OpenADefaultComponent

    In article <BB8D5C33.152D8%edwardmagicmouse.com>,
    Edward de Jong <edwardmagicmouse.com> wrote:
    > It appears that OpenADefaultComponent doesn't want the codec code as a
    > parameter; it instead wants to receive the quicktime file type constants.
    > These are entirely different. For example, the code code for JPEG files is
    > "jpeg", but the quicktime file type is "JPEG". The PICT file type comes
    > through the quickdraw codec "qdrw", but the type code is "PICT". How in the
    > world am I supposed to figure out what the file type was? I want to be able
    > to re-decode the contents of the file in RAM later on again, and I can get
    > the codec type from the ImageDescriptionHandle (which has cType field), but
    > where do I get the file type code???
    The reason is that there is not a one to one mapping. Many file
    types/extension will map to JPEG for example.

    Well, if you are doing this from RAM "later on again" you could in fact
    save away the file type at the time you are storing it in RAM. This
    would be my recommendation for performance and speed.

    However, if for some reason you can't/don't/won't have additional
    storage to contain information about the original source you can use
    (for many file types) the call GetGraphicsImporterForDataRef(). This
    allows you to find the graphics importer able to draw a stream of data.

    This works for popular file formats that contain enough identifying
    information in their header. This includes things like GIF, JPEG, PNG,
    etc.
    Tom Dowdy Guest

  3. #3

    Default RE: OpenADefaultComponent

    It appears that GetGraphicsImporterForFile(), once you have opened up a
    file, you can get the codec that was used. However, that codec 4 letter code
    doesn't always correspond to the 4 letter file type code you need to pass to
    OpenADefaultComponent.

    I do have the ability to store information about the data stream I have.
    But I can't seem to get from Quicktime the data type of the stream when I
    first open it using GetGraphicsImporterForFile() - if I examine the codec
    field, i see "jpeg", but the OpenADefaultComponent routine wants the
    quicktime file types, not the code name. I the case of JPEG files, one
    string is "jpeg", and the OpenA.. call wants "JPEG". For PICT files, you
    get "qdrw" as the codec, but the file type is "PICT". But for Photoshop and
    some others the two codes are the same. Anyway there doesn't seem to be
    call that gives you the code you need to send to OpenA..

    I am currently building a conversion table, where I manually map one 4
    letter codec code into a 4 letter Quicktime file type for later decoding.

    Edward de Jong Guest

  4. #4

    Default Re: OpenADefaultComponent

    In article <BB8E0C78.1538C%edwardmagicmouse.com>,
    Edward de Jong <edwardmagicmouse.com> wrote:
    > It appears that GetGraphicsImporterForFile(), once you have opened up a
    > file, you can get the codec that was used. However, that codec 4 letter code
    > doesn't always correspond to the 4 letter file type code you need to pass to
    > OpenADefaultComponent.
    This is incorrect. GetComponentInfo() on the graphics importer returned
    by GetGraphicsImporterForFile() will in fact give you a graphics
    importer that you can later open for later use rendering this same file.
    Tom Dowdy Guest

Similar Threads

  1. OpenADefaultComponent keeps returning -2003 error
    By Edward de Jong in forum Mac Programming
    Replies: 1
    Last Post: September 17th, 10:29 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139