Qt AVI debug print cleanup. Moved avi codec config files to /avi.

This commit is contained in:
mjbudd77 2021-09-22 22:40:15 -04:00
parent f774d320de
commit c5a9238774
1 changed files with 38 additions and 36 deletions

View File

@ -836,8 +836,9 @@ int loadCodecConfig( int type, const char *codec_name, AVCodecContext *ctx)
char section[256], id[256], val[256]; char section[256], id[256], val[256];
void *obj, *child; void *obj, *child;
FILE *fp; FILE *fp;
const char *baseDir = FCEUI_GetBaseDirectory();
sprintf( filename, "%s.conf", codec_name ); sprintf( filename, "%s/avi/%s.conf", baseDir, codec_name );
fp = fopen( filename, "r"); fp = fopen( filename, "r");
@ -965,8 +966,9 @@ int saveCodecConfig( int type, const char *codec_name, AVCodecContext *ctx)
char filename[512]; char filename[512];
const AVOption *opt; const AVOption *opt;
bool useOpt; bool useOpt;
const char *baseDir = FCEUI_GetBaseDirectory();
sprintf( filename, "%s.conf", codec_name ); sprintf( filename, "%s/avi/%s.conf", baseDir, codec_name );
fp = fopen( filename, "w"); fp = fopen( filename, "w");
@ -1384,30 +1386,30 @@ static int initAudioStream( const char *codec_name, OutputStream *ost )
return 0; return 0;
} }
static void print_Codecs(void) //static void print_Codecs(void)
{ //{
void *it = NULL; // void *it = NULL;
const AVCodec *c; // const AVCodec *c;
//
c = av_codec_iterate( &it ); // c = av_codec_iterate( &it );
//
while ( c != NULL ) // while ( c != NULL )
{ // {
if ( av_codec_is_encoder(c) ) // if ( av_codec_is_encoder(c) )
{ // {
if ( c->type == AVMEDIA_TYPE_VIDEO ) // if ( c->type == AVMEDIA_TYPE_VIDEO )
{ // {
printf("Video Encoder: %i %s %s\n", c->id, c->name, c->long_name); // printf("Video Encoder: %i %s %s\n", c->id, c->name, c->long_name);
} // }
else if ( c->type == AVMEDIA_TYPE_AUDIO ) // else if ( c->type == AVMEDIA_TYPE_AUDIO )
{ // {
printf("Audio Encoder: %i %s %s\n", c->id, c->name, c->long_name); // printf("Audio Encoder: %i %s %s\n", c->id, c->name, c->long_name);
} // }
} // }
//
c = av_codec_iterate( &it ); // c = av_codec_iterate( &it );
} // }
} //}
static int setCodecFromConfig(void) static int setCodecFromConfig(void)
{ {
@ -1485,7 +1487,7 @@ static int initMedia( const char *filename )
av_log_set_callback( log_callback ); av_log_set_callback( log_callback );
print_Codecs(); //print_Codecs();
/* Autodetect the output format from the name. default is MPEG. */ /* Autodetect the output format from the name. default is MPEG. */
fmt = av_guess_format(NULL, filename, NULL); fmt = av_guess_format(NULL, filename, NULL);
@ -2568,22 +2570,22 @@ void LibavOptionsPage::initPixelFormatSelect(const char *codec_name)
} }
if ( c->pix_fmts ) if ( c->pix_fmts )
{ {
int i=0, formatOk=0; int i=0; //, formatOk=0;
while (c->pix_fmts[i] != -1) while (c->pix_fmts[i] != -1)
{ {
desc = av_pix_fmt_desc_get( c->pix_fmts[i] ); desc = av_pix_fmt_desc_get( c->pix_fmts[i] );
if ( desc ) if ( desc )
{ {
printf("Codec PIX_FMT: %i: %s 0x%04X\t- %s\n", c->pix_fmts[i], //printf("Codec PIX_FMT: %i: %s 0x%04X\t- %s\n", c->pix_fmts[i],
desc->name, av_get_pix_fmt_loss(c->pix_fmts[i], AV_PIX_FMT_BGRA, 0), desc->alias); // desc->name, av_get_pix_fmt_loss(c->pix_fmts[i], AV_PIX_FMT_BGRA, 0), desc->alias);
videoPixfmt->addItem( tr(desc->name), c->pix_fmts[i]); videoPixfmt->addItem( tr(desc->name), c->pix_fmts[i]);
if ( LIBAV::video_st.pixelFormat == c->pix_fmts[i] ) if ( LIBAV::video_st.pixelFormat == c->pix_fmts[i] )
{ {
videoPixfmt->setCurrentIndex( videoPixfmt->count() - 1 ); videoPixfmt->setCurrentIndex( videoPixfmt->count() - 1 );
formatOk = true; //formatOk = true;
} }
} }
i++; i++;
@ -2605,8 +2607,8 @@ void LibavOptionsPage::initPixelFormatSelect(const char *codec_name)
pf = av_pix_fmt_desc_get_id(desc); pf = av_pix_fmt_desc_get_id(desc);
printf("Codec PIX_FMT: %i: %s 0x%04X\t- %s\n", //printf("Codec PIX_FMT: %i: %s 0x%04X\t- %s\n",
pf, desc->name, av_get_pix_fmt_loss(pf, AV_PIX_FMT_BGRA, 0), desc->alias); // pf, desc->name, av_get_pix_fmt_loss(pf, AV_PIX_FMT_BGRA, 0), desc->alias);
switch ( pf ) switch ( pf )
{ {
@ -2672,7 +2674,7 @@ void LibavOptionsPage::initCodecLists(void)
if ( c->type == AVMEDIA_TYPE_VIDEO ) if ( c->type == AVMEDIA_TYPE_VIDEO )
{ {
compatible = avformat_query_codec( ofmt, c->id, FF_COMPLIANCE_NORMAL ); compatible = avformat_query_codec( ofmt, c->id, FF_COMPLIANCE_NORMAL );
printf("Video Encoder: %i %s %s\t:%i\n", c->id, c->name, c->long_name, compatible); //printf("Video Encoder: %i %s %s\t:%i\n", c->id, c->name, c->long_name, compatible);
if ( compatible ) if ( compatible )
{ {
videoEncSel->addItem( tr(c->name), c->id ); videoEncSel->addItem( tr(c->name), c->id );
@ -2686,7 +2688,7 @@ void LibavOptionsPage::initCodecLists(void)
else if ( c->type == AVMEDIA_TYPE_AUDIO ) else if ( c->type == AVMEDIA_TYPE_AUDIO )
{ {
compatible = avformat_query_codec( ofmt, c->id, FF_COMPLIANCE_NORMAL ); compatible = avformat_query_codec( ofmt, c->id, FF_COMPLIANCE_NORMAL );
printf("Audio Encoder: %i %s %s\t:%i\n", c->id, c->name, c->long_name, compatible); //printf("Audio Encoder: %i %s %s\t:%i\n", c->id, c->name, c->long_name, compatible);
if ( compatible ) if ( compatible )
{ {
audioEncSel->addItem( tr(c->name), c->id ); audioEncSel->addItem( tr(c->name), c->id );
@ -2939,7 +2941,7 @@ LibavEncOptWin::LibavEncOptWin(int type, QWidget *parent)
{ {
const char *groupName = (*static_cast<AVClass**>(obj))->class_name; const char *groupName = (*static_cast<AVClass**>(obj))->class_name;
printf("OBJ Class: %s\n", groupName); //printf("OBJ Class: %s\n", groupName);
groupItem = new QTreeWidgetItem(); groupItem = new QTreeWidgetItem();
tree->addTopLevelItem(groupItem); tree->addTopLevelItem(groupItem);