Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display/Edit audio language (CLI) #63

Merged
merged 2 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/MOVMetaEdit_Checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ jobs:
- name: Configure GUI
run: |
cd Project/Qt
export PATH=/usr/local/opt/qt5/bin:$PATH
export PATH=/usr/local/opt/qt@5/bin:$PATH
export QT_SELECT=qt5
./prepare INCLUDEPATH+=/usr/local/include CONFIG+=c++11 -after QMAKE_MACOSX_DEPLOYMENT_TARGET=10.9
- name: Build GUI
run: |
cd Project/Qt
export PATH=/usr/local/opt/qt5/bin:$PATH
export PATH=/usr/local/opt/qt@5/bin:$PATH
make
1 change: 1 addition & 0 deletions Project/GNU/CLI/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ movmetaedit_SOURCES = \
../../../Source/Common/mp4/mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_chan.cpp \
../../../Source/Common/mp4/mp4_moov_trak_mdia_minf_vmhd.cpp \
../../../Source/Common/mp4/mp4_moov_trak_mdia_minf_smhd.cpp \
../../../Source/Common/mp4/mp4_moov_trak_mdia_mdhd.cpp \
../../../Source/Common/mp4/mp4_moov_trak_tkhd.cpp \
../../../Source/Common/mp4/mp4_moov_meta.cpp \
../../../Source/Common/mp4/mp4_moov_meta_hdlr.cpp \
Expand Down
1 change: 1 addition & 0 deletions Project/MSVC2017/CLI/MOVMetaEdit_CLI.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
<ClCompile Include="..\..\..\Source\Common\mp4\mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_clli.cpp" />
<ClCompile Include="..\..\..\Source\Common\mp4\mp4_moov_trak_mdia_minf_stbl_stsd_xxxxSound.cpp" />
<ClCompile Include="..\..\..\Source\Common\mp4\mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_chan.cpp" />
<ClCompile Include="..\..\..\Source\Common\mp4\mp4_moov_trak_mdia_mdhd.cpp" />
<ClCompile Include="..\..\..\Source\Common\mp4\mp4_moov_trak_mdia_minf_vmhd.cpp" />
<ClCompile Include="..\..\..\Source\Common\mp4\mp4_moov_trak_mdia_minf_smhd.cpp" />
<ClCompile Include="..\..\..\Source\Common\mp4_Base.cpp" />
Expand Down
1 change: 1 addition & 0 deletions Project/Qt/movmetaedit-gui.pro
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ SOURCES += \
../../Source/Common/mp4/mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_clli.cpp \
../../Source/Common/mp4/mp4_moov_trak_mdia_minf_stbl_stsd_xxxxSound.cpp \
../../Source/Common/mp4/mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_chan.cpp \
../../Source/Common/mp4/mp4_moov_trak_mdia_mdhd.cpp \
../../Source/Common/mp4/mp4_moov_trak_mdia_minf_vmhd.cpp \
../../Source/Common/mp4/mp4_moov_trak_mdia_minf_smhd.cpp \
../../Source/Common/mp4/mp4_moov_meta.cpp \
Expand Down
11 changes: 10 additions & 1 deletion Source/CLI/Help.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,18 @@ ReturnValue Help_Tech(bool WithExamples)
TEXTOUT(" Read HDR values from DolbyLabsMDF XML");
TEXTOUT(" --from-id VALUE");
TEXTOUT(" Read HDR values from the MasteringDisplay with the the specified ID in the XML");
TEXTOUT("Options related to the media header atom:");
TEXTOUT(" --language, --languages VALUE");
TEXTOUT(" Modify the media header language to VALUE for the specified audio track, \"[trackIndex=]lang[,[trackIndex=]lang...]\" format, e.g en,fr or 0=eng,1=fra");
TEXTOUT(" MOV style: Lang can be numeric or any of these predefined keywords(ISO 639-1) : en, fr, de, it, nl, sv, es, da, pt, no, he, ja, ar, fi, el, is,");
TEXTOUT(" mt, tr, hr, zh-tw, ur, hi, th, ko, lt, pl, hu, et, lv, smi, fo, fa, ru, zh-cn, nl-be, ga, sq, ro, cs, sk, sl, yi, sr, mk, bg, uk, be, uz, kk,");
TEXTOUT(" hy-az, hy, ka, mo, ky, tg, tk, mn-cn, mn, ps, ku, ks, sd, bo, ne, sa, mr, bn, as, gu, pa, or, ml, kn, ta, te, si, my, km, lo, vi, id,");
TEXTOUT(" az, tl, ms, ms-bn, am, om, so, sw, rw, rn, ny, mg, eo, cy, eu, ca, la, qu, gn, ay, tt, ug, dz, jv");
TEXTOUT(" MP4 style: Lang is a 3-letter code which should be a ISO 639-2 language code");
TEXTOUT("");
TEXTOUT("Options related to the audio channels description labels:");
TEXTOUT(" --channels VALUE");
TEXTOUT(" Modify the channels description to VALUE for the specified track, \"[track=]code[,[track=]code...]\" format, e.g L,R or 0=L,1=R,3=Delete");
TEXTOUT(" Modify the channels description to VALUE for the specified track, \"[trackIndex=]code[,[trackIndex=]code...]\" format, e.g L,R or 0=L,1=R,3=Delete");
TEXTOUT(" Code can be numeric or any of these predefined keywords: Delete(delete the channel information atom), L, R, C, LFE, Ls, Rs, Lc, Rc, Cs,");
TEXTOUT(" Lsd, Rsd, Tcs, Vhl, Vhc, Vhr, Trs, Trs2, Trs3, Lrs, Rrs, Lw, Rw, LFE2, Lt, Rt, HearingImpaired, Narration, M, DialogCentricMix,");
TEXTOUT(" CenterSurroundDirect, Haptic, W, X, Y,Z, M2, S, X2, Y2, HeadphonesLeft, HeadphonesRight, ClickTrack, ForeignLanguage,");
Expand Down
2 changes: 2 additions & 0 deletions Source/Common/mp4/mp4_.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ namespace Elements
const uint32_t moov_trak_mdia_minf_stbl_stsd_xxxx_chan = 0x6368616E;
const uint32_t moov_trak_mdia_minf_vmhd = 0x766D6864;
const uint32_t moov_trak_mdia_minf_smhd = 0x736D6864;
const uint32_t moov_trak_mdia_mdhd = 0x6D646864;
const uint32_t moov_trak_tkhd = 0x746B6864;
const uint32_t moov_meta = 0x6D657461;
const uint32_t moov_meta_hdlr = 0x68646C72;
Expand Down Expand Up @@ -128,6 +129,7 @@ CHUNK_I(7, moov_trak_mdia_minf_stbl_stsd_xxxxSound);
CHUNK_W(8, moov_trak_mdia_minf_stbl_stsd_xxxx_chan);
CHUNK__(5, moov_trak_mdia_minf_vmhd);
CHUNK__(5, moov_trak_mdia_minf_smhd);
CHUNK_W(4, moov_trak_mdia_mdhd);
CHUNK_W(3, moov_trak_tkhd);
CHUNK_I(2, moov_meta);
CHUNK_W(3, moov_meta_hdlr);
Expand Down
1 change: 1 addition & 0 deletions Source/Common/mp4/mp4_moov_trak_mdia.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ void mp4_moov_trak_mdia::Read_Internal ()
{
SUBS_BEGIN();
SUB_ELEMENT(moov_trak_mdia_minf);
SUB_ELEMENT(moov_trak_mdia_mdhd);
// SUB_ELEMENT(moov_meta_keys);
// SUB_ELEMENT(moov_meta_ilst);
SUBS_END();
Expand Down
109 changes: 109 additions & 0 deletions Source/Common/mp4/mp4_moov_trak_mdia_mdhd.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
/* Copyright (c) MediaArea.net SARL. All Rights Reserved.
*
* Use of this source code is governed by a MIT-style license that can
* be found in the License.html file in the root of the source tree.
*/

//---------------------------------------------------------------------------
#include "Common/mp4/mp4_.h"
//---------------------------------------------------------------------------

#include <iostream>

//***************************************************************************
// Read
//***************************************************************************

//---------------------------------------------------------------------------
void mp4_moov_trak_mdia_mdhd::Read_Internal()
{
Chunk.trak_Index=Global->moov_trak.size();
Global->moov_trak_mdia_mdhd[Chunk.trak_Index]=new global::block_moov_trak_mdia_mdhd();

Read_Internal_ReadAllInBuffer();

int32u Temp32;

Get_B1(Global->moov_trak_mdia_mdhd[Chunk.trak_Index]->Version);

if (Global->moov_trak_mdia_mdhd[Chunk.trak_Index]->Version>1)
throw exception_read_block("moov trak mdia mdhd version unsupported");

if (Chunk.Content.Size!=(Global->moov_trak_mdia_mdhd[Chunk.trak_Index]->Version==0?24:36))
throw exception_read_block("moov trak mdia mdhd invalid size");

Get_B3(Global->moov_trak_mdia_mdhd[Chunk.trak_Index]->Flags);
if (Global->moov_trak_mdia_mdhd[Chunk.trak_Index]->Version==0)
{
Get_B4(Temp32);
Global->moov_trak_mdia_mdhd[Chunk.trak_Index]->CreationTime=Temp32;
Get_B4(Temp32);
Global->moov_trak_mdia_mdhd[Chunk.trak_Index]->ModificationTime=Temp32;
}
else
{
Get_B8(Global->moov_trak_mdia_mdhd[Chunk.trak_Index]->CreationTime);
Get_B8(Global->moov_trak_mdia_mdhd[Chunk.trak_Index]->ModificationTime);
}
Get_B4(Global->moov_trak_mdia_mdhd[Chunk.trak_Index]->TimeScale);
if (Global->moov_trak_mdia_mdhd[Chunk.trak_Index]->Version==0)
{
Get_B4(Temp32);
Global->moov_trak_mdia_mdhd[Chunk.trak_Index]->Duration=Temp32;
}
else
{
Get_B8(Global->moov_trak_mdia_mdhd[Chunk.trak_Index]->Duration);
}
Get_B2(Global->moov_trak_mdia_mdhd[Chunk.trak_Index]->Language);
Get_B2(Global->moov_trak_mdia_mdhd[Chunk.trak_Index]->Quality);
}

//***************************************************************************
// Modify
//***************************************************************************

//---------------------------------------------------------------------------
void mp4_moov_trak_mdia_mdhd::Modify_Internal()
{
if (Chunk.Content.IsModified)
return;

if (Global->moov_trak_mdia_mdhd.find(Chunk.trak_Index)==Global->moov_trak_mdia_mdhd.end())
return;

if (Chunk.Content.Buffer)
delete[] Chunk.Content.Buffer;
Chunk.Content.Buffer_Offset=0;
Chunk.Content.Size=Global->moov_trak_mdia_mdhd[Chunk.trak_Index]->Version==0?24:36;
Chunk.Content.Buffer=new int8u[Chunk.Content.Size];

Put_B1(Global->moov_trak_mdia_mdhd[Chunk.trak_Index]->Version);
Put_B3(Global->moov_trak_mdia_mdhd[Chunk.trak_Index]->Flags);
if (Global->moov_trak_mdia_mdhd[Chunk.trak_Index]->Version==0)
{
Put_B4(Global->moov_trak_mdia_mdhd[Chunk.trak_Index]->CreationTime);
Put_B4(Global->moov_trak_mdia_mdhd[Chunk.trak_Index]->ModificationTime);
}
else
{
Put_B8(Global->moov_trak_mdia_mdhd[Chunk.trak_Index]->CreationTime);
Put_B8(Global->moov_trak_mdia_mdhd[Chunk.trak_Index]->ModificationTime);
}
Put_B4(Global->moov_trak_mdia_mdhd[Chunk.trak_Index]->TimeScale);
if (Global->moov_trak_mdia_mdhd[Chunk.trak_Index]->Version==0)
Put_B4(Global->moov_trak_mdia_mdhd[Chunk.trak_Index]->Duration);
else
Put_B8(Global->moov_trak_mdia_mdhd[Chunk.trak_Index]->Duration);
Put_B2(Global->moov_trak_mdia_mdhd[Chunk.trak_Index]->Language);
Put_B2(Global->moov_trak_mdia_mdhd[Chunk.trak_Index]->Quality);

Chunk.Content.IsModified=true;
Chunk.Content.Size_IsModified=true;
}

//---------------------------------------------------------------------------
void mp4_moov_trak_mdia_mdhd::Write_Internal()
{
mp4_Base::Write_Internal(Chunk.Content.Buffer, (size_t)Chunk.Content.Size);
}
29 changes: 29 additions & 0 deletions Source/Common/mp4_Base.h
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,29 @@ class mp4_Base
NumberChannelDescriptions=0;
}
};
struct block_moov_trak_mdia_mdhd
{
int8u Version;
int32u Flags;
int64u CreationTime;
int64u ModificationTime;
int32u TimeScale;
int64u Duration;
int16u Language;
int16u Quality;

block_moov_trak_mdia_mdhd()
{
Version=0;
Flags=0;
CreationTime=0;
ModificationTime=0;
TimeScale=0;
Duration=0;
Language=0;
Quality=0;
}
};
struct block_moov_trak_tkhd
{
double Width_Scale;
Expand Down Expand Up @@ -430,6 +453,8 @@ class mp4_Base
bool moov_trak_mdia_minf_stbl_stsd_xxxx_clli_Modified;
map<size_t, block_moov_trak_mdia_minf_stbl_stsd_xxxx_chan*> moov_trak_mdia_minf_stbl_stsd_xxxx_chan;
bool moov_trak_mdia_minf_stbl_stsd_xxxx_chan_Modified;
map<size_t, block_moov_trak_mdia_mdhd*> moov_trak_mdia_mdhd;
bool moov_trak_mdia_mdhd_Modified;
block_moov_trak_tkhd* moov_trak_tkhd;
bool moov_trak_tkhd_Modified;
block_moov_meta_hdlr* moov_meta_hdlr;
Expand Down Expand Up @@ -476,6 +501,7 @@ class mp4_Base
moov_trak_mdia_minf_stbl_stsd_xxxx_clli=NULL;
moov_trak_mdia_minf_stbl_stsd_xxxx_clli_Modified=false;
moov_trak_mdia_minf_stbl_stsd_xxxx_chan_Modified=false;
moov_trak_mdia_mdhd_Modified=false;
moov_trak_tkhd=NULL;
moov_trak_tkhd_Modified=false;
moov_meta_hdlr=NULL;
Expand Down Expand Up @@ -519,6 +545,9 @@ class mp4_Base
for(map<size_t, block_moov_trak_mdia_minf_stbl_stsd_xxxx_chan*>::iterator It=moov_trak_mdia_minf_stbl_stsd_xxxx_chan.begin();
It!=moov_trak_mdia_minf_stbl_stsd_xxxx_chan.end(); It++)
delete It->second;

for(map<size_t, block_moov_trak_mdia_mdhd*>::iterator It=moov_trak_mdia_mdhd.begin(); It!=moov_trak_mdia_mdhd.end(); It++)
delete It->second;
}
};

Expand Down
Loading
Loading