Guest User

Untitled

a guest
Jul 22nd, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. AP4_Track *test_videoTrack = nullptr;
  2. AP4_ByteStream *input = nullptr;
  3. AP4_Result result = AP4_FileByteStream::Create(filename, AP4_FileByteStream::STREAM_MODE_READ, input);
  4.  
  5. AP4_File m_file (*input, true);
  6.  
  7. //
  8. // Read movie tracks, and metadata, find the video track
  9. size_t index = 0;
  10. uint32_t m_width = 0, m_height = 0;
  11. auto item = m_file.GetMovie()->GetTracks().FirstItem();
  12. auto track = item->GetData();
  13. if (track->GetType() == AP4_Track::TYPE_VIDEO)
  14. {
  15. m_width = (uint32_t)((double)test_videoTrack->GetWidth() / double(1 << 16));
  16. m_height = (uint32_t)((double)test_videoTrack->GetHeight() / double(1 << 16));
  17.  
  18. std::string codec("unknown");
  19. auto sd = track->GetSampleDescription(0);
  20. AP4_String c;
  21. if (AP4_SUCCEEDED(sd->GetCodecString(c)))
  22. {
  23. codec = c.GetChars();
  24. }
  25.  
  26. // Find and instantiate the decoder
  27. AP4_Sample sample;
  28. AP4_DataBuffer sampleData;
  29. test_videoTrack->ReadSample(0, sample, sampleData);
  30. }
Add Comment
Please, Sign In to add comment