media/libmkv/bug970774.patch

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/media/libmkv/bug970774.patch	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,64 @@
     1.4 +diff --git a/media/libmkv/WebMElement.c b/media/libmkv/WebMElement.c
     1.5 +--- a/media/libmkv/WebMElement.c
     1.6 ++++ b/media/libmkv/WebMElement.c
     1.7 +@@ -52,32 +52,39 @@ static UInt64 generateTrackID(unsigned i
     1.8 +   r = r << 32;
     1.9 +   r +=  rand();
    1.10 + //  UInt64 rval = t ^ r;
    1.11 +   return t ^ r;
    1.12 + }
    1.13 + 
    1.14 + void writeVideoTrack(EbmlGlobal *glob, unsigned int trackNumber, int flagLacing,
    1.15 +                      const char *codecId, unsigned int pixelWidth, unsigned int pixelHeight,
    1.16 ++                     unsigned int displayWidth, unsigned int displayHeight,
    1.17 +                      double frameRate) {
    1.18 +   EbmlLoc start;
    1.19 +   UInt64 trackID;
    1.20 +   Ebml_StartSubElement(glob, &start, TrackEntry);
    1.21 +   Ebml_SerializeUnsigned(glob, TrackNumber, trackNumber);
    1.22 +   trackID = generateTrackID(trackNumber);
    1.23 +   Ebml_SerializeUnsigned(glob, TrackUID, trackID);
    1.24 +   Ebml_SerializeString(glob, CodecName, "VP8");  // TODO shouldn't be fixed
    1.25 + 
    1.26 +   Ebml_SerializeUnsigned(glob, TrackType, 1); // video is always 1
    1.27 +   Ebml_SerializeString(glob, CodecID, codecId);
    1.28 +   {
    1.29 +     EbmlLoc videoStart;
    1.30 +     Ebml_StartSubElement(glob, &videoStart, Video);
    1.31 +     Ebml_SerializeUnsigned(glob, PixelWidth, pixelWidth);
    1.32 +     Ebml_SerializeUnsigned(glob, PixelHeight, pixelHeight);
    1.33 ++    if (pixelWidth != displayWidth) {
    1.34 ++      Ebml_SerializeUnsigned(glob, DisplayWidth, displayWidth);
    1.35 ++    }
    1.36 ++    if (pixelHeight != displayHeight) {
    1.37 ++      Ebml_SerializeUnsigned(glob, DisplayHeight, displayHeight);
    1.38 ++    }
    1.39 +     Ebml_SerializeFloat(glob, FrameRate, frameRate);
    1.40 +     Ebml_EndSubElement(glob, &videoStart); // Video
    1.41 +   }
    1.42 +   Ebml_EndSubElement(glob, &start); // Track Entry
    1.43 + }
    1.44 + void writeAudioTrack(EbmlGlobal *glob, unsigned int trackNumber, int flagLacing,
    1.45 +                      const char *codecId, double samplingFrequency, unsigned int channels,
    1.46 +                      unsigned char *private, unsigned long privateSize) {
    1.47 +diff --git a/media/libmkv/WebMElement.h b/media/libmkv/WebMElement.h
    1.48 +--- a/media/libmkv/WebMElement.h
    1.49 ++++ b/media/libmkv/WebMElement.h
    1.50 +@@ -16,16 +16,17 @@ extern "C" {
    1.51 + #include "EbmlWriter.h"
    1.52 + 
    1.53 + // these are helper functions
    1.54 + void writeHeader(EbmlGlobal *ebml);
    1.55 + void writeSegmentInformation(EbmlGlobal *ebml, EbmlLoc *startInfo, unsigned long timeCodeScale, double duration);
    1.56 + // this function is a helper only, it assumes a lot of defaults
    1.57 + void writeVideoTrack(EbmlGlobal *ebml, unsigned int trackNumber, int flagLacing,
    1.58 +                      const char *codecId, unsigned int pixelWidth, unsigned int pixelHeight,
    1.59 ++                     unsigned int displayWidth, unsigned int displayHeight,
    1.60 +                      double frameRate);
    1.61 + void writeAudioTrack(EbmlGlobal *glob, unsigned int trackNumber, int flagLacing,
    1.62 +                      const char *codecId, double samplingFrequency, unsigned int channels,
    1.63 +                      unsigned char *private_, unsigned long privateSize);
    1.64 + 
    1.65 + void writeSimpleBlock(EbmlGlobal *ebml, unsigned char trackNumber, short timeCode,
    1.66 +                       int isKeyframe, unsigned char lacingFlag, int discardable,
    1.67 +                       unsigned char *data, unsigned long dataLength);

mercurial