ffmpeg AVFrame中的“opaque”指针

时间:2016-10-04 13:36:32

标签: c++ ffmpeg libav

<?php use yii\helpers\Html; use yii\bootstrap\ActiveForm; use yii\widgets\Pjax; use yii\bootstrap\Modal; use yii\helpers\Url; use yii\db\ActiveRecord; use kartik\widgets\DatePicker; ?> <h1 align="center">Form Ubah</h2> <?php echo "&nbsp"; echo "&nbsp"; ?> <?php $form = ActiveForm::begin([ 'layout' => 'horizontal', 'enableAjaxValidation' => false, 'id' => 'update-form', ]); ?> <?= $form->field($model, 'kode_calon')->textInput(['readOnly' => true, 'style' => 'width:100px']) ?> <?= $form->field($model, 'nama_calon')->textInput(['style' => 'width:380px']) ?> <?= $form->field($model, 'tempat_lahir')->textInput(['style' => 'width:380px']) ?> <?= $form->field($model, 'tanggal_lahir')->widget(DatePicker::classname(), [ 'options' => ['placeholder' => 'Masukkan tanggal lahir...'], 'language' => 'id', 'pluginOptions' => [ 'autoclose'=>true, 'format' => 'yyyy-mm-dd' ] ]); ?> <?= $form->field($model, 'pendidikan_terakhir')->textInput(['style' => 'width:380px']) ?> <?= $form->field($model, 'status_anak')->radioList(array('Yatim'=>'Yatim', 'Piatu'=>'Piatu', 'Miskin'=>'Miskin')); ?> <?= $form->field($model, 'anak_ke')->textInput(['style' => 'width:380px', 'type' => 'number']) ?> <?= $form->field($model, 'dari_ke')->textInput(['style' => 'width:380px', 'type' => 'number']) ?> <?= $form->field($model, 'alamat')->textArea(['style' => 'width: 380px']) ?> <?= $form->field($model, 'nama_bapak')->textInput(['style' => 'width:380px']) ?> <?= $form->field($model, 'alamat_bapak')->textInput(['style' => 'width:380px']) ?> <?= $form->field($model, 'pekerjaan_bapak')->textInput(['style' => 'width:380px']) ?> <?= $form->field($model, 'tanggal_meninggal_bapak')->widget(DatePicker::classname(), [ 'options' => ['placeholder' => 'Masukkan tanggal meniggal bapak...'], 'language' => 'id', 'pluginOptions' => [ 'autoclose'=>true, 'format' => 'yyyy-mm-dd' ] ]); ?> <?= $form->field($model, 'nama_ibu')->textInput(['style' => 'width:380px']) ?> <?= $form->field($model, 'alamat_ibu')->textInput(['style' => 'width:380px']) ?> <?= $form->field($model, 'pekerjaan_ibu')->textInput(['style' => 'width:380px']) ?> <?= $form->field($model, 'tanggal_meninggal_ibu')->widget(DatePicker::classname(), [ 'options' => ['placeholder' => 'Masukkan tanggal meninggal ibu...'], 'language' => 'id', 'pluginOptions' => [ 'autoclose'=>true, 'format' => 'yyyy-mm-dd' ] ]); ?> <?= $form->field($model, 'nama_wali')->textInput(['style' => 'width:380px']) ?> <?= $form->field($model, 'alamat_wali')->textInput(['style' => 'width:380px']) ?> <?= $form->field($model, 'pekerjaan_wali')->textInput(['style' => 'width:380px']) ?> <?= $form->field($model, 'status_ketentuan')->hiddenInput(['value'=>'Belum lolos'])->label(false); ?> <div class="form-group"> <div class="col-sm-offset-4"> <?= Html::submitButton('Ubah', ['class' => 'btn btn-primary']) ?> <?php echo "&nbsp"; echo "&nbsp"; echo Html::a('Keluar', ['index'],[ 'class'=>'btn btn-success', 'onclick' =>'$("#calonModal").modal("hide"); return false;' ]); ?> <?php ActiveForm::end();?> <?php $this->registerJs(' (function() { $("#Miskin").change(function() { if ($("#Miskin").is(":checked")) { $("#tanggal_meninggal_bapak").attr("readonly",true); $("#tanggal_meninggal_ibu").attr("readonly",true); $("#tanggal_meninggal_bapak", "#tanggal_meninggal_ibu").datepicker( {value:"0000-00-00",dateFormat: "yyyy-MM-dd" }); } }); }); '); ?>中,有一个结构AVFrame描述解码的视频或音频数据。

它有一个空指针ffmpeg。该文档声称它“是针对用户的一些私人数据”。

这是什么意思? 是否可以用它来传输任何附加数据作为每帧元数据?

2 个答案:

答案 0 :(得分:3)

这是一个专门用于用户(而不是ffmpeg库)用途的字段; ffmpeg不会以任何方式触碰此字段,因此您可以根据需要随意使用它。但有一点需要注意:一些ffmpeg函数会复制AVFrame(或者可能将AVFrame的引用移动到另一个),其中包括复制该字段的值。管理该字段指向的数据的生命周期可能有些棘手。

如果您只需要处理一些每帧元数据,您可能需要考虑AVFrame中可用的现有元数据存储(请参阅av_frame_get_metadata/av_frame_set_metadata

答案 1 :(得分:3)

为了扩展@Andrey Turkin所说的内容,目的是将特定于应用程序的对象数据添加到AVFrame结构中。特定用例通常是应用程序分配内存时(使用get_buffer2回调)。这个内存可能只是一个指针,但它有时可能是GPU中的内存或类似的东西。无论如何,如果应用程序拥有数据并创建与分配的内存/图片缓冲区相关联的对象,当解码器返回filesMatch函数中的给定AVFrame时,它通常会希望访问相关对象,这就是你通常希望使用不透明字段。