Patch and build against libav10
authorReinhard Tartler <siretart@tauware.de>
Sat, 22 Feb 2014 18:00:32 +0000 (18:00 +0000)
committerReinhard Tartler <siretart@tauware.de>
Sat, 22 Feb 2014 18:04:10 +0000 (18:04 +0000)
debian/control
debian/patches/libav10.patch [new file with mode: 0644]
debian/patches/series
debian/rules

index cdefcfb1b0431788edb9593cc76ac666c6beb75c..6bc4653e54a4f6e151b0b26655235e06fea9d863 100644 (file)
@@ -11,8 +11,10 @@ Build-Depends:
  freeglut3-dev,
  liba52-0.7.4-dev,
  libasound2-dev,
- libavcodec-dev (>= 6:9),
- libavformat-dev (>= 6:9),
+ libavcodec-dev (>= 6:10~),
+ libavdevice-dev (>= 6:10~),
+ libavformat-dev (>= 6:10~),
+ libavutil-dev (>= 6:10~),
  libfaad-dev,
  libfreenect-dev,
  libfreetype6-dev,
@@ -24,7 +26,7 @@ Build-Depends:
  libpng-dev,
  libpulse-dev,
  libsdl1.2-dev,
- libswscale-dev (>= 6:9),
+ libswscale-dev (>= 6:10~),
  libtheora-dev,
  libusb-1.0-0-dev,
  libvorbis-dev,
