Well, for app's functional testing you want to cover both. But if the core goal is to test the code scanning functionality, then whichever is easier (likely #1) will do, since it technically works the same internally I would assume, just the source data originated differently, but the type of data is essentially same.
I would try tackling #1 first since that should work with simulator and device, if the app offers scanning off an image on the device.
Try tackle #2, once you got #1 working. For #2, I'd have a test setup with printed codes on paper, cardboard, etc. to test against like being at a store, etc. and manually swap the hardcopy images. But I'd also have a soft copy image setup where the bar/QR codes come from a digital display (monitor, TV, digital picture frame, etc.) positioned in front of the device camera and the device camera scans off the digital display. This latter setup would then be automatable and can programmatically swap source images in the digital display.
As for specifics on automating this with Appiums, others can help you. I haven't touched Appium much to give guidance code/setup wise.