]> granicus.if.org Git - handbrake/commitdiff
QSV: move decavcodec's QSV option parsing to a QSV-specific code block.
authorRodeo <tdskywalker@gmail.com>
Wed, 5 Jun 2013 15:32:38 +0000 (15:32 +0000)
committerRodeo <tdskywalker@gmail.com>
Wed, 5 Jun 2013 15:32:38 +0000 (15:32 +0000)
Avoids log pollution such as:

"QSV options: Unknown suboption keyint"

git-svn-id: svn://svn.handbrake.fr/HandBrake/branches/qsv@5558 b64f7644-9d1e-0410-96f1-a4d463321fa5

libhb/decavcodec.c

index e453a7ed645a839fee6db67aff75adf98341bbad..621cf59d0b48c37c478c09f55c0fa0c55e4aa12e 100644 (file)
@@ -1103,29 +1103,6 @@ static int decavcodecvInit( hb_work_object_t * w, hb_job_t * job )
         pv->threads = HB_FFMPEG_THREADS_AUTO;
     }
 
-#ifdef USE_QSV
-    if(job){
-        qsv_param_set_defaults(&pv->qsv_config, hb_qsv_info);
-
-        hb_dict_t * qsv_opts = NULL;
-        if( job->advanced_opts != NULL && *job->advanced_opts != '\0' )
-            qsv_opts = hb_encopts_to_dict( job->advanced_opts, job->vcodec );
-
-        int ret;
-        hb_dict_entry_t * entry = NULL;
-        while( ( entry = hb_dict_next( qsv_opts, entry ) ) )
-        {
-            ret = qsv_param_parse( &pv->qsv_config, entry->key, entry->value );
-            if( ret == QSV_PARAM_BAD_NAME )
-                hb_log( "QSV options: Unknown suboption %s", entry->key );
-            else
-            if( ret == QSV_PARAM_BAD_VALUE )
-                hb_log( "QSV options: Bad argument %s=%s", entry->key, entry->value ? entry->value : "(null)" );
-        }
-        hb_dict_free( &qsv_opts );
-    }
-#endif
-
     if ( pv->title->opaque_priv )
     {
         AVFormatContext *ic = (AVFormatContext*)pv->title->opaque_priv;
@@ -1134,12 +1111,35 @@ static int decavcodecvInit( hb_work_object_t * w, hb_job_t * job )
 
 #ifdef USE_QSV
         if (job != NULL && job->vcodec == HB_VCODEC_QSV_H264 &&
-            w->codec_param == AV_CODEC_ID_H264){
+            w->codec_param == AV_CODEC_ID_H264)
+        {
             codec = avcodec_find_decoder_by_name("h264_qsv");
+            // parse QSV options before decoding
+            // FIXME: why do we need this here?
+            // FIXME: job->advanced_opts should not be used for decoder options
+            int ret;
+            hb_dict_t *qsv_opts = NULL;
+            hb_dict_entry_t *entry = NULL;
+            qsv_param_set_defaults(&pv->qsv_config, hb_qsv_info);
+            if (job->advanced_opts != NULL && *job->advanced_opts != '\0')
+            {
+                qsv_opts = hb_encopts_to_dict(job->advanced_opts, job->vcodec);
+            }
+            while ((entry = hb_dict_next(qsv_opts, entry)) != NULL)
+            {
+                ret = qsv_param_parse(&pv->qsv_config, entry->key, entry->value);
+                if (ret == QSV_PARAM_BAD_NAME)
+                    hb_log("QSV options: Unknown suboption %s", entry->key);
+                if (ret == QSV_PARAM_BAD_VALUE)
+                    hb_log("QSV options: Bad argument %s=%s", entry->key, entry->value);
+            }
+            hb_dict_free(&qsv_opts);
         }
         else
 #endif
+        {
             codec = avcodec_find_decoder(w->codec_param);
+        }
 
         if ( codec == NULL )
         {