diff --git a/debian/patches/libav10.patch b/debian/patches/libav10.patch
new file mode 100644 (file)
index 0000000..8722980
--- /dev/null
@@ -0,0 +1,308 @@
+Author: Reinhard Tartler <siretart@tauware.de>
+Description: Allow compilation against libav10
+
+--- a/applications/dashcast/video_decoder.c
++++ b/applications/dashcast/video_decoder.c
+@@ -338,7 +338,7 @@ int dc_video_decoder_read(VideoInputFile
+                               //But if the input is raw and there is no need to decode then
+                               // the packet is directly passed for decoded frame. We must wait until rescale is done before freeing it
+-                              if (codec_ctx->codec->id == CODEC_ID_RAWVIDEO) {
++                              if (codec_ctx->codec->id == AV_CODEC_ID_RAWVIDEO) {
+                                       video_data_node->nb_raw_frames_ref = video_input_file->nb_consumers;
+                                       video_data_node->raw_packet = packet;
+--- a/applications/dashcast/video_encoder.c
++++ b/applications/dashcast/video_encoder.c
+@@ -68,9 +68,9 @@ int dc_video_encoder_open(VideoOutputFil
+       video_output_file->vbuf = (uint8_t *) av_malloc(video_output_file->vbuf_size);
+ //    video_output_file->codec = avcodec_find_encoder_by_name("libx264"/*video_data_conf->codec*/);
+-      video_output_file->codec = avcodec_find_encoder(CODEC_ID_H264);
++      video_output_file->codec = avcodec_find_encoder(AV_CODEC_ID_H264);
+       if (video_output_file->codec == NULL) {
+-              GF_LOG(GF_LOG_ERROR, GF_LOG_DASH, ("Output video codec %d not found\n", CODEC_ID_H264));
++              GF_LOG(GF_LOG_ERROR, GF_LOG_DASH, ("Output video codec %d not found\n", AV_CODEC_ID_H264));
+               return -1;
+       }
+@@ -216,15 +216,9 @@ int dc_video_encoder_encode(VideoOutputF
+               pkt.data = video_output_file->vbuf;
+               pkt.size = video_output_file->vbuf_size;
+               pkt.pts = pkt.dts = video_data_node->vframe->pkt_dts = video_data_node->vframe->pkt_pts = video_data_node->vframe->pts;
+-#ifdef GPAC_USE_LIBAV
+-              video_output_file->encoded_frame_size = avcodec_encode_video(video_codec_ctx, video_output_file->vbuf, video_output_file->vbuf_size, video_data_node->vframe);
+-              got_packet = video_output_file->encoded_frame_size>=0 ? 1 : 0;
+-#else
+               video_output_file->encoded_frame_size = avcodec_encode_video2(video_codec_ctx, &pkt, video_data_node->vframe, &got_packet);
+-              //this is not true with libav !
+               if (video_output_file->encoded_frame_size >= 0)
+                       video_output_file->encoded_frame_size = pkt.size;
+-#endif
+               if (video_output_file->encoded_frame_size >= 0) {
+                       if (got_packet) {
+                               video_codec_ctx->coded_frame->pts = video_codec_ctx->coded_frame->pkt_pts = pkt.pts;
+--- a/modules/ffmpeg_in/ffmpeg_decode.c
++++ b/modules/ffmpeg_in/ffmpeg_decode.c
+@@ -101,7 +101,7 @@ static void FFDEC_LoadDSI(FFDec *ffd, GF
+       }
+       switch (codec->id) {
+-      case CODEC_ID_SVQ3:
++      case AV_CODEC_ID_SVQ3:
+       {
+               u32 at_type, size;
+               size = gf_bs_read_u32(bs);
+@@ -236,10 +236,10 @@ static GF_Err FFDEC_AttachStream(GF_Base
+                       (*ctx)->codec_type = AVMEDIA_TYPE_VIDEO;
+                       switch (ffd->oti) {
+                       case GPAC_OTI_VIDEO_MPEG4_PART2:
+-                              codec_id = CODEC_ID_MPEG4;
++                              codec_id = AV_CODEC_ID_MPEG4;
+                               break;
+                       case GPAC_OTI_VIDEO_AVC:
+-                              codec_id = CODEC_ID_H264;
++                              codec_id = AV_CODEC_ID_H264;
+                               break;
+ #ifdef HAS_HEVC
+             case GPAC_OTI_VIDEO_HEVC:
+@@ -253,14 +253,14 @@ static GF_Err FFDEC_AttachStream(GF_Base
+                       case GPAC_OTI_VIDEO_MPEG2_SPATIAL:
+                       case GPAC_OTI_VIDEO_MPEG2_HIGH:
+                       case GPAC_OTI_VIDEO_MPEG2_422:
+-                              codec_id = CODEC_ID_MPEG2VIDEO;
++                              codec_id = AV_CODEC_ID_MPEG2VIDEO;
+                               break;
+                       case GPAC_OTI_IMAGE_JPEG:
+-                              codec_id = CODEC_ID_MJPEG;
++                              codec_id = AV_CODEC_ID_MJPEG;
+                               ffd->is_image=1;
+                               break;
+                       case 0xFF:
+-                              codec_id = CODEC_ID_SVQ3;
++                              codec_id = AV_CODEC_ID_SVQ3;
+                               break;
+                       }
+               } else if (ffd->st==GF_STREAM_AUDIO) {
+@@ -269,12 +269,12 @@ static GF_Err FFDEC_AttachStream(GF_Base
+                       case GPAC_OTI_AUDIO_MPEG2_PART3:
+                       case GPAC_OTI_AUDIO_MPEG1:
+                               (*ctx)->frame_size = 1152;
+-                              codec_id = CODEC_ID_MP2;
++                              codec_id = AV_CODEC_ID_MP2;
+                               break;
+                       }
+               }
+               else if ((ffd->st==GF_STREAM_ND_SUBPIC) && (ffd->oti==0xe0)) {
+-                      codec_id = CODEC_ID_DVD_SUBTITLE;
++                      codec_id = AV_CODEC_ID_DVD_SUBTITLE;
+               }
+               *codec = avcodec_find_decoder(codec_id);
+       }
+@@ -357,8 +357,8 @@ static GF_Err FFDEC_AttachStream(GF_Base
+       }
+ #endif //HAS_HEVC
+-      if (codec_id == CODEC_ID_RAWVIDEO) {
+-              (*ctx)->codec_id = CODEC_ID_RAWVIDEO;
++      if (codec_id == AV_CODEC_ID_RAWVIDEO) {
++              (*ctx)->codec_id = AV_CODEC_ID_RAWVIDEO;
+               (*ctx)->pix_fmt = ffd->raw_pix_fmt;
+               if ((*ctx)->extradata && strstr((*ctx)->extradata, "BottomUp")) ffd->flipped = 1;
+       } else {
+@@ -370,7 +370,7 @@ static GF_Err FFDEC_AttachStream(GF_Base
+       }
+       /*setup audio streams*/
+       if (ffd->st==GF_STREAM_AUDIO) {
+-              if ((*codec)->id == CODEC_ID_MP2) {
++              if ((*codec)->id == AV_CODEC_ID_MP2) {
+                       (*ctx)->frame_size = ((*ctx)->sample_rate > 24000) ? 1152 : 576;
+               }
+               /*may be 0 (cfg not known yet)*/
+@@ -384,17 +384,17 @@ static GF_Err FFDEC_AttachStream(GF_Base
+       } else {
+               switch ((*codec)->id) {
+-              case CODEC_ID_MJPEG:
+-              case CODEC_ID_MJPEGB:
+-              case CODEC_ID_LJPEG:
++              case AV_CODEC_ID_MJPEG:
++              case AV_CODEC_ID_MJPEGB:
++              case AV_CODEC_ID_LJPEG:
+ #if (LIBAVCODEC_VERSION_INT > AV_VERSION_INT(51, 20, 0))
+-              case CODEC_ID_GIF:
++              case AV_CODEC_ID_GIF:
+ #endif
+-              case CODEC_ID_RAWVIDEO:
++              case AV_CODEC_ID_RAWVIDEO:
+                       ffd->pix_fmt = GF_PIXEL_RGB_24;
+                       break;
+-              case CODEC_ID_DVD_SUBTITLE:
++              case AV_CODEC_ID_DVD_SUBTITLE:
+                       *frame = avcodec_alloc_frame();
+ #ifdef USE_AVCODEC2
+                       {
+@@ -752,7 +752,7 @@ redecode:
+       }
+-      if ( ctx->codec_id == CODEC_ID_RAWVIDEO) {
++      if ( ctx->codec_id == AV_CODEC_ID_RAWVIDEO) {
+               if (*outBufferLength != ffd->out_size) {
+                       *outBufferLength = ffd->out_size;
+                       return GF_BUFFER_TOO_SMALL;
+@@ -849,7 +849,7 @@ redecode:
+                               /*OK we loose the DSI stored in the codec context, but H263 doesn't need any, and if we're
+                               here this means the DSI was broken, so no big deal*/
+                               avcodec_close(ctx);
+-                              *codec = avcodec_find_decoder(CODEC_ID_H263);
++                              *codec = avcodec_find_decoder(AV_CODEC_ID_H263);
+ #ifdef USE_AVCTX3
+                               if (! (*codec) || (avcodec_open2(ctx, *codec, NULL)<0)) return GF_NON_COMPLIANT_BITSTREAM;
+@@ -1132,9 +1132,9 @@ static u32 FFDEC_CanHandleStream(GF_Base
+       }
+       else if (StreamType==GF_STREAM_AUDIO) {
+               /*std MPEG-2 audio*/
+-              if ((ffd->oti==GPAC_OTI_AUDIO_MPEG2_PART3) || (ffd->oti==GPAC_OTI_AUDIO_MPEG1)) codec_id = CODEC_ID_MP2;
++              if ((ffd->oti==GPAC_OTI_AUDIO_MPEG2_PART3) || (ffd->oti==GPAC_OTI_AUDIO_MPEG1)) codec_id = AV_CODEC_ID_MP2;
+               /*std AC3 audio*/
+-              //if (ffd->oti==0xA5) codec_id = CODEC_ID_AC3;
++              //if (ffd->oti==0xA5) codec_id = AV_CODEC_ID_AC3;
+       }
+       /*std MPEG-4 visual*/
+@@ -1171,10 +1171,10 @@ static u32 FFDEC_CanHandleStream(GF_Base
+               switch (ffd->oti) {
+               /*MPEG-4 v1 simple profile*/
+-              case GPAC_OTI_VIDEO_MPEG4_PART2: codec_id = CODEC_ID_MPEG4; break;
++              case GPAC_OTI_VIDEO_MPEG4_PART2: codec_id = AV_CODEC_ID_MPEG4; break;
+               /*H264 (not std OTI, just the way we use it internally)*/
+               case GPAC_OTI_VIDEO_AVC:
+-                      codec_id = CODEC_ID_H264; break;
++                      codec_id = AV_CODEC_ID_H264; break;
+ #ifdef HAS_HEVC
+         case GPAC_OTI_VIDEO_HEVC:
+             codec_id = AV_CODEC_ID_HEVC; break;
+@@ -1188,10 +1188,10 @@ static u32 FFDEC_CanHandleStream(GF_Base
+               case GPAC_OTI_VIDEO_MPEG2_SPATIAL:
+               case GPAC_OTI_VIDEO_MPEG2_HIGH:
+               case GPAC_OTI_VIDEO_MPEG2_422:
+-                      codec_id = CODEC_ID_MPEG2VIDEO; break;
++                      codec_id = AV_CODEC_ID_MPEG2VIDEO; break;
+               /*JPEG*/
+               case GPAC_OTI_IMAGE_JPEG:
+-                      codec_id = CODEC_ID_MJPEG;
++                      codec_id = AV_CODEC_ID_MJPEG;
+                       /*return maybe supported as FFMPEG JPEG decoder has some issues with many files, so let's use it only if no
+                       other dec is available*/
+                       if (avcodec_find_decoder(codec_id) != NULL) 
+--- a/modules/ffmpeg_in/ffmpeg_demux.c
++++ b/modules/ffmpeg_in/ffmpeg_demux.c
+@@ -54,7 +54,7 @@
+ #endif /* AVERROR_NOFMT */
+-#if (LIBAVFORMAT_VERSION_MAJOR >= 54) && (LIBAVFORMAT_VERSION_MINOR >= 20)
++#if ((LIBAVFORMAT_VERSION_MAJOR >= 54) && (LIBAVFORMAT_VERSION_MINOR >= 20)) || (LIBAVFORMAT_VERSION_MAJOR >= 55)
+ #define av_find_stream_info(__c)      avformat_find_stream_info(__c, NULL)
+ #ifndef FF_API_FORMAT_PARAMETERS
+@@ -353,7 +353,7 @@ static Bool FFD_CanHandleURL(GF_InputSer
+       }
+ exit:
+-    if (ctx) av_close_input_file(ctx);
++    if (ctx) avformat_close_input(&ctx);
+       return ret;
+ }
+@@ -372,13 +372,13 @@ static GF_ESD *FFD_GetESDescriptor(FFDem
+       AVCodecContext *dec = ffd->ctx->streams[ffd->audio_st]->codec;
+               esd->slConfig->timestampResolution = ffd->audio_tscale.den;
+               switch (dec->codec_id) {
+-              case CODEC_ID_MP2:
++              case AV_CODEC_ID_MP2:
+                       esd->decoderConfig->objectTypeIndication = GPAC_OTI_AUDIO_MPEG1;
+                       break;
+-              case CODEC_ID_MP3:
++              case AV_CODEC_ID_MP3:
+                       esd->decoderConfig->objectTypeIndication = GPAC_OTI_AUDIO_MPEG2_PART3;
+                       break;
+-              case CODEC_ID_AAC:
++              case AV_CODEC_ID_AAC:
+                       if (!dec->extradata_size) goto opaque_audio;
+                       esd->decoderConfig->objectTypeIndication = GPAC_OTI_AUDIO_AAC_MPEG4;
+                       esd->decoderConfig->decoderSpecificInfo->dataLength = dec->extradata_size;
+@@ -413,25 +413,25 @@ opaque_audio:
+               AVCodecContext *dec = ffd->ctx->streams[ffd->video_st]->codec;
+               esd->slConfig->timestampResolution = ffd->video_tscale.den;
+               switch (dec->codec_id) {
+-              case CODEC_ID_MPEG4:
++              case AV_CODEC_ID_MPEG4:
+               /*there is a bug in fragmentation of raw H264 in ffmpeg, the NALU startcode (0x00000001) is split across
+               two frames - we therefore force internal ffmpeg codec ID to avoid NALU size recompute
+               at the decoder level*/
+-//            case CODEC_ID_H264:
++//            case AV_CODEC_ID_H264:
+                       /*if dsi not detected force use ffmpeg*/
+                       if (!dec->extradata_size) goto opaque_video;
+                       /*otherwise use any MPEG-4 Visual*/
+-                      esd->decoderConfig->objectTypeIndication = (dec->codec_id==CODEC_ID_H264) ? GPAC_OTI_VIDEO_AVC : GPAC_OTI_VIDEO_MPEG4_PART2;
++                      esd->decoderConfig->objectTypeIndication = (dec->codec_id==AV_CODEC_ID_H264) ? GPAC_OTI_VIDEO_AVC : GPAC_OTI_VIDEO_MPEG4_PART2;
+                       esd->decoderConfig->decoderSpecificInfo->dataLength = dec->extradata_size;
+                       esd->decoderConfig->decoderSpecificInfo->data = gf_malloc(sizeof(char)*dec->extradata_size);
+                       memcpy(esd->decoderConfig->decoderSpecificInfo->data,
+                                       dec->extradata,
+                                       sizeof(char)*dec->extradata_size);
+                       break;
+-              case CODEC_ID_MPEG1VIDEO:
++              case AV_CODEC_ID_MPEG1VIDEO:
+                       esd->decoderConfig->objectTypeIndication = GPAC_OTI_VIDEO_MPEG1;
+                       break;
+-              case CODEC_ID_MPEG2VIDEO:
++              case AV_CODEC_ID_MPEG2VIDEO:
+                       esd->decoderConfig->objectTypeIndication = GPAC_OTI_VIDEO_MPEG2_422;
+                       break;
+               default:
+@@ -629,11 +629,7 @@ static GF_Err FFD_ConnectService(GF_Inpu
+                       }
+                       /*setup downloader*/
+                       av_in->flags |= AVFMT_NOFILE;
+-#if FF_API_FORMAT_PARAMETERS /*commit ffmpeg 603b8bc2a109978c8499b06d2556f1433306eca7*/
+                       res = avformat_open_input(&ffd->ctx, szName, av_in, NULL);
+-#else
+-                      res = av_open_input_stream(&ffd->ctx, &ffd->io, szName, av_in, NULL);
+-#endif
+               }
+       } else {
+               res = open_file(&ffd->ctx, szName, av_in);
+@@ -712,7 +708,7 @@ static GF_Err FFD_ConnectService(GF_Inpu
+               ffd->seekable = (av_seek_frame(ffd->ctx, -1, 0, AVSEEK_FLAG_BACKWARD)<0) ? 0 : 1;
+               if (!ffd->seekable) {
+-                      av_close_input_file(ffd->ctx);
++                      avformat_close_input(&ffd->ctx);
+                       ffd->ctx = NULL;
+                       open_file(&ffd->ctx, szName, av_in);
+                       av_find_stream_info(ffd->ctx);
+@@ -727,7 +723,7 @@ static GF_Err FFD_ConnectService(GF_Inpu
+ err_exit:
+       GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, ("[FFMPEG] Error opening file %s: %s\n", url, gf_error_to_string(e)));
+-    if (ffd->ctx) av_close_input_file(ffd->ctx);
++    if (ffd->ctx) avformat_close_input(&ffd->ctx);
+       ffd->ctx = NULL;
+       gf_term_on_connect(serv, NULL, e);
+       return GF_OK;
+@@ -781,7 +777,7 @@ static GF_Err FFD_CloseService(GF_InputS
+       ffd->is_running = 0;
+-      if (ffd->ctx) av_close_input_file(ffd->ctx);
++      if (ffd->ctx) avformat_close_input(&ffd->ctx);
+       ffd->ctx = NULL;
+       ffd->audio_ch = ffd->video_ch = NULL;
+       ffd->audio_run = ffd->video_run = 0;
index 5f3c756a0da0921b91e924d3a903ceaf71a2f853..b4521636b85d91f2710c681403d8765e6eda7b22 100644 (file)
@@ -1,2 +1,3 @@
 mp4box-manpage-fix.patch
 gcc-optflags.patch
+libav10.patch
index d3386b4ffa180f3bb426320012d782a1260249ba..20e16ef0424fb62aabe9f7a44f149c89ef95941d 100755 (executable)
@@ -23,6 +23,8 @@ override_dh_auto_configure:
            --disable-ssl \
            $(DEB_EXTRA_CONFIGURE_FLAGS)
        echo "#define GPAC_SVN_REVISION \"$(GPAC_SVN_REVISION)\"" > include/gpac/revision.h
+       # workaround broken libav detection
+       sed -i 's,CONFIG_LIBAV=no,CONFIG_LIBAV=yes,' config.mak
 
 override_dh_auto_install:
        $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp