Author: dtimms
Update of /cvs/free/rpms/dvbcut/F-16
In directory old02.ovh.rpmfusion.lan:/tmp/cvs-serv1550
Added Files:
dvbcut-179-vs-ubuntu-12.04.diff
dvbcut-svn179-ffmpeg-0.11.1.patch
Log Message:
add two new patches missed in last commit
dvbcut-179-vs-ubuntu-12.04.diff:
lavfmuxer.cpp | 24 ++++++++++++++++--------
lavfmuxer.h | 2 +-
mpgfile.cpp | 30 ++++++++++++++++++++----------
3 files changed, 37 insertions(+), 19 deletions(-)
--- NEW FILE dvbcut-179-vs-ubuntu-12.04.diff ---
Index: src/lavfmuxer.h
===================================================================
--- src/lavfmuxer.h (revision 179)
+++ src/lavfmuxer.h (working copy)
@@ -73,7 +73,7 @@
avp.dts=dts;
avp.stream_index=st[str].stream_index;
if (flags & MUXER_FLAG_KEY)
- avp.flags |= PKT_FLAG_KEY;
+ avp.flags |= AV_PKT_FLAG_KEY;
int rv=av_interleaved_write_frame(avfc,&avp);
Index: src/mpgfile.cpp
===================================================================
--- src/mpgfile.cpp (revision 179)
+++ src/mpgfile.cpp (working copy)
@@ -154,15 +154,19 @@
if (!firstsequence || idx[streampic].getsequencenumber()>=seqnr)
{
- const uint8_t *data=(const uint8_t*)sd->getdata();
+ AVPacket avpkt;
+ av_init_packet(&avpkt);
+ avpkt.data = (uint8_t*)sd->getdata();
+ avpkt.size = bytes;
+ // HACK for CorePNG to decode as normal PNG by default
+ avpkt.flags = AV_PKT_FLAG_KEY;
int frameFinished=0;
- int decodebytes=bytes;
- while (decodebytes>0)
+ while (avpkt.size>0)
{
frameFinished=0;
- int bytesDecoded=avcodec_decode_video(S->avcc, avf, &frameFinished,
- (uint8_t*) data, decodebytes);
+ int bytesDecoded=avcodec_decode_video2(S->avcc, avf, &frameFinished,
+ &avpkt);
if (bytesDecoded<0)
{
fprintf(stderr,"libavcodec error while decoding frame #%d\n",pic);
@@ -170,8 +174,8 @@
return;
}
- data+=bytesDecoded;
- decodebytes-=bytesDecoded;
+ avpkt.data+=bytesDecoded;
+ avpkt.size-=bytesDecoded;
if (frameFinished)
{
@@ -184,7 +188,7 @@
if (pic>=stop)
{
frameFinished=0;
- decodebytes=0;
+ avpkt.size=0;
break;
}
}
@@ -200,8 +204,14 @@
if (pic < stop)
{
+ AVPacket avpkt;
+ av_init_packet(&avpkt);
+ avpkt.data = NULL;
+ avpkt.size = 0;
+ // HACK for CorePNG to decode as normal PNG by default
+ avpkt.flags = AV_PKT_FLAG_KEY;
int frameFinished=0;
- avcodec_decode_video(S->avcc, avf, &frameFinished, NULL, 0);
+ avcodec_decode_video2(S->avcc, avf, &frameFinished, &avpkt);
if (frameFinished)
{
if (last_cpn!=avf->coded_picture_number)
@@ -248,7 +258,7 @@
stream *S=&s[VIDEOSTREAM];
S->id=vid;
S->allocavcc();
- S->avcc->codec_type=CODEC_TYPE_VIDEO;
+ S->avcc->codec_type=AVMEDIA_TYPE_VIDEO;
S->avcc->codec_id=CODEC_ID_MPEG2VIDEO;
S->dec=avcodec_find_decoder(CODEC_ID_MPEG2VIDEO);
S->enc=avcodec_find_encoder(CODEC_ID_MPEG2VIDEO);
Index: src/lavfmuxer.cpp
===================================================================
--- src/lavfmuxer.cpp (revision 179)
+++ src/lavfmuxer.cpp (working copy)
@@ -34,12 +34,12 @@
lavfmuxer::lavfmuxer(const char *format, uint32_t audiostreammask, mpgfile &mpg,
const char *filename)
: muxer(), avfc(0), fileopened(false)
{
- fmt = guess_format(format, NULL, NULL);
+ fmt = av_guess_format(format, NULL, NULL);
if (!fmt) {
return;
}
- avfc=av_alloc_format_context();
+ avfc=avformat_alloc_context();
if (!avfc)
return;
@@ -73,7 +73,7 @@
av_free(s->codec);
s->codec = avcodec_alloc_context();
avcodec_get_context_defaults(s->codec);
- s->codec->codec_type=CODEC_TYPE_AUDIO;
+ s->codec->codec_type=AVMEDIA_TYPE_AUDIO;
s->codec->codec_id = (mpg.getstreamtype(astr)==streamtype::ac3audio) ?
CODEC_ID_AC3 : CODEC_ID_MP2;
s->codec->rc_buffer_size = 224*1024*8;
@@ -92,13 +92,21 @@
int16_t samples[AVCODEC_MAX_AUDIO_FRAME_SIZE/sizeof(int16_t)];
int frame_size=sizeof(samples);
//fprintf(stderr, "** decode audio size=%d\n", sd->inbytes());
-#if LIBAVCODEC_VERSION_INT >= ((52<<16)+(0<<8)+0)
- avcodec_decode_audio2
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(53, 35, 0)
+ AVPacket avpkt;
+ av_init_packet(&avpkt);
+ avpkt.data = (uint8_t*)sd->getdata();
+ avpkt.size = sd->inbytes();
+ // HACK for CorePNG to decode as normal PNG by default
+ avpkt.flags = AV_PKT_FLAG_KEY;
+ avcodec_decode_audio3(s->codec,samples,&frame_size, &avpkt);
+#elif LIBAVCODEC_VERSION_INT >= ((52<<16)+(0<<8)+0)
+ avcodec_decode_audio2(s->codec,samples,&frame_size,
+ (uint8_t*) sd->getdata(),sd->inbytes());
#else
- avcodec_decode_audio
+ avcodec_decode_audio(s->codec,samples,&frame_size,
+ (uint8_t*) sd->getdata(),sd->inbytes());
#endif
- (s->codec,samples,&frame_size,
- (uint8_t*) sd->getdata(),sd->inbytes());
avcodec_close(s->codec);
}
break;
dvbcut-svn179-ffmpeg-0.11.1.patch:
lavfmuxer.cpp | 34 ++++++++++++++++++++++++++++++----
mpgfile.cpp | 5 ++++-
mpgfile.cpp~ |only
3 files changed, 34 insertions(+), 5 deletions(-)
--- NEW FILE dvbcut-svn179-ffmpeg-0.11.1.patch ---
diff -ur dvbcut.orig/src/lavfmuxer.cpp dvbcut/src/lavfmuxer.cpp
--- dvbcut.orig/src/lavfmuxer.cpp 2012-08-31 23:28:42.000000000 +1000
+++ dvbcut/src/lavfmuxer.cpp 2012-09-01 12:12:04.472248687 +1000
@@ -43,9 +43,16 @@
if (!avfc)
return;
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(53, 35, 0)
+// todo: what here ?
+// maybe: AVFormatContext::audio_preload but no direct access.
+// AVOptions
+// iformat
+#else
avfc->preload= (int)(.5*AV_TIME_BASE);
- avfc->max_delay= (int)(.7*AV_TIME_BASE);
avfc->mux_rate=10080000;
+#endif
+ avfc->max_delay= (int)(.7*AV_TIME_BASE);
avfc->oformat=fmt;
strncpy(avfc->filename, filename, sizeof(avfc->filename));
@@ -114,19 +121,36 @@
}
}
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(53, 35, 0)
+ // error: 'av_set_parameters' was not declared in this scope
+ if (!(fmt->flags & AVFMT_NOFILE)&&(avio_open(&avfc->pb, filename,
AVIO_FLAG_WRITE) < 0)) {
+#else
if ((av_set_parameters(avfc, NULL) < 0) || (!(fmt->flags &
AVFMT_NOFILE)&&(url_fopen(&avfc->pb, filename, URL_WRONLY) < 0))) {
+#endif
av_free(avfc);
avfc=0;
return;
}
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(53, 35, 0)
+// todo: what here ?
+// maybe: AVFormatContext::audio_preload but no direct access.
+// AVOptions
+// iformat
+#else
avfc->preload= (int)(.5*AV_TIME_BASE);
- avfc->max_delay= (int)(.7*AV_TIME_BASE);
avfc->mux_rate=10080000;
+#endif
+ avfc->max_delay= (int)(.7*AV_TIME_BASE);
-
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(53, 35, 0)
+ av_dump_format(avfc, 0, filename, 1);
+ fileopened=true;
+ avformat_write_header(avfc, NULL);
+#else
dump_format(avfc, 0, filename, 1);
fileopened=true;
av_write_header(avfc);
+#endif
}
@@ -136,7 +160,9 @@
if (fileopened) {
av_write_trailer(avfc);
if (!(fmt->flags & AVFMT_NOFILE))
-#if LIBAVFORMAT_VERSION_INT >= ((52<<16)+(0<<8)+0)
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(53, 35, 0)
+ avio_close(avfc->pb);
+#elif LIBAVFORMAT_VERSION_INT >= ((52<<16)+(0<<8)+0)
url_fclose(avfc->pb);
#else
url_fclose(&avfc->pb);
diff -ur dvbcut.orig/src/mpgfile.cpp dvbcut/src/mpgfile.cpp
--- dvbcut.orig/src/mpgfile.cpp 2012-09-01 12:26:19.000000000 +1000
+++ dvbcut/src/mpgfile.cpp 2012-09-01 12:49:57.133541130 +1000
@@ -733,8 +733,11 @@
f->pts=idx[idx.indexnr(start+p)].getpts()-startpts;
f->coded_picture_number=f->display_picture_number=p;
f->key_frame=(p==0)?1:0;
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(53, 35, 0)
+ f->pict_type=(p==0)?AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
+#else
f->pict_type=(p==0)?FF_I_TYPE:FF_P_TYPE;
-
+#endif
out = avcodec_encode_video(avcc, buf,
m2v.getsize(), f);
Only in dvbcut/src: mpgfile.cpp~