Package: dvswitch
Version: 0.8.3.6-1.2
Followup-For: Bug #747868
User: [email protected]
Usertags: origin-ubuntu utopic ubuntu-patch
Dear Maintainer,
In Ubuntu, the attached patch was applied to achieve the following:
* Adapt and apply upstream patch (from newer version of dvswitch) to follow
renaming of CodecID to AVCodecID and fix FTBFS against libav10.
* Also adapt and apply upstream patch to stop using avcodec_encode_video
(also fixing the FTBFS against libav10).
Thanks for considering the patch.
Logan Rosen
-- System Information:
Debian Release: jessie/sid
APT prefers utopic-updates
APT policy: (500, 'utopic-updates'), (500, 'utopic-security'), (500,
'utopic'), (100, 'utopic-backports')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 3.15.0-4-generic (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
diff -u dvswitch-0.8.3.6/src/auto_codec.cpp dvswitch-0.8.3.6/src/auto_codec.cpp
--- dvswitch-0.8.3.6/src/auto_codec.cpp
+++ dvswitch-0.8.3.6/src/auto_codec.cpp
@@ -21,7 +21,7 @@
} initialiser;
}
-auto_codec auto_codec_open_decoder(CodecID codec_id)
+auto_codec auto_codec_open_decoder(AVCodecID codec_id)
{
auto_codec result(avcodec_alloc_context3(NULL));
if (!result.get())
@@ -30,7 +30,7 @@
return result;
}
-void auto_codec_open_decoder(const auto_codec & context, CodecID codec_id)
+void auto_codec_open_decoder(const auto_codec & context, AVCodecID codec_id)
{
boost::mutex::scoped_lock lock(avcodec_mutex);
AVCodec * codec = avcodec_find_decoder(codec_id);
@@ -39,7 +39,7 @@
os_check_error("avcodec_open", -avcodec_open2(context.get(), codec, NULL));
}
-auto_codec auto_codec_open_encoder(CodecID codec_id)
+auto_codec auto_codec_open_encoder(AVCodecID codec_id)
{
auto_codec result(avcodec_alloc_context3(NULL));
if (!result.get())
@@ -48,7 +48,7 @@
return result;
}
-void auto_codec_open_encoder(const auto_codec & context, CodecID codec_id)
+void auto_codec_open_encoder(const auto_codec & context, AVCodecID codec_id)
{
boost::mutex::scoped_lock lock(avcodec_mutex);
AVCodec * codec = avcodec_find_encoder(codec_id);
diff -u dvswitch-0.8.3.6/src/dv_display_widget.cpp dvswitch-0.8.3.6/src/dv_display_widget.cpp
--- dvswitch-0.8.3.6/src/dv_display_widget.cpp
+++ dvswitch-0.8.3.6/src/dv_display_widget.cpp
@@ -92,7 +92,7 @@
if (!decoder)
throw std::bad_alloc();
decoder->lowres = lowres;
- auto_codec_open_decoder(decoder_, CODEC_ID_DVVIDEO);
+ auto_codec_open_decoder(decoder_, AV_CODEC_ID_DVVIDEO);
decoder->opaque = this;
decoder->get_buffer = get_buffer;
decoder->release_buffer = release_buffer;
diff -u dvswitch-0.8.3.6/src/mixer.cpp dvswitch-0.8.3.6/src/mixer.cpp
--- dvswitch-0.8.3.6/src/mixer.cpp
+++ dvswitch-0.8.3.6/src/mixer.cpp
@@ -617,7 +617,7 @@
unsigned serial_num = 0;
const mix_data * m = 0;
- auto_codec decoder(auto_codec_open_decoder(CODEC_ID_DVVIDEO));
+ auto_codec decoder(auto_codec_open_decoder(AV_CODEC_ID_DVVIDEO));
AVCodecContext * dec = decoder.get();
dec->get_buffer = raw_frame_get_buffer;
dec->release_buffer = raw_frame_release_buffer;
@@ -643,7 +643,7 @@
std::cout << "INFO: DV encoder threads: " << enc_thread_count << "\n";
}
- auto_codec_open_encoder(encoder, CODEC_ID_DVVIDEO);
+ auto_codec_open_encoder(encoder, AV_CODEC_ID_DVVIDEO);
for (;;)
{
@@ -728,9 +728,12 @@
enc->pix_fmt = mixed_raw->pix_fmt;
mixed_raw->header.pts = serial_num;
mixed_dv = allocate_dv_frame();
- int out_size = avcodec_encode_video(enc,
- mixed_dv->buffer, system->size,
- &mixed_raw->header);
+ AVPacket packet;
+ memset(&packet, 0, sizeof(AVPacket));
+ int got_packet;
+ int out_size = avcodec_encode_video2(enc,
+ &packet,
+ &mixed_raw->header, &got_packet);
assert(size_t(out_size) == system->size);
mixed_dv->serial_num = serial_num;
diff -u dvswitch-0.8.3.6/src/auto_codec.hpp dvswitch-0.8.3.6/src/auto_codec.cpp
--- dvswitch-0.8.3.6.orig/src/auto_codec.hpp
+++ dvswitch-0.8.3.6/src/auto_codec.hpp
@@ -19,9 +19,9 @@
typedef auto_handle<AVCodecContext *, auto_codec_closer, auto_codec_factory>
auto_codec;
-auto_codec auto_codec_open_decoder(CodecID);
-void auto_codec_open_decoder(const auto_codec &, CodecID);
-auto_codec auto_codec_open_encoder(CodecID);
-void auto_codec_open_encoder(const auto_codec &, CodecID);
+auto_codec auto_codec_open_decoder(AVCodecID);
+void auto_codec_open_decoder(const auto_codec &, AVCodecID);
+auto_codec auto_codec_open_encoder(AVCodecID);
+void auto_codec_open_encoder(const auto_codec &, AVCodecID);
#endif // !INC_AUTO_CODEC_HPP