From: John F. <jo...@us...> - 2010-01-25 19:51:35
|
Update of /cvsroot/ingex/ingex In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv12307 Added Files: ffmpeg_default_bitrate.patch ffmpeg-DVCPROHD-0.5.patch ffmpeg_fix_imlib2.patch ffmpeg_quicktime_DVCPRO-HD.patch ffmpeg_tref_quicktime.patch ffmpeg-DNxHD-h264-aac.spec Log Message: Patches and spec for ffmpeg rpm. --- NEW FILE: ffmpeg_quicktime_DVCPRO-HD.patch --- diff -r -u libavformat/movenc.c ../ffmpeg-0.5-jf/libavformat/movenc.c --- libavformat/movenc.c 2009-02-28 16:02:29.000000000 +0000 +++ ../ffmpeg-0.5-jf/libavformat/movenc.c 2009-04-17 15:20:19.000000000 +0100 @@ -596,12 +596,19 @@ (tag == MKTAG('d','v','c','p') || track->enc->codec_id == CODEC_ID_RAWVIDEO))) { if (track->enc->codec_id == CODEC_ID_DVVIDEO) { - if (track->enc->height == 480) /* NTSC */ - if (track->enc->pix_fmt == PIX_FMT_YUV422P) tag = MKTAG('d','v','5','n'); - else tag = MKTAG('d','v','c',' '); - else if (track->enc->pix_fmt == PIX_FMT_YUV422P) tag = MKTAG('d','v','5','p'); - else if (track->enc->pix_fmt == PIX_FMT_YUV420P) tag = MKTAG('d','v','c','p'); - else tag = MKTAG('d','v','p','p'); + if (track->enc->width == 720) /* SD */ + if (track->enc->height == 480) /* NTSC */ + if (track->enc->pix_fmt == PIX_FMT_YUV422P) tag = MKTAG('d','v','5','n'); + else tag = MKTAG('d','v','c',' '); + else if (track->enc->pix_fmt == PIX_FMT_YUV422P) tag = MKTAG('d','v','5','p'); + else if (track->enc->pix_fmt == PIX_FMT_YUV420P) tag = MKTAG('d','v','c','p'); + else tag = MKTAG('d','v','p','p'); + else if (track->enc->height == 720) /* HD 720 line */ + if (track->enc->time_base.den == 50) tag = MKTAG('d','v','h','q'); + else tag = MKTAG('d','v','h','p'); + else /* HD 1080 line */ + if (track->enc->time_base.den == 25) tag = MKTAG('d','v','h','5'); + else tag = MKTAG('d','v','h','6'); } else if (track->enc->codec_id == CODEC_ID_RAWVIDEO) { tag = codec_get_tag(mov_pix_fmt_tags, track->enc->pix_fmt); if (!tag) // restore tag --- NEW FILE: ffmpeg_default_bitrate.patch --- --- libavcodec/options.c 2007-06-07 16:05:43.000000000 +0100 +++ libavcodec/options.c 2007-06-07 16:05:12.000000000 +0100 @@ -423,7 +423,7 @@ #define E AV_OPT_FLAG_ENCODING_PARAM #define D AV_OPT_FLAG_DECODING_PARAM -#define AV_CODEC_DEFAULT_BITRATE 200*1000 +#define AV_CODEC_DEFAULT_BITRATE 1100*1000 static const AVOption options[]={ {"b", "set video bitrate (in bits/s)", OFFSET(bit_rate), FF_OPT_TYPE_INT, AV_CODEC_DEFAULT_BITRATE, INT_MIN, INT_MAX, V|E}, --- NEW FILE: ffmpeg_fix_imlib2.patch --- Index: vhook/imlib2.c =================================================================== --- vhook/imlib2.c (revision 7963) +++ vhook/imlib2.c (working copy) @@ -103,6 +103,7 @@ #undef time #include <sys/time.h> #include <time.h> +#include <X11/Xlib.h> #include <Imlib2.h> #include "eval.h" --- NEW FILE: ffmpeg-DVCPROHD-0.5.patch --- --- libavcodec/dv.c 2009-02-20 13:00:44.000000000 +1100 +++ ../ffmpeg-0.5-DVCPROHD/libavcodec/dv.c 2009-03-16 12:11:28.083444869 +1100 @@ -48,19 +48,26 @@ //#include <assert.h> typedef struct DVVideoContext { - const DVprofile *sys; - AVFrame picture; - AVCodecContext *avctx; - uint8_t *buf; + const DVprofile* sys; + AVFrame picture; + AVCodecContext *avctx; + uint8_t *buf; - uint8_t dv_zigzag[2][64]; + uint8_t dv_zigzag[2][64]; + uint8_t dv_idct_shift[2][2][22][64]; [...6407 lines suppressed...] +#define DV_MAX_FRAME_SIZE 576000 +#endif + +struct DVMuxContext { + const struct DVprofile* sys; /* Current DV profile. E.g.: 525/60, 625/50 */ + int n_ast; /* Number of stereo audio streams (up to 4) */ + AVStream *ast[4]; /* Stereo audio streams */ + AVFifoBuffer audio_data[4]; /* Fifo for storing excessive amounts of PCM */ + + int frames; /* Number of a current frame */ + time_t start_time; /* Start time of recording */ + int has_audio; /* frame under contruction has audio */ + int has_video; /* frame under contruction has video */ + uint8_t frame_buf[DV_MAX_FRAME_SIZE]; /* frame under contruction */ +}; + +void dv_inject_metadata(DVMuxContext *c, uint8_t* frame); +void dv_inject_audio_raw(DVMuxContext *c, int channel, uint8_t* frame_ptr, uint8_t *data); + #endif /* AVFORMAT_DV_H */ --- NEW FILE: ffmpeg_tref_quicktime.patch --- Index: libavformat/movenc.c =================================================================== --- libavformat/movenc.c (revision 14032) +++ libavformat/movenc.c (working copy) @@ -69,6 +69,7 @@ MOVIentry *cluster; int audio_vbr; int height; ///< active picture (w/o VBI) height for D-10/IMX + int tref; } MOVTrack; typedef struct MOVMuxContext { @@ -707,6 +708,22 @@ return updateSize(pb, pos); } +static int mov_write_tmcd_tag(ByteIOContext *pb, MOVTrack *track) +{ + put_be32(pb, 36); /* size */ + put_tag(pb, "tmcd"); + put_be32(pb, 0); /* reserved */ + put_be16(pb, 0); /* reserved */ + put_be16(pb, 1); /* data reference index */ + put_be32(pb, 0); /* reserved */ + put_be32(pb, !!(track->enc->flags2 & CODEC_FLAG2_DROP_FRAME_TIMECODE)); /* flags */ + put_be32(pb, track->timescale); /* timescale */ + put_be32(pb, track->enc->time_base.num); /* frame duration */ + put_byte(pb, av_rescale_rnd(track->timescale, 1, track->enc->time_base.num, AV_ROUND_UP)); /* number of frames */ + put_be24(pb, 0); /* reserved */ + return 36; +} + static int mov_write_stsd_tag(ByteIOContext *pb, MOVTrack *track) { int64_t pos = url_ftell(pb); @@ -718,6 +735,9 @@ mov_write_audio_tag(pb, track); else if (track->enc->codec_type == CODEC_TYPE_SUBTITLE) mov_write_subtitle_tag(pb, track); + else if (track->enc->codec_type == CODEC_TYPE_DATA && + track->enc->codec_tag == MKTAG('t','m','c','d')) + mov_write_tmcd_tag(pb, track); return updateSize(pb, pos); } @@ -857,6 +877,45 @@ return 0x14; } +static int mov_write_gmhd_tag_tmcd(ByteIOContext *pb, MOVTrack *track) +{ + int64_t pos = url_ftell(pb); + put_be32(pb, 0); /* size */ + put_tag(pb, "gmhd"); + put_be32(pb, 24); /* size */ + put_tag(pb, "gmin"); + put_be32(pb, 0); /* version & flags */ + put_be16(pb, 64); /* graphic mode */ + put_be16(pb, 32768); /* color */ + put_be16(pb, 32768); + put_be16(pb, 32768); + put_be32(pb, 0); /* balance */ + + if (track->enc->codec_tag == MKTAG('t','m','c','d')) { + /* tmcd atom */ + put_be32(pb, 47); /* size */ + put_tag(pb, "tmcd"); + + /* tcmi atom */ + put_be32(pb, 39); /* size */ + put_tag(pb, "tcmi"); + put_be32(pb, 0); /* version & flags */ + put_be16(pb, 0); /* font */ + put_be16(pb, 0); /* face */ + put_be16(pb, 12); /* size */ + put_be16(pb, 0); /* reserved */ + put_be16(pb, 65535); /* fg color */ + put_be16(pb, 65535); /* fg color */ + put_be16(pb, 65535); /* fg color */ + put_be16(pb, 0); /* bg color */ + put_be16(pb, 0); /* bg color */ + put_be16(pb, 0); /* bg color */ + put_byte(pb, 6); /* font name length */ + put_buffer(pb, "System", 6); + } + return updateSize(pb, pos); +} + static int mov_write_hdlr_tag(ByteIOContext *pb, MOVTrack *track) { const char *hdlr, *descr = NULL, *hdlr_type = NULL; @@ -871,6 +930,10 @@ if (track->enc->codec_type == CODEC_TYPE_VIDEO) { hdlr_type = "vide"; descr = "VideoHandler"; + } else if (track->enc->codec_type == CODEC_TYPE_DATA && + track->enc->codec_tag == MKTAG('t','m','c','d')) { + hdlr_type = "tmcd"; + descr = "TimeCodeHandler"; } else if (track->enc->codec_type == CODEC_TYPE_AUDIO) { hdlr_type = "soun"; descr = "SoundHandler"; @@ -897,6 +960,8 @@ mov_write_vmhd_tag(pb); else if (track->enc->codec_type == CODEC_TYPE_AUDIO) mov_write_smhd_tag(pb); + else if (track->enc->codec_type == CODEC_TYPE_DATA) + mov_write_gmhd_tag_tmcd(pb, track); else if (track->enc->codec_type == CODEC_TYPE_SUBTITLE) { if (track->mode == MODE_MOV) mov_write_gmhd_tag(pb); else mov_write_nmhd_tag(pb); @@ -1038,14 +1103,26 @@ return 0x34; } +static int mov_write_tref_tag(ByteIOContext *pb, MOVTrack *track) +{ + put_be32(pb, 20); /* size */ + put_tag(pb, "tref"); + put_be32(pb, 12); /* size */ + put_tag(pb, "tmcd"); + put_be32(pb, track->tref); + return 20; +} + static int mov_write_trak_tag(ByteIOContext *pb, MOVTrack *track, AVStream *st) { int64_t pos = url_ftell(pb); put_be32(pb, 0); /* size */ put_tag(pb, "trak"); mov_write_tkhd_tag(pb, track, st); - if (track->mode == MODE_PSP || track->hasBframes) - mov_write_edts_tag(pb, track); // PSP Movies require edts box + //if (track->mode == MODE_PSP || track->hasBframes || track->ref) + mov_write_edts_tag(pb, track); // PSP/Omneon require edts box + if (track->tref != 0) + mov_write_tref_tag(pb, track); mov_write_mdia_tag(pb, track); if (track->mode == MODE_PSP) mov_write_uuid_tag_psp(pb,track); // PSP Movies require this uuid box @@ -1729,10 +1806,49 @@ { MOVMuxContext *mov = s->priv_data; ByteIOContext *pb = s->pb; + int64_t moov_pos; int res = 0; int i; - int64_t moov_pos = url_ftell(pb); + /* VERY VERY UGLY */ + for (i = 0; i < s->nb_streams; i++) { + AVStream *st = s->streams[i]; + if (st->codec->codec_type == CODEC_TYPE_VIDEO && + mov->mode == MODE_MOV && st->codec->timecode_frame_start > 0) { + MOVTrack *track = &mov->tracks[mov->nb_streams]; + uint32_t time_code = AV_RB32(&st->codec->timecode_frame_start); + AVPacket pkt; + + track->mode = MODE_MOV; + track->enc = avcodec_alloc_context(); + track->enc->codec_type = CODEC_TYPE_DATA; + track->enc->codec_tag = MKTAG('t','m','c','d'); + track->enc->time_base = st->codec->time_base; + track->enc->flags2 = st->codec->flags2; + track->enc->timecode_frame_start = st->codec->timecode_frame_start; + + track->tag = track->enc->codec_tag; + track->timescale = track->enc->time_base.den; + track->vosData = (uint8_t *)track->enc; // hack to free enc + track->vosLen = sizeof(AVCodecContext); + + mov->tracks[i].tref = mov->nb_streams + 1; + + av_init_packet(&pkt); + pkt.dts = 0; + pkt.pts = 0; + pkt.size = 4; + pkt.data = (uint8_t *)&time_code; + pkt.stream_index = mov->nb_streams; + pkt.duration = mov->tracks[i].trackDuration; + mov_write_packet(s, &pkt); + + mov->nb_streams++; + break; + } + } + + moov_pos = url_ftell(pb); /* Write size of mdat tag */ if (mov->mdat_size+8 <= UINT32_MAX) { --- NEW FILE: ffmpeg-DNxHD-h264-aac.spec --- Summary: FFmpeg library with DNxHD(VC-3) DVCPRO-HD H.264 AAC MP3 A52(AC-3) codecs Name: ffmpeg-DNxHD-h264-aac Version: 0.5 Release: 3 License: GPL Group: System Environment/Daemons Source: ffmpeg-%{version}.tar.bz2 Patch0: ffmpeg_fix_imlib2.patch Patch1: ffmpeg_default_bitrate.patch Patch2: ffmpeg_tref_quicktime.patch Patch3: ffmpeg-DVCPROHD-0.5.patch Patch4: ffmpeg_quicktime_DVCPRO-HD.patch Url: http://www.ffmpeg.org/download.html BuildRoot: %{_tmppath}/%{name}-root BuildRequires: autoconf nasm Provides: ffmpeg libavcodec.a libavformat.a libavutil.a %description FFmpeg library with DNxHD(VC-3), DVCPRO-HD, H.264, AAC, MP3, A52(AC-3) codecs. Tarball taken from http://www.ffmpeg.org/releases/ffmpeg-0.5.tar.bz2 Patched to support: - DVCPRO-HD (SMPTE SMPTE 370M) support (1080i50, 1080i60, 720p60) - Writing of timecode track in Quicktime wrapped files (.mov) %prep rm -rf $RPM_BUILD_ROOT # unpack the ffmpeg source %setup -q -n ffmpeg-%{version} # Patch code to fix any build time errors %patch0 %patch1 %patch2 %patch3 %patch4 %build ./configure --prefix=/usr --enable-pthreads --disable-demuxer=ogg --enable-swscale --enable-libx264 --enable-libmp3lame --enable-gpl --enable-libfaac --enable-libfaad make -j 3 %install make install DESTDIR=$RPM_BUILD_ROOT make install-man DESTDIR=$RPM_BUILD_ROOT %ifarch x86_64 mv $RPM_BUILD_ROOT/usr/lib $RPM_BUILD_ROOT/usr/lib64 %endif %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) %ifarch x86_64 /usr/lib64/ %else /usr/lib/ %endif /usr/include/ /usr/bin/ /usr/share/ %changelog * Mon Mar 16 2009 Stuart Cunningham <stu...@us...> 0.5 - Update to official 0.5 release (branched from revision 17727) - Restore DVCPRO-HD support using revised Dan Maas patch * Tue Dec 16 2008 Stuart Cunningham <stu...@us...> 16156 - Update to 16156 (includes some more efficient thread usage for DV codec) - Remove separate DNxHD raw parser since this is now in mainline FFmpeg * Fri Oct 10 2008 Stuart Cunningham <stu...@us...> 15593-2 - Turn on swscale support with --enable-swscale - Add DNxHD raw parser patch for reading from raw DNxHD frames * Fri Oct 10 2008 Stuart Cunningham <stu...@us...> 15593 - Updated to revision 15593 of ffmpeg - This release include in-tree DVCPRO-HD support * Mon Jun 30 2008 Stuart Cunningham <stu...@us...> 14032 - Updated to revision 14032 of ffmpeg - Added timecode track for quicktime wrapping patch * Thu Oct 4 2007 Stuart Cunningham <stu...@us...> 13743 - Updated to revision 13743 of ffmpeg - DVCPRO-HD support removed due to out-of-tree patch no longer working * Thu Oct 4 2007 Stuart Cunningham <stu...@us...> 11056 - Added DVCPRO-HD codec from Dan Maas * Thu Oct 4 2007 Stuart Cunningham <stu...@us...> 10666 - Initial version |