Ticket #5755: aspectratio.diff
File aspectratio.diff, 6.4 KB (added by , 16 years ago) |
---|
-
mythtv/libs/libmythtv/recorderbase.cpp
5 5 #include "tv_rec.h" 6 6 #include "libmythdb/mythverbose.h" 7 7 #include "RingBuffer.h" 8 #include "recordingprofile.h" 8 9 #include "programinfo.h" 9 #include "recordingprofile.h"10 10 #include "util.h" 11 11 12 12 #define TVREC_CARDNUM \ … … 23 23 : tvrec(rec), ringBuffer(NULL), weMadeBuffer(true), videocodec("rtjpeg"), 24 24 audiodevice("/dev/dsp"), videodevice("/dev/video"), vbidevice("/dev/vbi"), 25 25 vbimode(0), ntsc(true), ntsc_framerate(true), video_frame_rate(29.97), 26 curRecording(NULL), request_pause(false), paused(false),26 m_videoAspect(0), curRecording(NULL), request_pause(false), paused(false), 27 27 nextRingBuffer(NULL), nextRecording(NULL), 28 28 positionMapType(MARK_GOP_BYFRAME), positionMapLock(false) 29 29 { … … 237 237 238 238 if (rb_changed && tvrec) 239 239 tvrec->RingBufferChanged(ringBuffer, curRecording); 240 241 if (rb_changed) 242 m_videoAspect = 0; 240 243 } 241 244 242 245 /** \fn RecorderBase::SavePositionMap(bool) … … 274 277 positionMapLock.unlock(); 275 278 } 276 279 280 void RecorderBase::AspectChange(AspectRatio aspect, long long frame) 281 { 282 MarkTypes mark; 283 switch (aspect) 284 { 285 case ASPECT_1_1 : 286 mark = MARK_ASPECT_1_1; 287 break; 288 case ASPECT_4_3 : 289 mark = MARK_ASPECT_4_3; 290 break; 291 case ASPECT_16_9 : 292 mark = MARK_ASPECT_16_9; 293 break; 294 case ASPECT_21_1_1 : 295 mark = MARK_ASPECT_21_1_1; 296 break; 297 default : 298 mark = MARK_ASPECT_4_3; 299 } 300 301 if (curRecording) 302 curRecording->SetAspectChange(mark, frame); 303 } 304 277 305 /* vim: set expandtab tabstop=4 shiftwidth=4: */ -
mythtv/libs/libmythtv/recorderbase.h
212 212 */ 213 213 void SavePositionMap(bool force = false); 214 214 215 enum AspectRatio { 216 ASPECT_UNKNOWN = 0x00, 217 ASPECT_1_1 = 0x01, 218 ASPECT_4_3 = 0x02, 219 ASPECT_16_9 = 0x03, 220 ASPECT_21_1_1 = 0x04 221 }; 222 215 223 protected: 216 224 /** \brief Convenience function used to set integer options from a profile. 217 225 * \sa SetOption(const QString&, int) … … 231 239 */ 232 240 void SetPositionMapType(int type) { positionMapType = type; } 233 241 242 /** \brief Note a change in aspect ratio in the recordedmark table 243 */ 244 void AspectChange(AspectRatio ratio, long long frame); 245 234 246 TVRec *tvrec; 235 247 RingBuffer *ringBuffer; 236 248 bool weMadeBuffer; … … 245 257 bool ntsc_framerate; 246 258 double video_frame_rate; 247 259 260 uint m_videoAspect; // AspectRatio 261 248 262 ProgramInfo *curRecording; 249 263 250 264 // For handling pausing … … 263 277 QMutex positionMapLock; 264 278 QMap<long long, long long> positionMap; 265 279 QMap<long long, long long> positionMapDelta; 280 266 281 }; 267 282 268 283 #endif -
mythtv/libs/libmythtv/dtvrecorder.cpp
261 261 bool hasFrame = false; 262 262 bool hasKeyFrame = false; 263 263 264 uint aspectRatio; 265 264 266 // Scan for PES header codes; specifically picture_start 265 267 // sequence_start (SEQ) and group_start (GOP). 266 268 // 00 00 01 00: picture_start_code … … 289 291 { 290 292 _last_seq_seen = _frames_seen_count; 291 293 hasKeyFrame |= (_last_gop_seen + maxKFD)<_frames_seen_count; 294 295 // Look for aspectRatio changes and store them in the database 296 aspectRatio = (bufptr[3] >> 4); 297 //int frameRate = (bufptr[3] & 0x0000000f); 292 298 } 293 299 } 294 300 } … … 317 323 _frames_written_count++; 318 324 } 319 325 326 if ((aspectRatio > 0) && (aspectRatio != m_videoAspect)) 327 { 328 m_videoAspect = aspectRatio; 329 AspectChange((AspectRatio)aspectRatio, _frames_written_count); 330 } 331 320 332 return hasKeyFrame || (_payload_buffer.size() >= (188*50)); 321 333 } 322 334 -
mythtv/libs/libmythtv/programinfo.cpp
2945 2945 } 2946 2946 } 2947 2947 2948 /** 2949 * \brief Store a change in aspect ratio in the recordedmark table 2950 */ 2951 void ProgramInfo::SetAspectChange(MarkTypes type, long long frame) 2952 { 2953 if (isVideo) 2954 return; 2955 2956 VERBOSE(VB_IMPORTANT, QString("Set Aspect Change: %1").arg((int)type)); 2957 2958 MSqlQuery query(MSqlQuery::InitCon()); 2959 2960 query.prepare("INSERT INTO recordedmarkup" 2961 " (chanid, starttime, mark, type)" 2962 " VALUES" 2963 " ( :CHANID , :STARTTIME , :MARK , :TYPE );"); 2964 query.bindValue(":CHANID", chanid); 2965 query.bindValue(":STARTTIME", recstartts); 2966 2967 query.bindValue(":MARK", frame); 2968 query.bindValue(":TYPE", type); 2969 2970 if (!query.exec() || !query.isActive()) 2971 MythDB::DBError("aspect ratio change insert", query); 2972 } 2973 2948 2974 /** \fn ProgramInfo::ReactivateRecording(void) 2949 2975 * \brief Asks the scheduler to restart this recording if possible. 2950 2976 */ -
mythtv/libs/libmythtv/programinfo.h
41 41 MARK_GOP_START = 6, 42 42 MARK_KEYFRAME = 7, 43 43 MARK_SCENE_CHANGE = 8, 44 MARK_GOP_BYFRAME = 9 44 MARK_GOP_BYFRAME = 9, 45 MARK_ASPECT_1_1 = 10, 46 MARK_ASPECT_4_3 = 11, 47 MARK_ASPECT_16_9 = 12, 48 MARK_ASPECT_21_1_1 = 13 45 49 } MarkTypes; 46 50 MPUBLIC QString toString(MarkTypes type); 47 51 … … 307 311 void SetPositionMapDBReplacement(PMapDBReplacement *pmap) 308 312 { positionMapDBReplacement = pmap; } 309 313 314 // Aspect Ratio map 315 void SetAspectChange(MarkTypes type, long long frame); 316 310 317 // GUI stuff 311 318 void showDetails(void) const; 312 319 void EditRecording(void);