Click here to Skip to main content
15,881,858 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
our multi media professor gave us a mkv file and told us that it have a region code on its first byte of the file ! we should change this region code to 0 so that we could play it on any region ! the problem is when i change the first byte of the file get corrupted ! i think that te region code is not on the first byte ! so the the question is where is the region code byte?
can anyone explain a little about mkv format (i mean how does it decode the video etc.) and tell me where is the region code in mkv file? does it have a constant place?
here is the code :
C++
#include <iostream>
#include <fstream>
using namespace std;
ifstream::pos_type size=50000;
char * memblock;
int main(){
    fstream file;
    //opening file
    file.open("a.mkv",ios::in|ios::out|ios::binary);
    //size=file.tellg();
    /*
  memblock =new char [size];
    //set the pointer to the begging of the file
    file.seekg(0,ios::beg);
    //reading frome file
    file.read(memblock,size);
    for (int i=0;i<size;i++){
        cout<<memblock[i];
    }*/
     file<<"0";
    file.close();
    return 0;
    
}

note that the part that is between the /* and */ is the code that i have used to see the bytes of the mkv file ! i just want to change the region code !
note 2 : i am using Xcode and mountain lion OS !
Posted
Comments
lewax00 25-Apr-13 16:22pm    
To my knowledge, no video file formats have region codes. Physical media, like DVDs, do however.

it is entirely possible that what you are writing is causing the problem: you aren't writing a zero byte, you are writing a '0' character which is a very different value.
Try this instead:
C++
file << (unsigned char) 0;
However, I do not think that the first byte of the file is a region code - it doesn't appear to be described as such in the container specification: http://matroska.org/technical/specs/index.html[^]
 
Share this answer
 
Comments
Mohammad Mahdi Nejati 26-Apr-13 3:24am    
i agree with you ! but that what our professor told us ! so the question is if it not in the first byte where it is?
by the way thank;)
i agree with you ! but that what our professor told us ! so the question is if it not in the first byte where it is?
by the way thank;)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900