All pastes #185647 Raw Edit

Mine

public cpp v1 · immutable
#185647 ·published 2006-09-29 04:39 UTC
rendered paste body
Index: libs/libmythtv/avformatdecoder.cpp===================================================================--- libs/libmythtv/avformatdecoder.cpp	(revision 11313)+++ libs/libmythtv/avformatdecoder.cpp	(working copy)@@ -938,24 +938,29 @@     return fps; } -void AvFormatDecoder::InitVideoCodec(AVStream *stream, AVCodecContext *enc)+void AvFormatDecoder::InitVideoCodec(AVStream *stream, AVCodecContext *enc,+                                     bool selectedStream) {-    fps = normalized_fps(stream, enc);-     float aspect_ratio;-    if (enc->sample_aspect_ratio.num == 0)-        aspect_ratio = 0.0f;-    else-        aspect_ratio = av_q2d(enc->sample_aspect_ratio) *-            enc->width / enc->height; -    if (aspect_ratio <= 0.0f || aspect_ratio > 6.0f)-        aspect_ratio = (float)enc->width / (float)enc->height;+    if (selectedStream)+    {+        fps = normalized_fps(stream, enc); -    current_width = enc->width;-    current_height = enc->height;-    current_aspect = aspect_ratio;+        if (enc->sample_aspect_ratio.num == 0)+            aspect_ratio = 0.0f;+        else+            aspect_ratio = av_q2d(enc->sample_aspect_ratio) *+                enc->width / enc->height; +        if (aspect_ratio <= 0.0f || aspect_ratio > 6.0f)+            aspect_ratio = (float)enc->width / (float)enc->height;++        current_width = enc->width;+        current_height = enc->height;+        current_aspect = aspect_ratio;+    }+     enc->opaque = (void *)this;     enc->get_buffer = avcodec_default_get_buffer;     enc->release_buffer = avcodec_default_release_buffer;@@ -972,7 +977,8 @@      AVCodec *codec = avcodec_find_decoder(enc->codec_id);     -    if (!gContext->GetNumSetting("DecodeExtraAudio", 0) &&+    if (selectedStream &&+        !gContext->GetNumSetting("DecodeExtraAudio", 0) &&         codec->id != CODEC_ID_MPEG2VIDEO_XVMC           &&         codec->id != CODEC_ID_MPEG2VIDEO_XVMC_VLD)     {@@ -988,7 +994,8 @@         enc->draw_horiz_band = render_slice_xvmc;         enc->slice_flags = SLICE_FLAG_CODED_ORDER |             SLICE_FLAG_ALLOW_FIELD;-        directrendering = true;+        if (selectedStream)+            directrendering = true;     }     else if (codec && codec->capabilities & CODEC_CAP_DR1 &&              !(enc->width % 16))@@ -997,26 +1004,30 @@         enc->get_buffer = get_avf_buffer;         enc->release_buffer = release_avf_buffer;         enc->draw_horiz_band = NULL;-        directrendering = true;+        if (selectedStream)+            directrendering = true;     } -    uint align_width  = enc->width;-    uint align_height = enc->height;+    if (selectedStream)+    {+        uint align_width  = enc->width;+        uint align_height = enc->height; -    align_dimensions(enc, align_width, align_height);+        align_dimensions(enc, align_width, align_height); -    if (align_width == 0 && align_height == 0)-    {-        VERBOSE(VB_PLAYBACK, LOC + "InitVideoCodec "-                "failed to align dimensions, resetting decoder.");-        align_width = 640;-        align_height = 480;-        fps = 29.97;-        aspect_ratio = 4.0 / 3;+        if (align_width == 0 && align_height == 0)+        {+            VERBOSE(VB_PLAYBACK, LOC + "InitVideoCodec "+                    "failed to align dimensions, resetting decoder.");+            align_width = 640;+            align_height = 480;+            fps = 29.97;+            aspect_ratio = 4.0 / 3;+        }++        GetNVP()->SetVideoParams(align_width, align_height, fps,+                                 keyframedist, aspect_ratio, kScan_Detect);     }--    GetNVP()->SetVideoParams(align_width, align_height, fps,-                             keyframedist, aspect_ratio, kScan_Detect); }  #ifdef USING_XVMC@@ -1332,7 +1343,7 @@                             <<") type ("<<codec_type_string(enc->codec_type)                             <<") already open.");                 }-                InitVideoCodec(ic->streams[i], enc);+                 // Only use libmpeg2 when not using XvMC                 if (CODEC_ID_MPEG1VIDEO == enc->codec_id ||                     CODEC_ID_MPEG2VIDEO == enc->codec_id)@@ -1351,6 +1362,8 @@                     selectedVideoIndex = i;                 } +                InitVideoCodec(ic->streams[i], enc, selectedVideoIndex == i);+                 ScanATSCCaptionStreams(i);                  break;@@ -3415,3 +3428,5 @@      return fsize; }++/* vim: set expandtab tabstop=4 shiftwidth=4: */Index: libs/libmythtv/avformatdecoder.h===================================================================--- libs/libmythtv/avformatdecoder.h	(revision 11313)+++ libs/libmythtv/avformatdecoder.h	(working copy)@@ -168,7 +168,8 @@      void DecodeDTVCC(const uint8_t *buf);     void InitByteContext(void);-    void InitVideoCodec(AVStream *stream, AVCodecContext *enc);+    void InitVideoCodec(AVStream *stream, AVCodecContext *enc,+                        bool selectedStream = false);      /// Preprocess a packet, setting the video parms if nessesary.     void MpegPreProcessPkt(AVStream *stream, AVPacket *pkt);