OSDN Git Service

Adds a 'colr' box to mp4 files, indicating an NTSC profile. Makes the
[handbrake-jp/handbrake-jp-git.git] / contrib / patch-ffmpeg.patch
1 diff -ru ffmpeg-20060326-bak/configure ffmpeg-20060326/configure
2 --- ffmpeg-20060326-bak/configure       2006-03-26 22:04:53.000000000 +0200
3 +++ ffmpeg-20060326/configure   2006-04-26 16:48:00.000000000 +0200
4 @@ -272,7 +272,7 @@
5  2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
6  mmx="no"
7  ;;
8 -*20010315*) echo "BeBits gcc"
9 +*20010315*|2.95.3*) echo "BeBits gcc"
10  CFLAGS="$CFLAGS -fno-expensive-optimizations"
11  ;;
12  esac
13 diff -ru ffmpeg-20060326-bak/libavformat/movenc.c ffmpeg-20060326/libavformat/movenc.c
14 --- ffmpeg-20060326-bak/libavformat/movenc.c    2006-03-26 22:04:53.000000000 +0200
15 +++ ffmpeg-20060326/libavformat/movenc.c        2006-04-26 16:48:54.000000000 +0200
16 @@ -22,6 +22,10 @@
17  #include "avio.h"
18  #include "mov.h"
19  
20 +#ifndef UINT32_MAX
21 +#define UINT32_MAX (4294967295U)
22 +#endif
23 +
24  #undef NDEBUG
25  #include <assert.h>
26  
27 @@ -435,11 +439,6 @@
28              end = track->vosData + track->vosLen;
29  
30              put_byte(pb, 1); /* version */
31 -            put_byte(pb, 77); /* profile */
32 -            put_byte(pb, 64); /* profile compat */
33 -            put_byte(pb, 30); /* level */
34 -            put_byte(pb, 0xff); /* 6 bits reserved (111111) + 2 bits nal size length - 1 (11) */
35 -            put_byte(pb, 0xe1); /* 3 bits reserved (111) + 5 bits number of sps (00001) */
36  
37              /* look for sps and pps */
38              while (buf < end) {
39 @@ -458,6 +457,12 @@
40              }
41              assert(sps);
42              assert(pps);
43 +
44 +            put_byte(pb, sps[1]); /* profile */
45 +            put_byte(pb, sps[2]); /* profile compat */
46 +            put_byte(pb, sps[3]); /* level */
47 +            put_byte(pb, 0xff); /* 6 bits reserved (111111) + 2 bits nal size length - 1 (11) */
48 +            put_byte(pb, 0xe1); /* 3 bits reserved (111) + 5 bits number of sps (00001) */
49              put_be16(pb, sps_size);
50              put_buffer(pb, sps, sps_size);
51              put_byte(pb, 1); /* number of pps */
52 @@ -621,6 +626,18 @@
53      return tag;
54  }
55  
56 +static int mov_write_colr_tag(ByteIOContext *pb)
57 +{
58 +    put_be32( pb, 0x12 );
59 +    put_tag( pb, "colr" );
60 +    put_tag( pb, "nclc" );
61 +    put_be16( pb, 6 );
62 +    put_be16( pb, 1 );
63 +    put_be16( pb, 6 );
64 +    put_be32( pb, 0 );
65 +    return 0x12;
66 +}
67 +
68  static int mov_write_video_tag(ByteIOContext *pb, MOVTrack* track)
69  {
70      offset_t pos = url_ftell(pb);
71 @@ -670,6 +687,8 @@
72      else if(track->enc->codec_id == CODEC_ID_H264)
73          mov_write_avcc_tag(pb, track);
74  
75 +    mov_write_colr_tag(pb);
76 +
77      return updateSize (pb, pos);
78  }
79  
80 diff -ru ffmpeg-20060326-bak/libavformat/tcp.c ffmpeg-20060326/libavformat/tcp.c
81 --- ffmpeg-20060326-bak/libavformat/tcp.c       2006-03-26 22:04:53.000000000 +0200
82 +++ ffmpeg-20060326/libavformat/tcp.c   2006-04-26 16:48:00.000000000 +0200
83 @@ -112,11 +112,13 @@
84                  break;
85          }
86  
87 +#ifndef __BEOS__
88          /* test error */
89          optlen = sizeof(ret);
90          getsockopt (fd, SOL_SOCKET, SO_ERROR, &ret, &optlen);
91          if (ret != 0)
92              goto fail;
93 +#endif
94      }
95      s->fd = fd;
96      return 0;