summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/AS_DCP_JP2K.cpp10
-rwxr-xr-xsrc/PCMParserList.cpp62
-rwxr-xr-xsrc/asdcp-test.cpp6
3 files changed, 63 insertions, 15 deletions
diff --git a/src/AS_DCP_JP2K.cpp b/src/AS_DCP_JP2K.cpp
index 51cc017..58bc0c9 100755
--- a/src/AS_DCP_JP2K.cpp
+++ b/src/AS_DCP_JP2K.cpp
@@ -263,18 +263,18 @@ lh__Reader::MD_to_JP2K_PDesc(JP2K::PictureDescriptor& PDesc)
DefaultLogSink().Error("Unexpected PictureComponentSizing size: %u, should be 17\n", tmp_size);
// CodingStyleDefault
- memset(&m_PDesc.CodingStyleDefault, 0, sizeof(CodingStyleDefault_t));
- memcpy(&m_PDesc.CodingStyleDefault,
+ memset(&PDesc.CodingStyleDefault, 0, sizeof(CodingStyleDefault_t));
+ memcpy(&PDesc.CodingStyleDefault,
m_EssenceSubDescriptor->CodingStyleDefault.RoData(),
m_EssenceSubDescriptor->CodingStyleDefault.Length());
// QuantizationDefault
- memset(&m_PDesc.QuantizationDefault, 0, sizeof(QuantizationDefault_t));
- memcpy(&m_PDesc.QuantizationDefault,
+ memset(&PDesc.QuantizationDefault, 0, sizeof(QuantizationDefault_t));
+ memcpy(&PDesc.QuantizationDefault,
m_EssenceSubDescriptor->QuantizationDefault.RoData(),
m_EssenceSubDescriptor->QuantizationDefault.Length());
- m_PDesc.QuantizationDefault.SPqcdLength = m_EssenceSubDescriptor->QuantizationDefault.Length() - 1;
+ PDesc.QuantizationDefault.SPqcdLength = m_EssenceSubDescriptor->QuantizationDefault.Length() - 1;
}
return RESULT_OK;
diff --git a/src/PCMParserList.cpp b/src/PCMParserList.cpp
index 1fc434d..5a6a9c9 100755
--- a/src/PCMParserList.cpp
+++ b/src/PCMParserList.cpp
@@ -30,6 +30,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <PCMParserList.h>
+#include <KM_fileio.h>
#include <KM_log.h>
#include <assert.h>
@@ -114,15 +115,49 @@ ASDCP::PCMParserList::OpenRead(ui32_t argc, const char** argv, Rational& Picture
{
ASDCP_TEST_NULL_STR(argv);
Result_t result = RESULT_OK;
+ PathList_t::iterator fi;
+ PathList_t TmpFileList;
- for ( ui32_t i = 0; i < argc && ASDCP_SUCCESS(result); i++ )
+ if ( argc == 1 && PathIsDirectory(argv[0]) )
{
- ParserInstance* I = new ParserInstance;
- result = I->OpenRead(argv[i], PictureRate);
+ DirScanner Dir;
+ char name_buf[MaxFilePath];
+ result = Dir.Open(argv[0]);
+
+ if ( KM_SUCCESS(result) )
+ result = Dir.GetNext(name_buf);
+
+ while ( KM_SUCCESS(result) )
+ {
+ if ( name_buf[0] != '.' ) // no hidden files
+ {
+ std::string tmp_path = std::string(argv[0]) + "/" + name_buf;
+ TmpFileList.push_back(tmp_path);
+ }
+
+ result = Dir.GetNext(name_buf);
+ }
+
+ if ( result == RESULT_ENDOFFILE )
+ {
+ result = RESULT_OK;
+ TmpFileList.sort();
+ }
+ }
+ else
+ {
+ for ( ui32_t i = 0; i < argc; ++i )
+ TmpFileList.push_back(argv[i]);
+ }
+
+ for ( fi = TmpFileList.begin(); KM_SUCCESS(result) && fi != TmpFileList.end(); fi++ )
+ {
+ mem_ptr<ParserInstance> I = new ParserInstance;
+ result = I->OpenRead(fi->c_str(), PictureRate);
if ( ASDCP_SUCCESS(result) )
{
- if ( i == 0 )
+ if ( fi == TmpFileList.begin() )
{
m_ADesc = I->ADesc;
}
@@ -153,15 +188,22 @@ ASDCP::PCMParserList::OpenRead(ui32_t argc, const char** argv, Rational& Picture
result = I->FB.Capacity(PCM::CalcFrameBufferSize(m_ADesc));
if ( ASDCP_SUCCESS(result) )
- push_back(I);
+ {
+ push_back(I);
+ I.release();
+ }
}
- m_ADesc.ChannelCount = m_ChannelCount;
- m_ADesc.AvgBps = ( m_ADesc.AvgBps / m_ADesc.ChannelCount ) * m_ChannelCount;
+ if ( ASDCP_SUCCESS(result) )
+ {
+ m_ADesc.ChannelCount = m_ChannelCount;
+ m_ADesc.AvgBps = ceil(m_ADesc.AudioSamplingRate.Quotient()) * m_ADesc.BlockAlign;
+ }
+ else
+ {
+ clear();
+ }
- if ( ASDCP_FAILURE(result) )
- clear();
-
return result;
}
diff --git a/src/asdcp-test.cpp b/src/asdcp-test.cpp
index 203de9f..8b72ebc 100755
--- a/src/asdcp-test.cpp
+++ b/src/asdcp-test.cpp
@@ -1893,6 +1893,12 @@ main(int argc, const char** argv)
if ( Options.mode == MMT_INFO )
{
result = show_file_info(Options);
+
+ for ( int i = 1; ASDCP_SUCCESS(result) && i < Options.file_count; ++i )
+ {
+ Options.filenames[0] = Options.filenames[i]; // oh-so hackish
+ result = show_file_info(Options);
+ }
}
else if ( Options.mode == MMT_GOP_START )
{