Changeset 8611c6e68 in mythtv
- Timestamp:
- Sep 24, 2012, 2:09:07 AM (12 years ago)
- Branches:
- devel/2020-player, devel/ffmpeg-resync, fixes/0.26, fixes/0.27, fixes/0.28, fixes/29, fixes/30, fixes/31, github-templates, master
- Children:
- c7f0676059
- Parents:
- 2353ef9ce
- git-author:
- Gavin Hurlbut <ghurlbut@…> (09/24/12 02:09:07)
- git-committer:
- Gavin Hurlbut <ghurlbut@…> (09/24/12 06:59:37)
- Location:
- mythtv/programs/mythtranscode
- Files:
-
- 2 edited
-
mpeg2fix.cpp (modified) (5 diffs)
-
mpeg2fix.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
mythtv/programs/mythtranscode/mpeg2fix.cpp
r2353ef9ce r8611c6e68 1064 1064 } 1065 1065 1066 intMPEG2fixup::BuildFrame(AVPacket *pkt, QString fname)1066 bool MPEG2fixup::BuildFrame(AVPacket *pkt, QString fname) 1067 1067 { 1068 1068 const mpeg2_info_t *info; … … 1075 1075 info = mpeg2_info(img_decoder); 1076 1076 if (!info->display_fbuf) 1077 return 1;1077 return true; 1078 1078 1079 1079 outbuf_size = info->sequence->width * info->sequence->height * 2; … … 1117 1117 free(picture); 1118 1118 LOG(VB_GENERAL, LOG_ERR, "Couldn't find MPEG2 encoder"); 1119 return 1;1119 return true; 1120 1120 } 1121 1121 1122 1122 c = avcodec_alloc_context3(NULL); 1123 1124 //We disable all optimizations for the time being. There shouldn't be too1125 //much encoding going on, and the optimizations have been shown to cause1126 //corruption in some cases1127 c->dsp_mask = 0xffff;1128 1123 1129 1124 //NOTE: The following may seem wrong, but avcodec requires … … 1165 1160 free(picture); 1166 1161 LOG(VB_GENERAL, LOG_ERR, "could not open codec"); 1167 return 1;1162 return true; 1168 1163 } 1169 1164 1170 1165 int got_packet = 0; 1171 1172 int ret = avcodec_encode_video2(c, pkt, picture, &got_packet); 1173 1174 if (ret < 0 || !got_packet) 1175 { 1176 free(picture); 1177 LOG(VB_GENERAL, LOG_ERR, 1178 QString("avcodec_encode_video failed (%1)").arg(pkt->size)); 1179 return 1; 1166 int ret; 1167 bool initial = true; 1168 1169 // Need to call this repeatedly as it seems to be pipelined. The first 1170 // call will return no packet, then the second one will flush it. In case 1171 // it becomes more pipelined, just loop until it creates a packet or errors 1172 // out. 1173 while (!got_packet) 1174 { 1175 ret = avcodec_encode_video2(c, pkt, (initial ? picture : NULL), 1176 &got_packet); 1177 1178 if (ret < 0) 1179 { 1180 free(picture); 1181 LOG(VB_GENERAL, LOG_ERR, 1182 QString("avcodec_encode_video2 failed (%1)").arg(ret)); 1183 return true; 1184 } 1180 1185 } 1181 1186 … … 1199 1204 av_freep(&picture); 1200 1205 1201 return 0;1206 return false; 1202 1207 } 1203 1208 -
mythtv/programs/mythtranscode/mpeg2fix.h
r2353ef9ce r8611c6e68 172 172 void WriteYUV(QString filename, const mpeg2_info_t *info); 173 173 void WriteData(QString filename, uint8_t *data, int size); 174 intBuildFrame(AVPacket *pkt, QString fname);174 bool BuildFrame(AVPacket *pkt, QString fname); 175 175 MPEG2frame *GetPoolFrame(AVPacket *pkt); 176 176 MPEG2frame *GetPoolFrame(MPEG2frame *f);
Note: See TracChangeset
for help on using the changeset viewer.
