Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. WMA question

WMA question

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelp
10 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Al_Pennyworth
    wrote on last edited by
    #1

    I am having some problems with the editing of wma tags. I have a program that I created that will convert files from one format to another. I have implemented the WMA functionality using the WMF sdk and it is working well. But one problem that I have is when I try to use IWMHeaderInfo3 to add the title to the wma header (similar to ID3 tagging in MP3 files), I have found the title shows strange characters instead of the actual title. I am performing the necessary functions: open, QueryInterface, AddAttribute (and I tried SetAttribute), BeginWriting, and EndWriting. Per the MSDN documentation, I am doing everything in the correct manner. The conversion works but the actual tagging does not. Here is the actual AddAttribute call: pHdr->AddAttribute(0, L"Title", &wDummy, WMT_TYPE_STRING,0, (LPBYTE)&strValue, sizeof(WCHAR) * (strValue.Length() + 1)); Any ideas?

    M M 3 Replies Last reply
    0
    • A Al_Pennyworth

      I am having some problems with the editing of wma tags. I have a program that I created that will convert files from one format to another. I have implemented the WMA functionality using the WMF sdk and it is working well. But one problem that I have is when I try to use IWMHeaderInfo3 to add the title to the wma header (similar to ID3 tagging in MP3 files), I have found the title shows strange characters instead of the actual title. I am performing the necessary functions: open, QueryInterface, AddAttribute (and I tried SetAttribute), BeginWriting, and EndWriting. Per the MSDN documentation, I am doing everything in the correct manner. The conversion works but the actual tagging does not. Here is the actual AddAttribute call: pHdr->AddAttribute(0, L"Title", &wDummy, WMT_TYPE_STRING,0, (LPBYTE)&strValue, sizeof(WCHAR) * (strValue.Length() + 1)); Any ideas?

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      Al_Pennyworth wrote:

      when I try to use IWMHeaderInfo3 to add the title to the wma header (similar to ID3 tagging in MP3 files), I have found the title shows strange characters instead of the actual title.

      Shows where? How are you looking at the resulting attribute? What strange characters?

      "If you can dodge a wrench, you can dodge a ball."

      1 Reply Last reply
      0
      • A Al_Pennyworth

        I am having some problems with the editing of wma tags. I have a program that I created that will convert files from one format to another. I have implemented the WMA functionality using the WMF sdk and it is working well. But one problem that I have is when I try to use IWMHeaderInfo3 to add the title to the wma header (similar to ID3 tagging in MP3 files), I have found the title shows strange characters instead of the actual title. I am performing the necessary functions: open, QueryInterface, AddAttribute (and I tried SetAttribute), BeginWriting, and EndWriting. Per the MSDN documentation, I am doing everything in the correct manner. The conversion works but the actual tagging does not. Here is the actual AddAttribute call: pHdr->AddAttribute(0, L"Title", &wDummy, WMT_TYPE_STRING,0, (LPBYTE)&strValue, sizeof(WCHAR) * (strValue.Length() + 1)); Any ideas?

        M Offline
        M Offline
        Mark Salsbery
        wrote on last edited by
        #3

        Wait...what type is strValue? Looking at it again, this cast looks really suspicious: (LPBYTE)&strValue If it's a CString, try (LPBYTE)(LPCTSTR)strValue *edit* never mind. CString doesn't have a Length() method. Regardless, you'll need to pass a pointer to a NULL-terminated Unicode string. Mark

        "If you can dodge a wrench, you can dodge a ball."

        T 1 Reply Last reply
        0
        • M Mark Salsbery

          Wait...what type is strValue? Looking at it again, this cast looks really suspicious: (LPBYTE)&strValue If it's a CString, try (LPBYTE)(LPCTSTR)strValue *edit* never mind. CString doesn't have a Length() method. Regardless, you'll need to pass a pointer to a NULL-terminated Unicode string. Mark

          "If you can dodge a wrench, you can dodge a ball."

          T Offline
          T Offline
          toxcct
          wrote on last edited by
          #4

          Mark Salsbery wrote:

          CString doesn't have a Length() method

          CString::GetLength()[^] maybe ?


          [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

          M 1 Reply Last reply
          0
          • T toxcct

            Mark Salsbery wrote:

            CString doesn't have a Length() method

            CString::GetLength()[^] maybe ?


            [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

            M Offline
            M Offline
            Mark Salsbery
            wrote on last edited by
            #5

            Heh right. I'm trying to decipher what the type is without the OP :) (S)he uses Length() so maybe it's a CComBSTR ? Basically I'm talking to myself :laugh: Just to see how much time I can spend on one post without getting anywhere! :beer:

            "If you can dodge a wrench, you can dodge a ball."

            1 Reply Last reply
            0
            • A Al_Pennyworth

              I am having some problems with the editing of wma tags. I have a program that I created that will convert files from one format to another. I have implemented the WMA functionality using the WMF sdk and it is working well. But one problem that I have is when I try to use IWMHeaderInfo3 to add the title to the wma header (similar to ID3 tagging in MP3 files), I have found the title shows strange characters instead of the actual title. I am performing the necessary functions: open, QueryInterface, AddAttribute (and I tried SetAttribute), BeginWriting, and EndWriting. Per the MSDN documentation, I am doing everything in the correct manner. The conversion works but the actual tagging does not. Here is the actual AddAttribute call: pHdr->AddAttribute(0, L"Title", &wDummy, WMT_TYPE_STRING,0, (LPBYTE)&strValue, sizeof(WCHAR) * (strValue.Length() + 1)); Any ideas?

              M Offline
              M Offline
              Michael Dunn
              wrote on last edited by
              #6

              The other posts are right - you need to pass a real Unicode string, not a pointer to a string wrapper object.

              --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ Ford, what's this fish doing in my ear?

              A 1 Reply Last reply
              0
              • M Michael Dunn

                The other posts are right - you need to pass a real Unicode string, not a pointer to a string wrapper object.

                --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ Ford, what's this fish doing in my ear?

                A Offline
                A Offline
                Al_Pennyworth
                wrote on last edited by
                #7

                I have been offline for a bit so I wasn't able to answer any questions. The strValue that is being used is CComBSTR so it is not a CString. Where I am seeing the awkward values is in WMP, WinAmp, other media players, and in Explorer. It is displaying the box character for the length of the title.

                M M 2 Replies Last reply
                0
                • A Al_Pennyworth

                  I have been offline for a bit so I wasn't able to answer any questions. The strValue that is being used is CComBSTR so it is not a CString. Where I am seeing the awkward values is in WMP, WinAmp, other media players, and in Explorer. It is displaying the box character for the length of the title.

                  M Offline
                  M Offline
                  Mark Salsbery
                  wrote on last edited by
                  #8

                  Try LPCWSTR pUnicodeStrValue = OLE2CW(strValue); pHdr->AddAttribute(0, L"Title", &wDummy, WMT_TYPE_STRING,0, (LPBYTE)pUnicodeStrValue, sizeof(WCHAR) * (wcslen(pUnicodeStrValue) + 1));

                  "If you can dodge a wrench, you can dodge a ball."

                  1 Reply Last reply
                  0
                  • A Al_Pennyworth

                    I have been offline for a bit so I wasn't able to answer any questions. The strValue that is being used is CComBSTR so it is not a CString. Where I am seeing the awkward values is in WMP, WinAmp, other media players, and in Explorer. It is displaying the box character for the length of the title.

                    M Offline
                    M Offline
                    Michael Dunn
                    wrote on last edited by
                    #9

                    CComBSTR has an operator BSTR which gets you a pointer to the wrapped BSTR, so use that. Instead of (LPBYTE)&strValue use (LPBYTE)(BSTR)strValue

                    --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ Ford, what's this fish doing in my ear?

                    A 1 Reply Last reply
                    0
                    • M Michael Dunn

                      CComBSTR has an operator BSTR which gets you a pointer to the wrapped BSTR, so use that. Instead of (LPBYTE)&strValue use (LPBYTE)(BSTR)strValue

                      --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ Ford, what's this fish doing in my ear?

                      A Offline
                      A Offline
                      Al_Pennyworth
                      wrote on last edited by
                      #10

                      I want to thank everyone for the replies, works like a charm now!

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups